Skip to content

Commit

Permalink
chore(VLE): Convert Node Controller to Angular (#551)
Browse files Browse the repository at this point in the history
- Remove Hopscotch. Use popup instead to show rubric
- Add private modifier to some functions
- Remove unused functions.

#531
  • Loading branch information
geoffreykwan authored Mar 24, 2022
1 parent 0ef0e94 commit 204c3cf
Show file tree
Hide file tree
Showing 38 changed files with 889 additions and 1,740 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"fabric": "^3.6.6",
"highcharts": "^9.0.1",
"highcharts-angular": "^2.10.0",
"hopscotch": "^0.3.1",
"html2canvas": "^0.5.0-beta4",
"iframe-resizer": "^3.5.3",
"jquery": "^3.4.1",
Expand Down
2 changes: 0 additions & 2 deletions src/app/common-hybrid-angular.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatSelectModule } from '@angular/material/select';
import { HelpIconComponent } from '../assets/wise5/themes/default/themeComponents/helpIcon/help-icon.component';
import { NodeStatusIcon } from '../assets/wise5/themes/default/themeComponents/nodeStatusIcon/node-status-icon.component';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
Expand Down Expand Up @@ -84,7 +83,6 @@ export class EmptyComponent {}
DialogResponseComponent,
DialogResponsesComponent,
EmptyComponent,
HelpIconComponent,
NodeIconComponent,
NodeStatusIcon
],
Expand Down
2 changes: 2 additions & 0 deletions src/app/student-hybrid-angular.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { GenerateImageDialogComponent } from '../assets/wise5/directives/generat
import { TopBarModule } from './student/top-bar/top-bar.module';
import { StudentAssetsDialogModule } from '../assets/wise5/vle/studentAsset/student-assets-dialog/student-assets-dialog.module';
import { ComponentStudentModule } from '../assets/wise5/components/component/component-student.module';
import { NodeModule } from '../assets/wise5/vle/node/node.module';

@NgModule({
declarations: [
Expand All @@ -37,6 +38,7 @@ import { ComponentStudentModule } from '../assets/wise5/components/component/com
imports: [
AngularJSModule,
ComponentStudentModule,
NodeModule,
StudentAssetsDialogModule,
StudentComponentModule,
SummaryDisplayModule,
Expand Down
2 changes: 1 addition & 1 deletion src/assets/wise5/authoringTool/main/mainAuthoring.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="l-constrained" layout="column">
<md-content
class="node-content md-whiteframe-1dp"
style="border-color: {{nodeController.nodeStatus.icon.color}}; position: relative;"
style="position: relative;"
layout="row" layout-wrap>
<style>
.projectItem:hover {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="top" class="view-content view-content--with-sidemenu">
<div class="l-constrained" layout="column">
<md-content class="node-content md-whiteframe-1dp"
style="padding: 0 16px; border-color: {{::nodeController.nodeStatus.icon.color}}; position: relative;"
style="padding: 0 16px; position: relative;"
layout="row" layout-wrap>
<div style="margin-bottom: 20px; width: 100%">
<div style='text-align: right; background-color: white; position: sticky; top: 0px; z-index: 2;'>
Expand Down
2 changes: 0 additions & 2 deletions src/assets/wise5/common-angular-js-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ window['Highcharts'] = Highcharts;
window['HighchartsExporting'] = HighchartsExporting;
window['covariance'] = covariance;
import './components/graph/graphComponentModule';
import * as hopscotch from 'hopscotch';
window['hopscotch'] = hopscotch;
import './components/html/htmlComponentModule';
import HttpInterceptor from './services/httpInterceptor';
import './components/label/labelComponentModule';
Expand Down
11 changes: 11 additions & 0 deletions src/assets/wise5/components/component-student.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export abstract class ComponentStudent {
@Input()
workgroupId: number;

@Output()
saveComponentStateEvent: EventEmitter<any> = new EventEmitter<any>();

@Output()
starterStateChangedEvent = new EventEmitter<any>();

Expand Down Expand Up @@ -103,6 +106,14 @@ export abstract class ComponentStudent {
}

ngOnDestroy(): void {
if (this.isDirty) {
const request = {
componentId: this.componentId,
isSubmit: false,
nodeId: this.nodeId
};
this.saveComponentStateEvent.emit(this.getComponentStateWrapper(request));
}
this.subscriptions.unsubscribe();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { HighchartsChartModule } from 'highcharts-angular';
import { StudentComponentModule } from '../../../../app/student/student.component.module';
import { HelpIconModule } from '../../themes/default/themeComponents/helpIcon/help-icon.module';
import { PreviewComponentComponent } from '../../authoringTool/components/preview-component/preview-component.component';
import { StudentAssetsDialogModule } from '../../vle/studentAsset/student-assets-dialog/student-assets-dialog.module';
import { AnimationStudentModule } from '../animation/animation-student/animation-student.module';
Expand Down Expand Up @@ -34,6 +35,7 @@ import { ComponentComponent } from './component.component';
DrawStudentModule,
EmbeddedStudentModule,
GraphStudentModule,
HelpIconModule,
HighchartsChartModule,
HtmlStudentModule,
LabelStudentModule,
Expand Down
11 changes: 11 additions & 0 deletions src/assets/wise5/components/component/component.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</animation-student>
<audio-oscillator-student *ngSwitchCase="'AudioOscillator'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</audio-oscillator-student>
<concept-map-student *ngSwitchCase="'ConceptMap'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</concept-map-student>
<dialog-guidance-student *ngSwitchCase="'DialogGuidance'"
Expand All @@ -39,20 +42,23 @@
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</draw-student>
<embedded-student *ngSwitchCase="'Embedded'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</embedded-student>
<graph-student *ngSwitchCase="'Graph'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</graph-student>
<html-student *ngSwitchCase="'HTML'"
Expand All @@ -65,27 +71,31 @@
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</label-student>
<match-student *ngSwitchCase="'Match'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</match-student>
<multiple-choice-student *ngSwitchCase="'MultipleChoice'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</multiple-choice-student>
<open-response-student *ngSwitchCase="'OpenResponse'"
[nodeId]="nodeId"
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</open-response-student>
<outside-url-student *ngSwitchCase="'OutsideURL'"
Expand All @@ -105,6 +115,7 @@
[componentContent]="componentContent"
[componentState]="componentState"
[workgroupId]="workgroupId"
(saveComponentStateEvent)="saveComponentState($event)"
mode="student">
</table-student>
</div>
9 changes: 8 additions & 1 deletion src/assets/wise5/components/component/component.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ConfigService } from '../../services/configService';
import { NotebookService } from '../../services/notebookService';
import { ProjectService } from '../../services/projectService';
Expand Down Expand Up @@ -27,6 +27,9 @@ export class ComponentComponent {
@Input()
workgroupId: number;

@Output()
saveComponentStateEvent: EventEmitter<any> = new EventEmitter<any>();

constructor(
private configService: ConfigService,
private notebookService: NotebookService,
Expand Down Expand Up @@ -63,4 +66,8 @@ export class ComponentComponent {
}
this.componentContent = componentContent;
}

saveComponentState($event: any): void {
this.saveComponentStateEvent.emit($event);
}
}
Loading

0 comments on commit 204c3cf

Please sign in to comment.