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

Commit 1cdb869

Browse files
author
Helge Müller
committed
inserted tutorial and new interaction binding
1 parent 94e69a5 commit 1cdb869

23 files changed

+262
-164
lines changed

addon/components/application-interaction.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ import { inject as service } from "@ember/service";
33
import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
44

55
export default Interaction.extend(AlertifyHandler,{
6-
landscapeService: service()
6+
landscapeService: service(),
7+
tutorialService: service(),
8+
store: service()
79
});

addon/components/application-visualization.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ export default ApplicationRendering.extend(AlertifyHandler,{
1616
}else{
1717
this.set('interaction.model',this.get('interactionModel'));
1818
}
19-
20-
this.set('interaction.tutorialService',this.get('tutorialService'));
21-
this.set('interaction.landscapeService',this.get('landscapeService'));
22-
23-
2419
this.set('interaction.completed',this.get('completed'));
2520
this.set('interaction.runmode',this.get('runmode'));
2621
this.get('interaction').on('singleClick', this.get('clickListenerSingle'));
@@ -33,6 +28,7 @@ export default ApplicationRendering.extend(AlertifyHandler,{
3328
this.set("model.targetId",emberModel.get("id"));
3429
this.set("model.actionType","singleClick");
3530
this.set('selectTarget',false);
31+
this.showAlertifyMessage(`Target selected 'single click' on '`+emberModel.get('constructor.modelName')+"' with name '"+emberModel.get('name')+"'");
3632
}else{
3733
if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){
3834
if(this.get("runmode")){
@@ -49,6 +45,7 @@ export default ApplicationRendering.extend(AlertifyHandler,{
4945
this.set("model.targetId",emberModel.get("id"));
5046
this.set("model.actionType","doubleClick");
5147
this.set('selectTarget',false);
48+
this.showAlertifyMessage(`Target selected 'double click' on '`+emberModel.get('constructor.modelName')+"'");
5249
}else{
5350
if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){
5451
if(this.get("runmode")){

addon/components/landscape-interaction.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ import { inject as service } from "@ember/service";
33
import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
44

55
export default Interaction.extend(AlertifyHandler,{
6-
landscapeService: service()
6+
landscapeService: service(),
7+
tutorialService: service(),
8+
store: service()
79
});

addon/components/landscape-visualization.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ export default LandscapeRendering.extend(AlertifyHandler,{
2323
this.set('interaction.model',this.get('interactionModel'));
2424
}
2525
this.set('interaction.completed',this.get('completed'));
26-
27-
this.set('interaction.tutorialService',this.get('tutorialService'));
28-
this.set('interaction.landscapeService',this.get('landscapeService'));
29-
3026
this.set('interaction.runmode',this.get('runmode'));
3127

3228
this.get('interaction').on('showApplication', function (emberModel) {
3329
self.set('landscapeService.application', emberModel);
3430
});
3531

36-
this.get('interaction').on('singleClick', this.get('clickListenerSingle'));
37-
this.get('interaction').on('doubleClick', this.get('clickListenerDouble'));
32+
this.get('interaction').on('singleClick', this.clickListenerSingle);
33+
this.get('interaction').on('doubleClick', this.clickListenerDouble);
34+
},
35+
willDestroyElement(){
36+
this._super(...arguments);
37+
this.get('interaction').off('singleClick',this, this.clickListenerSingle);
38+
this.get('interaction').off('doubleClick',this, this.clickListenerDouble);
3839
},
3940
clickListenerSingle(emberModel){
4041
if(emberModel!=undefined){
@@ -43,6 +44,7 @@ export default LandscapeRendering.extend(AlertifyHandler,{
4344
this.set("model.targetId",emberModel.get("id"));
4445
this.set("model.actionType","singleClick");
4546
this.set('selectTarget',false);
47+
this.showAlertifyMessage(`Target selected 'single click' on '`+emberModel.get('constructor.modelName')+"' with name '"+emberModel.get('name')+"'");
4648
}else{
4749
if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){
4850
if(this.get("runmode")){
@@ -59,6 +61,8 @@ export default LandscapeRendering.extend(AlertifyHandler,{
5961
this.set("model.targetId",emberModel.get("id"));
6062
this.set("model.actionType","doubleClick");
6163
this.set('selectTarget',false);
64+
this.showAlertifyMessage(`Target selected 'double click' on '`+emberModel.get('constructor.modelName')+"'");
65+
6266
}else{
6367
if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){
6468
if(this.get("runmode")){
@@ -68,6 +72,13 @@ export default LandscapeRendering.extend(AlertifyHandler,{
6872
}
6973
}
7074
},
75+
getLandscape(){
76+
if(this.get('landscapeService.livelandscapes')){
77+
return this.get('landscapeRepo.latestLandscape');
78+
}else{
79+
return this.get('landscapeService.landscape');
80+
}
81+
},
7182
completed(laststep){
7283
if(this.get('runmode')){
7384
var step = this.get('tutorialService').getNextStep(laststep);

addon/components/sequence-form.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ export default Component.extend(AlertifyHandler,{
77
layout,
88
tutorialService: service(),
99
landscapeService: service(),
10+
tagName: "",
1011
actions:{
11-
resetLandscape(){
12-
if(this.get('landscapeService.landscape')!=null){
13-
this.set('landscapeService.landscape',null);
14-
}
12+
toggleSetLandscape(){
13+
this.set('landscapeService.selectLandscape',!this.get('landscapeService.selectLandscape'));
1514
},
1615
saveSequenceChanges(sequence) {
1716
if(sequence) {

addon/components/side-form-layout.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ import { computed } from '@ember/object';
55

66
export default Component.extend({
77
layout,
8+
tagName: "",
89
store: service(),
910
tutorialService: service(),
1011
landscapeService: service(),
1112
renderingService: service(),
1213
landscapeRepo: service("repos/landscape-repository"),
1314
landscapeListener: service(),
1415
currentUser: service(),
15-
16-
showLandscape: computed('landscapeRepo.latestApplication', function() {
17-
return !this.get('landscapeRepo.latestApplication');
16+
showLandscape: computed('landscapeService.application', function() {
17+
return !this.get('landscapeService.application');
1818
}),
19-
selectMode: computed('landscapeService.landscape',function(){
20-
if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){
21-
return !this.get('landscapeService.landscape');
22-
}
19+
selectMode: computed('landscapeService.selectLandscape',function(){
20+
if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){
21+
return this.get('landscapeService.selectLandscape') ;
22+
}
2323
return false;
2424
}),
2525
liveMode: computed('landscapeService.livelandscapes','selectMode', function() {
@@ -28,19 +28,13 @@ export default Component.extend({
2828
}
2929
return false;
3030
}),
31-
init(){
32-
this._super(...arguments);
33-
this.get('landscapeService').updateLandscapeList(true);
34-
this.get('landscapeListener').initSSE();
35-
this.get('landscapeListener').set('pauseVisualizationReload',true);
36-
},
3731
actions: {
32+
3833
resetView() {
3934
this.get('renderingService').reSetupScene();
4035
},
4136
openLandscapeView() {
42-
this.set('landscapeRepo.latestApplication', null);
43-
this.set('landscapeRepo.replayApplication', null);
37+
this.set('landscapeService.application', null);
4438
},
4539
toggleTimeline() {
4640
this.get('renderingService').toggleTimeline();
@@ -58,6 +52,12 @@ export default Component.extend({
5852
interaction.set('selectTarget',!interaction.get('selectTarget'));
5953
}
6054
},
55+
init(){
56+
this._super(...arguments);
57+
this.get('landscapeService').updateLandscapeList(true);
58+
this.get('landscapeListener').initSSE();
59+
this.get('landscapeListener').set('pauseVisualizationReload',true);
60+
},
6161
showTimeline() {
6262
this.set('renderingService.showTimeline', true);
6363
},
@@ -80,4 +80,5 @@ export default Component.extend({
8080
this._super(...arguments);
8181
this.get('additionalData').off('showWindow', this, this.onShowWindow);
8282
},
83+
8384
});

addon/components/step-form.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@ import Component from '@ember/component';
22
import layout from '../templates/components/step-form';
33
import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
44
import { inject as service } from "@ember/service";
5+
import { computed } from '@ember/object';
56

67
export default Component.extend(AlertifyHandler,{
78
layout,
9+
tagName: "",
810
tutorialService: service(),
911
landscapeService: service(),
12+
store: service(),
13+
nextStepAvailable: computed("model",function(){
14+
return this.get('tutorialService').getNextStep(this.get('model'));
15+
}),
16+
targetName: computed("model.targetId","model.targetType",function(){
17+
if(this.get("model.targetType")==undefined ||this.get("model.targetId")==undefined){
18+
return "";
19+
}
20+
let object = this.get('store').peekRecord(this.get("model.targetType"),this.get("model.targetId"));
21+
if(object!=undefined){
22+
return object.get('name');
23+
}
24+
return "";
25+
}),
1026
actions:{
1127
skipStep(){
1228
var step = this.get('tutorialService').getNextStep(this.get('model'));
@@ -25,7 +41,7 @@ export default Component.extend(AlertifyHandler,{
2541
}
2642
});
2743
this.get('tutorialService').set('activeStep',step);
28-
this.set('model',step);
44+
this.get('landscapeService').setInteractionModel(step);
2945
}else{
3046
this.showAlertifyMessage(`Last step completed.`);
3147
}
@@ -49,8 +65,12 @@ export default Component.extend(AlertifyHandler,{
4965
}
5066
},
5167
toggleSelectTarget(){
52-
this.set('landscapeService.landscapeinteraction.selectTarget',!this.get('landscapeService.landscapeinteraction.selectTarget'));
53-
this.set('landscapeService.applicationinteraction.selectTarget',!this.get('landscapeService.applicationinteraction.selectTarget'));
68+
if(this.get('landscapeService.application')){
69+
this.set('landscapeService.applicationinteraction.selectTarget',!this.get('landscapeService.applicationinteraction.selectTarget'));
70+
this.set('')
71+
}else{
72+
this.set('landscapeService.landscapeinteraction.selectTarget',!this.get('landscapeService.landscapeinteraction.selectTarget'));
73+
}
5474
},
5575
removeTarget(){
5676
this.set('model.targetType',"");

addon/components/timeline.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler';
99
export default Timeline.extend(AlertifyHandler,{
1010
layout,
1111
landscapeService: service(),
12+
landscapeListener: service(),
1213
chartClickHandler(evt) {
1314
this._super(...arguments);
1415
this.set('importLandscape',true);
1516
this.set('tutorialActivePoint',this.get('timelineChart').getElementAtEvent(evt)[0]);
1617
},
1718
actions:{
1819
submit(){
19-
if ( this.get('tutorialActivePoint')) {
20-
this.get('landscapeListener').set('pauseVisualizationReload',true);
21-
this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName'));
22-
this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x);
23-
this.get('landscapeListener').set('livelandscapes',false);
24-
25-
}
20+
if ( this.get('tutorialActivePoint')) {
21+
this.get('landscapeListener').set('pauseVisualizationReload',true);
22+
this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName'));
23+
this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x);
24+
this.get('landscapeService').set('livelandscapes',false);
25+
}
26+
},
27+
close(){
28+
this.get('landscapeListener').set('pauseVisualizationReload',false);
2629
}
2730
}
2831
});

addon/components/tutorial-form.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ export default Component.extend(AlertifyHandler,{
77
layout,
88
tutorialService: service(),
99
landscapeService: service(),
10+
tagName: "",
1011
actions:{
1112
saveTutorialChanges(tutorial){
1213
this.get('tutorialService').saveTutorialChanges(tutorial);
1314
},
14-
resetLandscape(){
15-
if(this.get('landscapeService.landscape')!=null){
16-
this.set('landscapeService.landscape',null);
17-
}
15+
toggleSetLandscape(){
16+
this.set('landscapeService.selectLandscape',!this.get('landscapeService.selectLandscape'));
1817
},
1918

2019
}

addon/controllers/tutorial.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default Controller.extend({
1313
controller.initRendering();
1414

1515
},
16-
1716
actions: {
1817
resetRoute() {
1918
//const routeName = this.get('tutorial');

0 commit comments

Comments
 (0)