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

Commit ed662a3

Browse files
author
Helge Müller
committed
changes after eval
1 parent 9056461 commit ed662a3

File tree

11 files changed

+64
-28
lines changed

11 files changed

+64
-28
lines changed

addon/components/application-visualization.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export default ApplicationRendering.extend(AlertifyHandler,{
2121
this.get('interaction').on('singleClick', this.get('clickListenerSingle'));
2222
this.get('interaction').on('doubleClick', this.get('clickListenerDouble'));
2323
},
24+
cleanup(){
25+
this._super(...arguments);
26+
this.get('interaction').off('singleClick',this, this.clickListenerSingle);
27+
this.get('interaction').off('doubleClick',this, this.clickListenerDouble);
28+
},
29+
willDestroyElement(){
30+
this._super(...arguments);
31+
this.get('interaction').off('singleClick',this, this.clickListenerSingle);
32+
this.get('interaction').off('doubleClick',this, this.clickListenerDouble);
33+
},
2434
clickListenerSingle(emberModel){
2535
if(emberModel!=undefined){
2636
if(this.get('selectTarget')){

addon/components/landscape-visualization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default LandscapeRendering.extend(AlertifyHandler,{
2727

2828
this.get('interaction').on('showApplication', function (emberModel) {
2929
this.set('landscapeService.application', emberModel);
30+
// this.trigger('doubleClick', emberModel);
3031
});
3132

3233
this.get('interaction').on('singleClick', this.clickListenerSingle);
@@ -67,7 +68,6 @@ export default LandscapeRendering.extend(AlertifyHandler,{
6768
this.set("model.actionType","doubleClick");
6869
this.set('selectTarget',false);
6970
this.showAlertifyMessage(`Target selected 'double click' on '`+emberModel.get('constructor.modelName')+"'");
70-
7171
}else{
7272
if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){
7373
if(this.get("runmode")){

addon/controllers/tutorial/list.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default Controller.extend(AlertifyHandler,{
2525
let newSequence = this.get('store').createRecord("sequence",{
2626
title: "new sequence"
2727
})
28+
tutorial.set('expanded',true);
2829
tutorial.get('sequences').pushObject(newSequence);
2930
newSequence.save().then(function () {
3031
tutorial.save();
@@ -34,6 +35,7 @@ export default Controller.extend(AlertifyHandler,{
3435
let newStep = this.get('store').createRecord("step",{
3536
title: "new step"
3637
})
38+
sequence.set('expanded',true);
3739
sequence.get('steps').pushObject(newStep);
3840
newStep.save().then(function () {
3941
sequence.save();

addon/models/sequence.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ export default DS.Model.extend({
55
text: DS.attr('string'),
66
landscapeTimestamp: DS.attr('string'),
77
steps: DS.hasMany('step',{async:false}),
8+
containsSteps: function() {
9+
return this.get('steps.length')>0;
10+
}.property('steps')
811
});

addon/models/tutorial.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ export default DS.Model.extend({
44
title: DS.attr('string'),
55
landscapeTimestamp: DS.attr('string'),
66
sequences: DS.hasMany('sequence',{async:false}),
7+
containsSequences: function() {
8+
return this.get('sequences.length')>0;
9+
}.property('sequences')
710
});

addon/routes/tutorial/sequence.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, {
99
this._super(...arguments);
1010
controller.set('landscapeService.liveMode',false);
1111
controller.get('landscapeService').updateLandscapeList(true);
12-
controller.get('landscapeService.landscape',null);
12+
13+
controller.set('landscapeService.landscape',null);
14+
controller.set('landscapeService.application', null);
1315

1416
if(controller.get('currentUser.user.isAdmin')){
1517
controller.set('runmode',false);

addon/serializers/tutoriallandscape.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,22 @@ import SaveRelationshipsMixin from 'ember-data-save-relationships';
66

77
export default LandscapeSerializer.extend(SaveRelationshipsMixin,{
88
attrs: {
9-
events:{serialize:true},
109
systems:{serialize:true},
1110
totalApplicationCommunications:{serialize:true}
1211
},
1312
payloadKeyFromModelName(model){
1413
return model;
1514
},
1615
serializeRecordForIncluded(key,relationship){
17-
if(this.serializedTypes.indexOf(key)!==-1){
18-
return;
19-
}
2016
if (relationship.kind === 'belongsTo') {
2117
var nextSnapshot = this.belongsTo(key);
2218
nextSnapshot.serializedTypes=this.serializedTypes;
2319
nextSnapshot.included=this.included;
2420
if(nextSnapshot.record.threeJSModel!=undefined){
2521
nextSnapshot.record.set('threeJSModel', null);
2622
}
27-
if(this.serializedTypes.indexOf(key)==-1){
28-
this.serializedTypes.push(key);
23+
if(this.serializedTypes.indexOf(nextSnapshot.get('id'))==-1){
24+
this.serializedTypes.push(nextSnapshot.get('id'));
2925
nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded;
3026
if(nextSnapshot.record.get('id')!=undefined){
3127
this.included.push(nextSnapshot.record.serialize({includeId:true}).data);
@@ -37,10 +33,9 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{
3733
var self=this;
3834
var nkey=key;
3935
var hasmany=this.hasMany(nkey);
40-
if(hasmany!=undefined){
4136
hasmany.forEach(function(v){
4237
if(v.record.threeJSModel!=undefined){
43-
v.record.set('threeJSModel', null);
38+
v.record.set('threeJSModel', null);
4439
}
4540
if(self.included==undefined){
4641
self.included=[];
@@ -51,7 +46,7 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{
5146
value.serializedTypes=self.serializedTypes;
5247
value.included=self.included;
5348
if(self.serializedTypes.indexOf(nkey)==-1){
54-
self.serializedTypes.push(nkey);
49+
self.serializedTypes.push(nextSnapshot.get('id'));
5550
}
5651
value.serializeRecordForIncluded=self.serializeRecordForIncluded;
5752
value.eachRelationship(self.serializeRecordForIncluded,value);
@@ -60,24 +55,24 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{
6055
}
6156
});
6257
}
63-
}
6458
},
6559
serialize(snapshot) {
6660
let json = this._super(...arguments);
67-
// snapshot.hasMany('systems').forEach(function(v,k){
68-
// delete json.data.relationships.systems.data[k].attributes.threeJSModel;
69-
// });
70-
//
71-
// snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){
72-
// delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel;
73-
// });
7461

7562
snapshot.serializeRecordForIncluded=this.serializeRecordForIncluded;
7663
snapshot.serializedTypes=[];
7764
snapshot.included=[];
7865
snapshot.eachRelationship(this.serializeRecordForIncluded,snapshot);
7966

80-
json.included=snapshot.included;
67+
snapshot.hasMany('systems').forEach(function(v,k){
68+
delete json.data.relationships.systems.data[k].attributes.threeJSModel;
69+
});
70+
71+
snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){
72+
delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel;
73+
});
74+
75+
json.included=snapshot.included;
8176
var newjson={
8277
data:{
8378
id: snapshot.record.get('id'),
@@ -108,7 +103,7 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{
108103
},
109104
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
110105
var json = {};
111-
if(Array.isArray(payload.data)){
106+
if(Array.isArray(payload.data) ){
112107
json = {data:[]};
113108
payload.data.forEach(function(v,k){
114109
json.data[k]=JSON.parse(v.attributes.landscape).data;
@@ -127,6 +122,10 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{
127122
json.included=payload.included;
128123
}
129124
}
125+
// if(requestType=="queryRecord"){
126+
// json.data=json.data[0];
127+
// return this._super(store, primaryModelClass, json, id, requestType);
128+
// }
130129
return this._super(store, primaryModelClass, json, id, requestType);
131130
}
132131
});

addon/templates/components/sequence-form.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}}
1+
{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}} Back{{/link-to}}
22
{{#bs-form model=model onSubmit=(action "saveSequenceChanges" model) as |form|}}
33
{{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}}
44
{{bs-button defaultText="Save" type="primary" buttonType="submit"}}

addon/templates/components/step-form.hbs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#unless runmode}}
2-
{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}}
2+
{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}} Back{{/link-to}}
33
{{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}}
44
{{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}}
55
{{form.element controlType="textarea" label="Text" rows=18 placeholder="Text" property="text"}}
@@ -38,6 +38,22 @@
3838
{{/unless}}
3939
{{/unless}}
4040
{{/unless}}
41+
42+
{{#if model.targetType}}
43+
{{#if model.actionType}}
44+
{{#if model.targetId}}
45+
{{#if landscapeService.landscape.systems}}
46+
Target: {{model.actionType}} on <span title={{model.targetId}}>{{targetName}}</span>
47+
{{else}}
48+
Target: {{model.actionType}} on {{help-tooltip title=model.targetId}}
49+
<div class="spinner-border spinner-border-sm" role="status">
50+
<span class="sr-only"> </span>
51+
</div>
52+
{{/if}}
53+
{{/if}}
54+
{{/if}}
55+
{{/if}}
56+
4157
{{else}}
4258
<h2>{{model.title}}</h2>
4359
<pre style='white-space:pre-line;display:inline-block'>{{model.text}}</pre>
@@ -49,7 +65,8 @@
4965
onClick=(action "skipStep")
5066
type="secondary"
5167
outline=true
52-
title="next step"
68+
disabled=(not landscapeService.landscape.systems)
69+
title="next step" as |button|
5370
}}
5471
next
5572
{{/bs-button}}

addon/templates/components/tutorial-form.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}}
1+
{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}} Back{{/link-to}}
22
{{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}}
33
{{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}}
44
{{bs-button defaultText="Save it" type="primary" buttonType="submit"}}

0 commit comments

Comments
 (0)