Skip to content
This repository was archived by the owner on Mar 21, 2022. It is now read-only.

Commit 9056461

Browse files
author
Helge Müller
committed
evaluation version
1 parent 1cdb869 commit 9056461

File tree

12 files changed

+72
-37
lines changed

12 files changed

+72
-37
lines changed

addon/components/landscape-interaction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
55
export default Interaction.extend(AlertifyHandler,{
66
landscapeService: service(),
77
tutorialService: service(),
8-
store: service()
8+
store: service(),
99
});

addon/components/landscape-visualization.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default LandscapeRendering.extend(AlertifyHandler,{
1515
},
1616
initInteraction(){
1717
this._super(...arguments);
18-
const self = this;
18+
//const self = this;
1919

2020
if(this.get('runmode')){
2121
this.set('interaction.model',this.get('tutorialService.activeStep'));
@@ -26,12 +26,17 @@ export default LandscapeRendering.extend(AlertifyHandler,{
2626
this.set('interaction.runmode',this.get('runmode'));
2727

2828
this.get('interaction').on('showApplication', function (emberModel) {
29-
self.set('landscapeService.application', emberModel);
29+
this.set('landscapeService.application', emberModel);
3030
});
3131

3232
this.get('interaction').on('singleClick', this.clickListenerSingle);
3333
this.get('interaction').on('doubleClick', this.clickListenerDouble);
3434
},
35+
cleanup(){
36+
this._super(...arguments);
37+
this.get('interaction').off('singleClick',this, this.clickListenerSingle);
38+
this.get('interaction').off('doubleClick',this, this.clickListenerDouble);
39+
},
3540
willDestroyElement(){
3641
this._super(...arguments);
3742
this.get('interaction').off('singleClick',this, this.clickListenerSingle);

addon/components/timeline.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ export default Timeline.extend(AlertifyHandler,{
1212
landscapeListener: service(),
1313
chartClickHandler(evt) {
1414
this._super(...arguments);
15-
this.set('importLandscape',true);
16-
this.set('tutorialActivePoint',this.get('timelineChart').getElementAtEvent(evt)[0]);
15+
if(this.get('timelineChart').getElementAtEvent(evt)[0]){
16+
this.set('importLandscape',true);
17+
this.set('tutorialActivePoint',this.get('timelineChart').getElementAtEvent(evt)[0]);
18+
}
1719
},
1820
actions:{
1921
submit(){
@@ -22,6 +24,11 @@ export default Timeline.extend(AlertifyHandler,{
2224
this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName'));
2325
this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x);
2426
this.get('landscapeService').set('livelandscapes',false);
27+
if(this.get('landscapeService.mockBackend')){
28+
this.get('landscapeService').set('selectLandscape',false);
29+
this.showAlertifyMessage("Mock landscape is active. Saved landscapes cannot be selected.");
30+
this.showAlertifyMessage("Please click 'Save it' to persist the selected Lanscape.");
31+
}
2532
}
2633
},
2734
close(){

addon/components/tutorial-form.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export default Component.extend(AlertifyHandler,{
1111
actions:{
1212
saveTutorialChanges(tutorial){
1313
this.get('tutorialService').saveTutorialChanges(tutorial);
14+
this.set('landscapeService.livelandscapes',false);
15+
this.set('landscapeService.selectLandscape',false);
1416
},
1517
toggleSetLandscape(){
1618
this.set('landscapeService.selectLandscape',!this.get('landscapeService.selectLandscape'));

addon/controllers/tutorial.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { inject as service } from "@ember/service";
44
export default Controller.extend({
55
store: service(),
66
renderingService: service("rendering-service"),
7-
updateModel() {
8-
// update your entity and then call
9-
this.get('renderingService').redrawScene();
10-
},
11-
setupController(controller, model) {
7+
setupController(controller, model) {
128
this._super(controller, model);
139
controller.initRendering();
1410

addon/routes/tutorial/run.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, {
1111
controller.get('tutorialService').initService(model);
1212
controller.get('landscapeService').updateLandscapeList(true);
1313
controller.set('landscapeService.liveMode',false);
14+
1415
var step = controller.get('tutorialService').getNextStep();
1516
controller.set('tutorialService.activeStep',step);
16-
controller.get('landscapeService.landscape',null);
17-
17+
18+
controller.set('landscapeService.landscape',null);
19+
controller.set('landscapeService.application', null);
20+
1821
controller.get('tutorialService').getSequence(step).then((sequence)=>{
1922
if(sequence!=undefined && sequence.get('landscapeTimestamp')!=undefined){
2023
controller.get('landscapeService').loadLandscape(sequence);

addon/routes/tutorial/step.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, {
88
setupController(controller, model) {
99
controller.set('landscapeService.liveMode',false);
1010
controller.get('landscapeService').updateLandscapeList(true);
11-
controller.get('landscapeService.landscape',null);
11+
12+
controller.set('landscapeService.landscape',null);
13+
controller.set('landscapeService.application', null);
1214

1315
controller.get('tutorialService').getSequence(model).then((sequence)=>{
1416
if(sequence.get('landscapeTimestamp')!=undefined){

addon/routes/tutorial/tutorial.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, {
88
setupController(controller, model) {
99
this._super(...arguments);
1010
controller.get('landscapeService').updateLandscapeList(true);
11-
controller.get('landscapeService.landscape',null);
11+
controller.set('landscapeService.landscape',null);
12+
controller.set('landscapeService.application', null);
13+
1214
controller.get('landscapeService').loadLandscape(model);
1315
controller.set('landscapeService.liveMode',false);
1416
if(controller.get('currentUser.user.isAdmin')){

addon/services/landscape-service.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export default Service.extend(Evented, {
3333
this.set('applicationinteraction.model',model);
3434
},
3535
updateLandscapeList(reload) {
36+
if(this.get('mockBackend')){
37+
this.set('landscapeList', []);
38+
this.set('landscapeList', this.get('store').peekAll('tutoriallandscape'));
39+
}else{
3640
this.set('landscapeList', []);
3741
this.get('store').findAll('tutoriallandscape', { reload })
3842
.then(landscapes => {
@@ -41,6 +45,7 @@ export default Service.extend(Evented, {
4145
landscapeList.sort((landscape1, landscape2) => parseInt(landscape1.id) < parseInt(landscape2.id) ? -1 : 1);
4246
this.set('landscapeList', landscapeList);
4347
});
48+
}
4449
},
4550
loadLandscape(model) {
4651
if (this.get('landscape') !== null) {
@@ -55,19 +60,22 @@ export default Service.extend(Evented, {
5560
}
5661
}
5762
if(model.get('landscapeTimestamp')!=undefined && model.get('landscapeTimestamp')!=""){
58-
this.importLandscape(model.get('landscapeTimestamp'),"");
63+
if(model.get('landscapeTimestamp')!=this.get('landscape.timestamp.timestamp')){
64+
this.importLandscape(model.get('landscapeTimestamp'),"");
65+
}
5966
}
6067

6168
},
6269
importLandscape(landscapeTimestamp,name){
6370
if(this.get('mockBackend')){
64-
this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => {
65-
this.set('landscape',landscape);
66-
this.get('renderingService').reSetupScene();
67-
});
71+
this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => {
72+
this.set('landscape',landscape);
73+
this.get('renderingService').reSetupScene();
74+
});
6875
}else{
6976
this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => {
7077
this.set('landscape',tutlandscape);
78+
this.get('renderingService').reSetupScene();
7179
}, () => {
7280
this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => {
7381
if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){
@@ -90,8 +98,10 @@ export default Service.extend(Evented, {
9098
timestamprecord.save();
9199
landscaperecord.save();
92100
this.set('landscape',landscaperecord);
101+
this.get('renderingService').reSetupScene();
93102
}else{
94103
this.set('landscape',landscape);
104+
this.get('renderingService').reSetupScene();
95105
}
96106
});
97107
});

addon/templates/components/side-form-layout.hbs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
hide live landscapes
2424
{{/bs-button}}
2525
{{#if showLandscape}}
26-
{{#if landscapeRepo.latestLandscape.systems}}
26+
{{#if landscapeService.latestLandscape.systems}}
2727
<div id="rendering">
2828
{{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }}
2929
<!-- popup(s) -->
@@ -48,7 +48,7 @@
4848
{{svg-jar "reply" class="octicon align-middle"}}
4949
{{/bs-button}}
5050
</div>
51-
{{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }}
51+
{{application-visualization latestApplication=landscapeRepo.latestApplication interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }}
5252
{{visualization/rendering/popups/popup-coordinator
5353
popupData=additionalData.popupContent}}
5454
</div>
@@ -70,24 +70,24 @@
7070
</div>
7171
</div>
7272
{{/unless}}
73-
{{else}}
73+
{{else}}
7474
{{#if showLandscape}}
75-
<div id="rendering">
76-
{{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }}
77-
</div>
75+
<div id="rendering">
76+
{{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }}
77+
</div>
7878
{{else}}
79-
<div id="rendering">
80-
<div style="position: absolute!important" class="pl-1">
81-
{{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}}
82-
{{svg-jar "reply" class="octicon align-middle"}}
83-
{{/bs-button}}
79+
<div id="rendering">
80+
<div style="position: absolute!important" class="pl-1">
81+
{{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}}
82+
{{svg-jar "reply" class="octicon align-middle"}}
83+
{{/bs-button}}
84+
</div>
85+
{{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }}
8486
</div>
85-
{{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }}
86-
</div>
87-
{{/if}}
8887
{{/if}}
88+
{{/if}}
8989
</div>
90-
<div class="col-4" id="tutorialselection">
90+
<div class="col-4" id="tutorialselection" style='background-color:rgba(255,255,255,0.3);border: 1px solid black'>
9191
{{#unless runmode}}
9292
{{#if this.currentUser.user.isAdmin}}
9393
{{component form model=model runmode=runmode}}

0 commit comments

Comments
 (0)