From 960822c05f887443128e0fb278b14ee3772c44ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Tue, 29 Jan 2019 10:15:41 +0100 Subject: [PATCH 01/30] Initial commit --- addon/adapters/tutorial.js | 50 +++++++++++++++++++++++++++++++++++ addon/controllers/tutorial.js | 19 +++++++++++++ addon/templates/tutorial.hbs | 6 +++++ index.js | 5 +++- 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 addon/adapters/tutorial.js diff --git a/addon/adapters/tutorial.js b/addon/adapters/tutorial.js new file mode 100644 index 0000000..993327f --- /dev/null +++ b/addon/adapters/tutorial.js @@ -0,0 +1,50 @@ +import JSONAPIAdapter from 'ember-data/adapters/json-api'; +import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; +import ENV from 'explorviz-frontend/config/environment'; + +export default JSONAPIAdapter.extend(DataAdapterMixin,{ + + host: ENV.APP.API_ROOT, + + init() { + + this.set('headers', { + "Accept": "application/vnd.api+json" + }); + + }, + + urlForUpdateRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/${id}`; + }, + + urlForDeleteRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/${id}`; + }, + + urlForFindAll() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/`; + }, + // @Override + urlForQueryRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials`; + }, + + // @Override + // Overrides URL for model.save() + urlForCreateRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/`; + }, + + + authorize(xhr) { + let { access_token } = this.get('session.data.authenticated'); + xhr.setRequestHeader('Authorization', `Bearer ${access_token}`); + } + +}); diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index 30289de..1d4dc29 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -1,7 +1,26 @@ import Controller from '@ember/controller'; +import { inject as service } from "@ember/service"; +import { task } from 'ember-concurrency'; export default Controller.extend({ + store: service(), + tutorials: null, + + init() { + this._super(...arguments); + this.updateTutorialList(true); + }, + updateTutorialList(reload) { + this.set('tutorials', []); + this.get('store').findAll('tutorial', { reload }) + .then(tutorials => { + let tutorialList = tutorials.toArray(); + // sort by id + userList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); + this.set('tutorials', userList); + }); + }, actions: { // body diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index 591173b..e6c53c9 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -8,6 +8,7 @@ onChange=(action (mut page)) as |bg|}} {{#bg.button value="importTutorial"}}Tutorial importieren{{/bg.button}} {{#bg.button value="createNewSequence"}}Neue Sequenz erstellen{{/bg.button}} + {{#bg.button value="listTutorials"}}Tutorials anzeigen{{/bg.button}} {{/bs-button-group}} {{#if (eq page "createNewSequence")}}

Add tutorial

@@ -23,6 +24,11 @@ accept="application/json" type="file" /> + {{else if (eq page "listTutorials")}} +{{#each tutorials as |tutorial|}} + {{tutorial.id}} +{{/each}} + {{/if}} diff --git a/index.js b/index.js index 2e1d1d8..4d70aae 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,8 @@ 'use strict'; module.exports = { - name: require('./package').name + name: require('./package').name, + isDevelopingAddon() { + return true; + } }; From 665b76f91b5b9898dfae678c24620f077c4b23d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Sun, 17 Mar 2019 20:56:17 +0100 Subject: [PATCH 02/30] tutorial basic editing --- addon/adapters/sequence.js | 54 +++ addon/adapters/step.js | 54 +++ addon/adapters/tutorial.js | 4 + addon/components/tutorial-management.js | 326 ++++++++++++++++++ addon/controllers/tutorial.js | 11 +- .../explorviz-frontend-extension-tutorial.js | 2 +- addon/models/sequence.js | 7 + addon/models/step.js | 8 + addon/models/tutorial.js | 6 +- addon/models/tutorialSequence.js | 15 - addon/models/tutorialStep.js | 10 - addon/routes/tutorial.js | 9 +- .../components/tutorial-management.hbs | 270 +++++++++++++++ addon/templates/tutorial.hbs | 46 +-- app/adapters/sequence.js | 1 + app/adapters/step.js | 1 + app/adapters/tutorial.js | 1 + app/components/tutorial-management.js | 1 + app/controllers/tutorial-management.js | 1 + app/models/sequence.js | 1 + app/models/step.js | 1 + app/models/tutorial.js | 1 + .../components/tutorial-management.js | 1 + .../components/tutorial-editor-test.js | 26 ++ .../components/tutorial-management-test.js | 26 ++ .../controllers/tutorial-management-test.js | 12 + 26 files changed, 821 insertions(+), 74 deletions(-) create mode 100644 addon/adapters/sequence.js create mode 100644 addon/adapters/step.js create mode 100644 addon/components/tutorial-management.js create mode 100644 addon/models/sequence.js create mode 100644 addon/models/step.js delete mode 100644 addon/models/tutorialSequence.js delete mode 100644 addon/models/tutorialStep.js create mode 100644 addon/templates/components/tutorial-management.hbs create mode 100644 app/adapters/sequence.js create mode 100644 app/adapters/step.js create mode 100644 app/adapters/tutorial.js create mode 100644 app/components/tutorial-management.js create mode 100644 app/controllers/tutorial-management.js create mode 100644 app/models/sequence.js create mode 100644 app/models/step.js create mode 100644 app/models/tutorial.js create mode 100644 app/templates/components/tutorial-management.js create mode 100644 tests/integration/components/tutorial-editor-test.js create mode 100644 tests/integration/components/tutorial-management-test.js create mode 100644 tests/unit/controllers/tutorial-management-test.js diff --git a/addon/adapters/sequence.js b/addon/adapters/sequence.js new file mode 100644 index 0000000..41c783a --- /dev/null +++ b/addon/adapters/sequence.js @@ -0,0 +1,54 @@ +import JSONAPIAdapter from 'ember-data/adapters/json-api'; +import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; +import ENV from 'explorviz-frontend/config/environment'; + +export default JSONAPIAdapter.extend(DataAdapterMixin,{ + + host: ENV.APP.API_ROOT, + + init() { + + this.set('headers', { + "Accept": "application/vnd.api+json" + }); + + }, + + urlForUpdateRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/sequences/${id}`; + }, + + urlForDeleteRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/sequences/${id}`; + }, + + urlForFindAll() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/sequences/`; + }, + // @Override + urlForQueryRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/sequences/`; + }, + urlForFindRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/sequences/${id}`; + }, + + // @Override + // Overrides URL for model.save() + urlForCreateRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/sequences/`; + }, + + + authorize(xhr) { + let { access_token } = this.get('session.data.authenticated'); + xhr.setRequestHeader('Authorization', `Bearer ${access_token}`); + } + +}); diff --git a/addon/adapters/step.js b/addon/adapters/step.js new file mode 100644 index 0000000..0f75576 --- /dev/null +++ b/addon/adapters/step.js @@ -0,0 +1,54 @@ +import JSONAPIAdapter from 'ember-data/adapters/json-api'; +import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; +import ENV from 'explorviz-frontend/config/environment'; + +export default JSONAPIAdapter.extend(DataAdapterMixin,{ + + host: ENV.APP.API_ROOT, + + init() { + + this.set('headers', { + "Accept": "application/vnd.api+json" + }); + + }, + + urlForUpdateRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/steps/${id}`; + }, + + urlForDeleteRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/steps/${id}`; + }, + + urlForFindAll() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/steps/`; + }, + // @Override + urlForQueryRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/steps`; + }, + urlForFindRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/steps/${id}`; + }, + + // @Override + // Overrides URL for model.save() + urlForCreateRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/steps/`; + }, + + + authorize(xhr) { + let { access_token } = this.get('session.data.authenticated'); + xhr.setRequestHeader('Authorization', `Bearer ${access_token}`); + } + +}); diff --git a/addon/adapters/tutorial.js b/addon/adapters/tutorial.js index 993327f..e4b6a55 100644 --- a/addon/adapters/tutorial.js +++ b/addon/adapters/tutorial.js @@ -33,6 +33,10 @@ export default JSONAPIAdapter.extend(DataAdapterMixin,{ const baseUrl = this.buildURL(); return `${baseUrl}/v1/tutorials`; }, + urlForFindRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/${id}`; + }, // @Override // Overrides URL for model.save() diff --git a/addon/components/tutorial-management.js b/addon/components/tutorial-management.js new file mode 100644 index 0000000..2138a34 --- /dev/null +++ b/addon/components/tutorial-management.js @@ -0,0 +1,326 @@ +import Component from '@ember/component'; +import { inject as service } from "@ember/service"; +import { getOwner } from '@ember/application'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Component.extend(AlertifyHandler,{ + tagName: '', + store: service(), + tutorials: null, + page: null, + currentTutorial:null, + currentSequence:null, + currentStep:null, + +selectedTarget:null, +landscapeListener: service("landscape-listener"), +landscapeRepo: service("repos/landscape-repository"), + didInsertElement() { + this._super(...arguments); + this.set('page', 'main'); + this.updateTutorialList(true); + }, + updateTutorialList(reload) { + this.set('tutorials', []); + this.get('store').findAll('tutorial', { reload }) + .then(tutorials => { + let tutorialList = tutorials.toArray(); + // sort by id + tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); + this.set('tutorials', tutorialList); + }); + }, + + actions: { + openMainPage() { + this.set('page', 'main'); + }, + openEditTutorialPage(tutorial){ + this.set('page', 'editTutorial'); + this.set('currentTutorial', tutorial); + this.setProperties({ + tutorial_id_change: tutorial.id, + tutorial_title_change: tutorial.title, + }); + }, + openEditSequencePage(tutorial,sequence){ + this.set('page', 'editSequence'); + this.set('currentTutorial', tutorial); + this.set('currentSequence', sequence); + this.setProperties({ + sequence_id_change: sequence.id, + sequence_title_change: sequence.title, + }); + }, + openEditStepPage(tutorial,sequence,step){ + this.set('page', 'editStep'); + this.set('currentTutorial', tutorial); + this.set('currentSequence', sequence); + this.set('currentStep', step); + this.setProperties({ + step_id_change: step.id, + step_title_change: step.title, + step_target_change: step.target, + step_target_type_change:step.targetType, + step_target_id_change:step.targetId + }); + }, + openCreateTutorialPage() { + this.set('page', 'createTutorial'); + }, + openCreateSequencePage() { + this.set('page', 'createSequence'); + }, + openCreateStepPage() { + this.set('page', 'createStep'); + }, + setTarget(tutorial,sequence,step,target){ + step.set("targetType",target.constructor.modelName); + step.set("targetId",target.get("id")); + step.save() + .then(()=> { + const message = `Step updated.`; + this.showAlertifyMessage(message); + this.actions.openEditStepPage.bind(this)(this.currentTutorial,this.currentSequence,this.currentStep,this.selectedTarget); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + }, + openSelectTarget(){ + this.set('page', 'selectTarget'); + this.get('landscapeListener').initSSE(); + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + this.set('landscapeInteraction', landscapeInteraction); + this.get('landscapeInteraction').on('singleClick', function(emberModel) { + this.set('selectedTarget',emberModel); + }); + }, + saveTutorial() { + const tutorialData = this.getProperties('title'); + // check for valid input + if(!tutorialData.title || tutorialData.title.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + const tutorialRecord = this.get('store').createRecord('tutorial', { + title: tutorialData.title, + }); + + tutorialRecord.save().then(() => { // success + const message = "Tutorial " + tutorialData.title + " was created."; + this.showAlertifyMessage(message); + this.updateTutorialList(false); + this.actions.openMainPage.bind(this)(); + this.setProperties({ + title: "", + }); + this.openMainPage(); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + tutorialRecord.deleteRecord(); + this.updateTutorialList(false); + }); + + + }, + saveSequence() { + const sequenceData = this.getProperties('title'); + + // check for valid input + if(!sequenceData.title || sequenceData.title.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + const sequenceRecord = this.get('store').createRecord('sequence', { + title: sequenceData.title, + }); + sequenceRecord.save().then(() => { // success + this.currentTutorial.sequences.pushObject(sequenceRecord); + this.currentTutorial.save().then(() => { + const message = "Sequence " + sequenceData.title + " was created and added to Tutorial "+this.currentTutorial.title+"."; + this.showAlertifyMessage(message); + this.updateTutorialList(true); + this.setProperties({ + title: "", + }); + this.actions.openMainPage.bind(this)(); + this.actions.openEditTutorialPage.bind(this)(this.currentTutorial); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + sequenceRecord.deleteRecord(); + this.updateTutorialList(false); + }); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + sequenceRecord.deleteRecord(); + this.updateTutorialList(false); + }); + }, + saveStep() { + const stepData = this.getProperties('title','target'); + + // check for valid input + if(!stepData.title || stepData.title.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + const stepRecord = this.get('store').createRecord('step', { + title: stepData.title, + target: this.selectedTarget, + + }); + stepRecord.save().then(() => { + this.currentSequence.steps.pushObject(stepRecord); + this.currentSequence.save().then(() => { + const message = "Step " + stepRecord.title + " was created and added to Sequence " + this.currentSequence.title + "."; + this.showAlertifyMessage(message); + this.updateTutorialList(true); + this.setProperties({ + title: "", + action: "" + }); + this.actions.openMainPage.bind(this)(); + this.actions.openEditSequencePage.bind(this)(this.currentTutorial,this.currentSequence); + }, (reason) => { + this.showReasonErrorAlert(reason); + stepRecord.deleteRecord(); + this.updateTutorialList(false); + }); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + stepRecord.deleteRecord(); + this.updateTutorialList(false); + }); + + + }, + saveTutorialChanges() { + const tutorialData = this.getProperties('tutorial_id_change', 'tutorial_title_change'); + + const tutorial = this.get('tutorials').find( tutorial => tutorial.get('id') == tutorialData.tutorial_id_change); + + if(tutorial) { + // check for valid input + if(!tutorialData.tutorial_title_change || tutorialData.tutorial_title_change.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + if(tutorial.get('title') !== tutorialData.tutorial_title_change) + tutorial.set('title', tutorialData.tutorial_title_change); + + tutorial.save() + .then(()=> { + const message = `Tutorial updated.`; + this.showAlertifyMessage(message); + this.setProperties({ + tutorial_id_change: "", + tutorial_title_change: "" + }); + this.actions.openMainPage.bind(this)(); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Tutorial not found.`); + } + }, + saveSequenceChanges(){ + const sequenceData = this.getProperties('sequence_id_change', 'sequence_title_change'); + const sequence = this.currentTutorial.sequences.find( sequence => sequence.get('id') == sequenceData.sequence_id_change); + if(sequence) { + // check for valid input + if(!sequenceData.sequence_title_change || sequenceData.sequence_title_change.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + if(sequence.get('title') !== sequenceData.sequence_title_change) + sequence.set('title', sequenceData.sequence_title_change); + + sequence.save() + .then(()=> { + const message = `Sequence updated.`; + this.showAlertifyMessage(message); + this.actions.openEditSequencePage.bind(this)(this.currentTutorial,this.currentSequence); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Sequence not found.`); + } + }, + saveStepChanges(){ + const stepData = this.getProperties('step_id_change', 'step_title_change','step_target_change'); + const step = this.currentSequence.steps.find( step => step.get('id') == stepData.step_id_change); + if(step) { + // check for valid input + if(!stepData.step_title_change || stepData.step_title_change.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + if(step.get('title') !== stepData.step_title_change) + step.set('title', stepData.step_title_change); + step.set('target',this.selectedTarget); + step.save() + .then(()=> { + const message = `Step updated.`; + this.showAlertifyMessage(message); + this.actions.openEditStepPage.bind(this)(this.currentTutorial,this.currentSequence,this.currentStep,this.selectedTarget); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Step not found.`); + } + + }, + deleteTutorial(tutorial) { + tutorial.destroyRecord() + .then(() => { // success + const message = `Tutorial ${tutorial.title} deleted.`; + this.showAlertifyMessage(message); + this.updateTutorialList(false); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + this.updateTutorialList(true); + } + ); + }, + deleteSequence(sequence) { + sequence.destroyRecord() + .then(() => { // success + const message = `Sequence ${sequence.title} deleted.`; + this.showAlertifyMessage(message); + this.updateTutorialList(false); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + this.updateTutorialList(true); + } + ); + }, + deleteStep(step) { + step.destroyRecord() + .then(() => { // success + const message = `Step ${step.title} deleted.`; + this.showAlertifyMessage(message); + this.updateTutorialList(false); + }, (reason) => { // failure + this.showReasonErrorAlert(reason); + this.updateTutorialList(true); + } + ); + }, + +}, +showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); +}, +}); diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index 1d4dc29..f707300 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -1,9 +1,14 @@ import Controller from '@ember/controller'; import { inject as service } from "@ember/service"; -import { task } from 'ember-concurrency'; export default Controller.extend({ store: service(), + renderingService: service(), + + updateModel() { + // update your entity and then call + this.get('renderingService').redrawScene(); + }, tutorials: null, @@ -17,8 +22,8 @@ export default Controller.extend({ .then(tutorials => { let tutorialList = tutorials.toArray(); // sort by id - userList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); - this.set('tutorials', userList); + tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); + this.set('tutorials', tutorialList); }); }, diff --git a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js index 1c64bbc..6adba53 100644 --- a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js +++ b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js @@ -15,5 +15,5 @@ export function initialize(appInstance) { export default { name: 'explorviz-frontend-extension-tutorial', - initialize + initialize: initialize }; diff --git a/addon/models/sequence.js b/addon/models/sequence.js new file mode 100644 index 0000000..f667ae3 --- /dev/null +++ b/addon/models/sequence.js @@ -0,0 +1,7 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + title: DS.attr('string'), + text: DS.attr('string'), + steps: DS.hasMany('step'), +}); diff --git a/addon/models/step.js b/addon/models/step.js new file mode 100644 index 0000000..de82a0b --- /dev/null +++ b/addon/models/step.js @@ -0,0 +1,8 @@ +import DS from 'ember-data'; + +export default DS.Model.extend({ + title: DS.attr('string'), + text: DS.attr('string'), + targetId: DS.attr('string'), + targetType: DS.attr('string') +}); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index 99ec896..7b24b83 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -2,8 +2,6 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), - sequences: hasMany('tutorialSequence', { - inverse: 'parentTutorial' - }), - + text: DS.attr('string'), + sequences: DS.hasMany('sequence'), }); diff --git a/addon/models/tutorialSequence.js b/addon/models/tutorialSequence.js deleted file mode 100644 index 499600b..0000000 --- a/addon/models/tutorialSequence.js +++ /dev/null @@ -1,15 +0,0 @@ -import DS from 'ember-data'; - -export default DS.Model.extend({ - title: DS.attr('string'), - text: DS.attr('string'), - - action: DS.attr('string'), - target: DS.attr('string'), - - landscape: belongsTo('landscape'), - parentTutorial: belongsTo('tutorial'), - steps: hasMany('tutorialStep', { - inverse: 'parentSequence' - }), -}); diff --git a/addon/models/tutorialStep.js b/addon/models/tutorialStep.js deleted file mode 100644 index b1a6034..0000000 --- a/addon/models/tutorialStep.js +++ /dev/null @@ -1,10 +0,0 @@ -import DS from 'ember-data'; - -export default DS.Model.extend({ - title: DS.attr('string'), - text: DS.attr('string'), - action: DS.attr('string'), - target: DS.attr('string'), - - parentSequence: belongsTo('tutorialSequence'), -}); diff --git a/addon/routes/tutorial.js b/addon/routes/tutorial.js index 79f4fed..67ed469 100644 --- a/addon/routes/tutorial.js +++ b/addon/routes/tutorial.js @@ -1,18 +1,11 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import { getOwner } from '@ember/application'; -import { inject as service } from "@ember/service"; export default BaseRoute.extend(AuthenticatedRouteMixin, { - setupController(controller, model) { - // Call _super for default behavior - - - }, actions: { // @Override BaseRoute resetRoute() { - const routeName = this.get('tutorial'); + //const routeName = this.get('tutorial'); }, } diff --git a/addon/templates/components/tutorial-management.hbs b/addon/templates/components/tutorial-management.hbs new file mode 100644 index 0000000..0b17c8d --- /dev/null +++ b/addon/templates/components/tutorial-management.hbs @@ -0,0 +1,270 @@ +
+ {{#if (eq page "main")}} +
+

Tutorials

+
+
+ {{#bs-button class="d-flex-center"onClick=(action "openCreateTutorialPage") type="success" outline=true title="Add Tutorial"}} + {{svg-jar "mortar-board" class="octicon"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial + {{/bs-button}} +
+
+
+ + + + + + + + + + + {{#each tutorials as |tutorial|}} + + + + + + + {{/each}} + +
IDTitleSequences
{{tutorial.id}}{{tutorial.title}} + {{tutorial.sequences.length}} + + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
+
+
+ {{else if (eq page "editTutorial")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+
+
+
+
+
+

Tutorial {{currentTutorial.title}}

+
+ {{#bs-form model=this onSubmit=(action "saveTutorialChanges") as |form|}} + {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} + Sequences: + {{#bs-button onClick=(action "openCreateSequencePage" currentTutorial) type="secondary" outline=true title="Add Sequence"}} + {{svg-jar "versions" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} + {{/bs-button}} + {{#each currentTutorial.sequences as |sequence|}} + {{#bs-button onClick=(action "openEditSequencePage" currentTutorial sequence) type="secondary" outline=true title="Edit Sequence"}} + {{svg-jar "pencil" class="octicon"}}{{sequence.title}} ({{sequence.steps.length}}) + {{/bs-button}} + {{/each}} + {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} + {{/bs-form}} +
+
+
+
+
+
+ {{else if (eq page "editSequence")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} + +
+
+
+
+
+
+

Tutorial "{{currentTutorial.title}}" + {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}} + Sequence "{{currentSequence.title}}" +

+
+ {{#bs-form model=this onSubmit=(action "saveSequenceChanges") as |form|}} + {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} + Steps: + {{#bs-button onClick=(action "openCreateStepPage" currentTutorial currentSequence) type="secondary" outline=true title="Add Step"}} + {{svg-jar "list-ordered" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} + {{/bs-button}} + {{#each currentSequence.steps as |step|}} + {{#bs-button onClick=(action "openEditStepPage" currentTutorial currentSequence step) type="secondary" outline=true title="Edit Step"}} + {{svg-jar "pencil" class="octicon"}}{{step.title}} + {{/bs-button}} + {{sequence.title}} + {{/each}} + {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} + {{/bs-form}} +
+
+
+
+
+
+ {{else if (eq page "editStep")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+
+
+
+
+
+

Tutorial "{{currentTutorial.title}}" + {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}} + Sequence "{{currentSequence.title}}" + {{#bs-button onClick=(action "openEditSequencePage" currentTutorial currentSequence) type="secondary" outline=true title="Back to Sequence"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}} + Step "{{currentStep.title}}" +

+
+ {{#bs-form model=this onSubmit=(action "saveStepChanges") as |form|}} + {{form.element controlType="number" label="Step ID" property="step_id_change" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="step_title_change"}} + {{#bs-button onClick=(action "openSelectTarget" currentTutorial currentSequence currentStep) type="secondary" outline=true title="Select Target"}} + {{svg-jar "search" class="octicon align-middle"}} + {{/bs-button}} + {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="step_target_id_change" disabled=true}} + {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="step_target_type_change" disabled=true}} + {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} + {{/bs-form}} + +
+
+
+
+
+
+ {{else if (eq page "createTutorial")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+
+
+
+

Create Tutorial

+ {{#bs-form model=this onSubmit=(action "saveTutorial") as |form|}} + {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} + {{bs-button defaultText="Create" type="primary" buttonType="submit"}} + {{/bs-form}} +
+
+
+
+ {{else if (eq page "createSequence")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+
+
+
+

Tutorial "{{currentTutorial.title}}" + {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}}Create Sequence

+ {{#bs-form model=this onSubmit=(action "saveSequence") as |form|}} + {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} + {{bs-button defaultText="Create" type="primary" buttonType="submit"}} + {{/bs-form}} +
+
+
+
+ {{else if (eq page "createStep")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+
+
+
+

Tutorial "{{currentTutorial.title}}" + {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}} + Sequence "{{currentSequence.title}}" + {{#bs-button onClick=(action "openEditSequencePage" currentTutorial currentSequence) type="secondary" outline=true title="Back to Sequence"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}} + Create Step

+ {{#bs-form model=this onSubmit=(action "saveStep") as |form|}} + {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} + {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="targetId" disabled=true}} + {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="targetType" disabled=true}} + {{bs-button defaultText="Create" type="primary" buttonType="submit"}} + {{/bs-form}} +
+
+
+
+ {{else if (eq page "selectTarget")}} +
+
+ {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+

Step "{{currentStep.title}}"

+ Type:{{step_target_type_change}} + Id:{{step_target_id_change}} + {{#bs-button onClick=(action "setTarget" currentTutorial currentSequence currentStep landscapeInteraction.selectedTarget) type="secondary" outline=true title="Back to Step"}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/bs-button}} + {{#if landscapeRepo.latestLandscape.systems}} +
+ {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} +
+ {{else}} +
+
+

No landscape found!

+

A new landscape will be fetched every 10 seconds.

+
+
+ {{ember-spinner}} +
+
+ {{/if}} +
+ {{/if}} +
diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index e6c53c9..e1f3234 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -1,35 +1,15 @@ -
-
-
- {{#bs-button-group - value=page - type="radio" - class="mt-3" - onChange=(action (mut page)) as |bg|}} - {{#bg.button value="importTutorial"}}Tutorial importieren{{/bg.button}} - {{#bg.button value="createNewSequence"}}Neue Sequenz erstellen{{/bg.button}} - {{#bg.button value="listTutorials"}}Tutorials anzeigen{{/bg.button}} - {{/bs-button-group}} - {{#if (eq page "createNewSequence")}} -

Add tutorial

- {{#bs-form formLayout=formLayout model=this as |form|}} - {{form.element controlType="text" label="Title" placeholder="Title" property="Title" required=true}} - {{bs-button defaultText="Create Tutorial" value="createTutorial" type="primary" buttonType="submit"}} - {{/bs-form}} - {{else if (eq page "importTutorial")}} -

Tutorial importieren

- - {{else if (eq page "listTutorials")}} -{{#each tutorials as |tutorial|}} - {{tutorial.id}} -{{/each}} +{{#bs-tab id="configuration-tab"customTabs=true as |tab|}} + - {{/if}} -
-
+
+ {{#tab.pane elementId="tutorialManagementPane" title="Tutorial Management"}} + {{#if (eq tab.activeId "tutorialManagementPane")}} + {{tutorial-management}} + {{/if}} + {{/tab.pane}}
+{{/bs-tab}} diff --git a/app/adapters/sequence.js b/app/adapters/sequence.js new file mode 100644 index 0000000..23c599c --- /dev/null +++ b/app/adapters/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/adapters/sequence'; diff --git a/app/adapters/step.js b/app/adapters/step.js new file mode 100644 index 0000000..8cefc7d --- /dev/null +++ b/app/adapters/step.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/adapters/step'; diff --git a/app/adapters/tutorial.js b/app/adapters/tutorial.js new file mode 100644 index 0000000..0379553 --- /dev/null +++ b/app/adapters/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/adapters/tutorial'; diff --git a/app/components/tutorial-management.js b/app/components/tutorial-management.js new file mode 100644 index 0000000..ff5a6dd --- /dev/null +++ b/app/components/tutorial-management.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/tutorial-management'; \ No newline at end of file diff --git a/app/controllers/tutorial-management.js b/app/controllers/tutorial-management.js new file mode 100644 index 0000000..976623b --- /dev/null +++ b/app/controllers/tutorial-management.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial-management'; diff --git a/app/models/sequence.js b/app/models/sequence.js new file mode 100644 index 0000000..8c71bf0 --- /dev/null +++ b/app/models/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/models/sequence'; diff --git a/app/models/step.js b/app/models/step.js new file mode 100644 index 0000000..7d4a058 --- /dev/null +++ b/app/models/step.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/models/step'; diff --git a/app/models/tutorial.js b/app/models/tutorial.js new file mode 100644 index 0000000..7baeb59 --- /dev/null +++ b/app/models/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/models/tutorial'; diff --git a/app/templates/components/tutorial-management.js b/app/templates/components/tutorial-management.js new file mode 100644 index 0000000..64ef129 --- /dev/null +++ b/app/templates/components/tutorial-management.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/components/tutorial-management'; diff --git a/tests/integration/components/tutorial-editor-test.js b/tests/integration/components/tutorial-editor-test.js new file mode 100644 index 0000000..3834be0 --- /dev/null +++ b/tests/integration/components/tutorial-editor-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | tutorial-editor', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{tutorial-editor}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#tutorial-editor}} + template block text + {{/tutorial-editor}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/tutorial-management-test.js b/tests/integration/components/tutorial-management-test.js new file mode 100644 index 0000000..fe30c35 --- /dev/null +++ b/tests/integration/components/tutorial-management-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | tutorial-management', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{tutorial-management}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#tutorial-management}} + template block text + {{/tutorial-management}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/controllers/tutorial-management-test.js b/tests/unit/controllers/tutorial-management-test.js new file mode 100644 index 0000000..1e4a5ac --- /dev/null +++ b/tests/unit/controllers/tutorial-management-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial-management', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial-management'); + assert.ok(controller); + }); +}); From 37fe1edf4475efa88b0471dafc8b41468e8045a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 18 Mar 2019 16:49:23 +0100 Subject: [PATCH 03/30] added serialized landscapes --- addon/components/tutorial-management.js | 2 + addon/models/tutorial.js | 1 + .../components/tutorial-management.hbs | 39 +++++++++++-------- package-lock.json | 4 +- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/addon/components/tutorial-management.js b/addon/components/tutorial-management.js index 2138a34..3498c0a 100644 --- a/addon/components/tutorial-management.js +++ b/addon/components/tutorial-management.js @@ -40,9 +40,11 @@ landscapeRepo: service("repos/landscape-repository"), openEditTutorialPage(tutorial){ this.set('page', 'editTutorial'); this.set('currentTutorial', tutorial); + console.log(tutorial.landscape); this.setProperties({ tutorial_id_change: tutorial.id, tutorial_title_change: tutorial.title, + tutorial_landscape_change: tutorial.landscape.id, }); }, openEditSequencePage(tutorial,sequence){ diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index 7b24b83..e6b7e46 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -3,5 +3,6 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), + landscape: DS.attr('string'), sequences: DS.hasMany('sequence'), }); diff --git a/addon/templates/components/tutorial-management.hbs b/addon/templates/components/tutorial-management.hbs index 0b17c8d..e3fa594 100644 --- a/addon/templates/components/tutorial-management.hbs +++ b/addon/templates/components/tutorial-management.hbs @@ -69,6 +69,8 @@ {{#bs-form model=this onSubmit=(action "saveTutorialChanges") as |form|}} {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} + {{form.element controlType="text" label="Landscape" placeholder="Landscape" property="tutorial_landscape_change"}} + Sequences: {{#bs-button onClick=(action "openCreateSequencePage" currentTutorial) type="secondary" outline=true title="Add Sequence"}} {{svg-jar "versions" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} @@ -250,21 +252,24 @@ {{#bs-button onClick=(action "setTarget" currentTutorial currentSequence currentStep landscapeInteraction.selectedTarget) type="secondary" outline=true title="Back to Step"}} {{svg-jar "arrow-left" class="octicon align-middle"}} {{/bs-button}} - {{#if landscapeRepo.latestLandscape.systems}} -
- {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} -
- {{else}} -
-
-

No landscape found!

-

A new landscape will be fetched every 10 seconds.

-
-
- {{ember-spinner}} -
-
- {{/if}} -
- {{/if}} + {{#if landscapeRepo.latestLandscape.systems}} +
+ {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape landscapeInteraction=landscapeInteraction}} + + {{visualization/rendering/popups/popup-coordinator + popupData=additionalData.popupContent}} +
+ {{else}} +
+
+

No Landscape Found!

+

A new landscape will be fetched every 10 seconds.

+
+
+ {{ember-spinner}} +
+
+ {{/if}} + + {{/if}} diff --git a/package-lock.json b/package-lock.json index ccac8b7..99f3701 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4442,7 +4442,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/ember-cli-htmlbars/-/ember-cli-htmlbars-3.0.1.tgz", "integrity": "sha512-pyyB2s52vKTXDC5svU3IjU7GRLg2+5O81o9Ui0ZSiBS14US/bZl46H2dwcdSJAK+T+Za36ZkQM9eh1rNwOxfoA==", - "dev": true, "requires": { "broccoli-persistent-filter": "^1.4.3", "hash-for-dep": "^1.2.3", @@ -4453,8 +4452,7 @@ "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" } } }, From 9ff78c1abad03b3636f1144292dd426294c8951f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 18 Mar 2019 16:49:23 +0100 Subject: [PATCH 04/30] added serialized landscapes --- addon/components/create-form.js | 6 + addon/components/edit-form.js | 29 ++++ addon/components/tutorial-hierarchie.js | 6 + addon/components/tutorial-management.js | 2 + addon/controllers/tutorial.js | 55 +++++-- .../explorviz-frontend-extension-tutorial.js | 6 +- addon/models/tutorial.js | 2 + addon/routes/tutorial.js | 3 +- addon/routes/tutorial/create.js | 7 + addon/routes/tutorial/edit.js | 46 ++++++ addon/routes/tutorial/list.js | 11 ++ addon/templates/components/create-form.hbs | 21 +++ addon/templates/components/edit-form.hbs | 5 + .../components/tutorial-hierarchie.hbs | 18 ++ .../components/tutorial-management.hbs | 154 +++--------------- addon/templates/tutorial.hbs | 16 +- addon/templates/tutorial/create.hbs | 18 ++ addon/templates/tutorial/edit.hbs | 18 ++ addon/templates/tutorial/list.hbs | 55 +++++++ app/components/create-form.js | 1 + app/components/edit-form.js | 1 + app/components/edit-page.js | 1 + app/components/tutorial-hierarchie.js | 1 + app/routes/tutorial/create.js | 1 + app/routes/tutorial/edit.js | 1 + app/routes/tutorial/list.js | 1 + app/templates/tutorial/create.js | 1 + app/templates/tutorial/edit.js | 1 + app/templates/tutorial/list.js | 1 + package-lock.json | 4 +- .../components/create-form-test.js | 26 +++ .../integration/components/edit-form-test.js | 26 +++ .../integration/components/edit-page-test.js | 26 +++ .../components/edit-tutorial-test.js | 26 +++ .../components/tutorial-hierarchie-test.js | 26 +++ tests/unit/routes/tutorial/create-test.js | 11 ++ tests/unit/routes/tutorial/edit-test.js | 11 ++ tests/unit/routes/tutorial/list-test.js | 11 ++ 38 files changed, 489 insertions(+), 166 deletions(-) create mode 100644 addon/components/create-form.js create mode 100644 addon/components/edit-form.js create mode 100644 addon/components/tutorial-hierarchie.js create mode 100644 addon/routes/tutorial/create.js create mode 100644 addon/routes/tutorial/edit.js create mode 100644 addon/routes/tutorial/list.js create mode 100644 addon/templates/components/create-form.hbs create mode 100644 addon/templates/components/edit-form.hbs create mode 100644 addon/templates/components/tutorial-hierarchie.hbs create mode 100644 addon/templates/tutorial/create.hbs create mode 100644 addon/templates/tutorial/edit.hbs create mode 100644 addon/templates/tutorial/list.hbs create mode 100644 app/components/create-form.js create mode 100644 app/components/edit-form.js create mode 100644 app/components/edit-page.js create mode 100644 app/components/tutorial-hierarchie.js create mode 100644 app/routes/tutorial/create.js create mode 100644 app/routes/tutorial/edit.js create mode 100644 app/routes/tutorial/list.js create mode 100644 app/templates/tutorial/create.js create mode 100644 app/templates/tutorial/edit.js create mode 100644 app/templates/tutorial/list.js create mode 100644 tests/integration/components/create-form-test.js create mode 100644 tests/integration/components/edit-form-test.js create mode 100644 tests/integration/components/edit-page-test.js create mode 100644 tests/integration/components/edit-tutorial-test.js create mode 100644 tests/integration/components/tutorial-hierarchie-test.js create mode 100644 tests/unit/routes/tutorial/create-test.js create mode 100644 tests/unit/routes/tutorial/edit-test.js create mode 100644 tests/unit/routes/tutorial/list-test.js diff --git a/addon/components/create-form.js b/addon/components/create-form.js new file mode 100644 index 0000000..4ed1930 --- /dev/null +++ b/addon/components/create-form.js @@ -0,0 +1,6 @@ +import Component from '@ember/component'; +import layout from '../templates/components/create-form'; + +export default Component.extend({ + layout +}); diff --git a/addon/components/edit-form.js b/addon/components/edit-form.js new file mode 100644 index 0000000..0709bed --- /dev/null +++ b/addon/components/edit-form.js @@ -0,0 +1,29 @@ +import Component from '@ember/component'; +import layout from '../templates/components/edit-form'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Component.extend(AlertifyHandler,{ + layout, + actions:{ + saveTutorialChanges(tutorial) { + if(tutorial) { + // check for valid input + if(!tutorial.get('title') || tutorial.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + tutorial.save() + .then(()=> { + const message = `Tutorial updated.`; + this.showAlertifyMessage(message); + this.actions.openMainPage.bind(this)(); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Tutorial not found.`); + } + }, + } +}); diff --git a/addon/components/tutorial-hierarchie.js b/addon/components/tutorial-hierarchie.js new file mode 100644 index 0000000..33ad798 --- /dev/null +++ b/addon/components/tutorial-hierarchie.js @@ -0,0 +1,6 @@ +import Component from '@ember/component'; +import layout from '../templates/components/tutorial-hierarchie'; + +export default Component.extend({ + layout +}); diff --git a/addon/components/tutorial-management.js b/addon/components/tutorial-management.js index 2138a34..5e262d5 100644 --- a/addon/components/tutorial-management.js +++ b/addon/components/tutorial-management.js @@ -40,9 +40,11 @@ landscapeRepo: service("repos/landscape-repository"), openEditTutorialPage(tutorial){ this.set('page', 'editTutorial'); this.set('currentTutorial', tutorial); + console.log(tutorial.get('serializedLandscape')); this.setProperties({ tutorial_id_change: tutorial.id, tutorial_title_change: tutorial.title, + // tutorial_landscape_change: tutorial.landscape.timestamp, }); }, openEditSequencePage(tutorial,sequence){ diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index f707300..fe7055d 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -12,21 +12,52 @@ export default Controller.extend({ tutorials: null, + init() { - this._super(...arguments); - this.updateTutorialList(true); - }, - updateTutorialList(reload) { - this.set('tutorials', []); - this.get('store').findAll('tutorial', { reload }) - .then(tutorials => { - let tutorialList = tutorials.toArray(); - // sort by id - tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); - this.set('tutorials', tutorialList); - }); + this._super(...arguments); + this.updateTutorialList(true); }, +updateTutorialList(reload) { + this.set('tutorials', []); + this.get('store').findAll('tutorial', { reload }) + .then(tutorials => { + let tutorialList = tutorials.toArray(); + // sort by id + tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); + this.set('tutorials', tutorialList); + }); +}, +saveTutorialChanges() { + const tutorialData = this.getProperties('tutorial_id_change', 'tutorial_title_change'); + + const tutorial = this.get('tutorials').find( tutorial => tutorial.get('id') == tutorialData.tutorial_id_change); + + if(tutorial) { + // check for valid input + if(!tutorialData.tutorial_title_change || tutorialData.tutorial_title_change.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + if(tutorial.get('title') !== tutorialData.tutorial_title_change) + tutorial.set('title', tutorialData.tutorial_title_change); + + tutorial.save() + .then(()=> { + const message = `Tutorial updated.`; + this.showAlertifyMessage(message); + this.setProperties({ + tutorial_id_change: "", + tutorial_title_change: "" + }); + this.actions.openMainPage.bind(this)(); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Tutorial not found.`); + } +}, actions: { // body selectedSingleFile(){ diff --git a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js index 6adba53..3041e19 100644 --- a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js +++ b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js @@ -9,7 +9,11 @@ export function initialize(appInstance) { } Router.map(function() { - this.route("tutorial"); + this.route("tutorial", function(){ + this.route('create'); + this.route('list'); + this.route('edit', { path: '/edit/:tutorial_id' }); + }); }); } diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index 7b24b83..5a0ff27 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -3,5 +3,7 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), + //route: DS.attr('string'), +// landscapeTimestamp: DS.attr('string'), sequences: DS.hasMany('sequence'), }); diff --git a/addon/routes/tutorial.js b/addon/routes/tutorial.js index 67ed469..0b3b74e 100644 --- a/addon/routes/tutorial.js +++ b/addon/routes/tutorial.js @@ -8,6 +8,5 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { //const routeName = this.get('tutorial'); }, - } - + }, }); diff --git a/addon/routes/tutorial/create.js b/addon/routes/tutorial/create.js new file mode 100644 index 0000000..87e807f --- /dev/null +++ b/addon/routes/tutorial/create.js @@ -0,0 +1,7 @@ +import Route from '@ember/routing/route'; +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + +}); diff --git a/addon/routes/tutorial/edit.js b/addon/routes/tutorial/edit.js new file mode 100644 index 0000000..344d3e7 --- /dev/null +++ b/addon/routes/tutorial/edit.js @@ -0,0 +1,46 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('tutorial', params.tutorial_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + saveTutorialChanges() { + const tutorialData = this.getProperties('tutorial_id_change', 'tutorial_title_change'); + + const tutorial = this.get('tutorials').find( tutorial => tutorial.get('id') == tutorialData.tutorial_id_change); + + if(tutorial) { + // check for valid input + if(!tutorialData.tutorial_title_change || tutorialData.tutorial_title_change.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + if(tutorial.get('title') !== tutorialData.tutorial_title_change) + tutorial.set('title', tutorialData.tutorial_title_change); + + tutorial.save() + .then(()=> { + const message = `Tutorial updated.`; + this.showAlertifyMessage(message); + this.setProperties({ + tutorial_id_change: "", + tutorial_title_change: "" + }); + this.actions.openMainPage.bind(this)(); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Tutorial not found.`); + } + }, + } + +}); \ No newline at end of file diff --git a/addon/routes/tutorial/list.js b/addon/routes/tutorial/list.js new file mode 100644 index 0000000..e34f577 --- /dev/null +++ b/addon/routes/tutorial/list.js @@ -0,0 +1,11 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import RSVP from 'rsvp'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model() { + return RSVP.hash({ + tutorials: this.get('store').findAll('tutorial') + }); + } +}); diff --git a/addon/templates/components/create-form.hbs b/addon/templates/components/create-form.hbs new file mode 100644 index 0000000..676ee68 --- /dev/null +++ b/addon/templates/components/create-form.hbs @@ -0,0 +1,21 @@ +{{#if step.title}} + {{#bs-form model=this onSubmit=(action "saveStepChanges") as |form|}} + {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} + {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="targetId" disabled=true}} + {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="targetType" disabled=true}} + {{bs-button defaultText="Create" type="primary" buttonType="submit"}} + {{/bs-form}} +{{else if sequence.title}} + {{#bs-form model=this onSubmit=(action "saveSequenceChanges") as |form|}} + {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} + {{/bs-form}} +{{else if tutorial.title}} + {{#bs-form model=this onSubmit=(action "saveTutorialChanges") as |form|}} + {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} + {{form.element controlType="text" label="Landscape" placeholder="Landscape" property="tutorial_landscape_change"}} + {{/bs-form}} +{{else}} +No Tutorial loaded. +{{/if}} \ No newline at end of file diff --git a/addon/templates/components/edit-form.hbs b/addon/templates/components/edit-form.hbs new file mode 100644 index 0000000..ad22181 --- /dev/null +++ b/addon/templates/components/edit-form.hbs @@ -0,0 +1,5 @@ + {{#bs-form model=tutorial onSubmit=(action "saveTutorialChanges" tutorial) as |form|}} + {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="title"}} + {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}} \ No newline at end of file diff --git a/addon/templates/components/tutorial-hierarchie.hbs b/addon/templates/components/tutorial-hierarchie.hbs new file mode 100644 index 0000000..b205974 --- /dev/null +++ b/addon/templates/components/tutorial-hierarchie.hbs @@ -0,0 +1,18 @@ +

+ {{#if tutorial.title}} + Tutorial "{{tutorial.title}}" + {{/if}} + {{#if sequence.title}} + {{#link-to "tutorial.edit" tutorial class=tutorial.id}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/link-to}} + Sequence "{{sequence.title}}" + + {{/if}} + {{#if step.title}} + {{#link-to "tutorial.edit" tutorial class=tutorial.id}} + {{svg-jar "arrow-left" class="octicon align-middle"}} + {{/link-to}} + Step "{{step.title}}" + {{/if}} +

\ No newline at end of file diff --git a/addon/templates/components/tutorial-management.hbs b/addon/templates/components/tutorial-management.hbs index 0b17c8d..ef89e4e 100644 --- a/addon/templates/components/tutorial-management.hbs +++ b/addon/templates/components/tutorial-management.hbs @@ -22,7 +22,7 @@ {{#each tutorials as |tutorial|}} - {{tutorial.id}} + {{#link-to "tutorial.edit" tutorial class=tutorial.id}}{{tutorial.id}}{{/link-to}} {{tutorial.title}} {{tutorial.sequences.length}} @@ -52,121 +52,6 @@ - {{else if (eq page "editTutorial")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-
-
-

Tutorial {{currentTutorial.title}}

-
- {{#bs-form model=this onSubmit=(action "saveTutorialChanges") as |form|}} - {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} - Sequences: - {{#bs-button onClick=(action "openCreateSequencePage" currentTutorial) type="secondary" outline=true title="Add Sequence"}} - {{svg-jar "versions" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} - {{/bs-button}} - {{#each currentTutorial.sequences as |sequence|}} - {{#bs-button onClick=(action "openEditSequencePage" currentTutorial sequence) type="secondary" outline=true title="Edit Sequence"}} - {{svg-jar "pencil" class="octicon"}}{{sequence.title}} ({{sequence.steps.length}}) - {{/bs-button}} - {{/each}} - {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
-
-
- {{else if (eq page "editSequence")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} - -
-
-
-
-
-
-

Tutorial "{{currentTutorial.title}}" - {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Sequence "{{currentSequence.title}}" -

-
- {{#bs-form model=this onSubmit=(action "saveSequenceChanges") as |form|}} - {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} - Steps: - {{#bs-button onClick=(action "openCreateStepPage" currentTutorial currentSequence) type="secondary" outline=true title="Add Step"}} - {{svg-jar "list-ordered" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} - {{/bs-button}} - {{#each currentSequence.steps as |step|}} - {{#bs-button onClick=(action "openEditStepPage" currentTutorial currentSequence step) type="secondary" outline=true title="Edit Step"}} - {{svg-jar "pencil" class="octicon"}}{{step.title}} - {{/bs-button}} - {{sequence.title}} - {{/each}} - {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
-
-
- {{else if (eq page "editStep")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-
-
-

Tutorial "{{currentTutorial.title}}" - {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Sequence "{{currentSequence.title}}" - {{#bs-button onClick=(action "openEditSequencePage" currentTutorial currentSequence) type="secondary" outline=true title="Back to Sequence"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Step "{{currentStep.title}}" -

-
- {{#bs-form model=this onSubmit=(action "saveStepChanges") as |form|}} - {{form.element controlType="number" label="Step ID" property="step_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="step_title_change"}} - {{#bs-button onClick=(action "openSelectTarget" currentTutorial currentSequence currentStep) type="secondary" outline=true title="Select Target"}} - {{svg-jar "search" class="octicon align-middle"}} - {{/bs-button}} - {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="step_target_id_change" disabled=true}} - {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="step_target_type_change" disabled=true}} - {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} - {{/bs-form}} - -
-
-
-
-
-
{{else if (eq page "createTutorial")}}
@@ -250,21 +135,24 @@ {{#bs-button onClick=(action "setTarget" currentTutorial currentSequence currentStep landscapeInteraction.selectedTarget) type="secondary" outline=true title="Back to Step"}} {{svg-jar "arrow-left" class="octicon align-middle"}} {{/bs-button}} - {{#if landscapeRepo.latestLandscape.systems}} -
- {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} -
- {{else}} -
-
-

No landscape found!

-

A new landscape will be fetched every 10 seconds.

-
-
- {{ember-spinner}} -
-
- {{/if}} -
- {{/if}} + {{#if landscapeRepo.latestLandscape.systems}} +
+ {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape landscapeInteraction=landscapeInteraction}} + + {{visualization/rendering/popups/popup-coordinator + popupData=additionalData.popupContent}} +
+ {{else}} +
+
+

No Landscape Found!

+

A new landscape will be fetched every 10 seconds.

+
+
+ {{ember-spinner}} +
+
+ {{/if}} +
+ {{/if}} diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index e1f3234..e2147ca 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -1,15 +1 @@ -{{#bs-tab id="configuration-tab"customTabs=true as |tab|}} - - -
- {{#tab.pane elementId="tutorialManagementPane" title="Tutorial Management"}} - {{#if (eq tab.activeId "tutorialManagementPane")}} - {{tutorial-management}} - {{/if}} - {{/tab.pane}} -
-{{/bs-tab}} +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/create.hbs b/addon/templates/tutorial/create.hbs new file mode 100644 index 0000000..23dd668 --- /dev/null +++ b/addon/templates/tutorial/create.hbs @@ -0,0 +1,18 @@ +
+
+ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +
+
+
+
+
+
+ {{tutorial-hierarchie tutorial=model}} +
+ {{create-form tutorial=model}} +
+
+
+
+
+
\ No newline at end of file diff --git a/addon/templates/tutorial/edit.hbs b/addon/templates/tutorial/edit.hbs new file mode 100644 index 0000000..3724bde --- /dev/null +++ b/addon/templates/tutorial/edit.hbs @@ -0,0 +1,18 @@ +
+
+ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +
+
+
+
+
+
+ {{tutorial-hierarchie tutorial=model}} +
+ {{edit-form tutorial=model}} +
+
+
+
+
+
\ No newline at end of file diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs new file mode 100644 index 0000000..f813d39 --- /dev/null +++ b/addon/templates/tutorial/list.hbs @@ -0,0 +1,55 @@ +
+

Tutorials

+
+
+ {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} +
+
+
+ + + + + + + + + + + {{#each model.tutorials as |tutorial|}} + + + + + + + {{/each}} + +
IDTitleSequences
+ {{#link-to "tutorial.edit" tutorial}}{{tutorial.id}}{{/link-to}} + {{tutorial.title}} + {{tutorial.sequences.length}} + + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.edit" tutorial}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
+
+
\ No newline at end of file diff --git a/app/components/create-form.js b/app/components/create-form.js new file mode 100644 index 0000000..2734d90 --- /dev/null +++ b/app/components/create-form.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/create-form'; \ No newline at end of file diff --git a/app/components/edit-form.js b/app/components/edit-form.js new file mode 100644 index 0000000..92a6769 --- /dev/null +++ b/app/components/edit-form.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/edit-form'; \ No newline at end of file diff --git a/app/components/edit-page.js b/app/components/edit-page.js new file mode 100644 index 0000000..fc8f2ee --- /dev/null +++ b/app/components/edit-page.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/edit-page'; \ No newline at end of file diff --git a/app/components/tutorial-hierarchie.js b/app/components/tutorial-hierarchie.js new file mode 100644 index 0000000..e0a0f3d --- /dev/null +++ b/app/components/tutorial-hierarchie.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/tutorial-hierarchie'; \ No newline at end of file diff --git a/app/routes/tutorial/create.js b/app/routes/tutorial/create.js new file mode 100644 index 0000000..5679403 --- /dev/null +++ b/app/routes/tutorial/create.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create'; diff --git a/app/routes/tutorial/edit.js b/app/routes/tutorial/edit.js new file mode 100644 index 0000000..4f1c2f4 --- /dev/null +++ b/app/routes/tutorial/edit.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit'; diff --git a/app/routes/tutorial/list.js b/app/routes/tutorial/list.js new file mode 100644 index 0000000..3091ef1 --- /dev/null +++ b/app/routes/tutorial/list.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list'; diff --git a/app/templates/tutorial/create.js b/app/templates/tutorial/create.js new file mode 100644 index 0000000..99c4814 --- /dev/null +++ b/app/templates/tutorial/create.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create'; diff --git a/app/templates/tutorial/edit.js b/app/templates/tutorial/edit.js new file mode 100644 index 0000000..5c1e557 --- /dev/null +++ b/app/templates/tutorial/edit.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit'; diff --git a/app/templates/tutorial/list.js b/app/templates/tutorial/list.js new file mode 100644 index 0000000..5ca3011 --- /dev/null +++ b/app/templates/tutorial/list.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list'; diff --git a/package-lock.json b/package-lock.json index ccac8b7..99f3701 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4442,7 +4442,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/ember-cli-htmlbars/-/ember-cli-htmlbars-3.0.1.tgz", "integrity": "sha512-pyyB2s52vKTXDC5svU3IjU7GRLg2+5O81o9Ui0ZSiBS14US/bZl46H2dwcdSJAK+T+Za36ZkQM9eh1rNwOxfoA==", - "dev": true, "requires": { "broccoli-persistent-filter": "^1.4.3", "hash-for-dep": "^1.2.3", @@ -4453,8 +4452,7 @@ "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" } } }, diff --git a/tests/integration/components/create-form-test.js b/tests/integration/components/create-form-test.js new file mode 100644 index 0000000..ffa3bae --- /dev/null +++ b/tests/integration/components/create-form-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | create-form', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{create-form}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#create-form}} + template block text + {{/create-form}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/edit-form-test.js b/tests/integration/components/edit-form-test.js new file mode 100644 index 0000000..f45758d --- /dev/null +++ b/tests/integration/components/edit-form-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | edit-form', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{edit-form}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#edit-form}} + template block text + {{/edit-form}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/edit-page-test.js b/tests/integration/components/edit-page-test.js new file mode 100644 index 0000000..4234aa6 --- /dev/null +++ b/tests/integration/components/edit-page-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | edit-page', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{edit-page}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#edit-page}} + template block text + {{/edit-page}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/edit-tutorial-test.js b/tests/integration/components/edit-tutorial-test.js new file mode 100644 index 0000000..7c87428 --- /dev/null +++ b/tests/integration/components/edit-tutorial-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | edit-tutorial', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{edit-tutorial}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#edit-tutorial}} + template block text + {{/edit-tutorial}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/tutorial-hierarchie-test.js b/tests/integration/components/tutorial-hierarchie-test.js new file mode 100644 index 0000000..f74557e --- /dev/null +++ b/tests/integration/components/tutorial-hierarchie-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | tutorial-hierarchie', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{tutorial-hierarchie}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#tutorial-hierarchie}} + template block text + {{/tutorial-hierarchie}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/routes/tutorial/create-test.js b/tests/unit/routes/tutorial/create-test.js new file mode 100644 index 0000000..9e846bf --- /dev/null +++ b/tests/unit/routes/tutorial/create-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/create', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/create'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/edit-test.js b/tests/unit/routes/tutorial/edit-test.js new file mode 100644 index 0000000..7d4cdd6 --- /dev/null +++ b/tests/unit/routes/tutorial/edit-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/edit', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/edit'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/list-test.js b/tests/unit/routes/tutorial/list-test.js new file mode 100644 index 0000000..3873296 --- /dev/null +++ b/tests/unit/routes/tutorial/list-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/list', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/list'); + assert.ok(route); + }); +}); From 337c766896bd75bcd0b6d26595fb2447f22bf5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Sun, 24 Mar 2019 18:21:49 +0100 Subject: [PATCH 05/30] tutorial landscape assosiaction and target selection --- addon/components/edit-form-list.js | 6 +++ addon/components/edit-form.js | 46 ++++++++++++++++++- addon/controllers/tutorial.js | 17 ++----- .../tutorial/edit/tutorial/target.js | 40 ++++++++++++++++ .../explorviz-frontend-extension-tutorial.js | 20 ++++++-- addon/models/sequence.js | 1 + addon/models/step.js | 1 + addon/models/tutorial.js | 14 +++++- addon/routes/tutorial/create/sequence.js | 4 ++ addon/routes/tutorial/create/step.js | 4 ++ .../{create.js => create/tutorial.js} | 0 addon/routes/tutorial/edit/sequence.js | 15 ++++++ addon/routes/tutorial/edit/step.js | 15 ++++++ .../tutorial/{edit.js => edit/tutorial.js} | 2 +- addon/routes/tutorial/edit/tutorial/target.js | 19 ++++++++ addon/routes/tutorial/list/sequence.js | 4 ++ addon/routes/tutorial/list/step.js | 4 ++ .../tutorial/{list.js => list/tutorial.js} | 0 addon/templates/components/edit-form-list.hbs | 39 ++++++++++++++++ addon/templates/components/edit-form.hbs | 34 +++++++++++++- .../components/tutorial-hierarchie.hbs | 13 +++--- .../components/tutorial-management.hbs | 2 +- addon/templates/tutorial.hbs | 2 +- addon/templates/tutorial/create/sequence.hbs | 1 + addon/templates/tutorial/create/step.hbs | 1 + addon/templates/tutorial/create/tutorial.hbs | 1 + .../{create.hbs => edit/sequence.hbs} | 8 ++-- addon/templates/tutorial/edit/step.hbs | 18 ++++++++ .../tutorial/{edit.hbs => edit/tutorial.hbs} | 2 +- .../tutorial/edit/tutorial/target.hbs | 23 ++++++++++ addon/templates/tutorial/list/sequence.hbs | 1 + addon/templates/tutorial/list/step.hbs | 1 + .../tutorial/{list.hbs => list/tutorial.hbs} | 6 +-- app/components/edit-form-list.js | 1 + .../tutorial/edit/tutorial/target.js | 1 + app/routes/tutorial/create/sequence.js | 1 + .../tutorial/{list.js => create/step.js} | 2 +- app/routes/tutorial/create/tutorial.js | 1 + app/routes/tutorial/edit/sequence.js | 1 + .../tutorial/{create.js => edit/step.js} | 2 +- app/routes/tutorial/edit/tutorial.js | 1 + app/routes/tutorial/edit/tutorial/target.js | 1 + app/routes/tutorial/list/sequence.js | 1 + app/routes/tutorial/{edit.js => list/step.js} | 2 +- app/routes/tutorial/list/tutorial.js | 1 + app/templates/tutorial/create/sequence.js | 1 + .../tutorial/{list.js => create/step.js} | 2 +- app/templates/tutorial/create/tutorial.js | 1 + app/templates/tutorial/edit/sequence.js | 1 + .../tutorial/{create.js => edit/step.js} | 2 +- app/templates/tutorial/edit/tutorial.js | 1 + .../tutorial/edit/tutorial/target.js | 1 + app/templates/tutorial/list/sequence.js | 1 + .../tutorial/{edit.js => list/step.js} | 2 +- app/templates/tutorial/list/tutorial.js | 1 + package-lock.json | 41 ++++++++++++----- .../components/edit-for-list-test.js | 26 +++++++++++ .../tutorial/edit/tutorial/target-test.js | 12 +++++ .../routes/tutorial/create/sequence-test.js | 11 +++++ .../{list-test.js => create/step-test.js} | 4 +- .../routes/tutorial/create/tutorial-test.js | 11 +++++ .../routes/tutorial/edit/sequence-test.js | 11 +++++ .../{create-test.js => edit/step-test.js} | 4 +- .../routes/tutorial/edit/tutorial-test.js | 11 +++++ .../tutorial/edit/tutorial/target-test.js | 11 +++++ .../routes/tutorial/list/sequence-test.js | 11 +++++ .../{edit-test.js => list/step-test.js} | 4 +- .../routes/tutorial/list/tutorial-test.js | 11 +++++ 68 files changed, 496 insertions(+), 64 deletions(-) create mode 100644 addon/components/edit-form-list.js create mode 100644 addon/controllers/tutorial/edit/tutorial/target.js create mode 100644 addon/routes/tutorial/create/sequence.js create mode 100644 addon/routes/tutorial/create/step.js rename addon/routes/tutorial/{create.js => create/tutorial.js} (100%) create mode 100644 addon/routes/tutorial/edit/sequence.js create mode 100644 addon/routes/tutorial/edit/step.js rename addon/routes/tutorial/{edit.js => edit/tutorial.js} (99%) create mode 100644 addon/routes/tutorial/edit/tutorial/target.js create mode 100644 addon/routes/tutorial/list/sequence.js create mode 100644 addon/routes/tutorial/list/step.js rename addon/routes/tutorial/{list.js => list/tutorial.js} (100%) create mode 100644 addon/templates/components/edit-form-list.hbs create mode 100644 addon/templates/tutorial/create/sequence.hbs create mode 100644 addon/templates/tutorial/create/step.hbs create mode 100644 addon/templates/tutorial/create/tutorial.hbs rename addon/templates/tutorial/{create.hbs => edit/sequence.hbs} (64%) create mode 100644 addon/templates/tutorial/edit/step.hbs rename addon/templates/tutorial/{edit.hbs => edit/tutorial.hbs} (98%) create mode 100644 addon/templates/tutorial/edit/tutorial/target.hbs create mode 100644 addon/templates/tutorial/list/sequence.hbs create mode 100644 addon/templates/tutorial/list/step.hbs rename addon/templates/tutorial/{list.hbs => list/tutorial.hbs} (92%) create mode 100644 app/components/edit-form-list.js create mode 100644 app/controllers/tutorial/edit/tutorial/target.js create mode 100644 app/routes/tutorial/create/sequence.js rename app/routes/tutorial/{list.js => create/step.js} (68%) create mode 100644 app/routes/tutorial/create/tutorial.js create mode 100644 app/routes/tutorial/edit/sequence.js rename app/routes/tutorial/{create.js => edit/step.js} (70%) create mode 100644 app/routes/tutorial/edit/tutorial.js create mode 100644 app/routes/tutorial/edit/tutorial/target.js create mode 100644 app/routes/tutorial/list/sequence.js rename app/routes/tutorial/{edit.js => list/step.js} (70%) create mode 100644 app/routes/tutorial/list/tutorial.js create mode 100644 app/templates/tutorial/create/sequence.js rename app/templates/tutorial/{list.js => create/step.js} (66%) create mode 100644 app/templates/tutorial/create/tutorial.js create mode 100644 app/templates/tutorial/edit/sequence.js rename app/templates/tutorial/{create.js => edit/step.js} (68%) create mode 100644 app/templates/tutorial/edit/tutorial.js create mode 100644 app/templates/tutorial/edit/tutorial/target.js create mode 100644 app/templates/tutorial/list/sequence.js rename app/templates/tutorial/{edit.js => list/step.js} (68%) create mode 100644 app/templates/tutorial/list/tutorial.js create mode 100644 tests/integration/components/edit-for-list-test.js create mode 100644 tests/unit/controllers/tutorial/edit/tutorial/target-test.js create mode 100644 tests/unit/routes/tutorial/create/sequence-test.js rename tests/unit/routes/tutorial/{list-test.js => create/step-test.js} (57%) create mode 100644 tests/unit/routes/tutorial/create/tutorial-test.js create mode 100644 tests/unit/routes/tutorial/edit/sequence-test.js rename tests/unit/routes/tutorial/{create-test.js => edit/step-test.js} (57%) create mode 100644 tests/unit/routes/tutorial/edit/tutorial-test.js create mode 100644 tests/unit/routes/tutorial/edit/tutorial/target-test.js create mode 100644 tests/unit/routes/tutorial/list/sequence-test.js rename tests/unit/routes/tutorial/{edit-test.js => list/step-test.js} (57%) create mode 100644 tests/unit/routes/tutorial/list/tutorial-test.js diff --git a/addon/components/edit-form-list.js b/addon/components/edit-form-list.js new file mode 100644 index 0000000..8f14417 --- /dev/null +++ b/addon/components/edit-form-list.js @@ -0,0 +1,6 @@ +import Component from '@ember/component'; +import layout from '../templates/components/edit-form-list'; + +export default Component.extend({ + layout +}); diff --git a/addon/components/edit-form.js b/addon/components/edit-form.js index 0709bed..7493fc0 100644 --- a/addon/components/edit-form.js +++ b/addon/components/edit-form.js @@ -17,7 +17,6 @@ export default Component.extend(AlertifyHandler,{ .then(()=> { const message = `Tutorial updated.`; this.showAlertifyMessage(message); - this.actions.openMainPage.bind(this)(); }, (reason) => { this.showReasonErrorAlert(reason); }); @@ -25,5 +24,48 @@ export default Component.extend(AlertifyHandler,{ this.showAlertifyMessage(`Tutorial not found.`); } }, - } + saveSequenceChanges(sequence) { + if(sequence) { + // check for valid input + if(!sequence.get('title') || sequence.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + sequence.save() + .then(()=> { + const message = `Sequence updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Sequence not found.`); + } + }, + + saveStepChanges(step) { + if(step) { + // check for valid input + if(!step.get('title') || step.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + step.save() + .then(()=> { + const message = `Step updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Step not found.`); + } + }, + }, + showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); + }, }); diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index fe7055d..ca22cf9 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -3,16 +3,15 @@ import { inject as service } from "@ember/service"; export default Controller.extend({ store: service(), - renderingService: service(), - - updateModel() { + renderingService: service("rendering-service"), + updateModel() { // update your entity and then call this.get('renderingService').redrawScene(); }, tutorials: null, - + init() { this._super(...arguments); this.updateTutorialList(true); @@ -58,15 +57,5 @@ saveTutorialChanges() { this.showAlertifyMessage(`Tutorial not found.`); } }, -actions: { - // body - selectedSingleFile(){ - - - }, - addTutorial(){ - - } -} }); diff --git a/addon/controllers/tutorial/edit/tutorial/target.js b/addon/controllers/tutorial/edit/tutorial/target.js new file mode 100644 index 0000000..967d397 --- /dev/null +++ b/addon/controllers/tutorial/edit/tutorial/target.js @@ -0,0 +1,40 @@ +import Controller from '@ember/controller'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; + import { inject as service } from "@ember/service"; +import { getOwner } from '@ember/application'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + + +export default Controller.extend(AlertifyHandler,{ + tagName: '', + store: service(), + renderingService: service("rendering-service"), + targetType: null, + targetId:null, + updateModel() { + // update your entity and then call + this.get('renderingService').redrawScene(); + }, + init(){ + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + this.set('landscapeInteraction', landscapeInteraction); + this.get('landscapeInteraction').on('singleClick', function(emberModel) { + if(emberModel!=undefined){ + this.set("targetType",emberModel.constructor.modelName); + this.set("targetId",emberModel.get("id")); + // console.log("Set Target:"+ Ember.get("targetType")+" "+targetId); + } + }); + }, + actions:{ + saveTarget(model,targetType,targetId){ + console.log(targetType); + console.log(targetId); + this.get("model").set("targetType",targetType); + this.get("model").set("targetId",targetId); + this.get("model").save(); + this.transitionToRoute("tutorial.edit.tutorial", model); + } + } +}); diff --git a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js index 3041e19..a482682 100644 --- a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js +++ b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js @@ -10,10 +10,24 @@ export function initialize(appInstance) { Router.map(function() { this.route("tutorial", function(){ - this.route('create'); - this.route('list'); - this.route('edit', { path: '/edit/:tutorial_id' }); + this.route("list", function(){ + this.route('tutorial'); + this.route('sequence'); + this.route('step'); + }); + this.route("edit", function(){ + this.route('tutorial', { path: '/tutorial/:tutorial_id/' }); + this.route('tutorial.target', { path: '/tutorial/:tutorial_id/target' }); + this.route('sequence', { path: '/sequence/:sequence_id/' }); + this.route('step', { path: '/step/:step_id/' }); + }); + this.route("create", function(){ + this.route('tutorial', { path: '/tutorial' }); + this.route('sequence', { path: '/sequence/for/:tutorial_id' }); + this.route('step', { path: '/step/for/:sequence_id' }); + }); }); + }); } diff --git a/addon/models/sequence.js b/addon/models/sequence.js index f667ae3..e476886 100644 --- a/addon/models/sequence.js +++ b/addon/models/sequence.js @@ -3,5 +3,6 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), + tutorial: DS.belongsTo('tutorial',{inverse:"sequences"}), steps: DS.hasMany('step'), }); diff --git a/addon/models/step.js b/addon/models/step.js index de82a0b..83dc828 100644 --- a/addon/models/step.js +++ b/addon/models/step.js @@ -3,6 +3,7 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), + sequence: DS.belongsTo('sequence',{inverse:"steps"}), targetId: DS.attr('string'), targetType: DS.attr('string') }); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index e6b7e46..63de376 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -3,6 +3,16 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), - landscape: DS.attr('string'), - sequences: DS.hasMany('sequence'), + targetId: DS.attr('string'), + targetType: DS.attr('string'), + landscapeTimestamp: DS.attr('string'), + sequences: DS.hasMany('sequence',{inverse:"tutorial"}), + landscape: Ember.computed(function() { + console.log(this.landscapeTimestamp); + return DS.PromiseObject.create({ + promise: this.get('store').queryRecord('landscape', {timestamp: this.landscapeTimestamp}).then(landscape => { + return landscape; + }) + }); + }), }); diff --git a/addon/routes/tutorial/create/sequence.js b/addon/routes/tutorial/create/sequence.js new file mode 100644 index 0000000..6c74252 --- /dev/null +++ b/addon/routes/tutorial/create/sequence.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default Route.extend({ +}); diff --git a/addon/routes/tutorial/create/step.js b/addon/routes/tutorial/create/step.js new file mode 100644 index 0000000..6c74252 --- /dev/null +++ b/addon/routes/tutorial/create/step.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default Route.extend({ +}); diff --git a/addon/routes/tutorial/create.js b/addon/routes/tutorial/create/tutorial.js similarity index 100% rename from addon/routes/tutorial/create.js rename to addon/routes/tutorial/create/tutorial.js diff --git a/addon/routes/tutorial/edit/sequence.js b/addon/routes/tutorial/edit/sequence.js new file mode 100644 index 0000000..4b83983 --- /dev/null +++ b/addon/routes/tutorial/edit/sequence.js @@ -0,0 +1,15 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('sequence', params.sequence_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } + +}); diff --git a/addon/routes/tutorial/edit/step.js b/addon/routes/tutorial/edit/step.js new file mode 100644 index 0000000..9454b12 --- /dev/null +++ b/addon/routes/tutorial/edit/step.js @@ -0,0 +1,15 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('step', params.step_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } + +}); diff --git a/addon/routes/tutorial/edit.js b/addon/routes/tutorial/edit/tutorial.js similarity index 99% rename from addon/routes/tutorial/edit.js rename to addon/routes/tutorial/edit/tutorial.js index dd6521b..ac1db60 100644 --- a/addon/routes/tutorial/edit.js +++ b/addon/routes/tutorial/edit/tutorial.js @@ -12,4 +12,4 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { }, } -}); \ No newline at end of file +}); diff --git a/addon/routes/tutorial/edit/tutorial/target.js b/addon/routes/tutorial/edit/tutorial/target.js new file mode 100644 index 0000000..ff2898f --- /dev/null +++ b/addon/routes/tutorial/edit/tutorial/target.js @@ -0,0 +1,19 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import { getOwner } from '@ember/application'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('tutorial', params.tutorial_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + + + } +}); diff --git a/addon/routes/tutorial/list/sequence.js b/addon/routes/tutorial/list/sequence.js new file mode 100644 index 0000000..6c74252 --- /dev/null +++ b/addon/routes/tutorial/list/sequence.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default Route.extend({ +}); diff --git a/addon/routes/tutorial/list/step.js b/addon/routes/tutorial/list/step.js new file mode 100644 index 0000000..6c74252 --- /dev/null +++ b/addon/routes/tutorial/list/step.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default Route.extend({ +}); diff --git a/addon/routes/tutorial/list.js b/addon/routes/tutorial/list/tutorial.js similarity index 100% rename from addon/routes/tutorial/list.js rename to addon/routes/tutorial/list/tutorial.js diff --git a/addon/templates/components/edit-form-list.hbs b/addon/templates/components/edit-form-list.hbs new file mode 100644 index 0000000..69287f8 --- /dev/null +++ b/addon/templates/components/edit-form-list.hbs @@ -0,0 +1,39 @@ +

{{if sequence "Steps" (if tutorial "Sequences" "") }}

+
+ + + + + + {{#if tutorial}}{{/if}} + + + +{{#if sequence}} + {{#each sequence.steps as |step|}} + + + + + {{/each}} + {{#link-to "tutorial.create.step" sequence}}Add new Step{{/link-to}} + +{{else if tutorial}} + +{{#each tutorial.sequences as |sequence|}} + + + + + + +{{/each}} + {{#link-to "tutorial.create.sequence" tutorial}}Add new Sequence{{/link-to}} +{{/if}} + +
IDTitleSteps
+ {{#link-to "tutorial.edit.step" step}}{{step.id}}{{/link-to}} + {{step.title}}
+ {{#link-to "tutorial.edit.sequence" sequence}}{{sequence.id}}{{/link-to}} +{{sequence.title}}{{sequence.steps.length}}
+
diff --git a/addon/templates/components/edit-form.hbs b/addon/templates/components/edit-form.hbs index ad22181..514d919 100644 --- a/addon/templates/components/edit-form.hbs +++ b/addon/templates/components/edit-form.hbs @@ -1,5 +1,35 @@ +{{#if tutorial}} + {{#bs-form model=tutorial onSubmit=(action "saveTutorialChanges" tutorial) as |form|}} {{form.element controlType="number" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="title"}} + {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} + {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} + {{#if tutorial.landscape.isFulfilled }} + {{#if tutorial.landscape}} + {{#link-to "tutorial.edit.tutorial.target" tutorial}}Select target{{/link-to}} + {{else}} + Landscape must be associated with tutorial before target can be set. + {{/if}} + {{else}} +
+ {{ember-spinner}} +
+ {{/if}} + {{edit-form-list tutorial=tutorial}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} \ No newline at end of file + {{/bs-form}} + +{{else if sequence}} + {{#bs-form model=sequence onSubmit=(action "saveSequenceChanges" sequence) as |form|}} + {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} + {{edit-form-list sequence=sequence}} + {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}} +{{else if step}} + {{#bs-form model=step onSubmit=(action "saveStepChanges" step) as |form|}} + {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} + {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}} +{{/if}} diff --git a/addon/templates/components/tutorial-hierarchie.hbs b/addon/templates/components/tutorial-hierarchie.hbs index b205974..b7aa8e5 100644 --- a/addon/templates/components/tutorial-hierarchie.hbs +++ b/addon/templates/components/tutorial-hierarchie.hbs @@ -1,18 +1,17 @@

- {{#if tutorial.title}} + {{#if tutorial}} Tutorial "{{tutorial.title}}" {{/if}} - {{#if sequence.title}} - {{#link-to "tutorial.edit" tutorial class=tutorial.id}} + {{#if sequence}} + {{#link-to "tutorial.edit.tutorial" sequence.tutorial}} {{svg-jar "arrow-left" class="octicon align-middle"}} {{/link-to}} Sequence "{{sequence.title}}" - {{/if}} - {{#if step.title}} - {{#link-to "tutorial.edit" tutorial class=tutorial.id}} + {{#if step}} + {{#link-to "tutorial.edit.sequence" step.sequence}} {{svg-jar "arrow-left" class="octicon align-middle"}} {{/link-to}} Step "{{step.title}}" {{/if}} -

\ No newline at end of file + diff --git a/addon/templates/components/tutorial-management.hbs b/addon/templates/components/tutorial-management.hbs index 624267e..16d8fb2 100644 --- a/addon/templates/components/tutorial-management.hbs +++ b/addon/templates/components/tutorial-management.hbs @@ -254,7 +254,7 @@ {{/bs-button}} {{#if landscapeRepo.latestLandscape.systems}}
- {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape landscapeInteraction=landscapeInteraction}} + {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} {{visualization/rendering/popups/popup-coordinator popupData=additionalData.popupContent}} diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index e2147ca..edbbdeb 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -1 +1 @@ -{{outlet}} \ No newline at end of file +{{outlet}}{{#link-to "tutorial.list.tutorial"}}List Tutorials{{/link-to}} diff --git a/addon/templates/tutorial/create/sequence.hbs b/addon/templates/tutorial/create/sequence.hbs new file mode 100644 index 0000000..e2147ca --- /dev/null +++ b/addon/templates/tutorial/create/sequence.hbs @@ -0,0 +1 @@ +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/create/step.hbs b/addon/templates/tutorial/create/step.hbs new file mode 100644 index 0000000..e2147ca --- /dev/null +++ b/addon/templates/tutorial/create/step.hbs @@ -0,0 +1 @@ +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/create/tutorial.hbs b/addon/templates/tutorial/create/tutorial.hbs new file mode 100644 index 0000000..e2147ca --- /dev/null +++ b/addon/templates/tutorial/create/tutorial.hbs @@ -0,0 +1 @@ +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/create.hbs b/addon/templates/tutorial/edit/sequence.hbs similarity index 64% rename from addon/templates/tutorial/create.hbs rename to addon/templates/tutorial/edit/sequence.hbs index 23dd668..e0fca87 100644 --- a/addon/templates/tutorial/create.hbs +++ b/addon/templates/tutorial/edit/sequence.hbs @@ -1,18 +1,18 @@
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} + {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}}
- {{tutorial-hierarchie tutorial=model}} + {{tutorial-hierarchie sequence=model}}
- {{create-form tutorial=model}} + {{edit-form sequence=model}}
-
\ No newline at end of file +
diff --git a/addon/templates/tutorial/edit/step.hbs b/addon/templates/tutorial/edit/step.hbs new file mode 100644 index 0000000..ebbb71e --- /dev/null +++ b/addon/templates/tutorial/edit/step.hbs @@ -0,0 +1,18 @@ +
+
+ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +
+
+
+
+
+
+ {{tutorial-hierarchie step=model}} +
+ {{edit-form step=model}} +
+
+
+
+
+
diff --git a/addon/templates/tutorial/edit.hbs b/addon/templates/tutorial/edit/tutorial.hbs similarity index 98% rename from addon/templates/tutorial/edit.hbs rename to addon/templates/tutorial/edit/tutorial.hbs index 3724bde..ad5fa16 100644 --- a/addon/templates/tutorial/edit.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/addon/templates/tutorial/edit/tutorial/target.hbs b/addon/templates/tutorial/edit/tutorial/target.hbs new file mode 100644 index 0000000..ec557c1 --- /dev/null +++ b/addon/templates/tutorial/edit/tutorial/target.hbs @@ -0,0 +1,23 @@ +
+

Tutorial "{{model.title}}"

+ Id:{{#if landscapeInteraction.targetId}}{{landscapeInteraction.targetId}}{{else}}{{model.targetId}}{{/if}} + Type:{{#if landscapeInteraction.targetType}}{{landscapeInteraction.targetType}}{{else}}{{model.targetType}}{{/if}} + {{#if model.landscape.isFulfilled}} + {{#bs-button onClick=(action "saveTarget" model landscapeInteraction.targetType landscapeInteraction.targetId) type="secondary" outline=true title="Back to Step"}} + {{svg-jar "desktop-download" class="octicon align-middle"}} + {{/bs-button}} +
+ {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction}} +
+ + {{else}} +
+
+

Landscape loading for "{{model.landscapeTimestamp}}"!

+
+ {{ember-spinner}} +
+
+
+ {{/if}} +
diff --git a/addon/templates/tutorial/list/sequence.hbs b/addon/templates/tutorial/list/sequence.hbs new file mode 100644 index 0000000..e2147ca --- /dev/null +++ b/addon/templates/tutorial/list/sequence.hbs @@ -0,0 +1 @@ +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/list/step.hbs b/addon/templates/tutorial/list/step.hbs new file mode 100644 index 0000000..e2147ca --- /dev/null +++ b/addon/templates/tutorial/list/step.hbs @@ -0,0 +1 @@ +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list/tutorial.hbs similarity index 92% rename from addon/templates/tutorial/list.hbs rename to addon/templates/tutorial/list/tutorial.hbs index f813d39..fac4e79 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list/tutorial.hbs @@ -19,7 +19,7 @@ {{#each model.tutorials as |tutorial|}} - {{#link-to "tutorial.edit" tutorial}}{{tutorial.id}}{{/link-to}} + {{#link-to "tutorial.edit.tutorial" tutorial}}{{tutorial.id}}{{/link-to}} {{tutorial.title}} @@ -33,7 +33,7 @@ {{#dd.menu as |ddm|}} {{#ddm.item title="Edit"}} - {{#link-to "tutorial.edit" tutorial}} + {{#link-to "tutorial.edit.tutorial" tutorial}} {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit {{/link-to}} @@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/app/components/edit-form-list.js b/app/components/edit-form-list.js new file mode 100644 index 0000000..7f34f17 --- /dev/null +++ b/app/components/edit-form-list.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/edit-form-list'; diff --git a/app/controllers/tutorial/edit/tutorial/target.js b/app/controllers/tutorial/edit/tutorial/target.js new file mode 100644 index 0000000..75afd46 --- /dev/null +++ b/app/controllers/tutorial/edit/tutorial/target.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/tutorial/target'; diff --git a/app/routes/tutorial/create/sequence.js b/app/routes/tutorial/create/sequence.js new file mode 100644 index 0000000..52d9cb4 --- /dev/null +++ b/app/routes/tutorial/create/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create/sequence'; diff --git a/app/routes/tutorial/list.js b/app/routes/tutorial/create/step.js similarity index 68% rename from app/routes/tutorial/list.js rename to app/routes/tutorial/create/step.js index 3091ef1..ec8f1dd 100644 --- a/app/routes/tutorial/list.js +++ b/app/routes/tutorial/create/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list'; +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create/step'; diff --git a/app/routes/tutorial/create/tutorial.js b/app/routes/tutorial/create/tutorial.js new file mode 100644 index 0000000..a1aeb59 --- /dev/null +++ b/app/routes/tutorial/create/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create/tutorial'; diff --git a/app/routes/tutorial/edit/sequence.js b/app/routes/tutorial/edit/sequence.js new file mode 100644 index 0000000..ffe8b5e --- /dev/null +++ b/app/routes/tutorial/edit/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/sequence'; diff --git a/app/routes/tutorial/create.js b/app/routes/tutorial/edit/step.js similarity index 70% rename from app/routes/tutorial/create.js rename to app/routes/tutorial/edit/step.js index 5679403..b8312d8 100644 --- a/app/routes/tutorial/create.js +++ b/app/routes/tutorial/edit/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create'; +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/step'; diff --git a/app/routes/tutorial/edit/tutorial.js b/app/routes/tutorial/edit/tutorial.js new file mode 100644 index 0000000..91ee3ee --- /dev/null +++ b/app/routes/tutorial/edit/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/tutorial'; diff --git a/app/routes/tutorial/edit/tutorial/target.js b/app/routes/tutorial/edit/tutorial/target.js new file mode 100644 index 0000000..1fa5954 --- /dev/null +++ b/app/routes/tutorial/edit/tutorial/target.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/tutorial/target'; diff --git a/app/routes/tutorial/list/sequence.js b/app/routes/tutorial/list/sequence.js new file mode 100644 index 0000000..48d33e4 --- /dev/null +++ b/app/routes/tutorial/list/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list/sequence'; diff --git a/app/routes/tutorial/edit.js b/app/routes/tutorial/list/step.js similarity index 70% rename from app/routes/tutorial/edit.js rename to app/routes/tutorial/list/step.js index 4f1c2f4..7687173 100644 --- a/app/routes/tutorial/edit.js +++ b/app/routes/tutorial/list/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit'; +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list/step'; diff --git a/app/routes/tutorial/list/tutorial.js b/app/routes/tutorial/list/tutorial.js new file mode 100644 index 0000000..0a78b6d --- /dev/null +++ b/app/routes/tutorial/list/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list/tutorial'; diff --git a/app/templates/tutorial/create/sequence.js b/app/templates/tutorial/create/sequence.js new file mode 100644 index 0000000..87ad1bb --- /dev/null +++ b/app/templates/tutorial/create/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create/sequence'; diff --git a/app/templates/tutorial/list.js b/app/templates/tutorial/create/step.js similarity index 66% rename from app/templates/tutorial/list.js rename to app/templates/tutorial/create/step.js index 5ca3011..799ab53 100644 --- a/app/templates/tutorial/list.js +++ b/app/templates/tutorial/create/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create/step'; diff --git a/app/templates/tutorial/create/tutorial.js b/app/templates/tutorial/create/tutorial.js new file mode 100644 index 0000000..2ca382a --- /dev/null +++ b/app/templates/tutorial/create/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create/tutorial'; diff --git a/app/templates/tutorial/edit/sequence.js b/app/templates/tutorial/edit/sequence.js new file mode 100644 index 0000000..4251be7 --- /dev/null +++ b/app/templates/tutorial/edit/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/sequence'; diff --git a/app/templates/tutorial/create.js b/app/templates/tutorial/edit/step.js similarity index 68% rename from app/templates/tutorial/create.js rename to app/templates/tutorial/edit/step.js index 99c4814..26254a2 100644 --- a/app/templates/tutorial/create.js +++ b/app/templates/tutorial/edit/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/step'; diff --git a/app/templates/tutorial/edit/tutorial.js b/app/templates/tutorial/edit/tutorial.js new file mode 100644 index 0000000..58454a8 --- /dev/null +++ b/app/templates/tutorial/edit/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/tutorial'; diff --git a/app/templates/tutorial/edit/tutorial/target.js b/app/templates/tutorial/edit/tutorial/target.js new file mode 100644 index 0000000..3ab7376 --- /dev/null +++ b/app/templates/tutorial/edit/tutorial/target.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/tutorial/target'; diff --git a/app/templates/tutorial/list/sequence.js b/app/templates/tutorial/list/sequence.js new file mode 100644 index 0000000..2ceef09 --- /dev/null +++ b/app/templates/tutorial/list/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list/sequence'; diff --git a/app/templates/tutorial/edit.js b/app/templates/tutorial/list/step.js similarity index 68% rename from app/templates/tutorial/edit.js rename to app/templates/tutorial/list/step.js index 5c1e557..022d29c 100644 --- a/app/templates/tutorial/edit.js +++ b/app/templates/tutorial/list/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list/step'; diff --git a/app/templates/tutorial/list/tutorial.js b/app/templates/tutorial/list/tutorial.js new file mode 100644 index 0000000..9e92d5b --- /dev/null +++ b/app/templates/tutorial/list/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list/tutorial'; diff --git a/package-lock.json b/package-lock.json index 99f3701..1462063 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6610,7 +6610,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6631,12 +6632,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6651,17 +6654,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6778,7 +6784,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6790,6 +6797,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6804,6 +6812,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6811,12 +6820,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6835,6 +6846,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6915,7 +6927,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6927,6 +6940,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7012,7 +7026,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7048,6 +7063,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7067,6 +7083,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7110,12 +7127,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/tests/integration/components/edit-for-list-test.js b/tests/integration/components/edit-for-list-test.js new file mode 100644 index 0000000..e89fc19 --- /dev/null +++ b/tests/integration/components/edit-for-list-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | edit-for-list', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{edit-for-list}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#edit-for-list}} + template block text + {{/edit-for-list}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/controllers/tutorial/edit/tutorial/target-test.js b/tests/unit/controllers/tutorial/edit/tutorial/target-test.js new file mode 100644 index 0000000..117b970 --- /dev/null +++ b/tests/unit/controllers/tutorial/edit/tutorial/target-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/edit/tutorial/target', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/edit/tutorial/target'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/routes/tutorial/create/sequence-test.js b/tests/unit/routes/tutorial/create/sequence-test.js new file mode 100644 index 0000000..5b1f25c --- /dev/null +++ b/tests/unit/routes/tutorial/create/sequence-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/create/sequence', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/create/sequence'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/list-test.js b/tests/unit/routes/tutorial/create/step-test.js similarity index 57% rename from tests/unit/routes/tutorial/list-test.js rename to tests/unit/routes/tutorial/create/step-test.js index 3873296..a2aff6c 100644 --- a/tests/unit/routes/tutorial/list-test.js +++ b/tests/unit/routes/tutorial/create/step-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | tutorial/list', function(hooks) { +module('Unit | Route | tutorial/create/step', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:tutorial/list'); + let route = this.owner.lookup('route:tutorial/create/step'); assert.ok(route); }); }); diff --git a/tests/unit/routes/tutorial/create/tutorial-test.js b/tests/unit/routes/tutorial/create/tutorial-test.js new file mode 100644 index 0000000..d49637d --- /dev/null +++ b/tests/unit/routes/tutorial/create/tutorial-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/create/tutorial', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/create/tutorial'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/edit/sequence-test.js b/tests/unit/routes/tutorial/edit/sequence-test.js new file mode 100644 index 0000000..5fa9624 --- /dev/null +++ b/tests/unit/routes/tutorial/edit/sequence-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/edit/sequence', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/edit/sequence'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/create-test.js b/tests/unit/routes/tutorial/edit/step-test.js similarity index 57% rename from tests/unit/routes/tutorial/create-test.js rename to tests/unit/routes/tutorial/edit/step-test.js index 9e846bf..0228b01 100644 --- a/tests/unit/routes/tutorial/create-test.js +++ b/tests/unit/routes/tutorial/edit/step-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | tutorial/create', function(hooks) { +module('Unit | Route | tutorial/edit/step', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:tutorial/create'); + let route = this.owner.lookup('route:tutorial/edit/step'); assert.ok(route); }); }); diff --git a/tests/unit/routes/tutorial/edit/tutorial-test.js b/tests/unit/routes/tutorial/edit/tutorial-test.js new file mode 100644 index 0000000..c1231cb --- /dev/null +++ b/tests/unit/routes/tutorial/edit/tutorial-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/edit/tutorial', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/edit/tutorial'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/edit/tutorial/target-test.js b/tests/unit/routes/tutorial/edit/tutorial/target-test.js new file mode 100644 index 0000000..be47d81 --- /dev/null +++ b/tests/unit/routes/tutorial/edit/tutorial/target-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/edit/tutorial/target', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/edit/tutorial/target'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/list/sequence-test.js b/tests/unit/routes/tutorial/list/sequence-test.js new file mode 100644 index 0000000..cbfc509 --- /dev/null +++ b/tests/unit/routes/tutorial/list/sequence-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/list/sequence', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/list/sequence'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/edit-test.js b/tests/unit/routes/tutorial/list/step-test.js similarity index 57% rename from tests/unit/routes/tutorial/edit-test.js rename to tests/unit/routes/tutorial/list/step-test.js index 7d4cdd6..c4201f9 100644 --- a/tests/unit/routes/tutorial/edit-test.js +++ b/tests/unit/routes/tutorial/list/step-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | tutorial/edit', function(hooks) { +module('Unit | Route | tutorial/list/step', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:tutorial/edit'); + let route = this.owner.lookup('route:tutorial/list/step'); assert.ok(route); }); }); diff --git a/tests/unit/routes/tutorial/list/tutorial-test.js b/tests/unit/routes/tutorial/list/tutorial-test.js new file mode 100644 index 0000000..ae9e1a6 --- /dev/null +++ b/tests/unit/routes/tutorial/list/tutorial-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/list/tutorial', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/list/tutorial'); + assert.ok(route); + }); +}); From 2ed59267bd83261eaa5cc830349e8522f14571ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Wed, 27 Mar 2019 17:13:58 +0100 Subject: [PATCH 06/30] tutorial routes --- addon/components/create-form.js | 64 ++++++++++++++++- addon/components/edit-form-list.js | 6 -- addon/components/edit-form.js | 71 ------------------- addon/controllers/tutorial/edit/sequence.js | 25 +++++++ addon/controllers/tutorial/edit/step.js | 25 +++++++ .../controllers/tutorial/edit/step/target.js | 33 +++++++++ addon/controllers/tutorial/edit/tutorial.js | 28 ++++++++ .../tutorial/edit/tutorial/target.js | 9 +-- addon/controllers/tutorial/run.js | 33 +++++++++ .../explorviz-frontend-extension-tutorial.js | 24 ++++--- addon/models/sequence.js | 2 +- addon/models/tutorial.js | 1 - addon/routes/tutorial.js | 13 ++-- addon/routes/tutorial/create/sequence.js | 5 +- addon/routes/tutorial/create/step.js | 5 +- addon/routes/tutorial/edit/step/target.js | 19 +++++ addon/routes/tutorial/list/sequence.js | 11 ++- addon/routes/tutorial/list/step.js | 11 ++- addon/routes/tutorial/run.js | 15 ++++ addon/templates/components/create-form.hbs | 32 ++++----- addon/templates/components/edit-form-list.hbs | 39 ---------- addon/templates/components/edit-form.hbs | 35 --------- addon/templates/tutorial.hbs | 2 +- addon/templates/tutorial/create/sequence.hbs | 20 +++++- addon/templates/tutorial/create/step.hbs | 20 +++++- addon/templates/tutorial/create/tutorial.hbs | 18 ++++- addon/templates/tutorial/edit/sequence.hbs | 29 +++++++- addon/templates/tutorial/edit/step.hbs | 26 ++++++- addon/templates/tutorial/edit/step/target.hbs | 23 ++++++ addon/templates/tutorial/edit/tutorial.hbs | 34 ++++++++- addon/templates/tutorial/list/sequence.hbs | 56 ++++++++++++++- addon/templates/tutorial/list/step.hbs | 53 +++++++++++++- addon/templates/tutorial/run.hbs | 17 +++++ app/controllers/tutorial/edit/sequence.js | 1 + .../tutorial/edit/step.js} | 2 +- app/controllers/tutorial/edit/step/target.js | 1 + app/controllers/tutorial/edit/tutorial.js | 1 + .../tutorial/run.js} | 2 +- app/routes/tutorial/edit/step/target.js | 1 + app/routes/tutorial/run.js | 1 + app/templates/tutorial/edit/step/target.js | 1 + app/templates/tutorial/run.js | 1 + .../integration/components/edit-form-test.js | 26 ------- .../tutorial/edit/sequence-test.js | 12 ++++ .../controllers/tutorial/edit/step-test.js | 12 ++++ .../tutorial/edit/step/target-test.js | 12 ++++ .../tutorial/edit/tutorial-test.js | 12 ++++ tests/unit/controllers/tutorial/run-test.js | 12 ++++ .../routes/tutorial/edit/step/target-test.js | 11 +++ tests/unit/routes/tutorial/run-test.js | 11 +++ 50 files changed, 679 insertions(+), 244 deletions(-) delete mode 100644 addon/components/edit-form-list.js delete mode 100644 addon/components/edit-form.js create mode 100644 addon/controllers/tutorial/edit/sequence.js create mode 100644 addon/controllers/tutorial/edit/step.js create mode 100644 addon/controllers/tutorial/edit/step/target.js create mode 100644 addon/controllers/tutorial/edit/tutorial.js create mode 100644 addon/controllers/tutorial/run.js create mode 100644 addon/routes/tutorial/edit/step/target.js create mode 100644 addon/routes/tutorial/run.js delete mode 100644 addon/templates/components/edit-form-list.hbs delete mode 100644 addon/templates/components/edit-form.hbs create mode 100644 addon/templates/tutorial/edit/step/target.hbs create mode 100644 addon/templates/tutorial/run.hbs create mode 100644 app/controllers/tutorial/edit/sequence.js rename app/{components/edit-form-list.js => controllers/tutorial/edit/step.js} (66%) create mode 100644 app/controllers/tutorial/edit/step/target.js create mode 100644 app/controllers/tutorial/edit/tutorial.js rename app/{components/edit-form.js => controllers/tutorial/run.js} (71%) create mode 100644 app/routes/tutorial/edit/step/target.js create mode 100644 app/routes/tutorial/run.js create mode 100644 app/templates/tutorial/edit/step/target.js create mode 100644 app/templates/tutorial/run.js delete mode 100644 tests/integration/components/edit-form-test.js create mode 100644 tests/unit/controllers/tutorial/edit/sequence-test.js create mode 100644 tests/unit/controllers/tutorial/edit/step-test.js create mode 100644 tests/unit/controllers/tutorial/edit/step/target-test.js create mode 100644 tests/unit/controllers/tutorial/edit/tutorial-test.js create mode 100644 tests/unit/controllers/tutorial/run-test.js create mode 100644 tests/unit/routes/tutorial/edit/step/target-test.js create mode 100644 tests/unit/routes/tutorial/run-test.js diff --git a/addon/components/create-form.js b/addon/components/create-form.js index 4ed1930..414a711 100644 --- a/addon/components/create-form.js +++ b/addon/components/create-form.js @@ -1,6 +1,64 @@ import Component from '@ember/component'; -import layout from '../templates/components/create-form'; +import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Component.extend(AlertifyHandler,{ + sequence:null, + store:service(), + showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); + }, + actions:{ + createStep(sequence){ + const stepData = this.getProperties('title'); + // check for valid input + if(!stepData.title || stepData.title.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + const stepRecord = this.get('store').createRecord('step', { + title: stepData.title, + sequence: sequence + }); + sequence.get("steps").pushObject(stepRecord); + sequence.save().then(() => { + const message = "Step " + stepRecord.title + " was created and added to Sequence " + sequence.title + "."; + this.showAlertifyMessage(message); + this.setProperties({ + title: "", + }); + }, (reason) => { + this.showReasonErrorAlert(reason); + stepRecord.deleteRecord(); + }); + }, + createSequence(tutorial){ + const stepData = this.getProperties('title'); + // check for valid input + if(!stepData.title || stepData.title.length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + const sequenceRecord = this.get('store').createRecord('sequence', { + title: stepData.title, + tutorial: tutorial + }); + tutorial.get("sequences").pushObject(sequenceRecord); + tutorial.save().then(() => { + const message = "Sequence " + sequenceRecord.title + " was created and added to Tutorial " + tutorial.title + "."; + this.showAlertifyMessage(message); + this.setProperties({ + title: "", + }); + }, (reason) => { + this.showReasonErrorAlert(reason); + stepRecord.deleteRecord(); + }); + }, + createTutorial(){ + + } + } -export default Component.extend({ - layout }); diff --git a/addon/components/edit-form-list.js b/addon/components/edit-form-list.js deleted file mode 100644 index 8f14417..0000000 --- a/addon/components/edit-form-list.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/edit-form-list'; - -export default Component.extend({ - layout -}); diff --git a/addon/components/edit-form.js b/addon/components/edit-form.js deleted file mode 100644 index 7493fc0..0000000 --- a/addon/components/edit-form.js +++ /dev/null @@ -1,71 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/edit-form'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - -export default Component.extend(AlertifyHandler,{ - layout, - actions:{ - saveTutorialChanges(tutorial) { - if(tutorial) { - // check for valid input - if(!tutorial.get('title') || tutorial.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - tutorial.save() - .then(()=> { - const message = `Tutorial updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Tutorial not found.`); - } - }, - saveSequenceChanges(sequence) { - if(sequence) { - // check for valid input - if(!sequence.get('title') || sequence.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - sequence.save() - .then(()=> { - const message = `Sequence updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Sequence not found.`); - } - }, - - saveStepChanges(step) { - if(step) { - // check for valid input - if(!step.get('title') || step.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - step.save() - .then(()=> { - const message = `Step updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Step not found.`); - } - }, - }, - showReasonErrorAlert(reason) { - const {title, detail} = reason.errors[0]; - this.showAlertifyMessage(`${title}: ${detail}`); - }, -}); diff --git a/addon/controllers/tutorial/edit/sequence.js b/addon/controllers/tutorial/edit/sequence.js new file mode 100644 index 0000000..04925c6 --- /dev/null +++ b/addon/controllers/tutorial/edit/sequence.js @@ -0,0 +1,25 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + actions:{ + saveSequenceChanges(sequence) { + if(sequence) { + // check for valid input + if(!sequence.get('title') || sequence.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + sequence.save() + .then(()=> { + const message = `Sequence updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Sequence not found.`); + } + }, + } +}); diff --git a/addon/controllers/tutorial/edit/step.js b/addon/controllers/tutorial/edit/step.js new file mode 100644 index 0000000..9679429 --- /dev/null +++ b/addon/controllers/tutorial/edit/step.js @@ -0,0 +1,25 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + actions:{ + saveStepChanges(step) { + if(step) { + // check for valid input + if(!step.get('title') || step.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + step.save() + .then(()=> { + const message = `Step updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Step not found.`); + } + }, +} +}); diff --git a/addon/controllers/tutorial/edit/step/target.js b/addon/controllers/tutorial/edit/step/target.js new file mode 100644 index 0000000..6a62752 --- /dev/null +++ b/addon/controllers/tutorial/edit/step/target.js @@ -0,0 +1,33 @@ +import Controller from '@ember/controller'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import { inject as service } from "@ember/service"; +import { getOwner } from '@ember/application'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + + +export default Controller.extend(AlertifyHandler,{ + tagName: '', + store: service(), + targetType: null, + targetId:null, + init(){ + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + this.set('landscapeInteraction', landscapeInteraction); + this.get('landscapeInteraction').on('singleClick', function(emberModel) { + if(emberModel!=undefined){ + this.set("targetType",emberModel.constructor.modelName); + this.set("targetId",emberModel.get("id")); + // console.log("Set Target:"+ Ember.get("targetType")+" "+targetId); + } + }); + }, + actions:{ + saveTarget(model,targetType,targetId){ + this.get("model").set("targetType",targetType); + this.get("model").set("targetId",targetId); + this.get("model").save(); + this.transitionToRoute("tutorial.edit.step", model); + } + } +}); diff --git a/addon/controllers/tutorial/edit/tutorial.js b/addon/controllers/tutorial/edit/tutorial.js new file mode 100644 index 0000000..9e4b44c --- /dev/null +++ b/addon/controllers/tutorial/edit/tutorial.js @@ -0,0 +1,28 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + actions:{ + saveTutorialChanges(tutorial) { + if(tutorial) { + // check for valid input + if(!tutorial.get('title') || tutorial.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + tutorial.save() + .then(()=> { + const message = `Tutorial updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Tutorial not found.`); + } + }, +}, +showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); +}, +}); diff --git a/addon/controllers/tutorial/edit/tutorial/target.js b/addon/controllers/tutorial/edit/tutorial/target.js index 967d397..8e43533 100644 --- a/addon/controllers/tutorial/edit/tutorial/target.js +++ b/addon/controllers/tutorial/edit/tutorial/target.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction'; - import { inject as service } from "@ember/service"; +import { inject as service } from "@ember/service"; import { getOwner } from '@ember/application'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; @@ -9,13 +9,8 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Controller.extend(AlertifyHandler,{ tagName: '', store: service(), - renderingService: service("rendering-service"), targetType: null, targetId:null, - updateModel() { - // update your entity and then call - this.get('renderingService').redrawScene(); - }, init(){ const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); this.set('landscapeInteraction', landscapeInteraction); @@ -29,8 +24,6 @@ export default Controller.extend(AlertifyHandler,{ }, actions:{ saveTarget(model,targetType,targetId){ - console.log(targetType); - console.log(targetId); this.get("model").set("targetType",targetType); this.get("model").set("targetId",targetId); this.get("model").save(); diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js new file mode 100644 index 0000000..c513bf3 --- /dev/null +++ b/addon/controllers/tutorial/run.js @@ -0,0 +1,33 @@ +import Controller from '@ember/controller'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import { inject as service } from "@ember/service"; +import { getOwner } from '@ember/application'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + + +export default Controller.extend(AlertifyHandler,{ + tagName: '', + store: service(), + currentTutorial:null, + currentSequence: null, + currentStep: null, + init(){ + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + this.set('landscapeInteraction', landscapeInteraction); + this.get('landscapeInteraction').on('singleClick', function(emberModel) { + if(emberModel!=undefined){ + this.set("targetType",emberModel.constructor.modelName); + this.set("targetId",emberModel.get("id")); + if(this.get('targetType')===this.get('step').targetType && this.get('targetId')===this.get('step').targetId){ + + } + } + console.log(this); + }); + }, + actions:{ + + + } +}); diff --git a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js index a482682..27e54a0 100644 --- a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js +++ b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js @@ -16,18 +16,20 @@ export function initialize(appInstance) { this.route('step'); }); this.route("edit", function(){ - this.route('tutorial', { path: '/tutorial/:tutorial_id/' }); - this.route('tutorial.target', { path: '/tutorial/:tutorial_id/target' }); - this.route('sequence', { path: '/sequence/:sequence_id/' }); - this.route('step', { path: '/step/:step_id/' }); - }); - this.route("create", function(){ - this.route('tutorial', { path: '/tutorial' }); - this.route('sequence', { path: '/sequence/for/:tutorial_id' }); - this.route('step', { path: '/step/for/:sequence_id' }); - }); - }); + this.route('tutorial', { path: '/tutorial/:tutorial_id' }); + this.route('tutorial.target', { path: '/tutorial/:tutorial_id/target' }); + this.route('sequence', { path: '/sequence/:sequence_id' }); + this.route('step', { path: '/step/:step_id' }); + this.route('step.target', { path: '/step/:step_id/target' }); + }); + this.route("create", function(){ + this.route('tutorial', { path: '/tutorial' }); + this.route('sequence', { path: '/sequence/for/:tutorial_id' }); + this.route('step', { path: '/step/for/:sequence_id' }); + }); + this.route('run', { path: '/run/tutorial/:tutorial_id' }); + }); }); } diff --git a/addon/models/sequence.js b/addon/models/sequence.js index e476886..2ac898e 100644 --- a/addon/models/sequence.js +++ b/addon/models/sequence.js @@ -4,5 +4,5 @@ export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), tutorial: DS.belongsTo('tutorial',{inverse:"sequences"}), - steps: DS.hasMany('step'), + steps: DS.hasMany('step',{inverse:"sequence"}), }); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index 63de376..5cb7397 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -8,7 +8,6 @@ export default DS.Model.extend({ landscapeTimestamp: DS.attr('string'), sequences: DS.hasMany('sequence',{inverse:"tutorial"}), landscape: Ember.computed(function() { - console.log(this.landscapeTimestamp); return DS.PromiseObject.create({ promise: this.get('store').queryRecord('landscape', {timestamp: this.landscapeTimestamp}).then(landscape => { return landscape; diff --git a/addon/routes/tutorial.js b/addon/routes/tutorial.js index 0b3b74e..f449c3c 100644 --- a/addon/routes/tutorial.js +++ b/addon/routes/tutorial.js @@ -2,11 +2,12 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; export default BaseRoute.extend(AuthenticatedRouteMixin, { - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); + beforeModel(/* transition */) { + //this.transitionTo('tutorial.list.tutorial'); // Implicitly aborts the on-going transition. }, - - }, + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/routes/tutorial/create/sequence.js b/addon/routes/tutorial/create/sequence.js index 6c74252..87e807f 100644 --- a/addon/routes/tutorial/create/sequence.js +++ b/addon/routes/tutorial/create/sequence.js @@ -1,4 +1,7 @@ import Route from '@ember/routing/route'; +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { -export default Route.extend({ }); diff --git a/addon/routes/tutorial/create/step.js b/addon/routes/tutorial/create/step.js index 6c74252..87e807f 100644 --- a/addon/routes/tutorial/create/step.js +++ b/addon/routes/tutorial/create/step.js @@ -1,4 +1,7 @@ import Route from '@ember/routing/route'; +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { -export default Route.extend({ }); diff --git a/addon/routes/tutorial/edit/step/target.js b/addon/routes/tutorial/edit/step/target.js new file mode 100644 index 0000000..025e1c1 --- /dev/null +++ b/addon/routes/tutorial/edit/step/target.js @@ -0,0 +1,19 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import { getOwner } from '@ember/application'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('step', params.step_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + + + } +}); diff --git a/addon/routes/tutorial/list/sequence.js b/addon/routes/tutorial/list/sequence.js index 6c74252..6c391b0 100644 --- a/addon/routes/tutorial/list/sequence.js +++ b/addon/routes/tutorial/list/sequence.js @@ -1,4 +1,11 @@ -import Route from '@ember/routing/route'; +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import RSVP from 'rsvp'; -export default Route.extend({ +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model() { + return RSVP.hash({ + sequences: this.get('store').findAll('sequence') + }); + } }); diff --git a/addon/routes/tutorial/list/step.js b/addon/routes/tutorial/list/step.js index 6c74252..6cfc9d1 100644 --- a/addon/routes/tutorial/list/step.js +++ b/addon/routes/tutorial/list/step.js @@ -1,4 +1,11 @@ -import Route from '@ember/routing/route'; +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import RSVP from 'rsvp'; -export default Route.extend({ +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model() { + return RSVP.hash({ + steps: this.get('store').findAll('step') + }); + } }); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js new file mode 100644 index 0000000..ac1db60 --- /dev/null +++ b/addon/routes/tutorial/run.js @@ -0,0 +1,15 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('tutorial', params.tutorial_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } + +}); diff --git a/addon/templates/components/create-form.hbs b/addon/templates/components/create-form.hbs index 676ee68..7dc8067 100644 --- a/addon/templates/components/create-form.hbs +++ b/addon/templates/components/create-form.hbs @@ -1,21 +1,17 @@ -{{#if step.title}} - {{#bs-form model=this onSubmit=(action "saveStepChanges") as |form|}} - {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} - {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="targetId" disabled=true}} - {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="targetType" disabled=true}} - {{bs-button defaultText="Create" type="primary" buttonType="submit"}} - {{/bs-form}} -{{else if sequence.title}} - {{#bs-form model=this onSubmit=(action "saveSequenceChanges") as |form|}} - {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} - {{/bs-form}} -{{else if tutorial.title}} - {{#bs-form model=this onSubmit=(action "saveTutorialChanges") as |form|}} +{{#if sequence}} + {{#bs-form model=this onSubmit=(action "createStep" sequence) as |form|}} + {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} + {{bs-button defaultText="Create" type="primary" buttonType="submit"}} +{{/bs-form}} +{{else if tutorial}} + {{#bs-form model=this onSubmit=(action "createSequence" tutorial) as |form|}} + {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} + {{/bs-form}} +{{else}} + {{#bs-form model=this onSubmit=(action "createTutorial") as |form|}} {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} {{form.element controlType="text" label="Landscape" placeholder="Landscape" property="tutorial_landscape_change"}} - {{/bs-form}} -{{else}} -No Tutorial loaded. -{{/if}} \ No newline at end of file + {{/bs-form}} +{{/if}} diff --git a/addon/templates/components/edit-form-list.hbs b/addon/templates/components/edit-form-list.hbs deleted file mode 100644 index 69287f8..0000000 --- a/addon/templates/components/edit-form-list.hbs +++ /dev/null @@ -1,39 +0,0 @@ -

{{if sequence "Steps" (if tutorial "Sequences" "") }}

-
- - - - - - {{#if tutorial}}{{/if}} - - - -{{#if sequence}} - {{#each sequence.steps as |step|}} - - - - - {{/each}} - {{#link-to "tutorial.create.step" sequence}}Add new Step{{/link-to}} - -{{else if tutorial}} - -{{#each tutorial.sequences as |sequence|}} - - - - - - -{{/each}} - {{#link-to "tutorial.create.sequence" tutorial}}Add new Sequence{{/link-to}} -{{/if}} - -
IDTitleSteps
- {{#link-to "tutorial.edit.step" step}}{{step.id}}{{/link-to}} - {{step.title}}
- {{#link-to "tutorial.edit.sequence" sequence}}{{sequence.id}}{{/link-to}} -{{sequence.title}}{{sequence.steps.length}}
-
diff --git a/addon/templates/components/edit-form.hbs b/addon/templates/components/edit-form.hbs deleted file mode 100644 index 514d919..0000000 --- a/addon/templates/components/edit-form.hbs +++ /dev/null @@ -1,35 +0,0 @@ -{{#if tutorial}} - - {{#bs-form model=tutorial onSubmit=(action "saveTutorialChanges" tutorial) as |form|}} - {{form.element controlType="number" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} - {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} - {{#if tutorial.landscape.isFulfilled }} - {{#if tutorial.landscape}} - {{#link-to "tutorial.edit.tutorial.target" tutorial}}Select target{{/link-to}} - {{else}} - Landscape must be associated with tutorial before target can be set. - {{/if}} - {{else}} -
- {{ember-spinner}} -
- {{/if}} - {{edit-form-list tutorial=tutorial}} - {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} - -{{else if sequence}} - {{#bs-form model=sequence onSubmit=(action "saveSequenceChanges" sequence) as |form|}} - {{form.element controlType="number" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} - {{edit-form-list sequence=sequence}} - {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} -{{else if step}} - {{#bs-form model=step onSubmit=(action "saveStepChanges" step) as |form|}} - {{form.element controlType="number" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} - {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} -{{/if}} diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index edbbdeb..c24cd68 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -1 +1 @@ -{{outlet}}{{#link-to "tutorial.list.tutorial"}}List Tutorials{{/link-to}} +{{outlet}} diff --git a/addon/templates/tutorial/create/sequence.hbs b/addon/templates/tutorial/create/sequence.hbs index e2147ca..617f0e4 100644 --- a/addon/templates/tutorial/create/sequence.hbs +++ b/addon/templates/tutorial/create/sequence.hbs @@ -1 +1,19 @@ -{{outlet}} \ No newline at end of file +
+
+ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +
+
+
+
+
+
+ Create Sequence for: + {{tutorial-hierarchie tutorial=model}} +
+ {{create-form tutorial=model}} +
+
+
+
+
+
diff --git a/addon/templates/tutorial/create/step.hbs b/addon/templates/tutorial/create/step.hbs index e2147ca..74b49b7 100644 --- a/addon/templates/tutorial/create/step.hbs +++ b/addon/templates/tutorial/create/step.hbs @@ -1 +1,19 @@ -{{outlet}} \ No newline at end of file +
+
+ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +
+
+
+
+
+
+ Create Step for: + {{tutorial-hierarchie sequence=model}} +
+ {{create-form sequence=model}} +
+
+
+
+
+
diff --git a/addon/templates/tutorial/create/tutorial.hbs b/addon/templates/tutorial/create/tutorial.hbs index e2147ca..caf34b1 100644 --- a/addon/templates/tutorial/create/tutorial.hbs +++ b/addon/templates/tutorial/create/tutorial.hbs @@ -1 +1,17 @@ -{{outlet}} \ No newline at end of file +
+
+ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +
+
+
+
+
+
+ Create Tutorial: + {{create-form}} +
+
+
+
+
+
diff --git a/addon/templates/tutorial/edit/sequence.hbs b/addon/templates/tutorial/edit/sequence.hbs index e0fca87..847c6f8 100644 --- a/addon/templates/tutorial/edit/sequence.hbs +++ b/addon/templates/tutorial/edit/sequence.hbs @@ -9,7 +9,34 @@
{{tutorial-hierarchie sequence=model}}
- {{edit-form sequence=model}} + {{#bs-form model=model onSubmit=(action "saveSequenceChanges" sequence) as |form|}} + {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} +

Steps

+
+ + + + + + {{#if tutorial}}{{/if}} + + + + {{#each model.steps as |step|}} + + + + + {{/each}} + +
IDTitleSteps
+ {{#link-to "tutorial.edit.step" step}}{{step.id}}{{/link-to}} + {{step.title}}
+
+ {{#link-to "tutorial.create.step" sequence}}Add new Step{{/link-to}} + {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}}
diff --git a/addon/templates/tutorial/edit/step.hbs b/addon/templates/tutorial/edit/step.hbs index ebbb71e..e1d74c2 100644 --- a/addon/templates/tutorial/edit/step.hbs +++ b/addon/templates/tutorial/edit/step.hbs @@ -1,6 +1,6 @@
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} + {{#link-to "tutorial.list.tutorial"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}}
@@ -9,7 +9,29 @@
{{tutorial-hierarchie step=model}}
- {{edit-form step=model}} + {{#bs-form model=model onSubmit=(action "saveStepChanges" step) as |form|}} + {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} + {{#if model.sequence.tutorial.landscape.isFulfilled}} + {{#if model.sequence.tutorial.landscape}} + {{#link-to "tutorial.edit.step.target" model}}Select target{{/link-to}} + {{#if model.targetId}} {{#if model.targetType}} + Target: {{model.targetId}} {{model.targetType}} + {{/if}}{{/if}} + {{else}} + Landscape must be associated with tutorial before target can be set. + {{/if}} + {{else}} + {{#if model.sequence.tutorial.landscapeTimestamp}} +
+ {{ember-spinner}} +
+ {{else}} + Landscape must be associated with tutorial before target can be set. + {{/if}} + {{/if}} + {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}}
diff --git a/addon/templates/tutorial/edit/step/target.hbs b/addon/templates/tutorial/edit/step/target.hbs new file mode 100644 index 0000000..fedd970 --- /dev/null +++ b/addon/templates/tutorial/edit/step/target.hbs @@ -0,0 +1,23 @@ +
+

Step "{{model.title}}"

+ Id:{{#if landscapeInteraction.targetId}}{{landscapeInteraction.targetId}}{{else}}{{model.targetId}}{{/if}} + Type:{{#if landscapeInteraction.targetType}}{{landscapeInteraction.targetType}}{{else}}{{model.targetType}}{{/if}} + {{#if model.sequence.tutorial.landscape.isFulfilled}} + {{#bs-button onClick=(action "saveTarget" model landscapeInteraction.targetType landscapeInteraction.targetId) type="secondary" outline=true title="Back to Step"}} + {{svg-jar "desktop-download" class="octicon align-middle"}} + {{/bs-button}} +
+ {{visualization/rendering/landscape-rendering latestLandscape=model.sequence.tutorial.landscape interaction=landscapeInteraction}} +
+ + {{else}} +
+
+

Landscape loading for "{{model.sequence.tutorial.landscapeTimestamp}}"!

+
+ {{ember-spinner}} +
+
+
+ {{/if}} +
diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs index ad5fa16..712c980 100644 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -1,6 +1,6 @@
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} + {{#link-to "tutorial.list.tutorial"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}}
@@ -9,7 +9,37 @@
{{tutorial-hierarchie tutorial=model}}
- {{edit-form tutorial=model}} + {{#bs-form model=model onSubmit=(action "saveTutorialChanges" tutorial) as |form|}} + {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} + {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} +

Sequences

+
+ + + + + + + + + + {{#each model.sequences as |sequence|}} + + + + + + {{/each}} + {{#link-to "tutorial.create.sequence" model}}Add new Sequence{{/link-to}} + +
IDTitleSteps
+ {{#link-to "tutorial.edit.sequence" sequence}}{{sequence.id}}{{/link-to}} + {{sequence.title}}{{sequence.steps.length}}
+
+ {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}} + {{#link-to "tutorial.run" model}}Run tutorial{{/link-to}}
diff --git a/addon/templates/tutorial/list/sequence.hbs b/addon/templates/tutorial/list/sequence.hbs index e2147ca..3f340ae 100644 --- a/addon/templates/tutorial/list/sequence.hbs +++ b/addon/templates/tutorial/list/sequence.hbs @@ -1 +1,55 @@ -{{outlet}} \ No newline at end of file +
+

Tutorials

+
+
+ {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} +
+
+
+ + + + + + + + + + + {{#each model.sequences as |sequence|}} + + + + + + + {{/each}} + +
IDTitlesteps
+ {{#link-to "tutorial.edit.sequence" sequence}}{{sequence.id}}{{/link-to}} + {{sequence.title}} + {{sequence.steps.length}} + + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.edit.sequence" sequence}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
+
+
diff --git a/addon/templates/tutorial/list/step.hbs b/addon/templates/tutorial/list/step.hbs index e2147ca..cf40f05 100644 --- a/addon/templates/tutorial/list/step.hbs +++ b/addon/templates/tutorial/list/step.hbs @@ -1 +1,52 @@ -{{outlet}} \ No newline at end of file +
+

Tutorials

+
+
+ {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} +
+
+
+ + + + + + + + + + {{#each model.steps as |step|}} + + + + + + + {{/each}} + +
IDTitle
+ {{#link-to "tutorial.edit.step" step}}{{step.id}}{{/link-to}} + {{step.title}} + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.edit.step" step}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
+
+
diff --git a/addon/templates/tutorial/run.hbs b/addon/templates/tutorial/run.hbs new file mode 100644 index 0000000..1101b34 --- /dev/null +++ b/addon/templates/tutorial/run.hbs @@ -0,0 +1,17 @@ +{{#if model.landscape.isFulfilled}} + {{landscapeInteraction.currentStep.title}} +
+ {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction tutorial=model}} +
+{{else if model.landscapeTimestamp}} +
+
+

Landscape loading for "{{model.landscapeTimestamp}}"!

+
+ {{ember-spinner}} +
+
+
+{{else}} + {{#link-to "tutorial.edit.tutorial" model}} Tutorial needs to have a set Landscape to be executable. {{/link-to}} +{{/if}} diff --git a/app/controllers/tutorial/edit/sequence.js b/app/controllers/tutorial/edit/sequence.js new file mode 100644 index 0000000..1dab40f --- /dev/null +++ b/app/controllers/tutorial/edit/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/sequence'; diff --git a/app/components/edit-form-list.js b/app/controllers/tutorial/edit/step.js similarity index 66% rename from app/components/edit-form-list.js rename to app/controllers/tutorial/edit/step.js index 7f34f17..b987961 100644 --- a/app/components/edit-form-list.js +++ b/app/controllers/tutorial/edit/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/edit-form-list'; +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/step'; diff --git a/app/controllers/tutorial/edit/step/target.js b/app/controllers/tutorial/edit/step/target.js new file mode 100644 index 0000000..6889e5b --- /dev/null +++ b/app/controllers/tutorial/edit/step/target.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/step/target'; diff --git a/app/controllers/tutorial/edit/tutorial.js b/app/controllers/tutorial/edit/tutorial.js new file mode 100644 index 0000000..14f0c16 --- /dev/null +++ b/app/controllers/tutorial/edit/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/tutorial'; diff --git a/app/components/edit-form.js b/app/controllers/tutorial/run.js similarity index 71% rename from app/components/edit-form.js rename to app/controllers/tutorial/run.js index 92a6769..9a66c98 100644 --- a/app/components/edit-form.js +++ b/app/controllers/tutorial/run.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/edit-form'; \ No newline at end of file +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/run'; diff --git a/app/routes/tutorial/edit/step/target.js b/app/routes/tutorial/edit/step/target.js new file mode 100644 index 0000000..f76fd27 --- /dev/null +++ b/app/routes/tutorial/edit/step/target.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/step/target'; diff --git a/app/routes/tutorial/run.js b/app/routes/tutorial/run.js new file mode 100644 index 0000000..567e49e --- /dev/null +++ b/app/routes/tutorial/run.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/run'; diff --git a/app/templates/tutorial/edit/step/target.js b/app/templates/tutorial/edit/step/target.js new file mode 100644 index 0000000..ffe1b50 --- /dev/null +++ b/app/templates/tutorial/edit/step/target.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/step/target'; diff --git a/app/templates/tutorial/run.js b/app/templates/tutorial/run.js new file mode 100644 index 0000000..7826608 --- /dev/null +++ b/app/templates/tutorial/run.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/run'; diff --git a/tests/integration/components/edit-form-test.js b/tests/integration/components/edit-form-test.js deleted file mode 100644 index f45758d..0000000 --- a/tests/integration/components/edit-form-test.js +++ /dev/null @@ -1,26 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; - -module('Integration | Component | edit-form', function(hooks) { - setupRenderingTest(hooks); - - test('it renders', async function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - - await render(hbs`{{edit-form}}`); - - assert.equal(this.element.textContent.trim(), ''); - - // Template block usage: - await render(hbs` - {{#edit-form}} - template block text - {{/edit-form}} - `); - - assert.equal(this.element.textContent.trim(), 'template block text'); - }); -}); diff --git a/tests/unit/controllers/tutorial/edit/sequence-test.js b/tests/unit/controllers/tutorial/edit/sequence-test.js new file mode 100644 index 0000000..0cff886 --- /dev/null +++ b/tests/unit/controllers/tutorial/edit/sequence-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/edit/sequence', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/edit/sequence'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/edit/step-test.js b/tests/unit/controllers/tutorial/edit/step-test.js new file mode 100644 index 0000000..060a65e --- /dev/null +++ b/tests/unit/controllers/tutorial/edit/step-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/edit/step', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/edit/step'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/edit/step/target-test.js b/tests/unit/controllers/tutorial/edit/step/target-test.js new file mode 100644 index 0000000..0d868a4 --- /dev/null +++ b/tests/unit/controllers/tutorial/edit/step/target-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/edit/step/target', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/edit/step/target'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/edit/tutorial-test.js b/tests/unit/controllers/tutorial/edit/tutorial-test.js new file mode 100644 index 0000000..4d15b74 --- /dev/null +++ b/tests/unit/controllers/tutorial/edit/tutorial-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/edit/tutorial', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/edit/tutorial'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/run-test.js b/tests/unit/controllers/tutorial/run-test.js new file mode 100644 index 0000000..1613479 --- /dev/null +++ b/tests/unit/controllers/tutorial/run-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/run', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/run'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/routes/tutorial/edit/step/target-test.js b/tests/unit/routes/tutorial/edit/step/target-test.js new file mode 100644 index 0000000..ae8a493 --- /dev/null +++ b/tests/unit/routes/tutorial/edit/step/target-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/edit/step/target', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/edit/step/target'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/run-test.js b/tests/unit/routes/tutorial/run-test.js new file mode 100644 index 0000000..9fe3a92 --- /dev/null +++ b/tests/unit/routes/tutorial/run-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/run', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/run'); + assert.ok(route); + }); +}); From 90bf71740d093a7613a85df8e739add959705d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 1 Apr 2019 19:04:23 +0200 Subject: [PATCH 07/30] selection timeline --- addon/adapters/tutoriallandscape.js | 54 +++++ .../navbar/toggle-live-landscape.js | 28 +++ addon/components/landscape-select/timeline.js | 219 ++++++++++++++++++ .../tutorial/edit/tutorial/landscape.js | 55 +++++ .../explorviz-frontend-extension-tutorial.js | 3 +- addon/models/tutorial.js | 2 +- addon/models/tutoriallandscape.js | 5 + .../tutorial/edit/tutorial/landscape.js | 19 ++ .../navbar/toggle-live-landscape.hbs | 9 + .../components/landscape-select/timeline.hbs | 1 + addon/templates/tutorial/edit/tutorial.hbs | 5 + .../tutorial/edit/tutorial/landscape.hbs | 47 ++++ app/adapters/tutoriallandscape.js | 1 + .../navbar/toggle-live-landscape.js | 1 + app/components/landscape-select/timeline.js | 1 + .../tutorial/edit/tutorial/landscape.js | 1 + app/models/tutoriallandscape.js | 1 + .../tutorial/edit/tutorial/landscape.js | 1 + .../tutorial/edit/tutorial/landscape.js | 1 + .../navbar/toggle-live-landscape-test.js | 26 +++ .../landscape-select/timeline-test.js | 26 +++ .../tutorial/edit/tutorial/landscape-test.js | 12 + .../tutorial/edit/tutorial/landscape-test.js | 11 + 23 files changed, 527 insertions(+), 2 deletions(-) create mode 100644 addon/adapters/tutoriallandscape.js create mode 100644 addon/components/landscape-select/navbar/toggle-live-landscape.js create mode 100644 addon/components/landscape-select/timeline.js create mode 100644 addon/controllers/tutorial/edit/tutorial/landscape.js create mode 100644 addon/models/tutoriallandscape.js create mode 100644 addon/routes/tutorial/edit/tutorial/landscape.js create mode 100644 addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs create mode 100644 addon/templates/components/landscape-select/timeline.hbs create mode 100644 addon/templates/tutorial/edit/tutorial/landscape.hbs create mode 100644 app/adapters/tutoriallandscape.js create mode 100644 app/components/landscape-select/navbar/toggle-live-landscape.js create mode 100644 app/components/landscape-select/timeline.js create mode 100644 app/controllers/tutorial/edit/tutorial/landscape.js create mode 100644 app/models/tutoriallandscape.js create mode 100644 app/routes/tutorial/edit/tutorial/landscape.js create mode 100644 app/templates/tutorial/edit/tutorial/landscape.js create mode 100644 tests/integration/components/landscape-select/navbar/toggle-live-landscape-test.js create mode 100644 tests/integration/components/landscape-select/timeline-test.js create mode 100644 tests/unit/controllers/tutorial/edit/tutorial/landscape-test.js create mode 100644 tests/unit/routes/tutorial/edit/tutorial/landscape-test.js diff --git a/addon/adapters/tutoriallandscape.js b/addon/adapters/tutoriallandscape.js new file mode 100644 index 0000000..7bae01e --- /dev/null +++ b/addon/adapters/tutoriallandscape.js @@ -0,0 +1,54 @@ +import JSONAPIAdapter from 'ember-data/adapters/json-api'; +import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; +import ENV from 'explorviz-frontend/config/environment'; + +export default JSONAPIAdapter.extend(DataAdapterMixin,{ + + host: ENV.APP.API_ROOT, + + init() { + + this.set('headers', { + "Accept": "application/vnd.api+json" + }); + + }, + + urlForUpdateRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/landscapes/${id}`; + }, + + urlForDeleteRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/landscapes/${id}`; + }, + + urlForFindAll() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/landscapes/`; + }, + // @Override + urlForQueryRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/landscapes/by-timestamp`; + }, + urlForFindRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/landscapes/${id}`; + }, + + // @Override + // Overrides URL for model.save() + urlForCreateRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/landscapes/`; + }, + + + authorize(xhr) { + let { access_token } = this.get('session.data.authenticated'); + xhr.setRequestHeader('Authorization', `Bearer ${access_token}`); + } + +}); diff --git a/addon/components/landscape-select/navbar/toggle-live-landscape.js b/addon/components/landscape-select/navbar/toggle-live-landscape.js new file mode 100644 index 0000000..00e82a5 --- /dev/null +++ b/addon/components/landscape-select/navbar/toggle-live-landscape.js @@ -0,0 +1,28 @@ +import Component from '@ember/component'; +import layout from '../../../templates/components/landscape-select/navbar/toggle-live-landscape'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import {inject as service} from '@ember/service'; + +export default Component.extend(AlertifyHandler,{ + tagName:'li', + landscapeListener: service("landscape-listener"), + layout, + actions:{ + toggleVisualizationReload() { + const self = this; + + const pauseReload = this.get('landscapeListener').pauseVisualizationReload; + + self.handleMessageForUser(pauseReload); + self.get('landscapeListener').toggleVisualizationReload(); + } + }, + handleMessageForUser(pauseReload) { + if(!pauseReload) { + this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); + } + else { + this.showAlertifyMessage("Visualization resumed! Live landscapes will be shown and can be selected."); + } + } +}); diff --git a/addon/components/landscape-select/timeline.js b/addon/components/landscape-select/timeline.js new file mode 100644 index 0000000..3b8f21d --- /dev/null +++ b/addon/components/landscape-select/timeline.js @@ -0,0 +1,219 @@ +import Component from '@ember/component'; +import layout from '../../templates/components/landscape-select/timeline'; +import Timeline from 'explorviz-frontend/components/visualization/page-setup/timeline/timeline'; + +export default Timeline.extend({ + tutorialLandscapes:false, + landscapeTimestamp:false, + layout, + renderChart(){ + if(!this.get('tutorialLandscapes')){ + this._super(...arguments); + }else{ + const self = this; + + self.debug("start timeline init"); + + const backgroundColor = self.get('chartColors.default.backgroundColor'); + const borderColor = self.get('chartColors.default.borderColor'); + + // chart data + var chartValues = []; + var chartLabels = []; + + // setting the context for the chart + var ctx = $('#timelineCanvas').get(0).getContext('2d'); + + // Chart configuration + var chartConfig = { + type: 'bar', + data: { + labels: chartLabels, + datasets: [{ + label: 'Requests', + backgroundColor: backgroundColor, + borderColor: borderColor, + data: chartValues, + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + layout: { + padding: { + left: 0, + right: 35, + top: 25, + bottom: 0 + } + }, + tooltips: { + enabled: true, + mode: 'point', + }, + legend: { + display: false + }, + scales: { + xAxes: [{ + display: true, + scaleLabel: { + display: true, + labelString: 'Time', + fontStyle: 'bold' + }, + type: 'time', + distribution: 'series', + time: { + unit: 'second', + displayFormats: { + second: 'HH:mm:ss' + }, + tooltipFormat: 'DD.MM.YYYY - kk:mm:ss' + }, + ticks: { + source: 'labels', + } + }], + yAxes: [{ + display: true, + scaleLabel: { + display: true, + labelString: 'Total Requests', + fontStyle: 'bold' + }, + ticks: { + beginAtZero: true + } + }] + }, + // performance optimizations + elements: { + line: { + tension: 0, // disables bezier curves + } + }, + 'onClick': function (evt) { + self.chartClickHandler(evt); + }, + } + }; + + var timelineChart = new Chart(ctx, chartConfig); + self.set('tutorialtimelineChart', timelineChart); + const updatedTimelineChart = self.get('tutorialtimelineChart'); + + const newTimelineData = { + x: 1553961723688, + y: 100 + }; + updatedTimelineChart.data.datasets[0].data.push(newTimelineData); + updatedTimelineChart.data.labels.push(1553961723688); + self.set('tutorialtimelineChart', updatedTimelineChart); + updatedTimelineChart.update(); + self.debug("end timeline init"); + } + }, + initChart(){ + if(!this.get('tutorialLandscapes')){ + this._super(...arguments); + }else{ + const self = this; + + // referencing the canvas + self.set('canvas', $('#timelineCanvas').get(0)); + + // setting the default colors for highlighting and resetting purposes + const color = Chart.helpers.color; + + self.set('chartColors', { + default: { + backgroundColor: color('rgb(0, 123, 255)').alpha(0.5).rgbString(), + borderColor: 'rgba(0,0,0,0.1)', + radius: '3' + }, + highlighted: { + backgroundColor: 'red', + borderColor: 'black', + radius: '4' + } + }); + + // setting the maximum number of data points shown in the timeline + self.set('maxNumOfDataPoints', 10); + } + }, + chartClickHandler(evt) { + if(!this.get('tutorialLandscapes')){ + this.super(...arguments); + }else{ + const self = this; + + const timelineChart = self.get('timelineChart'); + + const colorsDefault = self.get('chartColors.default'); + const colorsHighlighted = self.get('chartColors.highlighted'); + + var activePoint = timelineChart.getElementAtEvent(evt)[0]; + const lastHighlightedElementIndex = self.get('lastHighlightedElementIndex'); + + // data point clicked - only one data point is highlighted at a time + if (activePoint) { + var data = activePoint._chart.data; + var datasetIndex = activePoint._datasetIndex; + var elementIndex = activePoint._index; + var retrievedTimestamp = data.datasets[datasetIndex].data[elementIndex].x; + + // data point was already highlighted + if (lastHighlightedElementIndex === elementIndex) { + // do nothing + } else { + // highlight clicked data point + timelineChart.getDatasetMeta(datasetIndex).data[elementIndex].custom = colorsHighlighted; + + // reset the style of the previous data point + if (lastHighlightedElementIndex) { + timelineChart.getDatasetMeta(datasetIndex).data[lastHighlightedElementIndex].custom = colorsDefault; + } + + // save the index of the clicked data point + self.set('lastHighlightedElementIndex', elementIndex); + + self.set('timelineChart', timelineChart); + timelineChart.update(); + + // load specific landscape and pause visulization + + // convert timestamp to readable date for notification + const formattedTimestamp = timestampToDate([retrievedTimestamp]); + + self.showAlertifyMessage("Loading landscape [" + formattedTimestamp + "]"); + self.handleNotificationMessage(false); + self.get('store').queryRecord('tutoriallandscape', {timestamp: timestamp}).then(success, failure).catch(error); + this.landscapeTimestamp=timestamp; + + } + } else { + // reset the style of the previous data point and unpause the visualization + if (lastHighlightedElementIndex) { + + timelineChart.getDatasetMeta(0).data[lastHighlightedElementIndex].custom = colorsDefault; + + self.set('lastHighlightedElementIndex', null); + + self.set('tutorialtimelineChart', timelineChart); + timelineChart.update(); + + self.handleNotificationMessage(true); + + } + // TODO + // maybe Bug within ChartJS? The first data point can't be unhighlighted like the others + else { + self.unhighlightFirstDataPoint(); + } + } + } + }, + +}); diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js new file mode 100644 index 0000000..ee5ab4f --- /dev/null +++ b/addon/controllers/tutorial/edit/tutorial/landscape.js @@ -0,0 +1,55 @@ +import Controller from '@ember/controller'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import { inject as service } from "@ember/service"; +import { getOwner } from '@ember/application'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + + +export default Controller.extend(AlertifyHandler,{ + tagName: '', + store: service(), + targetType: null, + targetId:null, + renderingService: service("rendering-service"), + landscapeRepo: service("repos/landscape-repository"), + landscapeListener: service("landscape-listener"), + init(){ + this.get('landscapeListener').initSSE(); + this.get('landscapeListener').pauseVisualizationReload=true; + }, + + actions:{ + saveLandscape(model,timestamp){ + this.get("model").set("landscapeTimestamp",timestamp); + this.get("model").save(); + this.get("store").queryRecord('tutoriallandscape', {timestamp: timestamp}).then(() =>{ + model.set('landscapeTimestamp',timestamp); + model.save().then(()=>{ + const message = "Landscape for Tutorial " + tutorialData.title + " was saved."; + this.showAlertifyMessage(message); + }); + },()=>{ + this.get("store").queryRecord('landscape', {timestamp: timestamp}).then((landscape) => { + const tutorialLandscape = this.get("store").createRecord("tutoriallandscape",landscape); + tutorialLandscape.save().then(() =>{ + const message = "Landscape for Tutorial " + tutorialData.title + " was imported and saved."; + this.showAlertifyMessage(message); + }); + }); + }); + }, + resetView() { + this.get('renderingService').reSetupScene(); + }, + + openLandscapeView() { + this.set('landscapeRepo.latestApplication', null); + this.set('landscapeRepo.replayApplication', null); + }, + + toggleTimeline() { + this.get('renderingService').toggleTimeline(); + } + } +}); diff --git a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js index 27e54a0..8651994 100644 --- a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js +++ b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js @@ -18,8 +18,9 @@ export function initialize(appInstance) { this.route("edit", function(){ this.route('tutorial', { path: '/tutorial/:tutorial_id' }); this.route('tutorial.target', { path: '/tutorial/:tutorial_id/target' }); + this.route('tutorial.landscape', { path: '/tutorial/:tutorial_id/landscape' }); this.route('sequence', { path: '/sequence/:sequence_id' }); - this.route('step', { path: '/step/:step_id' }); + this.route('step', { path: '/step/:step_id' }); this.route('step.target', { path: '/step/:step_id/target' }); }); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index 5cb7397..e246f10 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -9,7 +9,7 @@ export default DS.Model.extend({ sequences: DS.hasMany('sequence',{inverse:"tutorial"}), landscape: Ember.computed(function() { return DS.PromiseObject.create({ - promise: this.get('store').queryRecord('landscape', {timestamp: this.landscapeTimestamp}).then(landscape => { + promise: this.get('store').queryRecord('tutoriallandscape', {timestamp: this.landscapeTimestamp}).then(landscape => { return landscape; }) }); diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js new file mode 100644 index 0000000..efa4cbc --- /dev/null +++ b/addon/models/tutoriallandscape.js @@ -0,0 +1,5 @@ +import Landscape from 'explorviz-frontend/models/landscape'; + +export default Landscape.extend({ + +}); diff --git a/addon/routes/tutorial/edit/tutorial/landscape.js b/addon/routes/tutorial/edit/tutorial/landscape.js new file mode 100644 index 0000000..ff2898f --- /dev/null +++ b/addon/routes/tutorial/edit/tutorial/landscape.js @@ -0,0 +1,19 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import LandscapeInteraction from + 'explorviz-frontend/utils/landscape-rendering/interaction'; +import { getOwner } from '@ember/application'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('tutorial', params.tutorial_id); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + + + } +}); diff --git a/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs b/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs new file mode 100644 index 0000000..364d5fb --- /dev/null +++ b/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs @@ -0,0 +1,9 @@ +{{#if landscapeListener.pauseVisualizationReload}} + + {{svg-jar "history" class="octicon align-middle navbar-highlight"}} + +{{else}} + + {{svg-jar "history" class="octicon align-middle"}} + +{{/if}} diff --git a/addon/templates/components/landscape-select/timeline.hbs b/addon/templates/components/landscape-select/timeline.hbs new file mode 100644 index 0000000..94d2933 --- /dev/null +++ b/addon/templates/components/landscape-select/timeline.hbs @@ -0,0 +1 @@ + diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs index 712c980..32a7b86 100644 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -13,6 +13,11 @@ {{form.element controlType="number" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} + {{#if model.landscape.isFulfilled}} + {{#link-to "tutorial.edit.tutorial.landscape" model}}edit landscape{{/link-to}} + {{else}} + {{#link-to "tutorial.edit.tutorial.landscape" model}}select landscape{{/link-to}} + {{/if}}

Sequences

diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs new file mode 100644 index 0000000..6b925b2 --- /dev/null +++ b/addon/templates/tutorial/edit/tutorial/landscape.hbs @@ -0,0 +1,47 @@ +
+
+

Tutorial "{{model.title}}"

+ Id:{{#if landscapeInteraction.landscapeTimestamp}}{{landscapeInteraction.landscapeTimestamp}}{{else}}{{model.landscapeTimestamp}}{{/if}} + {{#if model.landscape.isFulfilled}} + + + {{visualization/page-setup/visualization-navbar + content=(array + (component "landscape-select/navbar/toggle-live-landscape" class="nav-item") + ) +}} +
+ {{#if (and landscapeListener.pauseVisualizationReload model.landscape.isFulfilled)}} + {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction}} + {{else}} + {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} + {{/if}} +
+
+ {{#bs-button + onClick=(action "toggleTimeline") + type="secondary" + outline=true + class="btn-timeline" + title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") + }} + {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} + {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} + {{/bs-button}} +
+ {{landscape-select/timeline tutorialLandscapes=landscapeListener.pauseVisualizationReload landscapeTimestamp=model.landscapeTimestamp}} +
+
+ {{else}} +
+
+

Landscape loading for "{{model.landscapeTimestamp}}"!

+
+ {{ember-spinner}} +
+
+
+ {{/if}} + +
+
diff --git a/app/adapters/tutoriallandscape.js b/app/adapters/tutoriallandscape.js new file mode 100644 index 0000000..b974551 --- /dev/null +++ b/app/adapters/tutoriallandscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/adapters/tutoriallandscape'; diff --git a/app/components/landscape-select/navbar/toggle-live-landscape.js b/app/components/landscape-select/navbar/toggle-live-landscape.js new file mode 100644 index 0000000..8489a25 --- /dev/null +++ b/app/components/landscape-select/navbar/toggle-live-landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/navbar/toggle-live-landscape'; \ No newline at end of file diff --git a/app/components/landscape-select/timeline.js b/app/components/landscape-select/timeline.js new file mode 100644 index 0000000..5527627 --- /dev/null +++ b/app/components/landscape-select/timeline.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/timeline'; \ No newline at end of file diff --git a/app/controllers/tutorial/edit/tutorial/landscape.js b/app/controllers/tutorial/edit/tutorial/landscape.js new file mode 100644 index 0000000..74b8ada --- /dev/null +++ b/app/controllers/tutorial/edit/tutorial/landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/tutorial/landscape'; diff --git a/app/models/tutoriallandscape.js b/app/models/tutoriallandscape.js new file mode 100644 index 0000000..b8942df --- /dev/null +++ b/app/models/tutoriallandscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/models/tutoriallandscape'; diff --git a/app/routes/tutorial/edit/tutorial/landscape.js b/app/routes/tutorial/edit/tutorial/landscape.js new file mode 100644 index 0000000..4a128ae --- /dev/null +++ b/app/routes/tutorial/edit/tutorial/landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/tutorial/landscape'; diff --git a/app/templates/tutorial/edit/tutorial/landscape.js b/app/templates/tutorial/edit/tutorial/landscape.js new file mode 100644 index 0000000..9dc4aa1 --- /dev/null +++ b/app/templates/tutorial/edit/tutorial/landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/tutorial/landscape'; diff --git a/tests/integration/components/landscape-select/navbar/toggle-live-landscape-test.js b/tests/integration/components/landscape-select/navbar/toggle-live-landscape-test.js new file mode 100644 index 0000000..f1feca7 --- /dev/null +++ b/tests/integration/components/landscape-select/navbar/toggle-live-landscape-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-select/navbar/toggle-live-landscape', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-select/navbar/toggle-live-landscape}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-select/navbar/toggle-live-landscape}} + template block text + {{/landscape-select/navbar/toggle-live-landscape}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/landscape-select/timeline-test.js b/tests/integration/components/landscape-select/timeline-test.js new file mode 100644 index 0000000..9e009cd --- /dev/null +++ b/tests/integration/components/landscape-select/timeline-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-select/timeline', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-select/timeline}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-select/timeline}} + template block text + {{/landscape-select/timeline}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/controllers/tutorial/edit/tutorial/landscape-test.js b/tests/unit/controllers/tutorial/edit/tutorial/landscape-test.js new file mode 100644 index 0000000..2ef9f04 --- /dev/null +++ b/tests/unit/controllers/tutorial/edit/tutorial/landscape-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/edit/tutorial/landscape', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/edit/tutorial/landscape'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/routes/tutorial/edit/tutorial/landscape-test.js b/tests/unit/routes/tutorial/edit/tutorial/landscape-test.js new file mode 100644 index 0000000..e21e4db --- /dev/null +++ b/tests/unit/routes/tutorial/edit/tutorial/landscape-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/edit/tutorial/landscape', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/edit/tutorial/landscape'); + assert.ok(route); + }); +}); From 6c323f91d24b9bdd647be1cd8111da96a7889232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Fri, 5 Apr 2019 11:00:56 +0200 Subject: [PATCH 08/30] timeline improvements --- addon/adapters/tutoriallandscape.js | 1 - .../landscape-select/landscapelist.js | 25 ++ .../navbar/return-to-saved.js | 27 +++ .../landscape-select/navbar/save-landscape.js | 32 +++ .../navbar/toggle-live-landscape.js | 12 +- addon/components/landscape-select/timeline.js | 217 +----------------- .../tutorial/edit/tutorial/landscape.js | 1 + .../landscape-select/landscapelist.hbs | 5 + .../navbar/return-to-saved.hbs | 3 + .../navbar/save-landscape.hbs | 3 + .../navbar/toggle-live-landscape.hbs | 2 +- .../tutorial/edit/tutorial/landscape.hbs | 38 +-- .../landscape-select/landscapelist.js | 1 + .../navbar/return-to-saved.js | 1 + .../landscape-select/navbar/save-landscape.js | 1 + .../landscape-select/landscapelist-test.js | 26 +++ .../navbar/return-to-saved-test.js | 26 +++ .../navbar/save-landscape-test.js | 26 +++ 18 files changed, 211 insertions(+), 236 deletions(-) create mode 100644 addon/components/landscape-select/landscapelist.js create mode 100644 addon/components/landscape-select/navbar/return-to-saved.js create mode 100644 addon/components/landscape-select/navbar/save-landscape.js create mode 100644 addon/templates/components/landscape-select/landscapelist.hbs create mode 100644 addon/templates/components/landscape-select/navbar/return-to-saved.hbs create mode 100644 addon/templates/components/landscape-select/navbar/save-landscape.hbs create mode 100644 app/components/landscape-select/landscapelist.js create mode 100644 app/components/landscape-select/navbar/return-to-saved.js create mode 100644 app/components/landscape-select/navbar/save-landscape.js create mode 100644 tests/integration/components/landscape-select/landscapelist-test.js create mode 100644 tests/integration/components/landscape-select/navbar/return-to-saved-test.js create mode 100644 tests/integration/components/landscape-select/navbar/save-landscape-test.js diff --git a/addon/adapters/tutoriallandscape.js b/addon/adapters/tutoriallandscape.js index 7bae01e..7cefe0d 100644 --- a/addon/adapters/tutoriallandscape.js +++ b/addon/adapters/tutoriallandscape.js @@ -23,7 +23,6 @@ export default JSONAPIAdapter.extend(DataAdapterMixin,{ const baseUrl = this.buildURL(); return `${baseUrl}/v1/tutorials/landscapes/${id}`; }, - urlForFindAll() { const baseUrl = this.buildURL(); return `${baseUrl}/v1/tutorials/landscapes/`; diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js new file mode 100644 index 0000000..7d61478 --- /dev/null +++ b/addon/components/landscape-select/landscapelist.js @@ -0,0 +1,25 @@ +import Component from '@ember/component'; +import layout from '../../templates/components/landscape-select/landscapelist'; +import {inject as service} from '@ember/service'; + +export default Component.extend({ + layout, + store: service(), + landscapeListener: service("landscape-listener"), + landscapes: null, + init(){ + this._super(...arguments); + this.updateLandscapeList(true); + }, + + updateLandscapeList(reload) { + this.set('landscapes', []); + this.get('store').findAll('tutoriallandscape', { reload }) + .then(landscapes => { + let landscapeList = landscapes.toArray(); + // sort by id + landscapeList.sort((landscape1, landscape2) => parseInt(landscape1.id) < parseInt(landscape2.id) ? -1 : 1); + this.set('landscapes', landscapeList); + }); + }, +}); diff --git a/addon/components/landscape-select/navbar/return-to-saved.js b/addon/components/landscape-select/navbar/return-to-saved.js new file mode 100644 index 0000000..5039f9b --- /dev/null +++ b/addon/components/landscape-select/navbar/return-to-saved.js @@ -0,0 +1,27 @@ +import Component from '@ember/component'; +import layout from '../../../templates/components/landscape-select/navbar/return-to-saved'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import {inject as service} from '@ember/service'; + +export default Component.extend(AlertifyHandler,{ + tagName:'li', + landscapeListener: service("landscape-listener"), + toggle:null, + layout, + actions:{ + returnToSaved() { + this.set('toggle',false); + this.get('landscapeListener').set('pauseVisualizationReload',true); + + this.handleMessageForUser(pauseReload); + } + }, + handleMessageForUser(pauseReload) { + if(!pauseReload){ + this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); + } + else { + this.showAlertifyMessage("Visualization resumed! Live landscapes will be shown and can be selected."); + } + } +}); diff --git a/addon/components/landscape-select/navbar/save-landscape.js b/addon/components/landscape-select/navbar/save-landscape.js new file mode 100644 index 0000000..f6f4d4b --- /dev/null +++ b/addon/components/landscape-select/navbar/save-landscape.js @@ -0,0 +1,32 @@ +import Component from '@ember/component'; +import layout from '../../../templates/components/landscape-select/navbar/save-landscape'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import {inject as service} from '@ember/service'; + +export default Component.extend(AlertifyHandler,{ + tagName:'li', + store: service(), + landscapeListener: service("landscape-listener"), + toggle:null, + layout, + actions:{ + saveLandscape(){ + this.get('store').findAll('tutoriallandscape',true) + .then(landscapes => { + let landscape = landscapes.find((landscape)=>landscape.id===this.get('landscape').id); + this.get('tutorial').set('landscapeTimestamp',this.get('landscape').get('timestamp')); + this.get('tutorial').save(); + // sort by id + this.set('landscapes', landscapeList); + }); + }, + }, + handleMessageForUser(pauseReload) { + if(!pauseReload){ + this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); + } + else { + this.showAlertifyMessage("Visualization resumed! Live landscapes will be shown and can be selected."); + } + } +}); diff --git a/addon/components/landscape-select/navbar/toggle-live-landscape.js b/addon/components/landscape-select/navbar/toggle-live-landscape.js index 00e82a5..99a5a4f 100644 --- a/addon/components/landscape-select/navbar/toggle-live-landscape.js +++ b/addon/components/landscape-select/navbar/toggle-live-landscape.js @@ -6,19 +6,19 @@ import {inject as service} from '@ember/service'; export default Component.extend(AlertifyHandler,{ tagName:'li', landscapeListener: service("landscape-listener"), + toggle:null, layout, actions:{ toggleVisualizationReload() { - const self = this; - + this.set('toggle',!this.get('toggle')); const pauseReload = this.get('landscapeListener').pauseVisualizationReload; - - self.handleMessageForUser(pauseReload); - self.get('landscapeListener').toggleVisualizationReload(); + this.handleMessageForUser(pauseReload); + this.get('landscapeListener').toggleVisualizationReload(); + this.get('landscapeListener'). } }, handleMessageForUser(pauseReload) { - if(!pauseReload) { + if(!pauseReload){ this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); } else { diff --git a/addon/components/landscape-select/timeline.js b/addon/components/landscape-select/timeline.js index 3b8f21d..0b3263d 100644 --- a/addon/components/landscape-select/timeline.js +++ b/addon/components/landscape-select/timeline.js @@ -3,217 +3,12 @@ import layout from '../../templates/components/landscape-select/timeline'; import Timeline from 'explorviz-frontend/components/visualization/page-setup/timeline/timeline'; export default Timeline.extend({ - tutorialLandscapes:false, - landscapeTimestamp:false, - layout, - renderChart(){ - if(!this.get('tutorialLandscapes')){ - this._super(...arguments); - }else{ - const self = this; + layout, + chartClickHandler(evt) { + this._super(...arguments); + var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; + this.get('landscapeListener').set('pauseVisualizationReload',true); - self.debug("start timeline init"); - - const backgroundColor = self.get('chartColors.default.backgroundColor'); - const borderColor = self.get('chartColors.default.borderColor'); - - // chart data - var chartValues = []; - var chartLabels = []; - - // setting the context for the chart - var ctx = $('#timelineCanvas').get(0).getContext('2d'); - - // Chart configuration - var chartConfig = { - type: 'bar', - data: { - labels: chartLabels, - datasets: [{ - label: 'Requests', - backgroundColor: backgroundColor, - borderColor: borderColor, - data: chartValues, - }] - }, - options: { - responsive: true, - maintainAspectRatio: false, - layout: { - padding: { - left: 0, - right: 35, - top: 25, - bottom: 0 - } - }, - tooltips: { - enabled: true, - mode: 'point', - }, - legend: { - display: false - }, - scales: { - xAxes: [{ - display: true, - scaleLabel: { - display: true, - labelString: 'Time', - fontStyle: 'bold' - }, - type: 'time', - distribution: 'series', - time: { - unit: 'second', - displayFormats: { - second: 'HH:mm:ss' - }, - tooltipFormat: 'DD.MM.YYYY - kk:mm:ss' - }, - ticks: { - source: 'labels', - } - }], - yAxes: [{ - display: true, - scaleLabel: { - display: true, - labelString: 'Total Requests', - fontStyle: 'bold' - }, - ticks: { - beginAtZero: true - } - }] - }, - // performance optimizations - elements: { - line: { - tension: 0, // disables bezier curves - } - }, - 'onClick': function (evt) { - self.chartClickHandler(evt); - }, - } - }; - - var timelineChart = new Chart(ctx, chartConfig); - self.set('tutorialtimelineChart', timelineChart); - const updatedTimelineChart = self.get('tutorialtimelineChart'); - - const newTimelineData = { - x: 1553961723688, - y: 100 - }; - updatedTimelineChart.data.datasets[0].data.push(newTimelineData); - updatedTimelineChart.data.labels.push(1553961723688); - self.set('tutorialtimelineChart', updatedTimelineChart); - updatedTimelineChart.update(); - self.debug("end timeline init"); + this.set("landscapeTimestamp",tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); } - }, - initChart(){ - if(!this.get('tutorialLandscapes')){ - this._super(...arguments); - }else{ - const self = this; - - // referencing the canvas - self.set('canvas', $('#timelineCanvas').get(0)); - - // setting the default colors for highlighting and resetting purposes - const color = Chart.helpers.color; - - self.set('chartColors', { - default: { - backgroundColor: color('rgb(0, 123, 255)').alpha(0.5).rgbString(), - borderColor: 'rgba(0,0,0,0.1)', - radius: '3' - }, - highlighted: { - backgroundColor: 'red', - borderColor: 'black', - radius: '4' - } - }); - - // setting the maximum number of data points shown in the timeline - self.set('maxNumOfDataPoints', 10); - } - }, - chartClickHandler(evt) { - if(!this.get('tutorialLandscapes')){ - this.super(...arguments); - }else{ - const self = this; - - const timelineChart = self.get('timelineChart'); - - const colorsDefault = self.get('chartColors.default'); - const colorsHighlighted = self.get('chartColors.highlighted'); - - var activePoint = timelineChart.getElementAtEvent(evt)[0]; - const lastHighlightedElementIndex = self.get('lastHighlightedElementIndex'); - - // data point clicked - only one data point is highlighted at a time - if (activePoint) { - var data = activePoint._chart.data; - var datasetIndex = activePoint._datasetIndex; - var elementIndex = activePoint._index; - var retrievedTimestamp = data.datasets[datasetIndex].data[elementIndex].x; - - // data point was already highlighted - if (lastHighlightedElementIndex === elementIndex) { - // do nothing - } else { - // highlight clicked data point - timelineChart.getDatasetMeta(datasetIndex).data[elementIndex].custom = colorsHighlighted; - - // reset the style of the previous data point - if (lastHighlightedElementIndex) { - timelineChart.getDatasetMeta(datasetIndex).data[lastHighlightedElementIndex].custom = colorsDefault; - } - - // save the index of the clicked data point - self.set('lastHighlightedElementIndex', elementIndex); - - self.set('timelineChart', timelineChart); - timelineChart.update(); - - // load specific landscape and pause visulization - - // convert timestamp to readable date for notification - const formattedTimestamp = timestampToDate([retrievedTimestamp]); - - self.showAlertifyMessage("Loading landscape [" + formattedTimestamp + "]"); - self.handleNotificationMessage(false); - self.get('store').queryRecord('tutoriallandscape', {timestamp: timestamp}).then(success, failure).catch(error); - this.landscapeTimestamp=timestamp; - - } - } else { - // reset the style of the previous data point and unpause the visualization - if (lastHighlightedElementIndex) { - - timelineChart.getDatasetMeta(0).data[lastHighlightedElementIndex].custom = colorsDefault; - - self.set('lastHighlightedElementIndex', null); - - self.set('tutorialtimelineChart', timelineChart); - timelineChart.update(); - - self.handleNotificationMessage(true); - - } - // TODO - // maybe Bug within ChartJS? The first data point can't be unhighlighted like the others - else { - self.unhighlightFirstDataPoint(); - } - } - } - }, - }); diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js index ee5ab4f..a3c9780 100644 --- a/addon/controllers/tutorial/edit/tutorial/landscape.js +++ b/addon/controllers/tutorial/edit/tutorial/landscape.js @@ -11,6 +11,7 @@ export default Controller.extend(AlertifyHandler,{ store: service(), targetType: null, targetId:null, + tutorialLandscape: true, renderingService: service("rendering-service"), landscapeRepo: service("repos/landscape-repository"), landscapeListener: service("landscape-listener"), diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs new file mode 100644 index 0000000..0a332eb --- /dev/null +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -0,0 +1,5 @@ + +Possible Landscapes: +{{#each landscapes as |landscape|}} + {{landscape.landscapeTimestamp}} +{{/each}} diff --git a/addon/templates/components/landscape-select/navbar/return-to-saved.hbs b/addon/templates/components/landscape-select/navbar/return-to-saved.hbs new file mode 100644 index 0000000..5c2b66d --- /dev/null +++ b/addon/templates/components/landscape-select/navbar/return-to-saved.hbs @@ -0,0 +1,3 @@ + + {{svg-jar "issue-reopened" class="octicon align-middle"}} + diff --git a/addon/templates/components/landscape-select/navbar/save-landscape.hbs b/addon/templates/components/landscape-select/navbar/save-landscape.hbs new file mode 100644 index 0000000..9c48806 --- /dev/null +++ b/addon/templates/components/landscape-select/navbar/save-landscape.hbs @@ -0,0 +1,3 @@ + + {{svg-jar "database" class="octicon align-middle"}} + diff --git a/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs b/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs index 364d5fb..a1a655f 100644 --- a/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs +++ b/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs @@ -1,4 +1,4 @@ -{{#if landscapeListener.pauseVisualizationReload}} +{{#if toggle}} {{svg-jar "history" class="octicon align-middle navbar-highlight"}} diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs index 6b925b2..e5947ca 100644 --- a/addon/templates/tutorial/edit/tutorial/landscape.hbs +++ b/addon/templates/tutorial/edit/tutorial/landscape.hbs @@ -7,31 +7,35 @@ {{visualization/page-setup/visualization-navbar content=(array - (component "landscape-select/navbar/toggle-live-landscape" class="nav-item") + (component "landscape-select/navbar/toggle-live-landscape" class="nav-item" toggle=tutorialLandscape) + (component "landscape-select/navbar/save-landscape" class="nav-item" tutorial=model) + (component "landscape-select/navbar/return-to-saved" class="nav-item" tutorial=model) ) }} +{{tutorialLandscape}}
- {{#if (and landscapeListener.pauseVisualizationReload model.landscape.isFulfilled)}} + {{#if (and tutorialLandscape model.landscape.isFulfilled)}} {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction}} + {{landscape-select/landscapelist}} {{else}} {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} +
+ {{#bs-button + onClick=(action "toggleTimeline") + type="secondary" + outline=true + class="btn-timeline" + title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") + }} + {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} + {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} + {{/bs-button}} +
+ {{landscape-select/timeline landscapeTimestamp=model.landscapeTimestamp}} +
+
{{/if}}
-
- {{#bs-button - onClick=(action "toggleTimeline") - type="secondary" - outline=true - class="btn-timeline" - title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") - }} - {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} - {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} - {{/bs-button}} -
- {{landscape-select/timeline tutorialLandscapes=landscapeListener.pauseVisualizationReload landscapeTimestamp=model.landscapeTimestamp}} -
-
{{else}}
diff --git a/app/components/landscape-select/landscapelist.js b/app/components/landscape-select/landscapelist.js new file mode 100644 index 0000000..3fff765 --- /dev/null +++ b/app/components/landscape-select/landscapelist.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/landscapelist'; \ No newline at end of file diff --git a/app/components/landscape-select/navbar/return-to-saved.js b/app/components/landscape-select/navbar/return-to-saved.js new file mode 100644 index 0000000..4dc47c8 --- /dev/null +++ b/app/components/landscape-select/navbar/return-to-saved.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/navbar/return-to-saved'; \ No newline at end of file diff --git a/app/components/landscape-select/navbar/save-landscape.js b/app/components/landscape-select/navbar/save-landscape.js new file mode 100644 index 0000000..d2a1573 --- /dev/null +++ b/app/components/landscape-select/navbar/save-landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/navbar/save-landscape'; \ No newline at end of file diff --git a/tests/integration/components/landscape-select/landscapelist-test.js b/tests/integration/components/landscape-select/landscapelist-test.js new file mode 100644 index 0000000..db4fc46 --- /dev/null +++ b/tests/integration/components/landscape-select/landscapelist-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-select/landscapelist', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-select/landscapelist}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-select/landscapelist}} + template block text + {{/landscape-select/landscapelist}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/landscape-select/navbar/return-to-saved-test.js b/tests/integration/components/landscape-select/navbar/return-to-saved-test.js new file mode 100644 index 0000000..86cc467 --- /dev/null +++ b/tests/integration/components/landscape-select/navbar/return-to-saved-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-select/navbar/return-to-saved', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-select/navbar/return-to-saved}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-select/navbar/return-to-saved}} + template block text + {{/landscape-select/navbar/return-to-saved}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/landscape-select/navbar/save-landscape-test.js b/tests/integration/components/landscape-select/navbar/save-landscape-test.js new file mode 100644 index 0000000..a633b51 --- /dev/null +++ b/tests/integration/components/landscape-select/navbar/save-landscape-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-select/navbar/save-landscape', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-select/navbar/save-landscape}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-select/navbar/save-landscape}} + template block text + {{/landscape-select/navbar/save-landscape}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); From b821614d106b384dffea9e8558da684062bcc612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Fri, 5 Apr 2019 17:07:12 +0200 Subject: [PATCH 09/30] landscape service --- .../navbar/return-to-saved.js | 10 ++------ .../landscape-select/navbar/save-landscape.js | 4 +--- .../navbar/toggle-live-landscape.js | 1 - addon/controllers/tutorial/edit/tutorial.js | 1 + .../tutorial/edit/tutorial/landscape.js | 3 ++- addon/models/tutorial.js | 7 ------ addon/routes/tutorial/create/tutorial.js | 6 ++++- addon/routes/tutorial/index.js | 12 ++++++++++ addon/services/tutorial-landscape.js | 24 +++++++++++++++++++ addon/templates/tutorial.hbs | 2 +- addon/templates/tutorial/edit/tutorial.hbs | 2 +- .../tutorial/edit/tutorial/landscape.hbs | 4 ++-- app/routes/tutorial/index.js | 1 + app/services/tutorial-landscape.js | 1 + .../unit/services/tutorial-landscape-test.js | 12 ++++++++++ 15 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 addon/routes/tutorial/index.js create mode 100644 addon/services/tutorial-landscape.js create mode 100644 app/routes/tutorial/index.js create mode 100644 app/services/tutorial-landscape.js create mode 100644 tests/unit/services/tutorial-landscape-test.js diff --git a/addon/components/landscape-select/navbar/return-to-saved.js b/addon/components/landscape-select/navbar/return-to-saved.js index 5039f9b..76b7431 100644 --- a/addon/components/landscape-select/navbar/return-to-saved.js +++ b/addon/components/landscape-select/navbar/return-to-saved.js @@ -12,16 +12,10 @@ export default Component.extend(AlertifyHandler,{ returnToSaved() { this.set('toggle',false); this.get('landscapeListener').set('pauseVisualizationReload',true); - - this.handleMessageForUser(pauseReload); + this.handleMessageForUser(); } }, - handleMessageForUser(pauseReload) { - if(!pauseReload){ + handleMessageForUser() { this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); - } - else { - this.showAlertifyMessage("Visualization resumed! Live landscapes will be shown and can be selected."); - } } }); diff --git a/addon/components/landscape-select/navbar/save-landscape.js b/addon/components/landscape-select/navbar/save-landscape.js index f6f4d4b..9a504f9 100644 --- a/addon/components/landscape-select/navbar/save-landscape.js +++ b/addon/components/landscape-select/navbar/save-landscape.js @@ -14,10 +14,8 @@ export default Component.extend(AlertifyHandler,{ this.get('store').findAll('tutoriallandscape',true) .then(landscapes => { let landscape = landscapes.find((landscape)=>landscape.id===this.get('landscape').id); - this.get('tutorial').set('landscapeTimestamp',this.get('landscape').get('timestamp')); + this.get('tutorial').set('landscapeTimestamp',landscape.get('timestamp')); this.get('tutorial').save(); - // sort by id - this.set('landscapes', landscapeList); }); }, }, diff --git a/addon/components/landscape-select/navbar/toggle-live-landscape.js b/addon/components/landscape-select/navbar/toggle-live-landscape.js index 99a5a4f..4c3d052 100644 --- a/addon/components/landscape-select/navbar/toggle-live-landscape.js +++ b/addon/components/landscape-select/navbar/toggle-live-landscape.js @@ -14,7 +14,6 @@ export default Component.extend(AlertifyHandler,{ const pauseReload = this.get('landscapeListener').pauseVisualizationReload; this.handleMessageForUser(pauseReload); this.get('landscapeListener').toggleVisualizationReload(); - this.get('landscapeListener'). } }, handleMessageForUser(pauseReload) { diff --git a/addon/controllers/tutorial/edit/tutorial.js b/addon/controllers/tutorial/edit/tutorial.js index 9e4b44c..dd3ec5c 100644 --- a/addon/controllers/tutorial/edit/tutorial.js +++ b/addon/controllers/tutorial/edit/tutorial.js @@ -4,6 +4,7 @@ export default Controller.extend({ actions:{ saveTutorialChanges(tutorial) { if(tutorial) { + // check for valid input if(!tutorial.get('title') || tutorial.get('title').length === 0) { this.showAlertifyMessage('Title cannot be empty.'); diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js index a3c9780..46a6b39 100644 --- a/addon/controllers/tutorial/edit/tutorial/landscape.js +++ b/addon/controllers/tutorial/edit/tutorial/landscape.js @@ -11,7 +11,8 @@ export default Controller.extend(AlertifyHandler,{ store: service(), targetType: null, targetId:null, - tutorialLandscape: true, + hasTutorialLandscape: true, + tutorialLandscape: service(), renderingService: service("rendering-service"), landscapeRepo: service("repos/landscape-repository"), landscapeListener: service("landscape-listener"), diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index e246f10..b1671f5 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -7,11 +7,4 @@ export default DS.Model.extend({ targetType: DS.attr('string'), landscapeTimestamp: DS.attr('string'), sequences: DS.hasMany('sequence',{inverse:"tutorial"}), - landscape: Ember.computed(function() { - return DS.PromiseObject.create({ - promise: this.get('store').queryRecord('tutoriallandscape', {timestamp: this.landscapeTimestamp}).then(landscape => { - return landscape; - }) - }); - }), }); diff --git a/addon/routes/tutorial/create/tutorial.js b/addon/routes/tutorial/create/tutorial.js index 87e807f..4865f9c 100644 --- a/addon/routes/tutorial/create/tutorial.js +++ b/addon/routes/tutorial/create/tutorial.js @@ -3,5 +3,9 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; export default BaseRoute.extend(AuthenticatedRouteMixin, { - + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/routes/tutorial/index.js b/addon/routes/tutorial/index.js new file mode 100644 index 0000000..69cc575 --- /dev/null +++ b/addon/routes/tutorial/index.js @@ -0,0 +1,12 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; + +export default BaseRoute.extend({ + beforeModel: function() { + this.transitionTo("tutorial.list.tutorial"); + }, + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } +}); diff --git a/addon/services/tutorial-landscape.js b/addon/services/tutorial-landscape.js new file mode 100644 index 0000000..4aac5f2 --- /dev/null +++ b/addon/services/tutorial-landscape.js @@ -0,0 +1,24 @@ +import Service from '@ember/service'; +import Evented from '@ember/object/evented'; +import debugLogger from 'ember-debug-logger'; + +export default Service.extend(Evented, { + debug: debugLogger(), + tutorialLandscape: null, + loadTutorialLandscape(tutorial){ + if(this.tutorialLandscape!==null){ + this.get('store').unloadRecord(this.tutorialLandscape); + } + this.set('tutorialLandscape',this.get('store').queryRecord('tutoriallandscape', {timestamp: tutorial.landscapeTimestamp }).then(landscape => { + if(landcape===null){ + landscape = this.get('store').queryRecord('landscape', {timestamp: tutorial.landscapeTimestamp }).then(landscape => { + landscape=this.get('store').createRecord("tutoriallandscape",landcape); + landscape.save(); + return landscape; + }); + } + return landscape; + }) + ); + }, +}) \ No newline at end of file diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index c24cd68..e2147ca 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -1 +1 @@ -{{outlet}} +{{outlet}} \ No newline at end of file diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs index 32a7b86..cfa244d 100644 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -9,7 +9,7 @@
{{tutorial-hierarchie tutorial=model}}
- {{#bs-form model=model onSubmit=(action "saveTutorialChanges" tutorial) as |form|}} + {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} {{form.element controlType="number" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs index e5947ca..f723687 100644 --- a/addon/templates/tutorial/edit/tutorial/landscape.hbs +++ b/addon/templates/tutorial/edit/tutorial/landscape.hbs @@ -9,10 +9,10 @@ content=(array (component "landscape-select/navbar/toggle-live-landscape" class="nav-item" toggle=tutorialLandscape) (component "landscape-select/navbar/save-landscape" class="nav-item" tutorial=model) - (component "landscape-select/navbar/return-to-saved" class="nav-item" tutorial=model) + (component "landscape-select/navbar/return-to-saved" class="nav-item" tutorial=model toggle=tutorialLandscape) ) }} -{{tutorialLandscape}} +Showing live-landscapes: {{not tutorialLandscape}}
{{#if (and tutorialLandscape model.landscape.isFulfilled)}} {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction}} diff --git a/app/routes/tutorial/index.js b/app/routes/tutorial/index.js new file mode 100644 index 0000000..7ef5c24 --- /dev/null +++ b/app/routes/tutorial/index.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/index'; diff --git a/app/services/tutorial-landscape.js b/app/services/tutorial-landscape.js new file mode 100644 index 0000000..ce63b74 --- /dev/null +++ b/app/services/tutorial-landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/services/tutorial-landscape'; diff --git a/tests/unit/services/tutorial-landscape-test.js b/tests/unit/services/tutorial-landscape-test.js new file mode 100644 index 0000000..01659dd --- /dev/null +++ b/tests/unit/services/tutorial-landscape-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Service | tutorial-landscape', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let service = this.owner.lookup('service:tutorial-landscape'); + assert.ok(service); + }); +}); From 22f907bf2bd5c479db16af4545e579165e87e120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Thu, 11 Apr 2019 18:57:51 +0200 Subject: [PATCH 10/30] landscape service --- addon/adapters/tutoriallandscape.js | 2 +- addon/controllers/tutorial/edit/tutorial.js | 5 +- addon/models/tutoriallandscape.js | 8 +- addon/routes/tutorial/create/sequence.js | 6 +- addon/routes/tutorial/create/step.js | 6 +- addon/routes/tutorial/edit/tutorial.js | 6 +- addon/routes/tutorial/list/sequence.js | 7 +- addon/routes/tutorial/list/step.js | 7 +- addon/routes/tutorial/list/tutorial.js | 7 +- addon/serializers/tutoriallandscape.js | 21 ++++ addon/services/tutorial-landscape.js | 29 +++-- addon/templates/tutorial/edit/tutorial.hbs | 8 +- app/serializers/tutoriallandscape.js | 1 + app/templates/tutorial/index.js | 1 + package-lock.json | 124 +++++++++++++++----- package.json | 1 + 16 files changed, 182 insertions(+), 57 deletions(-) create mode 100644 addon/serializers/tutoriallandscape.js create mode 100644 app/serializers/tutoriallandscape.js create mode 100644 app/templates/tutorial/index.js diff --git a/addon/adapters/tutoriallandscape.js b/addon/adapters/tutoriallandscape.js index 7cefe0d..4ac473b 100644 --- a/addon/adapters/tutoriallandscape.js +++ b/addon/adapters/tutoriallandscape.js @@ -41,7 +41,7 @@ export default JSONAPIAdapter.extend(DataAdapterMixin,{ // Overrides URL for model.save() urlForCreateRecord() { const baseUrl = this.buildURL(); - return `${baseUrl}/v1/tutorials/landscapes/`; + return `${baseUrl}/v1/tutorials/landscapes/import`; }, diff --git a/addon/controllers/tutorial/edit/tutorial.js b/addon/controllers/tutorial/edit/tutorial.js index dd3ec5c..98e18b2 100644 --- a/addon/controllers/tutorial/edit/tutorial.js +++ b/addon/controllers/tutorial/edit/tutorial.js @@ -1,6 +1,9 @@ import Controller from '@ember/controller'; +import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Controller.extend({ +export default Controller.extend(AlertifyHandler,{ + landscapeservice:service('tutorial-landscape'), actions:{ saveTutorialChanges(tutorial) { if(tutorial) { diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index efa4cbc..2ad8a46 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -1,5 +1,7 @@ -import Landscape from 'explorviz-frontend/models/landscape'; - -export default Landscape.extend({ +import DS from 'ember-data'; +export default DS.Model.extend({ + timestamp: DS.attr('String'), + //landscape: DS.attr('String'), + landscape: DS.belongsTo('landscape',{inverse: null}), }); diff --git a/addon/routes/tutorial/create/sequence.js b/addon/routes/tutorial/create/sequence.js index 87e807f..4865f9c 100644 --- a/addon/routes/tutorial/create/sequence.js +++ b/addon/routes/tutorial/create/sequence.js @@ -3,5 +3,9 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; export default BaseRoute.extend(AuthenticatedRouteMixin, { - + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/routes/tutorial/create/step.js b/addon/routes/tutorial/create/step.js index 87e807f..4865f9c 100644 --- a/addon/routes/tutorial/create/step.js +++ b/addon/routes/tutorial/create/step.js @@ -3,5 +3,9 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; export default BaseRoute.extend(AuthenticatedRouteMixin, { - + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/routes/tutorial/edit/tutorial.js b/addon/routes/tutorial/edit/tutorial.js index ac1db60..3253346 100644 --- a/addon/routes/tutorial/edit/tutorial.js +++ b/addon/routes/tutorial/edit/tutorial.js @@ -3,7 +3,11 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { - return this.store.findRecord('tutorial', params.tutorial_id); + return this.store.findRecord('tutorial', params.tutorial_id);; + }, + setupController(controller, model) { + this._super(...arguments); + controller.get('landscapeservice').loadTutorialLandscape(model); }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/list/sequence.js b/addon/routes/tutorial/list/sequence.js index 6c391b0..1455632 100644 --- a/addon/routes/tutorial/list/sequence.js +++ b/addon/routes/tutorial/list/sequence.js @@ -7,5 +7,10 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { return RSVP.hash({ sequences: this.get('store').findAll('sequence') }); - } + }, + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/routes/tutorial/list/step.js b/addon/routes/tutorial/list/step.js index 6cfc9d1..552574c 100644 --- a/addon/routes/tutorial/list/step.js +++ b/addon/routes/tutorial/list/step.js @@ -7,5 +7,10 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { return RSVP.hash({ steps: this.get('store').findAll('step') }); - } + }, + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/routes/tutorial/list/tutorial.js b/addon/routes/tutorial/list/tutorial.js index e34f577..961cdf3 100644 --- a/addon/routes/tutorial/list/tutorial.js +++ b/addon/routes/tutorial/list/tutorial.js @@ -7,5 +7,10 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { return RSVP.hash({ tutorials: this.get('store').findAll('tutorial') }); - } + }, + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } }); diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js new file mode 100644 index 0000000..ca16471 --- /dev/null +++ b/addon/serializers/tutoriallandscape.js @@ -0,0 +1,21 @@ +import JSONAPISerializer from 'ember-data/serializers/json-api'; +import SaveRelationshipsMixin from 'ember-data-save-relationships'; + +export default JSONAPISerializer.extend(SaveRelationshipsMixin, { + attrs: { + landscape: { serialize: true } + }, + serialize(snapshot, options) { + let json = this._super(...arguments); + json.data.attributes.landscape=JSON.stringify(json.data.relationships.landscape); + delete json.data.relationships.landscape; + return json; + }, + normalizeResponse(store, primaryModelClass, payload, id, requestType) { + payload.data.relationships={}; + payload.data.relationships.landscape=JSON.parse(payload.data.attributes.landscape); + console.log(payload); + delete payload.data.attributes.landscape; + return this._super(store, primaryModelClass, payload, id, requestType); + } +}); \ No newline at end of file diff --git a/addon/services/tutorial-landscape.js b/addon/services/tutorial-landscape.js index 4aac5f2..e8d212a 100644 --- a/addon/services/tutorial-landscape.js +++ b/addon/services/tutorial-landscape.js @@ -1,22 +1,29 @@ import Service from '@ember/service'; import Evented from '@ember/object/evented'; import debugLogger from 'ember-debug-logger'; +import { inject as service } from "@ember/service"; export default Service.extend(Evented, { debug: debugLogger(), + store: service(), tutorialLandscape: null, - loadTutorialLandscape(tutorial){ - if(this.tutorialLandscape!==null){ - this.get('store').unloadRecord(this.tutorialLandscape); - } - this.set('tutorialLandscape',this.get('store').queryRecord('tutoriallandscape', {timestamp: tutorial.landscapeTimestamp }).then(landscape => { - if(landcape===null){ - landscape = this.get('store').queryRecord('landscape', {timestamp: tutorial.landscapeTimestamp }).then(landscape => { - landscape=this.get('store').createRecord("tutoriallandscape",landcape); - landscape.save(); - return landscape; + loadTutorialLandscape(tutorial) { + if (this.tutorialLandscape !== null) { + this.get('store').unloadRecord(this.tutorialLandscape); + } + this.set( + 'tutorialLandscape', + this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + return landscape; + }, () => { + var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", { + timestamp: tutorial.landscapeTimestamp, + landscape: landscape }); - } + tutoriallandscape.save(); + return tutoriallandscape; + }); return landscape; }) ); diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs index cfa244d..62a4d37 100644 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -13,11 +13,9 @@ {{form.element controlType="number" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} - {{#if model.landscape.isFulfilled}} - {{#link-to "tutorial.edit.tutorial.landscape" model}}edit landscape{{/link-to}} - {{else}} - {{#link-to "tutorial.edit.tutorial.landscape" model}}select landscape{{/link-to}} - {{/if}} + {{#link-to "tutorial.edit.tutorial.landscape" model}} + {{#if landscapeservice.tutorialLandscape.isFulfilled}}edit landscape{{else}}select landscape{{/if}} + {{/link-to}}

Sequences

diff --git a/app/serializers/tutoriallandscape.js b/app/serializers/tutoriallandscape.js new file mode 100644 index 0000000..f13ae16 --- /dev/null +++ b/app/serializers/tutoriallandscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/serializers/tutoriallandscape'; diff --git a/app/templates/tutorial/index.js b/app/templates/tutorial/index.js new file mode 100644 index 0000000..d696132 --- /dev/null +++ b/app/templates/tutorial/index.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial//tutorial'; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1462063..784f9b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4729,6 +4729,89 @@ "semver": "^5.3.0" } }, + "ember-data-save-relationships": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/ember-data-save-relationships/-/ember-data-save-relationships-0.0.10.tgz", + "integrity": "sha1-vXigw+p2J8KjHumlAzIp+jZt8Sc=", + "dev": true, + "requires": { + "ember-cli-babel": "^6.12.0" + }, + "dependencies": { + "amd-name-resolver": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/amd-name-resolver/-/amd-name-resolver-1.2.0.tgz", + "integrity": "sha512-hlSTWGS1t6/xq5YCed7YALg7tKZL3rkl7UwEZ/eCIkn8JxmM6fU6Qs/1hwtjQqfuYxlffuUcgYEm0f5xP4YKaA==", + "dev": true, + "requires": { + "ensure-posix-path": "^1.0.1" + } + }, + "broccoli-babel-transpiler": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/broccoli-babel-transpiler/-/broccoli-babel-transpiler-6.5.1.tgz", + "integrity": "sha512-w6GcnkxvHcNCte5FcLGEG1hUdQvlfvSN/6PtGWU/otg69Ugk8rUk51h41R0Ugoc+TNxyeFG1opRt2RlA87XzNw==", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "broccoli-funnel": "^2.0.1", + "broccoli-merge-trees": "^2.0.0", + "broccoli-persistent-filter": "^1.4.3", + "clone": "^2.0.0", + "hash-for-dep": "^1.2.3", + "heimdalljs-logger": "^0.1.7", + "json-stable-stringify": "^1.0.0", + "rsvp": "^4.8.2", + "workerpool": "^2.3.0" + } + }, + "broccoli-merge-trees": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/broccoli-merge-trees/-/broccoli-merge-trees-2.0.1.tgz", + "integrity": "sha512-WjaexJ+I8BxP5V5RNn6um/qDRSmKoiBC/QkRi79FT9ClHfldxRyCDs9mcV7mmoaPlsshmmPaUz5jdtcKA6DClQ==", + "dev": true, + "requires": { + "broccoli-plugin": "^1.3.0", + "merge-trees": "^1.0.1" + } + }, + "ember-cli-babel": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/ember-cli-babel/-/ember-cli-babel-6.18.0.tgz", + "integrity": "sha512-7ceC8joNYxY2wES16iIBlbPSxwKDBhYwC8drU3ZEvuPDMwVv1KzxCNu1fvxyFEBWhwaRNTUxSCsEVoTd9nosGA==", + "dev": true, + "requires": { + "amd-name-resolver": "1.2.0", + "babel-plugin-debug-macros": "^0.2.0-beta.6", + "babel-plugin-ember-modules-api-polyfill": "^2.6.0", + "babel-plugin-transform-es2015-modules-amd": "^6.24.0", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.7.0", + "broccoli-babel-transpiler": "^6.5.0", + "broccoli-debug": "^0.6.4", + "broccoli-funnel": "^2.0.0", + "broccoli-source": "^1.1.0", + "clone": "^2.0.0", + "ember-cli-version-checker": "^2.1.2", + "semver": "^5.5.0" + } + }, + "merge-trees": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-trees/-/merge-trees-1.0.1.tgz", + "integrity": "sha1-zL5nRWl4f53vF/1G5lJfVwC70j4=", + "dev": true, + "requires": { + "can-symlink": "^1.0.0", + "fs-tree-diff": "^0.5.4", + "heimdalljs": "^0.2.1", + "heimdalljs-logger": "^0.1.7", + "rimraf": "^2.4.3", + "symlink-or-copy": "^1.0.0" + } + } + } + }, "ember-disable-prototype-extensions": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/ember-disable-prototype-extensions/-/ember-disable-prototype-extensions-1.1.3.tgz", @@ -6610,8 +6693,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -6632,14 +6714,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6654,20 +6734,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -6784,8 +6861,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -6797,7 +6873,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6812,7 +6887,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6820,14 +6894,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6846,7 +6918,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6927,8 +6998,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -6940,7 +7010,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7026,8 +7095,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -7063,7 +7131,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7083,7 +7150,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7127,14 +7193,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/package.json b/package.json index 77d0bce..686bf05 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "ember-cli-sri": "^2.1.1", "ember-cli-template-lint": "^1.0.0-beta.1", "ember-cli-uglify": "^2.1.0", + "ember-data-save-relationships": "0.0.10", "ember-disable-prototype-extensions": "^1.1.3", "ember-export-application-global": "^2.0.0", "ember-load-initializers": "^1.1.0", From d9ec632700c0ed9961426e6bc913a074a5daff1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Wed, 17 Apr 2019 18:03:11 +0200 Subject: [PATCH 11/30] model changes --- addon/models/tutoriallandscape.js | 7 +++---- addon/models/tutorialtimestamp.js | 4 ++++ app/models/tutorialtimestamp.js | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 addon/models/tutorialtimestamp.js create mode 100644 app/models/tutorialtimestamp.js diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index 2ad8a46..9bcaea0 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -1,7 +1,6 @@ import DS from 'ember-data'; +import Landscape from "explorviz-frontend/model/landscape" -export default DS.Model.extend({ - timestamp: DS.attr('String'), - //landscape: DS.attr('String'), - landscape: DS.belongsTo('landscape',{inverse: null}), +export default Landscape.extend({ + timestamp: DS.belongsTo('tutorialtimestamp'), }); diff --git a/addon/models/tutorialtimestamp.js b/addon/models/tutorialtimestamp.js new file mode 100644 index 0000000..17c698c --- /dev/null +++ b/addon/models/tutorialtimestamp.js @@ -0,0 +1,4 @@ +import Timestamp from "explorviz-frontend/model/timestamp" +export default Timestamp.extend({ + name: DS.attr('String') +}); \ No newline at end of file diff --git a/app/models/tutorialtimestamp.js b/app/models/tutorialtimestamp.js new file mode 100644 index 0000000..0ef2d37 --- /dev/null +++ b/app/models/tutorialtimestamp.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/models/tutorialtimestamp'; From 85d7fb48a7ebb877282ae42e5091ce1d8ddb5fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Sun, 21 Apr 2019 22:43:53 +0200 Subject: [PATCH 12/30] landscape loading on tutorial reload --- addon/adapters/tutorialtimestamp.js | 53 +++++++++++++++++++ addon/components/landscape-interaction.js | 6 +++ .../landscape-select/landscapelist.js | 2 +- .../landscape-select/navbar/save-landscape.js | 6 --- addon/components/landscape-visualization.js | 6 +++ addon/components/tutorial-management.js | 1 - .../tutorial/edit/tutorial/landscape.js | 1 - addon/controllers/tutorial/list/landscape.js | 4 ++ addon/models/tutoriallandscape.js | 2 +- addon/models/tutorialtimestamp.js | 6 ++- .../tutorial/edit/tutorial/landscape.js | 5 ++ addon/serializers/tutoriallandscape.js | 41 ++++++++------ addon/services/tutorial-landscape.js | 39 +++++++++----- .../components/landscape-interaction.hbs | 1 + .../landscape-select/landscapelist.hbs | 2 +- .../components/landscape-visualization.hbs | 1 + addon/templates/tutorial/edit/tutorial.hbs | 4 +- .../tutorial/edit/tutorial/landscape.hbs | 20 ++++--- app/adapters/tutorialtimestamp.js | 1 + app/components/landscape-interaction.js | 1 + app/components/landscape-visualization.js | 1 + app/controllers/tutorial/list/landscape.js | 1 + app/services/landscape.js | 1 + package-lock.json | 41 ++++++++++---- .../components/landscape-interaction-test.js | 26 +++++++++ .../landscape-visualization-test.js | 26 +++++++++ .../tutorial/list/landscape-test.js | 12 +++++ tests/unit/services/landscape-test.js | 12 +++++ 28 files changed, 257 insertions(+), 65 deletions(-) create mode 100644 addon/adapters/tutorialtimestamp.js create mode 100644 addon/components/landscape-interaction.js create mode 100644 addon/components/landscape-visualization.js create mode 100644 addon/controllers/tutorial/list/landscape.js create mode 100644 addon/templates/components/landscape-interaction.hbs create mode 100644 addon/templates/components/landscape-visualization.hbs create mode 100644 app/adapters/tutorialtimestamp.js create mode 100644 app/components/landscape-interaction.js create mode 100644 app/components/landscape-visualization.js create mode 100644 app/controllers/tutorial/list/landscape.js create mode 100644 app/services/landscape.js create mode 100644 tests/integration/components/landscape-interaction-test.js create mode 100644 tests/integration/components/landscape-visualization-test.js create mode 100644 tests/unit/controllers/tutorial/list/landscape-test.js create mode 100644 tests/unit/services/landscape-test.js diff --git a/addon/adapters/tutorialtimestamp.js b/addon/adapters/tutorialtimestamp.js new file mode 100644 index 0000000..de5106f --- /dev/null +++ b/addon/adapters/tutorialtimestamp.js @@ -0,0 +1,53 @@ +import JSONAPIAdapter from 'ember-data/adapters/json-api'; +import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; +import ENV from 'explorviz-frontend/config/environment'; + +export default JSONAPIAdapter.extend(DataAdapterMixin,{ + + host: ENV.APP.API_ROOT, + + init() { + + this.set('headers', { + "Accept": "application/vnd.api+json" + }); + + }, + + urlForUpdateRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/timestamps/${id}`; + }, + + urlForDeleteRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/timestamps/${id}`; + }, + urlForFindAll() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/timestamps/`; + }, + // @Override + urlForQueryRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/timestamps/`; + }, + urlForFindRecord(id) { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/timestamps/${id}`; + }, + + // @Override + // Overrides URL for model.save() + urlForCreateRecord() { + const baseUrl = this.buildURL(); + return `${baseUrl}/v1/tutorials/timestamps/import`; + }, + + + authorize(xhr) { + let { access_token } = this.get('session.data.authenticated'); + xhr.setRequestHeader('Authorization', `Bearer ${access_token}`); + } + +}); diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js new file mode 100644 index 0000000..d67846c --- /dev/null +++ b/addon/components/landscape-interaction.js @@ -0,0 +1,6 @@ +import Component from '@ember/component'; +import layout from '../templates/components/landscape-interaction'; + +export default Component.extend({ + layout +}); diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js index 7d61478..93174f6 100644 --- a/addon/components/landscape-select/landscapelist.js +++ b/addon/components/landscape-select/landscapelist.js @@ -9,7 +9,7 @@ export default Component.extend({ landscapes: null, init(){ this._super(...arguments); - this.updateLandscapeList(true); + this.updateLandscapeList(); }, updateLandscapeList(reload) { diff --git a/addon/components/landscape-select/navbar/save-landscape.js b/addon/components/landscape-select/navbar/save-landscape.js index 9a504f9..dc0ae06 100644 --- a/addon/components/landscape-select/navbar/save-landscape.js +++ b/addon/components/landscape-select/navbar/save-landscape.js @@ -11,12 +11,6 @@ export default Component.extend(AlertifyHandler,{ layout, actions:{ saveLandscape(){ - this.get('store').findAll('tutoriallandscape',true) - .then(landscapes => { - let landscape = landscapes.find((landscape)=>landscape.id===this.get('landscape').id); - this.get('tutorial').set('landscapeTimestamp',landscape.get('timestamp')); - this.get('tutorial').save(); - }); }, }, handleMessageForUser(pauseReload) { diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js new file mode 100644 index 0000000..b113466 --- /dev/null +++ b/addon/components/landscape-visualization.js @@ -0,0 +1,6 @@ +import Component from '@ember/component'; +import layout from '../templates/components/landscape-visualization'; +import LandscapeVisualization from 'explorviz-frontend/controller/visualization' +export default Component.extend(LandscapeVisualization,{ + layout +}); diff --git a/addon/components/tutorial-management.js b/addon/components/tutorial-management.js index 3498c0a..0c8f5a4 100644 --- a/addon/components/tutorial-management.js +++ b/addon/components/tutorial-management.js @@ -40,7 +40,6 @@ landscapeRepo: service("repos/landscape-repository"), openEditTutorialPage(tutorial){ this.set('page', 'editTutorial'); this.set('currentTutorial', tutorial); - console.log(tutorial.landscape); this.setProperties({ tutorial_id_change: tutorial.id, tutorial_title_change: tutorial.title, diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js index 46a6b39..5e58b6c 100644 --- a/addon/controllers/tutorial/edit/tutorial/landscape.js +++ b/addon/controllers/tutorial/edit/tutorial/landscape.js @@ -20,7 +20,6 @@ export default Controller.extend(AlertifyHandler,{ this.get('landscapeListener').initSSE(); this.get('landscapeListener').pauseVisualizationReload=true; }, - actions:{ saveLandscape(model,timestamp){ this.get("model").set("landscapeTimestamp",timestamp); diff --git a/addon/controllers/tutorial/list/landscape.js b/addon/controllers/tutorial/list/landscape.js new file mode 100644 index 0000000..d630f31 --- /dev/null +++ b/addon/controllers/tutorial/list/landscape.js @@ -0,0 +1,4 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ +}); diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index 9bcaea0..5bbfe3d 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -1,5 +1,5 @@ import DS from 'ember-data'; -import Landscape from "explorviz-frontend/model/landscape" +import Landscape from "explorviz-frontend/models/landscape" export default Landscape.extend({ timestamp: DS.belongsTo('tutorialtimestamp'), diff --git a/addon/models/tutorialtimestamp.js b/addon/models/tutorialtimestamp.js index 17c698c..053381b 100644 --- a/addon/models/tutorialtimestamp.js +++ b/addon/models/tutorialtimestamp.js @@ -1,4 +1,6 @@ -import Timestamp from "explorviz-frontend/model/timestamp" +import Timestamp from "explorviz-frontend/models/timestamp" +import DS from 'ember-data'; + export default Timestamp.extend({ name: DS.attr('String') -}); \ No newline at end of file +}); diff --git a/addon/routes/tutorial/edit/tutorial/landscape.js b/addon/routes/tutorial/edit/tutorial/landscape.js index ff2898f..bea414e 100644 --- a/addon/routes/tutorial/edit/tutorial/landscape.js +++ b/addon/routes/tutorial/edit/tutorial/landscape.js @@ -8,6 +8,11 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { return this.store.findRecord('tutorial', params.tutorial_id); }, + setupController(controller, model) { + controller.get('tutorialLandscape').loadTutorialLandscape(model); + //this._super(controller, model); + }, + actions: { // @Override BaseRoute resetRoute() { diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index ca16471..95a6f5c 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -1,21 +1,32 @@ -import JSONAPISerializer from 'ember-data/serializers/json-api'; -import SaveRelationshipsMixin from 'ember-data-save-relationships'; - -export default JSONAPISerializer.extend(SaveRelationshipsMixin, { - attrs: { - landscape: { serialize: true } - }, +import LandscapeSerializer from "explorviz-frontend/serializers/landscape" + +export default LandscapeSerializer.extend({ serialize(snapshot, options) { let json = this._super(...arguments); - json.data.attributes.landscape=JSON.stringify(json.data.relationships.landscape); - delete json.data.relationships.landscape; + debugger; + + json.data.attributes.landscape=JSON.stringify(json); + json.data.relationships={tutorialtimestamp: {data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}}; + json.included=[{ + type:"tutorialtimestamp", + id:snapshot.record.get('timestamp').get('id'), + attributes: { + name:snapshot.record.get('timestamp').get('name'), + timestamp:snapshot.record.get('timestamp').get('timestamp') + } + }]; + return json; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { - payload.data.relationships={}; - payload.data.relationships.landscape=JSON.parse(payload.data.attributes.landscape); - console.log(payload); - delete payload.data.attributes.landscape; - return this._super(store, primaryModelClass, payload, id, requestType); + if(Array.isArray(payload.data)){ + var json = {data:[]}; + payload.data.forEach(function(v,k){ + json.data[k]=JSON.parse(v.attributes.landscape).data; + }); + }else{ + var json = JSON.parse(payload.data.attributes.landscape); + } + return this._super(store, primaryModelClass, json, id, requestType); } -}); \ No newline at end of file +}); diff --git a/addon/services/tutorial-landscape.js b/addon/services/tutorial-landscape.js index e8d212a..3637337 100644 --- a/addon/services/tutorial-landscape.js +++ b/addon/services/tutorial-landscape.js @@ -7,25 +7,38 @@ export default Service.extend(Evented, { debug: debugLogger(), store: service(), tutorialLandscape: null, + tutorialTimestamp: null, loadTutorialLandscape(tutorial) { if (this.tutorialLandscape !== null) { this.get('store').unloadRecord(this.tutorialLandscape); } - this.set( - 'tutorialLandscape', - this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { - return landscape; - }, () => { + this.set('tutorialTimestamp',tutorial.landscapeTimestamp); + var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + debugger; + this.set('tutorialLandscape',landscape); + }, (e) => { var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", { - timestamp: tutorial.landscapeTimestamp, - landscape: landscape + var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", + { + id:landscape.get('timestamp').get('id'), + timestamp:landscape.get('timestamp').get('timestamp'), + totalRequests:landscape.get('timestamp').get('totalRequests'), + name:"unnamed timestamp", + }); + tutorialtimestamp.save().then(()=>{ + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", + { + id: landscape.get('id'), + events: landscape.get('events'), + systems: landscape.get('systems'), + totalApplicationCommunications: landscape.get('totalApplicationCommunications'), + timestamp: tutorialtimestamp , }); + debugger; tutoriallandscape.save(); - return tutoriallandscape; + this.set('tutorialLandscape',tutoriallandscape); + }); }); - return landscape; - }) - ); + }); }, -}) \ No newline at end of file +}) diff --git a/addon/templates/components/landscape-interaction.hbs b/addon/templates/components/landscape-interaction.hbs new file mode 100644 index 0000000..fb5c4b1 --- /dev/null +++ b/addon/templates/components/landscape-interaction.hbs @@ -0,0 +1 @@ +{{yield}} \ No newline at end of file diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index 0a332eb..f812684 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -1,5 +1,5 @@ Possible Landscapes: {{#each landscapes as |landscape|}} - {{landscape.landscapeTimestamp}} + {{landscape}} {{/each}} diff --git a/addon/templates/components/landscape-visualization.hbs b/addon/templates/components/landscape-visualization.hbs new file mode 100644 index 0000000..fb5c4b1 --- /dev/null +++ b/addon/templates/components/landscape-visualization.hbs @@ -0,0 +1 @@ +{{yield}} \ No newline at end of file diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs index 62a4d37..1a006af 100644 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -13,8 +13,8 @@ {{form.element controlType="number" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} - {{#link-to "tutorial.edit.tutorial.landscape" model}} - {{#if landscapeservice.tutorialLandscape.isFulfilled}}edit landscape{{else}}select landscape{{/if}} + {{#link-to "tutorial.edit.tutorial.landscape" model}} + {{#if landscapeservice.tutorialLandscape}}edit landscape{{else}}select landscape{{/if}} {{/link-to}}

Sequences

diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs index f723687..cf648ea 100644 --- a/addon/templates/tutorial/edit/tutorial/landscape.hbs +++ b/addon/templates/tutorial/edit/tutorial/landscape.hbs @@ -1,21 +1,19 @@

Tutorial "{{model.title}}"

- Id:{{#if landscapeInteraction.landscapeTimestamp}}{{landscapeInteraction.landscapeTimestamp}}{{else}}{{model.landscapeTimestamp}}{{/if}} - {{#if model.landscape.isFulfilled}} - - +{{tutorialLandscape.tutorialLandscape.timestamp}} + {{#if tutorialLandscape.tutorialLandscape}} {{visualization/page-setup/visualization-navbar content=(array - (component "landscape-select/navbar/toggle-live-landscape" class="nav-item" toggle=tutorialLandscape) - (component "landscape-select/navbar/save-landscape" class="nav-item" tutorial=model) - (component "landscape-select/navbar/return-to-saved" class="nav-item" tutorial=model toggle=tutorialLandscape) + (component "landscape-select/navbar/toggle-live-landscape" class="nav-item" toggle=hasTutorialLandscape) + ) }} -Showing live-landscapes: {{not tutorialLandscape}} +Showing live-landscapes: {{not hasTutorialLandscape}}
- {{#if (and tutorialLandscape model.landscape.isFulfilled)}} - {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction}} + {{#if hasTutorialLandscape}} + {{tutorialLandscape.tutorialLandscape.landscape}} + {{!-- {{visualization/rendering/landscape-rendering latestLandscape=tutorialLandscape.tutorialLandscape.landscape interaction=landscapeInteraction}} --}} {{landscape-select/landscapelist}} {{else}} {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} @@ -39,7 +37,7 @@ Showing live-landscapes: {{not tutorialLandscape}} {{else}}
-

Landscape loading for "{{model.landscapeTimestamp}}"!

+

Landscape loading for "{{landscapeservice.tutorialTimestamp}}"!

{{ember-spinner}}
diff --git a/app/adapters/tutorialtimestamp.js b/app/adapters/tutorialtimestamp.js new file mode 100644 index 0000000..f724475 --- /dev/null +++ b/app/adapters/tutorialtimestamp.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/adapters/tutorialtimestamp'; diff --git a/app/components/landscape-interaction.js b/app/components/landscape-interaction.js new file mode 100644 index 0000000..0afe532 --- /dev/null +++ b/app/components/landscape-interaction.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-interaction'; \ No newline at end of file diff --git a/app/components/landscape-visualization.js b/app/components/landscape-visualization.js new file mode 100644 index 0000000..a506142 --- /dev/null +++ b/app/components/landscape-visualization.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-visualization'; \ No newline at end of file diff --git a/app/controllers/tutorial/list/landscape.js b/app/controllers/tutorial/list/landscape.js new file mode 100644 index 0000000..d21d731 --- /dev/null +++ b/app/controllers/tutorial/list/landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/list/landscape'; diff --git a/app/services/landscape.js b/app/services/landscape.js new file mode 100644 index 0000000..3d0f8d3 --- /dev/null +++ b/app/services/landscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/services/landscape'; diff --git a/package-lock.json b/package-lock.json index 784f9b2..82019f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6693,7 +6693,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6714,12 +6715,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6734,17 +6737,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6861,7 +6867,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6873,6 +6880,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6887,6 +6895,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6894,12 +6903,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6918,6 +6929,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6998,7 +7010,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7010,6 +7023,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7095,7 +7109,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7131,6 +7146,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7150,6 +7166,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7193,12 +7210,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/tests/integration/components/landscape-interaction-test.js b/tests/integration/components/landscape-interaction-test.js new file mode 100644 index 0000000..92902b0 --- /dev/null +++ b/tests/integration/components/landscape-interaction-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-interaction', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-interaction}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-interaction}} + template block text + {{/landscape-interaction}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/landscape-visualization-test.js b/tests/integration/components/landscape-visualization-test.js new file mode 100644 index 0000000..024d818 --- /dev/null +++ b/tests/integration/components/landscape-visualization-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | landscape-visualization', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{landscape-visualization}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#landscape-visualization}} + template block text + {{/landscape-visualization}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/controllers/tutorial/list/landscape-test.js b/tests/unit/controllers/tutorial/list/landscape-test.js new file mode 100644 index 0000000..2910eb2 --- /dev/null +++ b/tests/unit/controllers/tutorial/list/landscape-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/list/landscape', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/list/landscape'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/services/landscape-test.js b/tests/unit/services/landscape-test.js new file mode 100644 index 0000000..597f24e --- /dev/null +++ b/tests/unit/services/landscape-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Service | landscape', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let service = this.owner.lookup('service:landscape'); + assert.ok(service); + }); +}); From 3495d4c4d9a4ad9a3a38aee787505f858370b8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 22 Apr 2019 15:41:52 +0200 Subject: [PATCH 13/30] restructure --- .../landscape-select/landscapelist.js | 19 +---- .../landscape-select/navbar/save-landscape.js | 5 -- .../navbar/toggle-live-landscape.js | 13 +-- addon/components/landscape-select/timeline.js | 5 +- addon/controllers/tutorial.js | 52 +----------- addon/controllers/tutorial/edit/tutorial.js | 29 ++----- .../tutorial/edit/tutorial/landscape.js | 24 +----- addon/routes/tutorial.js | 3 - addon/routes/tutorial/edit/tutorial.js | 5 +- .../tutorial/edit/tutorial/landscape.js | 7 +- addon/serializers/tutoriallandscape.js | 2 - addon/services/landscape-service.js | 72 +++++++++++++++++ addon/services/tutorial-landscape.js | 44 ----------- addon/services/tutorial-service.js | 42 ++++++++++ .../landscape-select/landscapelist.hbs | 15 ++-- .../navbar/toggle-live-landscape.hbs | 2 +- .../components/landscape-visualization.hbs | 2 +- addon/templates/tutorial.hbs | 2 +- addon/templates/tutorial/edit/tutorial.hbs | 4 +- .../tutorial/edit/tutorial/landscape.hbs | 79 +++++++++---------- ...rial-landscape.js => landscape-service.js} | 2 +- .../{landscape.js => tutorial-service.js} | 2 +- 22 files changed, 195 insertions(+), 235 deletions(-) create mode 100644 addon/services/landscape-service.js delete mode 100644 addon/services/tutorial-landscape.js create mode 100644 addon/services/tutorial-service.js rename app/services/{tutorial-landscape.js => landscape-service.js} (68%) rename app/services/{landscape.js => tutorial-service.js} (70%) diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js index 93174f6..2124541 100644 --- a/addon/components/landscape-select/landscapelist.js +++ b/addon/components/landscape-select/landscapelist.js @@ -5,21 +5,6 @@ import {inject as service} from '@ember/service'; export default Component.extend({ layout, store: service(), - landscapeListener: service("landscape-listener"), - landscapes: null, - init(){ - this._super(...arguments); - this.updateLandscapeList(); - }, - - updateLandscapeList(reload) { - this.set('landscapes', []); - this.get('store').findAll('tutoriallandscape', { reload }) - .then(landscapes => { - let landscapeList = landscapes.toArray(); - // sort by id - landscapeList.sort((landscape1, landscape2) => parseInt(landscape1.id) < parseInt(landscape2.id) ? -1 : 1); - this.set('landscapes', landscapeList); - }); - }, + landscapeListener: service(), + landscapeService: service(), }); diff --git a/addon/components/landscape-select/navbar/save-landscape.js b/addon/components/landscape-select/navbar/save-landscape.js index dc0ae06..04d096d 100644 --- a/addon/components/landscape-select/navbar/save-landscape.js +++ b/addon/components/landscape-select/navbar/save-landscape.js @@ -7,12 +7,7 @@ export default Component.extend(AlertifyHandler,{ tagName:'li', store: service(), landscapeListener: service("landscape-listener"), - toggle:null, layout, - actions:{ - saveLandscape(){ - }, - }, handleMessageForUser(pauseReload) { if(!pauseReload){ this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); diff --git a/addon/components/landscape-select/navbar/toggle-live-landscape.js b/addon/components/landscape-select/navbar/toggle-live-landscape.js index 4c3d052..c0511b1 100644 --- a/addon/components/landscape-select/navbar/toggle-live-landscape.js +++ b/addon/components/landscape-select/navbar/toggle-live-landscape.js @@ -5,19 +5,20 @@ import {inject as service} from '@ember/service'; export default Component.extend(AlertifyHandler,{ tagName:'li', - landscapeListener: service("landscape-listener"), - toggle:null, + landscapeListener: service(), + landscapeService: service(), layout, actions:{ toggleVisualizationReload() { - this.set('toggle',!this.get('toggle')); - const pauseReload = this.get('landscapeListener').pauseVisualizationReload; - this.handleMessageForUser(pauseReload); this.get('landscapeListener').toggleVisualizationReload(); + if(this.get('landscapeListener').pauseVisualizationReload){ + this.get('landscapeService').set('selected',null); + } + this.handleMessageForUser(this.get('landscapeListener').pauseVisualizationReload); } }, handleMessageForUser(pauseReload) { - if(!pauseReload){ + if(pauseReload){ this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); } else { diff --git a/addon/components/landscape-select/timeline.js b/addon/components/landscape-select/timeline.js index 0b3263d..75f3332 100644 --- a/addon/components/landscape-select/timeline.js +++ b/addon/components/landscape-select/timeline.js @@ -8,7 +8,8 @@ export default Timeline.extend({ this._super(...arguments); var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; this.get('landscapeListener').set('pauseVisualizationReload',true); - - this.set("landscapeTimestamp",tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); + this.get('landscapeListener').set("landscapeTimestamp",tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); + this.get('landscapeService').selectLandscape(this.get('landscapeListener').get("landscapeTimestamp")); + //this.await.clearRender(); } }); diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index ca22cf9..6a8005d 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -4,58 +4,8 @@ import { inject as service } from "@ember/service"; export default Controller.extend({ store: service(), renderingService: service("rendering-service"), - updateModel() { + updateModel() { // update your entity and then call this.get('renderingService').redrawScene(); }, - - tutorials: null, - - - init() { - this._super(...arguments); - this.updateTutorialList(true); - }, -updateTutorialList(reload) { - this.set('tutorials', []); - this.get('store').findAll('tutorial', { reload }) - .then(tutorials => { - let tutorialList = tutorials.toArray(); - // sort by id - tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); - this.set('tutorials', tutorialList); - }); -}, -saveTutorialChanges() { - const tutorialData = this.getProperties('tutorial_id_change', 'tutorial_title_change'); - - const tutorial = this.get('tutorials').find( tutorial => tutorial.get('id') == tutorialData.tutorial_id_change); - - if(tutorial) { - // check for valid input - if(!tutorialData.tutorial_title_change || tutorialData.tutorial_title_change.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - if(tutorial.get('title') !== tutorialData.tutorial_title_change) - tutorial.set('title', tutorialData.tutorial_title_change); - - tutorial.save() - .then(()=> { - const message = `Tutorial updated.`; - this.showAlertifyMessage(message); - this.setProperties({ - tutorial_id_change: "", - tutorial_title_change: "" - }); - this.actions.openMainPage.bind(this)(); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Tutorial not found.`); - } -}, - }); diff --git a/addon/controllers/tutorial/edit/tutorial.js b/addon/controllers/tutorial/edit/tutorial.js index 98e18b2..034af4c 100644 --- a/addon/controllers/tutorial/edit/tutorial.js +++ b/addon/controllers/tutorial/edit/tutorial.js @@ -3,30 +3,11 @@ import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Controller.extend(AlertifyHandler,{ - landscapeservice:service('tutorial-landscape'), + tutorialService:service(), + landscapeService:service(), actions:{ - saveTutorialChanges(tutorial) { - if(tutorial) { - - // check for valid input - if(!tutorial.get('title') || tutorial.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; + saveTutorialChanges(tutorial){ + this.get('tutorialService').saveTutorialChanges(tutorial); } - tutorial.save() - .then(()=> { - const message = `Tutorial updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Tutorial not found.`); - } - }, -}, -showReasonErrorAlert(reason) { - const {title, detail} = reason.errors[0]; - this.showAlertifyMessage(`${title}: ${detail}`); -}, + } }); diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js index 5e58b6c..3bdf1b3 100644 --- a/addon/controllers/tutorial/edit/tutorial/landscape.js +++ b/addon/controllers/tutorial/edit/tutorial/landscape.js @@ -11,35 +11,15 @@ export default Controller.extend(AlertifyHandler,{ store: service(), targetType: null, targetId:null, - hasTutorialLandscape: true, - tutorialLandscape: service(), + landscapeService: service(), renderingService: service("rendering-service"), landscapeRepo: service("repos/landscape-repository"), landscapeListener: service("landscape-listener"), init(){ this.get('landscapeListener').initSSE(); - this.get('landscapeListener').pauseVisualizationReload=true; + this.get('landscapeListener').set('pauseVisualizationReload',true); }, actions:{ - saveLandscape(model,timestamp){ - this.get("model").set("landscapeTimestamp",timestamp); - this.get("model").save(); - this.get("store").queryRecord('tutoriallandscape', {timestamp: timestamp}).then(() =>{ - model.set('landscapeTimestamp',timestamp); - model.save().then(()=>{ - const message = "Landscape for Tutorial " + tutorialData.title + " was saved."; - this.showAlertifyMessage(message); - }); - },()=>{ - this.get("store").queryRecord('landscape', {timestamp: timestamp}).then((landscape) => { - const tutorialLandscape = this.get("store").createRecord("tutoriallandscape",landscape); - tutorialLandscape.save().then(() =>{ - const message = "Landscape for Tutorial " + tutorialData.title + " was imported and saved."; - this.showAlertifyMessage(message); - }); - }); - }); - }, resetView() { this.get('renderingService').reSetupScene(); }, diff --git a/addon/routes/tutorial.js b/addon/routes/tutorial.js index f449c3c..0db5cc4 100644 --- a/addon/routes/tutorial.js +++ b/addon/routes/tutorial.js @@ -2,9 +2,6 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; export default BaseRoute.extend(AuthenticatedRouteMixin, { - beforeModel(/* transition */) { - //this.transitionTo('tutorial.list.tutorial'); // Implicitly aborts the on-going transition. - }, actions: { resetRoute() { //const routeName = this.get('tutorial'); diff --git a/addon/routes/tutorial/edit/tutorial.js b/addon/routes/tutorial/edit/tutorial.js index 3253346..3c05e95 100644 --- a/addon/routes/tutorial/edit/tutorial.js +++ b/addon/routes/tutorial/edit/tutorial.js @@ -3,11 +3,12 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { - return this.store.findRecord('tutorial', params.tutorial_id);; + return this.store.findRecord('tutorial', params.tutorial_id); }, setupController(controller, model) { this._super(...arguments); - controller.get('landscapeservice').loadTutorialLandscape(model); + controller.get('landscapeService').updateLandscapeList(); + controller.get('landscapeService').loadTutorialLandscape(model); }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/edit/tutorial/landscape.js b/addon/routes/tutorial/edit/tutorial/landscape.js index bea414e..5b6e7b1 100644 --- a/addon/routes/tutorial/edit/tutorial/landscape.js +++ b/addon/routes/tutorial/edit/tutorial/landscape.js @@ -9,8 +9,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { return this.store.findRecord('tutorial', params.tutorial_id); }, setupController(controller, model) { - controller.get('tutorialLandscape').loadTutorialLandscape(model); - //this._super(controller, model); + this._super(...arguments); + controller.get('landscapeService').updateLandscapeList(); + controller.get('landscapeService').loadTutorialLandscape(model); }, actions: { @@ -18,7 +19,5 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { resetRoute() { //const routeName = this.get('tutorial'); }, - - } }); diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 95a6f5c..1094655 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -3,8 +3,6 @@ import LandscapeSerializer from "explorviz-frontend/serializers/landscape" export default LandscapeSerializer.extend({ serialize(snapshot, options) { let json = this._super(...arguments); - debugger; - json.data.attributes.landscape=JSON.stringify(json); json.data.relationships={tutorialtimestamp: {data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}}; json.included=[{ diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js new file mode 100644 index 0000000..80e9190 --- /dev/null +++ b/addon/services/landscape-service.js @@ -0,0 +1,72 @@ +import Service from '@ember/service'; +import Evented from '@ember/object/evented'; +import debugLogger from 'ember-debug-logger'; +import { inject as service } from "@ember/service"; + +export default Service.extend(Evented, { + debug: debugLogger(), + store: service(), + landscape: null, + persisted: null, + selected: null, + landscapeList: null, + updateLandscapeList(reload) { + this.set('landscapeList', []); + this.get('store').findAll('tutoriallandscape', { reload }) + .then(landscapes => { + let landscapeList = landscapes.toArray(); + // sort by id + landscapeList.sort((landscape1, landscape2) => parseInt(landscape1.id) < parseInt(landscape2.id) ? -1 : 1); + this.set('landscapeList', landscapeList); + }); + }, + selectLandscape(landscapeTimestamp){ + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp}).then((landscape) => { + this.set('selected',landscape); + this.set('persisted',true); + },()=>{ + landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + this.set('selected',landscape); + this.set('persisted',false); + }); + })}, + loadTutorialLandscape(tutorial) { + if (this.get('landscape') !== null) { + if (this.get('landscape').get('timestamp').get('timestamp')!= tutorial.landscapeTimestamp ){ + this.get('store').unloadRecord(this.get('landscape')); + }else{ + return; + } + } + this.importTutorialLandscape(tutorial); + }, + importTutorialLandscape(tutorial){ + var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + this.set('landscape',landscape); + this.set('persisted',true); + }, (e) => { + var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", + { + id:landscape.get('timestamp').get('id'), + timestamp:landscape.get('timestamp').get('timestamp'), + totalRequests:landscape.get('timestamp').get('totalRequests'), + name:"unnamed timestamp", + }); + tutorialtimestamp.save().then(()=>{ + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", + { + id: landscape.get('id'), + events: landscape.get('events'), + systems: landscape.get('systems'), + totalApplicationCommunications: landscape.get('totalApplicationCommunications'), + timestamp: tutorialtimestamp , + }); + tutoriallandscape.save(); + this.set('persisted',true); + this.set('landscape',tutoriallandscape); + }); + }); + }); + } +}) diff --git a/addon/services/tutorial-landscape.js b/addon/services/tutorial-landscape.js deleted file mode 100644 index 3637337..0000000 --- a/addon/services/tutorial-landscape.js +++ /dev/null @@ -1,44 +0,0 @@ -import Service from '@ember/service'; -import Evented from '@ember/object/evented'; -import debugLogger from 'ember-debug-logger'; -import { inject as service } from "@ember/service"; - -export default Service.extend(Evented, { - debug: debugLogger(), - store: service(), - tutorialLandscape: null, - tutorialTimestamp: null, - loadTutorialLandscape(tutorial) { - if (this.tutorialLandscape !== null) { - this.get('store').unloadRecord(this.tutorialLandscape); - } - this.set('tutorialTimestamp',tutorial.landscapeTimestamp); - var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { - debugger; - this.set('tutorialLandscape',landscape); - }, (e) => { - var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { - var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", - { - id:landscape.get('timestamp').get('id'), - timestamp:landscape.get('timestamp').get('timestamp'), - totalRequests:landscape.get('timestamp').get('totalRequests'), - name:"unnamed timestamp", - }); - tutorialtimestamp.save().then(()=>{ - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", - { - id: landscape.get('id'), - events: landscape.get('events'), - systems: landscape.get('systems'), - totalApplicationCommunications: landscape.get('totalApplicationCommunications'), - timestamp: tutorialtimestamp , - }); - debugger; - tutoriallandscape.save(); - this.set('tutorialLandscape',tutoriallandscape); - }); - }); - }); - }, -}) diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js new file mode 100644 index 0000000..e06144a --- /dev/null +++ b/addon/services/tutorial-service.js @@ -0,0 +1,42 @@ +import Service from '@ember/service'; +import Evented from '@ember/object/evented'; +import debugLogger from 'ember-debug-logger'; +import { inject as service } from "@ember/service"; + +export default Service.extend(Evented, { + debug: debugLogger(), + store: service(), + landscapeService:service(), + tutorialList: null, + + updateTutorialList(reload) { + this.set('tutorialList', []); + this.get('store').findAll('tutorial', { reload }) + .then(tutorials => { + let tutorialList = tutorials.toArray(); + // sort by id + tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); + this.set('tutorialList', tutorialList); + }); + }, + + saveTutorialChanges(tutorial) { + if(tutorial) { + // check for valid input + if(!tutorial.get('title') || tutorial.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + tutorial.save() + .then(()=> { + const message = `Tutorial updated.`; + this.get('landscapeService').loadTutorialLandscape(tutorial); + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Tutorial not found.`); + } + }, +}); diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index f812684..fc0e1a6 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -1,5 +1,10 @@ - -Possible Landscapes: -{{#each landscapes as |landscape|}} - {{landscape}} -{{/each}} +{{#if tutorialLandscape.selected}} +Selected Landscape:{{tutorialLandscape.selectedLandscape.timestamp}} +{{else}} + {{landscapeService.landscapeList.length}} possible Landscapes: +
    + {{#each landscapeService.landscapeList as |landscape|}} +
  • {{landscape}}
  • + {{/each}} +
+{{/if}} diff --git a/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs b/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs index a1a655f..364d5fb 100644 --- a/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs +++ b/addon/templates/components/landscape-select/navbar/toggle-live-landscape.hbs @@ -1,4 +1,4 @@ -{{#if toggle}} +{{#if landscapeListener.pauseVisualizationReload}} {{svg-jar "history" class="octicon align-middle navbar-highlight"}} diff --git a/addon/templates/components/landscape-visualization.hbs b/addon/templates/components/landscape-visualization.hbs index fb5c4b1..889d9ee 100644 --- a/addon/templates/components/landscape-visualization.hbs +++ b/addon/templates/components/landscape-visualization.hbs @@ -1 +1 @@ -{{yield}} \ No newline at end of file +{{yield}} diff --git a/addon/templates/tutorial.hbs b/addon/templates/tutorial.hbs index e2147ca..c24cd68 100644 --- a/addon/templates/tutorial.hbs +++ b/addon/templates/tutorial.hbs @@ -1 +1 @@ -{{outlet}} \ No newline at end of file +{{outlet}} diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs index 1a006af..3604f06 100644 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ b/addon/templates/tutorial/edit/tutorial.hbs @@ -10,11 +10,11 @@ {{tutorial-hierarchie tutorial=model}}
{{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} - {{form.element controlType="number" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{#link-to "tutorial.edit.tutorial.landscape" model}} - {{#if landscapeservice.tutorialLandscape}}edit landscape{{else}}select landscape{{/if}} + {{#if landscapeService.landscape}}edit landscape{{else}}select landscape{{/if}} {{/link-to}}

Sequences

diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs index cf648ea..46ec0a1 100644 --- a/addon/templates/tutorial/edit/tutorial/landscape.hbs +++ b/addon/templates/tutorial/edit/tutorial/landscape.hbs @@ -1,49 +1,46 @@

Tutorial "{{model.title}}"

-{{tutorialLandscape.tutorialLandscape.timestamp}} - {{#if tutorialLandscape.tutorialLandscape}} - {{visualization/page-setup/visualization-navbar - content=(array - (component "landscape-select/navbar/toggle-live-landscape" class="nav-item" toggle=hasTutorialLandscape) - - ) -}} -Showing live-landscapes: {{not hasTutorialLandscape}} -
- {{#if hasTutorialLandscape}} - {{tutorialLandscape.tutorialLandscape.landscape}} - {{!-- {{visualization/rendering/landscape-rendering latestLandscape=tutorialLandscape.tutorialLandscape.landscape interaction=landscapeInteraction}} --}} - {{landscape-select/landscapelist}} - {{else}} - {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} -
- {{#bs-button - onClick=(action "toggleTimeline") - type="secondary" - outline=true - class="btn-timeline" - title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") + {{if landscapeService.persisted "Landscape imported" "Save selection to import landscape"}} + {{#if landscapeService.selected}} + {{visualization/page-setup/visualization-navbar + content=(array + (component "landscape-select/navbar/toggle-live-landscape" class="nav-item") + ) }} - {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} - {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} - {{/bs-button}} -
- {{landscape-select/timeline landscapeTimestamp=model.landscapeTimestamp}} +
+ {{#if landscapeListener.selected}} + {{landscape-select/landscapelist selectedLandscape=tutorialLandscape.landscape}} + {{visualization/rendering/landscape-rendering latestLandscape=tutorialLandscape.tutorialLandscape interaction=landscapeInteraction}} + {{else}} + {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} +
+ {{#bs-button + onClick=(action "toggleTimeline") + type="secondary" + outline=true + class="btn-timeline" + title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") + }} + {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} + {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} + {{/bs-button}} +
+ {{landscape-select/timeline landscapeTimestamp=model.landscapeTimestamp}} +
+
+ {{/if}} +
+ {{else}} +
+
+

Landscape loading for "{{model.landscapeTimestamp}}"!

+
+ {{ember-spinner}} +
+
-
- {{/if}} -
- {{else}} -
-
-

Landscape loading for "{{landscapeservice.tutorialTimestamp}}"!

-
- {{ember-spinner}} -
-
-
- {{/if}} + {{/if}}
diff --git a/app/services/tutorial-landscape.js b/app/services/landscape-service.js similarity index 68% rename from app/services/tutorial-landscape.js rename to app/services/landscape-service.js index ce63b74..cf57266 100644 --- a/app/services/tutorial-landscape.js +++ b/app/services/landscape-service.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/services/tutorial-landscape'; +export { default } from 'explorviz-frontend-extension-tutorial/services/landscape-service'; diff --git a/app/services/landscape.js b/app/services/tutorial-service.js similarity index 70% rename from app/services/landscape.js rename to app/services/tutorial-service.js index 3d0f8d3..1832f4d 100644 --- a/app/services/landscape.js +++ b/app/services/tutorial-service.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/services/landscape'; +export { default } from 'explorviz-frontend-extension-tutorial/services/tutorial-service'; From d4d753c9f50bb8bd739dec3f5e1c98d1466d32ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Tue, 23 Apr 2019 21:02:58 +0200 Subject: [PATCH 14/30] sidebar forms, precleanup --- addon/components/landscape-interaction.js | 8 +- .../landscape-select/landscapelist.js | 15 +++ addon/components/landscape-select/timeline.js | 8 +- addon/components/landscape-visualization.js | 9 +- addon/components/sequence-form.js | 28 ++++ addon/components/side-form-layout.js | 76 +++++++++++ addon/components/step-form.js | 31 +++++ addon/components/tutorial-form.js | 22 ++++ .../tutorial/edit/tutorial/landscape.js | 20 ++- addon/controllers/tutorial/list.js | 5 + addon/controllers/tutorial/sequence.js | 33 +++++ addon/controllers/tutorial/step.js | 33 +++++ addon/controllers/tutorial/tutorial.js | 8 ++ .../explorviz-frontend-extension-tutorial.js | 21 +-- addon/routes/tutorial/create/step.js | 11 -- addon/routes/tutorial/create/tutorial.js | 11 -- addon/routes/tutorial/index.js | 2 +- .../tutorial/{create/sequence.js => list.js} | 7 +- addon/routes/tutorial/sequence.js | 20 +++ addon/routes/tutorial/step.js | 20 +++ addon/routes/tutorial/tutorial.js | 20 +++ addon/services/landscape-service.js | 52 ++++++-- addon/services/tutorial-service.js | 4 +- .../landscape-select/landscapelist.hbs | 16 ++- addon/templates/components/sequence-form.hbs | 5 + .../templates/components/side-form-layout.hbs | 94 +++++++++++++ addon/templates/components/step-form.hbs | 5 + addon/templates/components/tutorial-form.hbs | 20 +++ addon/templates/tutorial/create/sequence.hbs | 19 --- addon/templates/tutorial/create/step.hbs | 19 --- addon/templates/tutorial/create/tutorial.hbs | 17 --- .../tutorial/edit/tutorial/landscape.hbs | 8 +- addon/templates/tutorial/list.hbs | 124 ++++++++++++++++++ addon/templates/tutorial/sequence.hbs | 1 + addon/templates/tutorial/step.hbs | 1 + addon/templates/tutorial/tutorial.hbs | 1 + app/components/sequence-form.js | 1 + app/components/side-form-layout.js | 1 + app/components/step-form.js | 1 + app/components/tutorial-form.js | 1 + app/controllers/tutorial/list.js | 1 + app/controllers/tutorial/sequence.js | 1 + app/controllers/tutorial/step.js | 1 + app/controllers/tutorial/tutorial.js | 1 + app/routes/tutorial/list.js | 1 + app/routes/tutorial/{create => }/sequence.js | 2 +- app/routes/tutorial/{create => }/step.js | 2 +- app/routes/tutorial/{create => }/tutorial.js | 2 +- app/templates/tutorial/list.js | 1 + .../tutorial/{create => }/sequence.js | 2 +- app/templates/tutorial/{create => }/step.js | 2 +- .../tutorial/{create => }/tutorial.js | 2 +- .../components/sequence-form-test.js | 26 ++++ .../integration/components/side-form-test.js | 26 ++++ .../integration/components/step-form-test.js | 26 ++++ .../components/tutorial-form-test.js | 26 ++++ tests/unit/controllers/tutorial/list-test.js | 12 ++ .../controllers/tutorial/sequence-test.js | 12 ++ tests/unit/controllers/tutorial/step-test.js | 12 ++ .../controllers/tutorial/tutorial-test.js | 12 ++ tests/unit/routes/tutorial/list-test.js | 11 ++ .../tutorial/{create => }/sequence-test.js | 4 +- .../routes/tutorial/{create => }/step-test.js | 4 +- .../tutorial/{create => }/tutorial-test.js | 4 +- 64 files changed, 850 insertions(+), 141 deletions(-) create mode 100644 addon/components/sequence-form.js create mode 100644 addon/components/side-form-layout.js create mode 100644 addon/components/step-form.js create mode 100644 addon/components/tutorial-form.js create mode 100644 addon/controllers/tutorial/list.js create mode 100644 addon/controllers/tutorial/sequence.js create mode 100644 addon/controllers/tutorial/step.js create mode 100644 addon/controllers/tutorial/tutorial.js delete mode 100644 addon/routes/tutorial/create/step.js delete mode 100644 addon/routes/tutorial/create/tutorial.js rename addon/routes/tutorial/{create/sequence.js => list.js} (68%) create mode 100644 addon/routes/tutorial/sequence.js create mode 100644 addon/routes/tutorial/step.js create mode 100644 addon/routes/tutorial/tutorial.js create mode 100644 addon/templates/components/sequence-form.hbs create mode 100644 addon/templates/components/side-form-layout.hbs create mode 100644 addon/templates/components/step-form.hbs create mode 100644 addon/templates/components/tutorial-form.hbs delete mode 100644 addon/templates/tutorial/create/sequence.hbs delete mode 100644 addon/templates/tutorial/create/step.hbs delete mode 100644 addon/templates/tutorial/create/tutorial.hbs create mode 100644 addon/templates/tutorial/list.hbs create mode 100644 addon/templates/tutorial/sequence.hbs create mode 100644 addon/templates/tutorial/step.hbs create mode 100644 addon/templates/tutorial/tutorial.hbs create mode 100644 app/components/sequence-form.js create mode 100644 app/components/side-form-layout.js create mode 100644 app/components/step-form.js create mode 100644 app/components/tutorial-form.js create mode 100644 app/controllers/tutorial/list.js create mode 100644 app/controllers/tutorial/sequence.js create mode 100644 app/controllers/tutorial/step.js create mode 100644 app/controllers/tutorial/tutorial.js create mode 100644 app/routes/tutorial/list.js rename app/routes/tutorial/{create => }/sequence.js (65%) rename app/routes/tutorial/{create => }/step.js (68%) rename app/routes/tutorial/{create => }/tutorial.js (65%) create mode 100644 app/templates/tutorial/list.js rename app/templates/tutorial/{create => }/sequence.js (64%) rename app/templates/tutorial/{create => }/step.js (66%) rename app/templates/tutorial/{create => }/tutorial.js (64%) create mode 100644 tests/integration/components/sequence-form-test.js create mode 100644 tests/integration/components/side-form-test.js create mode 100644 tests/integration/components/step-form-test.js create mode 100644 tests/integration/components/tutorial-form-test.js create mode 100644 tests/unit/controllers/tutorial/list-test.js create mode 100644 tests/unit/controllers/tutorial/sequence-test.js create mode 100644 tests/unit/controllers/tutorial/step-test.js create mode 100644 tests/unit/controllers/tutorial/tutorial-test.js create mode 100644 tests/unit/routes/tutorial/list-test.js rename tests/unit/routes/tutorial/{create => }/sequence-test.js (55%) rename tests/unit/routes/tutorial/{create => }/step-test.js (57%) rename tests/unit/routes/tutorial/{create => }/tutorial-test.js (55%) diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index d67846c..533af1f 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -1,6 +1,8 @@ -import Component from '@ember/component'; -import layout from '../templates/components/landscape-interaction'; +//import layout from '../templates/components/landscape-interaction'; +import layout from 'explorviz-frontend/templates/utils/landscape-rendering/interaction' -export default Component.extend({ +import Interaction from 'explorviz-frontend/utils/landscape-rendering/interaction' + +export default Interaction.extend({ layout }); diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js index 2124541..663b77e 100644 --- a/addon/components/landscape-select/landscapelist.js +++ b/addon/components/landscape-select/landscapelist.js @@ -7,4 +7,19 @@ export default Component.extend({ store: service(), landscapeListener: service(), landscapeService: service(), + tutorialService: service(), + actions:{ + setTutorialTimestamp(tutorial,timestamp){ + tutorial.set('landscapeTimestamp',timestamp); + }, + showLiveLandscapes(){ + this.set("landscapeService.livelandscapes",true); + this.get('landscapeListener').set('pauseVisualizationReload',false); + }, + hideLiveLandscapes(){ + this.set("landscapeService.livelandscapes",false); + this.get('landscapeListener').set('pauseVisualizationReload',true); + + } + } }); diff --git a/addon/components/landscape-select/timeline.js b/addon/components/landscape-select/timeline.js index 75f3332..a22f3f8 100644 --- a/addon/components/landscape-select/timeline.js +++ b/addon/components/landscape-select/timeline.js @@ -1,15 +1,19 @@ import Component from '@ember/component'; import layout from '../../templates/components/landscape-select/timeline'; import Timeline from 'explorviz-frontend/components/visualization/page-setup/timeline/timeline'; +import {inject as service} from '@ember/service'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Timeline.extend({ +export default Timeline.extend(AlertifyHandler,{ layout, + landscapeService: service(), chartClickHandler(evt) { this._super(...arguments); var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; this.get('landscapeListener').set('pauseVisualizationReload',true); this.get('landscapeListener').set("landscapeTimestamp",tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); - this.get('landscapeService').selectLandscape(this.get('landscapeListener').get("landscapeTimestamp")); + this.get('landscapeService').importLandscape(this.get('landscapeListener.landscapeTimestamp')); + this.get('landscapeService').selectLandscape(this.get('landscapeListener.landscapeTimestamp')); //this.await.clearRender(); } }); diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index b113466..ae2f537 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -1,6 +1,7 @@ -import Component from '@ember/component'; -import layout from '../templates/components/landscape-visualization'; -import LandscapeVisualization from 'explorviz-frontend/controller/visualization' -export default Component.extend(LandscapeVisualization,{ +// import layout from '../templates/components/landscape-visualization'; +import layout from 'explorviz-frontend/templates/components/visualization/rendering/landscape-rendering' + +import LandscapeRendering from 'explorviz-frontend/components/visualization/rendering/landscape-rendering' +export default LandscapeRendering.extend({ layout }); diff --git a/addon/components/sequence-form.js b/addon/components/sequence-form.js new file mode 100644 index 0000000..615bb61 --- /dev/null +++ b/addon/components/sequence-form.js @@ -0,0 +1,28 @@ +import Component from '@ember/component'; +import layout from '../templates/components/sequence-form'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Component.extend(AlertifyHandler,{ + layout, + actions:{ + saveSequenceChanges(sequence) { + if(sequence) { + // check for valid input + if(!sequence.get('title') || sequence.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + sequence.save() + .then(()=> { + const message = `Sequence updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Sequence not found.`); + } + }, + } +}); diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js new file mode 100644 index 0000000..baec3be --- /dev/null +++ b/addon/components/side-form-layout.js @@ -0,0 +1,76 @@ +import Component from '@ember/component'; +import layout from '../templates/components/side-form-layout'; +import { inject as service } from "@ember/service"; +import { computed } from '@ember/object'; + +export default Component.extend({ + layout, + store: service(), + landscapeService: service(), + renderingService: service(), + landscapeRepo: service("repos/landscape-repository"), + landscapeListener: service(), + + showLandscape: computed('landscapeRepo.latestApplication', function() { + return !this.get('landscapeRepo.latestApplication'); + }), + + selectMode: computed('landscapeService.landscape',function(){ + return !this.get('landscapeService.landscape'); + }), + + liveMode: computed('landscapeService.livelandscapes','selectMode', function() { + return this.get('selectMode') && this.get('landscapeService.livelandscapes'); + }), + // showLandscape: false, + // selectMode: false, + // livemode: false, + actions: { + resetView() { + this.get('renderingService').reSetupScene(); + }, + + openLandscapeView() { + this.set('landscapeRepo.latestApplication', null); + this.set('landscapeRepo.replayApplication', null); + }, + + toggleTimeline() { + this.get('renderingService').toggleTimeline(); + }, + hideLiveLandscapes(){ + this.set('landscapeService.livelandscapes',false); + this.get('landscapeListener').set('pauseVisualizationReload',true); + + } + }, + showTimeline() { + this.set('renderingService.showTimeline', true); + }, + + hideVersionbar(){ + this.set('renderingService.showVersionbar', false); + }, + + initRendering() { + this.get('landscapeListener').initSSE(); + this.get('additionalData').on('showWindow', this, this.onShowWindow); + }, + + onShowWindow() { + this.get('renderingService').resizeCanvas(); + }, + + // @Override + cleanup() { + this._super(...arguments); + this.get('additionalData').off('showWindow', this, this.onShowWindow); + }, + + init(){ + this._super(...arguments); + this.get('landscapeService').updateLandscapeList(); + this.get('landscapeListener').initSSE(); + this.get('landscapeListener').set('pauseVisualizationReload',true); + }, +}); diff --git a/addon/components/step-form.js b/addon/components/step-form.js new file mode 100644 index 0000000..8a5e013 --- /dev/null +++ b/addon/components/step-form.js @@ -0,0 +1,31 @@ +import Component from '@ember/component'; +import layout from '../templates/components/step-form'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Component.extend(AlertifyHandler,{ + layout, + actions:{ + saveStepChanges(step) { + if(step) { + // check for valid input + if(!step.get('title') || step.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + step.save() + .then(()=> { + const message = `Step updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Step not found.`); + } + }, +}, +showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); +}, +}); diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js new file mode 100644 index 0000000..8f3f011 --- /dev/null +++ b/addon/components/tutorial-form.js @@ -0,0 +1,22 @@ +import Component from '@ember/component'; +import layout from '../templates/components/tutorial-form'; +import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Component.extend(AlertifyHandler,{ + layout, + tutorialService: service(), + landscapeService: service(), + actions:{ + saveTutorialChanges(tutorial){ + this.get('tutorialService').saveTutorialChanges(tutorial); + }, + selectNewLandscape(){ + if(this.get('landscapeService.landscape')!=null){ + this.set('landscapeService.landscape',null); + }else{ + this.get("landscapeService").selectLandscape(this.get('model.landscapeTimestamp')); + } + } + } +}); diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js index 3bdf1b3..9f1550c 100644 --- a/addon/controllers/tutorial/edit/tutorial/landscape.js +++ b/addon/controllers/tutorial/edit/tutorial/landscape.js @@ -12,19 +12,29 @@ export default Controller.extend(AlertifyHandler,{ targetType: null, targetId:null, landscapeService: service(), - renderingService: service("rendering-service"), + renderingService: service(), landscapeRepo: service("repos/landscape-repository"), - landscapeListener: service("landscape-listener"), + landscapeListener: service(), + additionalData: service(), + init(){ this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); }, - actions:{ + didReceiveAttrs() { + this._super(...arguments); + this.get('additionalData').openAdditionalData(); + }, + + actions:{ + openDataSelection(){ + this.get('additionalData').addComponent("visualization/page-setup/sidebar/side-form"); + this.get('additionalData').openAdditionalData(); + }, resetView() { this.get('renderingService').reSetupScene(); }, - - openLandscapeView() { + openLandscapeView(){ this.set('landscapeRepo.latestApplication', null); this.set('landscapeRepo.replayApplication', null); }, diff --git a/addon/controllers/tutorial/list.js b/addon/controllers/tutorial/list.js new file mode 100644 index 0000000..5fdee48 --- /dev/null +++ b/addon/controllers/tutorial/list.js @@ -0,0 +1,5 @@ +import Controller from '@ember/controller'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Controller.extend(AlertifyHandler,{ +}); diff --git a/addon/controllers/tutorial/sequence.js b/addon/controllers/tutorial/sequence.js new file mode 100644 index 0000000..a82a9b9 --- /dev/null +++ b/addon/controllers/tutorial/sequence.js @@ -0,0 +1,33 @@ +import Controller from '@ember/controller'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import { inject as service } from "@ember/service"; + +export default Controller.extend(AlertifyHandler,{ + tutorialService:service(), + landscapeService:service(), + actions:{ + saveSequenceChanges(sequence) { + if(sequence) { + // check for valid input + if(!sequence.get('title') || sequence.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + sequence.save() + .then(()=> { + const message = `Sequence updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Sequence not found.`); + } + }, + }, + showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); + }, +}); diff --git a/addon/controllers/tutorial/step.js b/addon/controllers/tutorial/step.js new file mode 100644 index 0000000..632c314 --- /dev/null +++ b/addon/controllers/tutorial/step.js @@ -0,0 +1,33 @@ +import Controller from '@ember/controller'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import { inject as service } from "@ember/service"; + +export default Controller.extend(AlertifyHandler,{ + tutorialService:service(), + landscapeService:service(), + actions:{ + saveStepChanges(step) { + if(step) { + // check for valid input + if(!step.get('title') || step.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + + step.save() + .then(()=> { + const message = `Step updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Step not found.`); + } + }, +}, +showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); +}, +}); diff --git a/addon/controllers/tutorial/tutorial.js b/addon/controllers/tutorial/tutorial.js new file mode 100644 index 0000000..84885dc --- /dev/null +++ b/addon/controllers/tutorial/tutorial.js @@ -0,0 +1,8 @@ +import Controller from '@ember/controller'; +import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Controller.extend(AlertifyHandler,{ + tutorialService:service(), + landscapeService:service() +}); diff --git a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js index 8651994..636068e 100644 --- a/addon/instance-initializers/explorviz-frontend-extension-tutorial.js +++ b/addon/instance-initializers/explorviz-frontend-extension-tutorial.js @@ -10,26 +10,11 @@ export function initialize(appInstance) { Router.map(function() { this.route("tutorial", function(){ - this.route("list", function(){ - this.route('tutorial'); - this.route('sequence'); - this.route('step'); - }); - this.route("edit", function(){ - this.route('tutorial', { path: '/tutorial/:tutorial_id' }); - this.route('tutorial.target', { path: '/tutorial/:tutorial_id/target' }); - this.route('tutorial.landscape', { path: '/tutorial/:tutorial_id/landscape' }); + this.route("list", { path: '/list' }); + this.route('tutorial', { path: '/:tutorial_id' }); this.route('sequence', { path: '/sequence/:sequence_id' }); this.route('step', { path: '/step/:step_id' }); - this.route('step.target', { path: '/step/:step_id/target' }); - - }); - this.route("create", function(){ - this.route('tutorial', { path: '/tutorial' }); - this.route('sequence', { path: '/sequence/for/:tutorial_id' }); - this.route('step', { path: '/step/for/:sequence_id' }); - }); - this.route('run', { path: '/run/tutorial/:tutorial_id' }); + this.route('run', { path: '/run/:tutorial_id' }); }); }); } diff --git a/addon/routes/tutorial/create/step.js b/addon/routes/tutorial/create/step.js deleted file mode 100644 index 4865f9c..0000000 --- a/addon/routes/tutorial/create/step.js +++ /dev/null @@ -1,11 +0,0 @@ -import Route from '@ember/routing/route'; -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - actions: { - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } -}); diff --git a/addon/routes/tutorial/create/tutorial.js b/addon/routes/tutorial/create/tutorial.js deleted file mode 100644 index 4865f9c..0000000 --- a/addon/routes/tutorial/create/tutorial.js +++ /dev/null @@ -1,11 +0,0 @@ -import Route from '@ember/routing/route'; -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - actions: { - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } -}); diff --git a/addon/routes/tutorial/index.js b/addon/routes/tutorial/index.js index 69cc575..1d24f43 100644 --- a/addon/routes/tutorial/index.js +++ b/addon/routes/tutorial/index.js @@ -2,7 +2,7 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; export default BaseRoute.extend({ beforeModel: function() { - this.transitionTo("tutorial.list.tutorial"); + this.transitionTo("tutorial.list"); }, actions: { resetRoute() { diff --git a/addon/routes/tutorial/create/sequence.js b/addon/routes/tutorial/list.js similarity index 68% rename from addon/routes/tutorial/create/sequence.js rename to addon/routes/tutorial/list.js index 4865f9c..961cdf3 100644 --- a/addon/routes/tutorial/create/sequence.js +++ b/addon/routes/tutorial/list.js @@ -1,8 +1,13 @@ -import Route from '@ember/routing/route'; import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import RSVP from 'rsvp'; export default BaseRoute.extend(AuthenticatedRouteMixin, { + model() { + return RSVP.hash({ + tutorials: this.get('store').findAll('tutorial') + }); + }, actions: { resetRoute() { //const routeName = this.get('tutorial'); diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js new file mode 100644 index 0000000..04c7011 --- /dev/null +++ b/addon/routes/tutorial/sequence.js @@ -0,0 +1,20 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('sequence', params.sequence_id); + }, + setupController(controller, model) { + this._super(...arguments); + controller.get('landscapeService').updateLandscapeList(); + controller.get('landscapeService').loadTutorialLandscape(model); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } + +}); diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js new file mode 100644 index 0000000..2f124fa --- /dev/null +++ b/addon/routes/tutorial/step.js @@ -0,0 +1,20 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('step', params.step_id); + }, + setupController(controller, model) { + this._super(...arguments); + controller.get('landscapeService').updateLandscapeList(); + controller.get('landscapeService').loadTutorialLandscape(model); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } + +}); diff --git a/addon/routes/tutorial/tutorial.js b/addon/routes/tutorial/tutorial.js new file mode 100644 index 0000000..3c05e95 --- /dev/null +++ b/addon/routes/tutorial/tutorial.js @@ -0,0 +1,20 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + return this.store.findRecord('tutorial', params.tutorial_id); + }, + setupController(controller, model) { + this._super(...arguments); + controller.get('landscapeService').updateLandscapeList(); + controller.get('landscapeService').loadTutorialLandscape(model); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } + +}); diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 80e9190..2cbe211 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -7,8 +7,7 @@ export default Service.extend(Evented, { debug: debugLogger(), store: service(), landscape: null, - persisted: null, - selected: null, + livelandscapes: false, landscapeList: null, updateLandscapeList(reload) { this.set('landscapeList', []); @@ -22,36 +21,62 @@ export default Service.extend(Evented, { }, selectLandscape(landscapeTimestamp){ this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp}).then((landscape) => { - this.set('selected',landscape); - this.set('persisted',true); + this.set('landscape',landscape); },()=>{ - landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { - this.set('selected',landscape); - this.set('persisted',false); + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp}).then((landscape) => { + this.set('landscape',landscape); }); })}, loadTutorialLandscape(tutorial) { if (this.get('landscape') !== null) { - if (this.get('landscape').get('timestamp').get('timestamp')!= tutorial.landscapeTimestamp ){ + if (this.get('landscape.timestamp.timestamp')!= tutorial.get('landscapeTimestamp') ){ this.get('store').unloadRecord(this.get('landscape')); }else{ return; } } - this.importTutorialLandscape(tutorial); + if(tutorial.get('landscapeTimestamp')){ + this.importTutorialLandscape(tutorial); + } }, importTutorialLandscape(tutorial){ - var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.get('landscapeTimestamp') }).then((landscape) => { + this.set('landscape',landscape); + }, (e) => { + var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.get('landscapeTimestamp') }).then((landscape) => { + var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", + { + id:landscape.get('timestamp').get('id'), + timestamp:landscape.get('timestamp').get('timestamp'), + totalRequests:landscape.get('timestamp').get('totalRequests'), + name:"new timestamp", + }); + tutorialtimestamp.save().then(()=>{ + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", + { + id: landscape.get('id'), + events: landscape.get('events'), + systems: landscape.get('systems'), + totalApplicationCommunications: landscape.get('totalApplicationCommunications'), + timestamp: tutorialtimestamp , + }); + tutoriallandscape.save(); + this.set('landscape',tutoriallandscape); + }); + }); + }); + }, + importLandscape(landscapeTimestamp){ + var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((landscape) => { this.set('landscape',landscape); - this.set('persisted',true); }, (e) => { - var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.landscapeTimestamp }).then((landscape) => { + var landscape = this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", { id:landscape.get('timestamp').get('id'), timestamp:landscape.get('timestamp').get('timestamp'), totalRequests:landscape.get('timestamp').get('totalRequests'), - name:"unnamed timestamp", + name:"new timestamp", }); tutorialtimestamp.save().then(()=>{ var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", @@ -63,7 +88,6 @@ export default Service.extend(Evented, { timestamp: tutorialtimestamp , }); tutoriallandscape.save(); - this.set('persisted',true); this.set('landscape',tutoriallandscape); }); }); diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index e06144a..07bbe1a 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -2,8 +2,9 @@ import Service from '@ember/service'; import Evented from '@ember/object/evented'; import debugLogger from 'ember-debug-logger'; import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Service.extend(Evented, { +export default Service.extend(Evented,AlertifyHandler, { debug: debugLogger(), store: service(), landscapeService:service(), @@ -19,7 +20,6 @@ export default Service.extend(Evented, { this.set('tutorialList', tutorialList); }); }, - saveTutorialChanges(tutorial) { if(tutorial) { // check for valid input diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index fc0e1a6..f4fc0f9 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -1,10 +1,24 @@ {{#if tutorialLandscape.selected}} Selected Landscape:{{tutorialLandscape.selectedLandscape.timestamp}} {{else}} + No Landscape selected for Tutorial {{landscapeService.landscapeList.length}} possible Landscapes: + {{#bs-button + onClick=(action "showLiveLandscapes") + type="secondary" + outline=true + class="btn-timeline" + title="show live landscapes" + }} + show live landscapes + {{/bs-button}} {{/if}} diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs new file mode 100644 index 0000000..707f77b --- /dev/null +++ b/addon/templates/components/sequence-form.hbs @@ -0,0 +1,5 @@ +{{#bs-form model=sequence onSubmit=(action "saveSequenceChanges" sequence) as |form|}} + {{form.element controlType="text" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} +{{bs-button defaultText="Save" type="primary" buttonType="submit"}} +{{/bs-form}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs new file mode 100644 index 0000000..b76187a --- /dev/null +++ b/addon/templates/components/side-form-layout.hbs @@ -0,0 +1,94 @@ +
+
+ {{#if selectMode}} + {{#unless liveMode}} + {{landscape-select/landscapelist model=model}} + {{else}} + {{#bs-button + onClick=(action "hideLiveLandscapes") + type="secondary" + outline=true + class="btn-timeline" + title="hide live landscapes" + }} + hide live landscapes + {{/bs-button}} + {{#if showLandscape}} + {{#if landscapeRepo.latestLandscape.systems}} + {{!-- {{visualization/page-setup/visualization-navbar + content=(array + (component "visualization/page-setup/navbar/reset-visualization") + (component "visualization/page-setup/navbar/pause-reload") + (component "visualization/page-setup/navbar/event-opener") + ) + }} --}} + +
+ {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape}} + + {{visualization/rendering/popups/popup-coordinator + popupData=additionalData.popupContent}} +
+ {{else}} +
+
+

No Landscape Found!

+

A new landscape will be fetched every 10 seconds.

+
+
+ {{ember-spinner}} +
+
+ {{/if}} + {{else}} + {{!-- {{visualization/page-setup/visualization-navbar + content=(array + (component "visualization/page-setup/navbar/reset-visualization") + (component "visualization/page-setup/navbar/pause-reload") + (component "visualization/page-setup/navbar/trace-overview") + (component "visualization/page-setup/navbar/sql-opener") + (component "visualization/page-setup/navbar/application-opener") + (component "visualization/page-setup/navbar/application-search") + ) + }} --}} +
+
+ {{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
+ {{visualization/rendering/application-rendering latestApplication=landscapeRepo.latestApplication}} + + {{visualization/rendering/popups/popup-coordinator + popupData=additionalData.popupContent}} +
+ {{/if}} + +
+ {{#bs-button + onClick=(action "toggleTimeline") + type="secondary" + outline=true + class="btn-timeline" + title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") + }} + {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} + {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} + {{/bs-button}} +
+ {{landscape-select/timeline}} +
+
+ {{/unless}} + {{else}} +
+ {{!-- {{landscapeService.landscape.systems}} --}} + {{!-- {{landscape-visualization latestLandscape=landscapeService.landscape}} --}} + Visualization not implemented! +
+ {{/if}} +
+
+ {{component form model=model}} +
+
diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs new file mode 100644 index 0000000..1ebff53 --- /dev/null +++ b/addon/templates/components/step-form.hbs @@ -0,0 +1,5 @@ +{{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} + {{form.element controlType="text" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} +{{bs-button defaultText="Save" type="primary" buttonType="submit"}} +{{/bs-form}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs new file mode 100644 index 0000000..a1d26a9 --- /dev/null +++ b/addon/templates/components/tutorial-form.hbs @@ -0,0 +1,20 @@ +{{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} + {{form.element controlType="text" label="ID" property="id" disabled=true}} + {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} + {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp" disabled=true}} + + + {{!-- {{#link-to "tutorial.edit.tutorial.landscape" model}} + {{#if landscapeService.landscape}}edit landscape{{else}}select landscape{{/if}} + {{/link-to}} --}} +{{bs-button defaultText="Save" type="primary" buttonType="submit"}} +{{/bs-form}} +{{#bs-button + onClick=(action "selectNewLandscape") + type="secondary" + outline=true + class="btn-timeline" + title="change landscape" +}} +change landscape +{{/bs-button}} diff --git a/addon/templates/tutorial/create/sequence.hbs b/addon/templates/tutorial/create/sequence.hbs deleted file mode 100644 index 617f0e4..0000000 --- a/addon/templates/tutorial/create/sequence.hbs +++ /dev/null @@ -1,19 +0,0 @@ -
-
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -
-
-
-
-
-
- Create Sequence for: - {{tutorial-hierarchie tutorial=model}} -
- {{create-form tutorial=model}} -
-
-
-
-
-
diff --git a/addon/templates/tutorial/create/step.hbs b/addon/templates/tutorial/create/step.hbs deleted file mode 100644 index 74b49b7..0000000 --- a/addon/templates/tutorial/create/step.hbs +++ /dev/null @@ -1,19 +0,0 @@ -
-
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -
-
-
-
-
-
- Create Step for: - {{tutorial-hierarchie sequence=model}} -
- {{create-form sequence=model}} -
-
-
-
-
-
diff --git a/addon/templates/tutorial/create/tutorial.hbs b/addon/templates/tutorial/create/tutorial.hbs deleted file mode 100644 index caf34b1..0000000 --- a/addon/templates/tutorial/create/tutorial.hbs +++ /dev/null @@ -1,17 +0,0 @@ -
-
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -
-
-
-
-
-
- Create Tutorial: - {{create-form}} -
-
-
-
-
-
diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs index 46ec0a1..9b02727 100644 --- a/addon/templates/tutorial/edit/tutorial/landscape.hbs +++ b/addon/templates/tutorial/edit/tutorial/landscape.hbs @@ -1,5 +1,9 @@
+ {{#bs-button + onClick=(action "openDataSelection") + title="togglesidebar" + }}asdasd{{/bs-button}}

Tutorial "{{model.title}}"

{{if landscapeService.persisted "Landscape imported" "Save selection to import landscape"}} {{#if landscapeService.selected}} @@ -41,6 +45,8 @@
{{/if}} - +
+ {{visualization/page-setup/sidebar/data-selection}} +
diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs new file mode 100644 index 0000000..ddfc5da --- /dev/null +++ b/addon/templates/tutorial/list.hbs @@ -0,0 +1,124 @@ +
+

Tutorials

+
+
+ {{!-- {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} --}} +
+
+
+
+ + + + + + + + + + + {{#each model.tutorials as |tutorial|}} + + + + + + + + {{#each tutorial.sequences as |sequence|}} + + + + + + + + {{#each sequence.steps as |step|}} + + + + + + + + {{/each}} + {{/each}} + {{/each}} + +
+IDTitleSequences
+ {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.id}}{{/link-to}} + {{tutorial.title}} + {{tutorial.sequences.length}} + + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.edit.tutorial" tutorial}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
> + {{#link-to "tutorial.sequence" sequence}}{{sequence.id}}{{/link-to}} + {{sequence.title}} + {{sequence.steps.length}} + + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.sequence" sequence}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
>> + {{#link-to "tutorial.step" step}}{{step.id}}{{/link-to}} + {{step.title}} + + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.step" step}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Delete"}} + + {{svg-jar "x" class="octicon" id="delete-button"}}Delete + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} +
+
+
diff --git a/addon/templates/tutorial/sequence.hbs b/addon/templates/tutorial/sequence.hbs new file mode 100644 index 0000000..5657ed0 --- /dev/null +++ b/addon/templates/tutorial/sequence.hbs @@ -0,0 +1 @@ +{{side-form-layout form="sequence-form" model=model}} diff --git a/addon/templates/tutorial/step.hbs b/addon/templates/tutorial/step.hbs new file mode 100644 index 0000000..584d8d4 --- /dev/null +++ b/addon/templates/tutorial/step.hbs @@ -0,0 +1 @@ +{{side-form-layout form="step-form" model=model}} diff --git a/addon/templates/tutorial/tutorial.hbs b/addon/templates/tutorial/tutorial.hbs new file mode 100644 index 0000000..e8e795a --- /dev/null +++ b/addon/templates/tutorial/tutorial.hbs @@ -0,0 +1 @@ +{{side-form-layout form="tutorial-form" model=model}} diff --git a/app/components/sequence-form.js b/app/components/sequence-form.js new file mode 100644 index 0000000..aa0afd9 --- /dev/null +++ b/app/components/sequence-form.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/sequence-form'; \ No newline at end of file diff --git a/app/components/side-form-layout.js b/app/components/side-form-layout.js new file mode 100644 index 0000000..ebe092b --- /dev/null +++ b/app/components/side-form-layout.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/side-form-layout'; diff --git a/app/components/step-form.js b/app/components/step-form.js new file mode 100644 index 0000000..1c247f4 --- /dev/null +++ b/app/components/step-form.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/step-form'; \ No newline at end of file diff --git a/app/components/tutorial-form.js b/app/components/tutorial-form.js new file mode 100644 index 0000000..89ebc6e --- /dev/null +++ b/app/components/tutorial-form.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/tutorial-form'; \ No newline at end of file diff --git a/app/controllers/tutorial/list.js b/app/controllers/tutorial/list.js new file mode 100644 index 0000000..0181aba --- /dev/null +++ b/app/controllers/tutorial/list.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/list'; diff --git a/app/controllers/tutorial/sequence.js b/app/controllers/tutorial/sequence.js new file mode 100644 index 0000000..8970acb --- /dev/null +++ b/app/controllers/tutorial/sequence.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/sequence'; diff --git a/app/controllers/tutorial/step.js b/app/controllers/tutorial/step.js new file mode 100644 index 0000000..0d7de59 --- /dev/null +++ b/app/controllers/tutorial/step.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/step'; diff --git a/app/controllers/tutorial/tutorial.js b/app/controllers/tutorial/tutorial.js new file mode 100644 index 0000000..8379892 --- /dev/null +++ b/app/controllers/tutorial/tutorial.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/tutorial'; diff --git a/app/routes/tutorial/list.js b/app/routes/tutorial/list.js new file mode 100644 index 0000000..3091ef1 --- /dev/null +++ b/app/routes/tutorial/list.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list'; diff --git a/app/routes/tutorial/create/sequence.js b/app/routes/tutorial/sequence.js similarity index 65% rename from app/routes/tutorial/create/sequence.js rename to app/routes/tutorial/sequence.js index 52d9cb4..69e78be 100644 --- a/app/routes/tutorial/create/sequence.js +++ b/app/routes/tutorial/sequence.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create/sequence'; +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/sequence'; diff --git a/app/routes/tutorial/create/step.js b/app/routes/tutorial/step.js similarity index 68% rename from app/routes/tutorial/create/step.js rename to app/routes/tutorial/step.js index ec8f1dd..66c6a0a 100644 --- a/app/routes/tutorial/create/step.js +++ b/app/routes/tutorial/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create/step'; +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/step'; diff --git a/app/routes/tutorial/create/tutorial.js b/app/routes/tutorial/tutorial.js similarity index 65% rename from app/routes/tutorial/create/tutorial.js rename to app/routes/tutorial/tutorial.js index a1aeb59..a62dfc4 100644 --- a/app/routes/tutorial/create/tutorial.js +++ b/app/routes/tutorial/tutorial.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/create/tutorial'; +export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/tutorial'; diff --git a/app/templates/tutorial/list.js b/app/templates/tutorial/list.js new file mode 100644 index 0000000..5ca3011 --- /dev/null +++ b/app/templates/tutorial/list.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list'; diff --git a/app/templates/tutorial/create/sequence.js b/app/templates/tutorial/sequence.js similarity index 64% rename from app/templates/tutorial/create/sequence.js rename to app/templates/tutorial/sequence.js index 87ad1bb..c0159ee 100644 --- a/app/templates/tutorial/create/sequence.js +++ b/app/templates/tutorial/sequence.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create/sequence'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/sequence'; diff --git a/app/templates/tutorial/create/step.js b/app/templates/tutorial/step.js similarity index 66% rename from app/templates/tutorial/create/step.js rename to app/templates/tutorial/step.js index 799ab53..441c123 100644 --- a/app/templates/tutorial/create/step.js +++ b/app/templates/tutorial/step.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create/step'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/step'; diff --git a/app/templates/tutorial/create/tutorial.js b/app/templates/tutorial/tutorial.js similarity index 64% rename from app/templates/tutorial/create/tutorial.js rename to app/templates/tutorial/tutorial.js index 2ca382a..2e3718d 100644 --- a/app/templates/tutorial/create/tutorial.js +++ b/app/templates/tutorial/tutorial.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/create/tutorial'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/tutorial'; diff --git a/tests/integration/components/sequence-form-test.js b/tests/integration/components/sequence-form-test.js new file mode 100644 index 0000000..4fc20cb --- /dev/null +++ b/tests/integration/components/sequence-form-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | sequence-form', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{sequence-form}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#sequence-form}} + template block text + {{/sequence-form}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/side-form-test.js b/tests/integration/components/side-form-test.js new file mode 100644 index 0000000..ce56371 --- /dev/null +++ b/tests/integration/components/side-form-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | side-form', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{side-form}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#side-form}} + template block text + {{/side-form}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/step-form-test.js b/tests/integration/components/step-form-test.js new file mode 100644 index 0000000..15a9865 --- /dev/null +++ b/tests/integration/components/step-form-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | step-form', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{step-form}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#step-form}} + template block text + {{/step-form}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/integration/components/tutorial-form-test.js b/tests/integration/components/tutorial-form-test.js new file mode 100644 index 0000000..2998130 --- /dev/null +++ b/tests/integration/components/tutorial-form-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Component | tutorial-form', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs`{{tutorial-form}}`); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + {{#tutorial-form}} + template block text + {{/tutorial-form}} + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/tests/unit/controllers/tutorial/list-test.js b/tests/unit/controllers/tutorial/list-test.js new file mode 100644 index 0000000..9eb0651 --- /dev/null +++ b/tests/unit/controllers/tutorial/list-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/list', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/list'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/sequence-test.js b/tests/unit/controllers/tutorial/sequence-test.js new file mode 100644 index 0000000..99072e8 --- /dev/null +++ b/tests/unit/controllers/tutorial/sequence-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/sequence', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/sequence'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/step-test.js b/tests/unit/controllers/tutorial/step-test.js new file mode 100644 index 0000000..c95444f --- /dev/null +++ b/tests/unit/controllers/tutorial/step-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/step', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/step'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/controllers/tutorial/tutorial-test.js b/tests/unit/controllers/tutorial/tutorial-test.js new file mode 100644 index 0000000..f32f7c2 --- /dev/null +++ b/tests/unit/controllers/tutorial/tutorial-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | tutorial/tutorial', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:tutorial/tutorial'); + assert.ok(controller); + }); +}); diff --git a/tests/unit/routes/tutorial/list-test.js b/tests/unit/routes/tutorial/list-test.js new file mode 100644 index 0000000..3873296 --- /dev/null +++ b/tests/unit/routes/tutorial/list-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | tutorial/list', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:tutorial/list'); + assert.ok(route); + }); +}); diff --git a/tests/unit/routes/tutorial/create/sequence-test.js b/tests/unit/routes/tutorial/sequence-test.js similarity index 55% rename from tests/unit/routes/tutorial/create/sequence-test.js rename to tests/unit/routes/tutorial/sequence-test.js index 5b1f25c..b9764d2 100644 --- a/tests/unit/routes/tutorial/create/sequence-test.js +++ b/tests/unit/routes/tutorial/sequence-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | tutorial/create/sequence', function(hooks) { +module('Unit | Route | tutorial/sequence', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:tutorial/create/sequence'); + let route = this.owner.lookup('route:tutorial/sequence'); assert.ok(route); }); }); diff --git a/tests/unit/routes/tutorial/create/step-test.js b/tests/unit/routes/tutorial/step-test.js similarity index 57% rename from tests/unit/routes/tutorial/create/step-test.js rename to tests/unit/routes/tutorial/step-test.js index a2aff6c..a7b6f64 100644 --- a/tests/unit/routes/tutorial/create/step-test.js +++ b/tests/unit/routes/tutorial/step-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | tutorial/create/step', function(hooks) { +module('Unit | Route | tutorial/step', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:tutorial/create/step'); + let route = this.owner.lookup('route:tutorial/step'); assert.ok(route); }); }); diff --git a/tests/unit/routes/tutorial/create/tutorial-test.js b/tests/unit/routes/tutorial/tutorial-test.js similarity index 55% rename from tests/unit/routes/tutorial/create/tutorial-test.js rename to tests/unit/routes/tutorial/tutorial-test.js index d49637d..b804424 100644 --- a/tests/unit/routes/tutorial/create/tutorial-test.js +++ b/tests/unit/routes/tutorial/tutorial-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | tutorial/create/tutorial', function(hooks) { +module('Unit | Route | tutorial/tutorial', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:tutorial/create/tutorial'); + let route = this.owner.lookup('route:tutorial/tutorial'); assert.ok(route); }); }); From 3a63fde678b4bab1aee09ad460a527e21dd14765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Wed, 24 Apr 2019 13:57:12 +0200 Subject: [PATCH 15/30] precleanup --- .../landscape-select/landscapelist.js | 1 - addon/components/side-form-layout.js | 12 +++++++- addon/routes/tutorial/step.js | 3 ++ addon/services/landscape-service.js | 29 +------------------ .../landscape-select/landscapelist.hbs | 9 ------ .../navbar/return-to-saved.hbs | 3 -- .../navbar/save-landscape.hbs | 3 -- addon/templates/components/sequence-form.hbs | 1 + .../templates/components/side-form-layout.hbs | 13 +++++++-- addon/templates/components/step-form.hbs | 1 + addon/templates/components/tutorial-form.hbs | 3 +- 11 files changed, 30 insertions(+), 48 deletions(-) delete mode 100644 addon/templates/components/landscape-select/navbar/return-to-saved.hbs delete mode 100644 addon/templates/components/landscape-select/navbar/save-landscape.hbs diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js index 663b77e..8b50b57 100644 --- a/addon/components/landscape-select/landscapelist.js +++ b/addon/components/landscape-select/landscapelist.js @@ -19,7 +19,6 @@ export default Component.extend({ hideLiveLandscapes(){ this.set("landscapeService.livelandscapes",false); this.get('landscapeListener').set('pauseVisualizationReload',true); - } } }); diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index baec3be..616715b 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -16,11 +16,17 @@ export default Component.extend({ }), selectMode: computed('landscapeService.landscape',function(){ + if(this.get('model.constructor.modelName')=="tutorial"){ return !this.get('landscapeService.landscape'); + } + return false; }), liveMode: computed('landscapeService.livelandscapes','selectMode', function() { - return this.get('selectMode') && this.get('landscapeService.livelandscapes'); + if(this.get('model.constructor.modelName')=="tutorial"){ + return this.get('selectMode') && this.get('landscapeService.livelandscapes'); + } + return false; }), // showLandscape: false, // selectMode: false, @@ -38,6 +44,10 @@ export default Component.extend({ toggleTimeline() { this.get('renderingService').toggleTimeline(); }, + showLiveLandscapes(){ + this.set("landscapeService.livelandscapes",true); + this.get('landscapeListener').set('pauseVisualizationReload',false); + }, hideLiveLandscapes(){ this.set('landscapeService.livelandscapes',false); this.get('landscapeListener').set('pauseVisualizationReload',true); diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index 2f124fa..c6b71a0 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -9,6 +9,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.get('landscapeService').updateLandscapeList(); controller.get('landscapeService').loadTutorialLandscape(model); + controller.set('landscapeService.liveMode',false); + controller.set('landscapeService.',false); + }, actions: { // @Override BaseRoute diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 2cbe211..9ef498e 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -36,36 +36,9 @@ export default Service.extend(Evented, { } } if(tutorial.get('landscapeTimestamp')){ - this.importTutorialLandscape(tutorial); + this.importLandscape(tutorial.get('landscapeTimestamp')); } }, - importTutorialLandscape(tutorial){ - var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: tutorial.get('landscapeTimestamp') }).then((landscape) => { - this.set('landscape',landscape); - }, (e) => { - var landscape = this.get('store').queryRecord('landscape', { timestamp: tutorial.get('landscapeTimestamp') }).then((landscape) => { - var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", - { - id:landscape.get('timestamp').get('id'), - timestamp:landscape.get('timestamp').get('timestamp'), - totalRequests:landscape.get('timestamp').get('totalRequests'), - name:"new timestamp", - }); - tutorialtimestamp.save().then(()=>{ - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", - { - id: landscape.get('id'), - events: landscape.get('events'), - systems: landscape.get('systems'), - totalApplicationCommunications: landscape.get('totalApplicationCommunications'), - timestamp: tutorialtimestamp , - }); - tutoriallandscape.save(); - this.set('landscape',tutoriallandscape); - }); - }); - }); - }, importLandscape(landscapeTimestamp){ var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((landscape) => { this.set('landscape',landscape); diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index f4fc0f9..02e4533 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -12,13 +12,4 @@ Selected Landscape:{{tutorialLandscape.selectedLandscape.timestamp}} {{/each}} - {{#bs-button - onClick=(action "showLiveLandscapes") - type="secondary" - outline=true - class="btn-timeline" - title="show live landscapes" - }} - show live landscapes - {{/bs-button}} {{/if}} diff --git a/addon/templates/components/landscape-select/navbar/return-to-saved.hbs b/addon/templates/components/landscape-select/navbar/return-to-saved.hbs deleted file mode 100644 index 5c2b66d..0000000 --- a/addon/templates/components/landscape-select/navbar/return-to-saved.hbs +++ /dev/null @@ -1,3 +0,0 @@ - - {{svg-jar "issue-reopened" class="octicon align-middle"}} - diff --git a/addon/templates/components/landscape-select/navbar/save-landscape.hbs b/addon/templates/components/landscape-select/navbar/save-landscape.hbs deleted file mode 100644 index 9c48806..0000000 --- a/addon/templates/components/landscape-select/navbar/save-landscape.hbs +++ /dev/null @@ -1,3 +0,0 @@ - - {{svg-jar "database" class="octicon align-middle"}} - diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index 707f77b..aed81be 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -1,3 +1,4 @@ +{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} {{#bs-form model=sequence onSubmit=(action "saveSequenceChanges" sequence) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index b76187a..00b9fc6 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -2,6 +2,15 @@
{{#if selectMode}} {{#unless liveMode}} + {{#bs-button + onClick=(action "showLiveLandscapes") + type="secondary" + outline=true + class="btn-timeline" + title="show live landscapes" + }} + show live landscapes + {{/bs-button}} {{landscape-select/landscapelist model=model}} {{else}} {{#bs-button @@ -82,8 +91,8 @@ {{/unless}} {{else}}
- {{!-- {{landscapeService.landscape.systems}} --}} - {{!-- {{landscape-visualization latestLandscape=landscapeService.landscape}} --}} + {{landscape-visualization latestLandscape=landscapeService.landscape}} + {{landscapeService.landscape.timestamp.timestamp}} Visualization not implemented!
{{/if}} diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index 1ebff53..d6f99a3 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -1,3 +1,4 @@ +{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} {{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index a1d26a9..62ab71d 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -1,7 +1,8 @@ +{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} - {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp" disabled=true}} + {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{!-- {{#link-to "tutorial.edit.tutorial.landscape" model}} From c7c5c6c45ca6f0430dca09861561365847e88023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Wed, 24 Apr 2019 15:24:42 +0200 Subject: [PATCH 16/30] cleanup --- addon/components/create-form.js | 64 ---- .../navbar/return-to-saved.js | 21 -- .../landscape-select/navbar/save-landscape.js | 19 - addon/components/landscape-select/timeline.js | 19 - addon/components/timeline.js | 18 + addon/components/tutorial-form.js | 2 - addon/components/tutorial-hierarchie.js | 6 - addon/components/tutorial-management.js | 327 ------------------ addon/controllers/tutorial/edit/sequence.js | 25 -- addon/controllers/tutorial/edit/step.js | 25 -- .../controllers/tutorial/edit/step/target.js | 33 -- addon/controllers/tutorial/edit/tutorial.js | 13 - .../tutorial/edit/tutorial/landscape.js | 46 --- .../tutorial/edit/tutorial/target.js | 33 -- addon/controllers/tutorial/list/landscape.js | 4 - addon/controllers/tutorial/run.js | 33 -- addon/models/tutoriallandscape.js | 16 + addon/routes/tutorial/edit/sequence.js | 15 - addon/routes/tutorial/edit/step.js | 15 - addon/routes/tutorial/edit/step/target.js | 19 - addon/routes/tutorial/edit/tutorial.js | 20 -- .../tutorial/edit/tutorial/landscape.js | 23 -- addon/routes/tutorial/edit/tutorial/target.js | 19 - addon/routes/tutorial/list/sequence.js | 16 - addon/routes/tutorial/list/step.js | 16 - addon/routes/tutorial/list/tutorial.js | 16 - addon/routes/tutorial/run.js | 15 - addon/serializers/tutoriallandscape.js | 3 +- addon/services/landscape-service.js | 27 +- addon/templates/components/create-form.hbs | 17 - addon/templates/components/create-page.hbs | 0 .../components/landscape-select/timeline.hbs | 1 - .../templates/components/side-form-layout.hbs | 2 +- addon/templates/components/timeline.hbs | 1 + .../components/tutorial-hierarchie.hbs | 17 - .../components/tutorial-management.hbs | 275 --------------- addon/templates/tutorial/edit/sequence.hbs | 45 --- addon/templates/tutorial/edit/step.hbs | 40 --- addon/templates/tutorial/edit/step/target.hbs | 23 -- addon/templates/tutorial/edit/tutorial.hbs | 51 --- .../tutorial/edit/tutorial/landscape.hbs | 52 --- .../tutorial/edit/tutorial/target.hbs | 23 -- addon/templates/tutorial/list/sequence.hbs | 55 --- addon/templates/tutorial/list/step.hbs | 52 --- addon/templates/tutorial/list/tutorial.hbs | 55 --- app/components/create-form.js | 1 - .../navbar/return-to-saved.js | 1 - .../landscape-select/navbar/save-landscape.js | 1 - app/components/landscape-select/timeline.js | 1 - app/components/{edit-page.js => timeline.js} | 2 +- app/controllers/tutorial-management.js | 1 - app/controllers/tutorial/edit/sequence.js | 1 - app/controllers/tutorial/edit/step.js | 1 - app/controllers/tutorial/edit/step/target.js | 1 - app/controllers/tutorial/edit/tutorial.js | 1 - .../tutorial/edit/tutorial/landscape.js | 1 - .../tutorial/edit/tutorial/target.js | 1 - app/controllers/tutorial/list/landscape.js | 1 - app/routes/tutorial/edit/sequence.js | 1 - app/routes/tutorial/edit/step.js | 1 - app/routes/tutorial/edit/step/target.js | 1 - app/routes/tutorial/edit/tutorial.js | 1 - .../tutorial/edit/tutorial/landscape.js | 1 - app/routes/tutorial/edit/tutorial/target.js | 1 - app/routes/tutorial/list/sequence.js | 1 - app/routes/tutorial/list/step.js | 1 - app/routes/tutorial/list/tutorial.js | 1 - .../edit/step.js => components/timeline.js} | 2 +- .../components/tutorial-management.js | 1 - app/templates/tutorial/edit/sequence.js | 1 - app/templates/tutorial/edit/step/target.js | 1 - app/templates/tutorial/edit/tutorial.js | 1 - .../tutorial/edit/tutorial/landscape.js | 1 - .../tutorial/edit/tutorial/target.js | 1 - app/templates/tutorial/list/sequence.js | 1 - app/templates/tutorial/list/step.js | 1 - app/templates/tutorial/list/tutorial.js | 1 - 77 files changed, 51 insertions(+), 1600 deletions(-) delete mode 100644 addon/components/create-form.js delete mode 100644 addon/components/landscape-select/navbar/return-to-saved.js delete mode 100644 addon/components/landscape-select/navbar/save-landscape.js delete mode 100644 addon/components/landscape-select/timeline.js create mode 100644 addon/components/timeline.js delete mode 100644 addon/components/tutorial-hierarchie.js delete mode 100644 addon/components/tutorial-management.js delete mode 100644 addon/controllers/tutorial/edit/sequence.js delete mode 100644 addon/controllers/tutorial/edit/step.js delete mode 100644 addon/controllers/tutorial/edit/step/target.js delete mode 100644 addon/controllers/tutorial/edit/tutorial.js delete mode 100644 addon/controllers/tutorial/edit/tutorial/landscape.js delete mode 100644 addon/controllers/tutorial/edit/tutorial/target.js delete mode 100644 addon/controllers/tutorial/list/landscape.js delete mode 100644 addon/controllers/tutorial/run.js delete mode 100644 addon/routes/tutorial/edit/sequence.js delete mode 100644 addon/routes/tutorial/edit/step.js delete mode 100644 addon/routes/tutorial/edit/step/target.js delete mode 100644 addon/routes/tutorial/edit/tutorial.js delete mode 100644 addon/routes/tutorial/edit/tutorial/landscape.js delete mode 100644 addon/routes/tutorial/edit/tutorial/target.js delete mode 100644 addon/routes/tutorial/list/sequence.js delete mode 100644 addon/routes/tutorial/list/step.js delete mode 100644 addon/routes/tutorial/list/tutorial.js delete mode 100644 addon/routes/tutorial/run.js delete mode 100644 addon/templates/components/create-form.hbs delete mode 100644 addon/templates/components/create-page.hbs delete mode 100644 addon/templates/components/landscape-select/timeline.hbs create mode 100644 addon/templates/components/timeline.hbs delete mode 100644 addon/templates/components/tutorial-hierarchie.hbs delete mode 100644 addon/templates/components/tutorial-management.hbs delete mode 100644 addon/templates/tutorial/edit/sequence.hbs delete mode 100644 addon/templates/tutorial/edit/step.hbs delete mode 100644 addon/templates/tutorial/edit/step/target.hbs delete mode 100644 addon/templates/tutorial/edit/tutorial.hbs delete mode 100644 addon/templates/tutorial/edit/tutorial/landscape.hbs delete mode 100644 addon/templates/tutorial/edit/tutorial/target.hbs delete mode 100644 addon/templates/tutorial/list/sequence.hbs delete mode 100644 addon/templates/tutorial/list/step.hbs delete mode 100644 addon/templates/tutorial/list/tutorial.hbs delete mode 100644 app/components/create-form.js delete mode 100644 app/components/landscape-select/navbar/return-to-saved.js delete mode 100644 app/components/landscape-select/navbar/save-landscape.js delete mode 100644 app/components/landscape-select/timeline.js rename app/components/{edit-page.js => timeline.js} (75%) delete mode 100644 app/controllers/tutorial-management.js delete mode 100644 app/controllers/tutorial/edit/sequence.js delete mode 100644 app/controllers/tutorial/edit/step.js delete mode 100644 app/controllers/tutorial/edit/step/target.js delete mode 100644 app/controllers/tutorial/edit/tutorial.js delete mode 100644 app/controllers/tutorial/edit/tutorial/landscape.js delete mode 100644 app/controllers/tutorial/edit/tutorial/target.js delete mode 100644 app/controllers/tutorial/list/landscape.js delete mode 100644 app/routes/tutorial/edit/sequence.js delete mode 100644 app/routes/tutorial/edit/step.js delete mode 100644 app/routes/tutorial/edit/step/target.js delete mode 100644 app/routes/tutorial/edit/tutorial.js delete mode 100644 app/routes/tutorial/edit/tutorial/landscape.js delete mode 100644 app/routes/tutorial/edit/tutorial/target.js delete mode 100644 app/routes/tutorial/list/sequence.js delete mode 100644 app/routes/tutorial/list/step.js delete mode 100644 app/routes/tutorial/list/tutorial.js rename app/templates/{tutorial/edit/step.js => components/timeline.js} (67%) delete mode 100644 app/templates/components/tutorial-management.js delete mode 100644 app/templates/tutorial/edit/sequence.js delete mode 100644 app/templates/tutorial/edit/step/target.js delete mode 100644 app/templates/tutorial/edit/tutorial.js delete mode 100644 app/templates/tutorial/edit/tutorial/landscape.js delete mode 100644 app/templates/tutorial/edit/tutorial/target.js delete mode 100644 app/templates/tutorial/list/sequence.js delete mode 100644 app/templates/tutorial/list/step.js delete mode 100644 app/templates/tutorial/list/tutorial.js diff --git a/addon/components/create-form.js b/addon/components/create-form.js deleted file mode 100644 index 414a711..0000000 --- a/addon/components/create-form.js +++ /dev/null @@ -1,64 +0,0 @@ -import Component from '@ember/component'; -import { inject as service } from "@ember/service"; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - -export default Component.extend(AlertifyHandler,{ - sequence:null, - store:service(), - showReasonErrorAlert(reason) { - const {title, detail} = reason.errors[0]; - this.showAlertifyMessage(`${title}: ${detail}`); - }, - actions:{ - createStep(sequence){ - const stepData = this.getProperties('title'); - // check for valid input - if(!stepData.title || stepData.title.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - const stepRecord = this.get('store').createRecord('step', { - title: stepData.title, - sequence: sequence - }); - sequence.get("steps").pushObject(stepRecord); - sequence.save().then(() => { - const message = "Step " + stepRecord.title + " was created and added to Sequence " + sequence.title + "."; - this.showAlertifyMessage(message); - this.setProperties({ - title: "", - }); - }, (reason) => { - this.showReasonErrorAlert(reason); - stepRecord.deleteRecord(); - }); - }, - createSequence(tutorial){ - const stepData = this.getProperties('title'); - // check for valid input - if(!stepData.title || stepData.title.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - const sequenceRecord = this.get('store').createRecord('sequence', { - title: stepData.title, - tutorial: tutorial - }); - tutorial.get("sequences").pushObject(sequenceRecord); - tutorial.save().then(() => { - const message = "Sequence " + sequenceRecord.title + " was created and added to Tutorial " + tutorial.title + "."; - this.showAlertifyMessage(message); - this.setProperties({ - title: "", - }); - }, (reason) => { - this.showReasonErrorAlert(reason); - stepRecord.deleteRecord(); - }); - }, - createTutorial(){ - - } - } - -}); diff --git a/addon/components/landscape-select/navbar/return-to-saved.js b/addon/components/landscape-select/navbar/return-to-saved.js deleted file mode 100644 index 76b7431..0000000 --- a/addon/components/landscape-select/navbar/return-to-saved.js +++ /dev/null @@ -1,21 +0,0 @@ -import Component from '@ember/component'; -import layout from '../../../templates/components/landscape-select/navbar/return-to-saved'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -import {inject as service} from '@ember/service'; - -export default Component.extend(AlertifyHandler,{ - tagName:'li', - landscapeListener: service("landscape-listener"), - toggle:null, - layout, - actions:{ - returnToSaved() { - this.set('toggle',false); - this.get('landscapeListener').set('pauseVisualizationReload',true); - this.handleMessageForUser(); - } - }, - handleMessageForUser() { - this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); - } -}); diff --git a/addon/components/landscape-select/navbar/save-landscape.js b/addon/components/landscape-select/navbar/save-landscape.js deleted file mode 100644 index 04d096d..0000000 --- a/addon/components/landscape-select/navbar/save-landscape.js +++ /dev/null @@ -1,19 +0,0 @@ -import Component from '@ember/component'; -import layout from '../../../templates/components/landscape-select/navbar/save-landscape'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -import {inject as service} from '@ember/service'; - -export default Component.extend(AlertifyHandler,{ - tagName:'li', - store: service(), - landscapeListener: service("landscape-listener"), - layout, - handleMessageForUser(pauseReload) { - if(!pauseReload){ - this.showAlertifyMessage("Visualization paused! Tutorial landscapes are shown."); - } - else { - this.showAlertifyMessage("Visualization resumed! Live landscapes will be shown and can be selected."); - } - } -}); diff --git a/addon/components/landscape-select/timeline.js b/addon/components/landscape-select/timeline.js deleted file mode 100644 index a22f3f8..0000000 --- a/addon/components/landscape-select/timeline.js +++ /dev/null @@ -1,19 +0,0 @@ -import Component from '@ember/component'; -import layout from '../../templates/components/landscape-select/timeline'; -import Timeline from 'explorviz-frontend/components/visualization/page-setup/timeline/timeline'; -import {inject as service} from '@ember/service'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - -export default Timeline.extend(AlertifyHandler,{ - layout, - landscapeService: service(), - chartClickHandler(evt) { - this._super(...arguments); - var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; - this.get('landscapeListener').set('pauseVisualizationReload',true); - this.get('landscapeListener').set("landscapeTimestamp",tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); - this.get('landscapeService').importLandscape(this.get('landscapeListener.landscapeTimestamp')); - this.get('landscapeService').selectLandscape(this.get('landscapeListener.landscapeTimestamp')); - //this.await.clearRender(); - } -}); diff --git a/addon/components/timeline.js b/addon/components/timeline.js new file mode 100644 index 0000000..e73f549 --- /dev/null +++ b/addon/components/timeline.js @@ -0,0 +1,18 @@ +import Timeline from 'explorviz-frontend/components/visualization/page-setup/timeline/timeline'; +import layout from 'explorviz-frontend/templates/components/visualization/page-setup/timeline/timeline' +import {inject as service} from '@ember/service'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + +export default Timeline.extend(AlertifyHandler,{ + layout, + landscapeService: service(), + chartClickHandler(evt) { + //this._super(...arguments); + var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; + if (tutorialActivePoint) { + this.get('landscapeListener').set('pauseVisualizationReload',true); + this.get('landscapeService').importLandscape(tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); + //this.await.clearRender(); + } + } +}); diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js index 8f3f011..94bce20 100644 --- a/addon/components/tutorial-form.js +++ b/addon/components/tutorial-form.js @@ -14,8 +14,6 @@ export default Component.extend(AlertifyHandler,{ selectNewLandscape(){ if(this.get('landscapeService.landscape')!=null){ this.set('landscapeService.landscape',null); - }else{ - this.get("landscapeService").selectLandscape(this.get('model.landscapeTimestamp')); } } } diff --git a/addon/components/tutorial-hierarchie.js b/addon/components/tutorial-hierarchie.js deleted file mode 100644 index 33ad798..0000000 --- a/addon/components/tutorial-hierarchie.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/tutorial-hierarchie'; - -export default Component.extend({ - layout -}); diff --git a/addon/components/tutorial-management.js b/addon/components/tutorial-management.js deleted file mode 100644 index 0c8f5a4..0000000 --- a/addon/components/tutorial-management.js +++ /dev/null @@ -1,327 +0,0 @@ -import Component from '@ember/component'; -import { inject as service } from "@ember/service"; -import { getOwner } from '@ember/application'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - -export default Component.extend(AlertifyHandler,{ - tagName: '', - store: service(), - tutorials: null, - page: null, - currentTutorial:null, - currentSequence:null, - currentStep:null, - -selectedTarget:null, -landscapeListener: service("landscape-listener"), -landscapeRepo: service("repos/landscape-repository"), - didInsertElement() { - this._super(...arguments); - this.set('page', 'main'); - this.updateTutorialList(true); - }, - updateTutorialList(reload) { - this.set('tutorials', []); - this.get('store').findAll('tutorial', { reload }) - .then(tutorials => { - let tutorialList = tutorials.toArray(); - // sort by id - tutorialList.sort((tutorial1, tutorial2) => parseInt(tutorial1.id) < parseInt(tutorial2.id) ? -1 : 1); - this.set('tutorials', tutorialList); - }); - }, - - actions: { - openMainPage() { - this.set('page', 'main'); - }, - openEditTutorialPage(tutorial){ - this.set('page', 'editTutorial'); - this.set('currentTutorial', tutorial); - this.setProperties({ - tutorial_id_change: tutorial.id, - tutorial_title_change: tutorial.title, - tutorial_landscape_change: tutorial.landscape.id, - }); - }, - openEditSequencePage(tutorial,sequence){ - this.set('page', 'editSequence'); - this.set('currentTutorial', tutorial); - this.set('currentSequence', sequence); - this.setProperties({ - sequence_id_change: sequence.id, - sequence_title_change: sequence.title, - }); - }, - openEditStepPage(tutorial,sequence,step){ - this.set('page', 'editStep'); - this.set('currentTutorial', tutorial); - this.set('currentSequence', sequence); - this.set('currentStep', step); - this.setProperties({ - step_id_change: step.id, - step_title_change: step.title, - step_target_change: step.target, - step_target_type_change:step.targetType, - step_target_id_change:step.targetId - }); - }, - openCreateTutorialPage() { - this.set('page', 'createTutorial'); - }, - openCreateSequencePage() { - this.set('page', 'createSequence'); - }, - openCreateStepPage() { - this.set('page', 'createStep'); - }, - setTarget(tutorial,sequence,step,target){ - step.set("targetType",target.constructor.modelName); - step.set("targetId",target.get("id")); - step.save() - .then(()=> { - const message = `Step updated.`; - this.showAlertifyMessage(message); - this.actions.openEditStepPage.bind(this)(this.currentTutorial,this.currentSequence,this.currentStep,this.selectedTarget); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - }, - openSelectTarget(){ - this.set('page', 'selectTarget'); - this.get('landscapeListener').initSSE(); - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - this.set('landscapeInteraction', landscapeInteraction); - this.get('landscapeInteraction').on('singleClick', function(emberModel) { - this.set('selectedTarget',emberModel); - }); - }, - saveTutorial() { - const tutorialData = this.getProperties('title'); - // check for valid input - if(!tutorialData.title || tutorialData.title.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - const tutorialRecord = this.get('store').createRecord('tutorial', { - title: tutorialData.title, - }); - - tutorialRecord.save().then(() => { // success - const message = "Tutorial " + tutorialData.title + " was created."; - this.showAlertifyMessage(message); - this.updateTutorialList(false); - this.actions.openMainPage.bind(this)(); - this.setProperties({ - title: "", - }); - this.openMainPage(); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - tutorialRecord.deleteRecord(); - this.updateTutorialList(false); - }); - - - }, - saveSequence() { - const sequenceData = this.getProperties('title'); - - // check for valid input - if(!sequenceData.title || sequenceData.title.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - const sequenceRecord = this.get('store').createRecord('sequence', { - title: sequenceData.title, - }); - sequenceRecord.save().then(() => { // success - this.currentTutorial.sequences.pushObject(sequenceRecord); - this.currentTutorial.save().then(() => { - const message = "Sequence " + sequenceData.title + " was created and added to Tutorial "+this.currentTutorial.title+"."; - this.showAlertifyMessage(message); - this.updateTutorialList(true); - this.setProperties({ - title: "", - }); - this.actions.openMainPage.bind(this)(); - this.actions.openEditTutorialPage.bind(this)(this.currentTutorial); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - sequenceRecord.deleteRecord(); - this.updateTutorialList(false); - }); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - sequenceRecord.deleteRecord(); - this.updateTutorialList(false); - }); - }, - saveStep() { - const stepData = this.getProperties('title','target'); - - // check for valid input - if(!stepData.title || stepData.title.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - const stepRecord = this.get('store').createRecord('step', { - title: stepData.title, - target: this.selectedTarget, - - }); - stepRecord.save().then(() => { - this.currentSequence.steps.pushObject(stepRecord); - this.currentSequence.save().then(() => { - const message = "Step " + stepRecord.title + " was created and added to Sequence " + this.currentSequence.title + "."; - this.showAlertifyMessage(message); - this.updateTutorialList(true); - this.setProperties({ - title: "", - action: "" - }); - this.actions.openMainPage.bind(this)(); - this.actions.openEditSequencePage.bind(this)(this.currentTutorial,this.currentSequence); - }, (reason) => { - this.showReasonErrorAlert(reason); - stepRecord.deleteRecord(); - this.updateTutorialList(false); - }); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - stepRecord.deleteRecord(); - this.updateTutorialList(false); - }); - - - }, - saveTutorialChanges() { - const tutorialData = this.getProperties('tutorial_id_change', 'tutorial_title_change'); - - const tutorial = this.get('tutorials').find( tutorial => tutorial.get('id') == tutorialData.tutorial_id_change); - - if(tutorial) { - // check for valid input - if(!tutorialData.tutorial_title_change || tutorialData.tutorial_title_change.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - if(tutorial.get('title') !== tutorialData.tutorial_title_change) - tutorial.set('title', tutorialData.tutorial_title_change); - - tutorial.save() - .then(()=> { - const message = `Tutorial updated.`; - this.showAlertifyMessage(message); - this.setProperties({ - tutorial_id_change: "", - tutorial_title_change: "" - }); - this.actions.openMainPage.bind(this)(); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Tutorial not found.`); - } - }, - saveSequenceChanges(){ - const sequenceData = this.getProperties('sequence_id_change', 'sequence_title_change'); - const sequence = this.currentTutorial.sequences.find( sequence => sequence.get('id') == sequenceData.sequence_id_change); - if(sequence) { - // check for valid input - if(!sequenceData.sequence_title_change || sequenceData.sequence_title_change.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - if(sequence.get('title') !== sequenceData.sequence_title_change) - sequence.set('title', sequenceData.sequence_title_change); - - sequence.save() - .then(()=> { - const message = `Sequence updated.`; - this.showAlertifyMessage(message); - this.actions.openEditSequencePage.bind(this)(this.currentTutorial,this.currentSequence); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Sequence not found.`); - } - }, - saveStepChanges(){ - const stepData = this.getProperties('step_id_change', 'step_title_change','step_target_change'); - const step = this.currentSequence.steps.find( step => step.get('id') == stepData.step_id_change); - if(step) { - // check for valid input - if(!stepData.step_title_change || stepData.step_title_change.length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - if(step.get('title') !== stepData.step_title_change) - step.set('title', stepData.step_title_change); - step.set('target',this.selectedTarget); - step.save() - .then(()=> { - const message = `Step updated.`; - this.showAlertifyMessage(message); - this.actions.openEditStepPage.bind(this)(this.currentTutorial,this.currentSequence,this.currentStep,this.selectedTarget); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Step not found.`); - } - - }, - deleteTutorial(tutorial) { - tutorial.destroyRecord() - .then(() => { // success - const message = `Tutorial ${tutorial.title} deleted.`; - this.showAlertifyMessage(message); - this.updateTutorialList(false); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - this.updateTutorialList(true); - } - ); - }, - deleteSequence(sequence) { - sequence.destroyRecord() - .then(() => { // success - const message = `Sequence ${sequence.title} deleted.`; - this.showAlertifyMessage(message); - this.updateTutorialList(false); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - this.updateTutorialList(true); - } - ); - }, - deleteStep(step) { - step.destroyRecord() - .then(() => { // success - const message = `Step ${step.title} deleted.`; - this.showAlertifyMessage(message); - this.updateTutorialList(false); - }, (reason) => { // failure - this.showReasonErrorAlert(reason); - this.updateTutorialList(true); - } - ); - }, - -}, -showReasonErrorAlert(reason) { - const {title, detail} = reason.errors[0]; - this.showAlertifyMessage(`${title}: ${detail}`); -}, -}); diff --git a/addon/controllers/tutorial/edit/sequence.js b/addon/controllers/tutorial/edit/sequence.js deleted file mode 100644 index 04925c6..0000000 --- a/addon/controllers/tutorial/edit/sequence.js +++ /dev/null @@ -1,25 +0,0 @@ -import Controller from '@ember/controller'; - -export default Controller.extend({ - actions:{ - saveSequenceChanges(sequence) { - if(sequence) { - // check for valid input - if(!sequence.get('title') || sequence.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - sequence.save() - .then(()=> { - const message = `Sequence updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Sequence not found.`); - } - }, - } -}); diff --git a/addon/controllers/tutorial/edit/step.js b/addon/controllers/tutorial/edit/step.js deleted file mode 100644 index 9679429..0000000 --- a/addon/controllers/tutorial/edit/step.js +++ /dev/null @@ -1,25 +0,0 @@ -import Controller from '@ember/controller'; - -export default Controller.extend({ - actions:{ - saveStepChanges(step) { - if(step) { - // check for valid input - if(!step.get('title') || step.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; - } - - step.save() - .then(()=> { - const message = `Step updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Step not found.`); - } - }, -} -}); diff --git a/addon/controllers/tutorial/edit/step/target.js b/addon/controllers/tutorial/edit/step/target.js deleted file mode 100644 index 6a62752..0000000 --- a/addon/controllers/tutorial/edit/step/target.js +++ /dev/null @@ -1,33 +0,0 @@ -import Controller from '@ember/controller'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { inject as service } from "@ember/service"; -import { getOwner } from '@ember/application'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - - -export default Controller.extend(AlertifyHandler,{ - tagName: '', - store: service(), - targetType: null, - targetId:null, - init(){ - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - this.set('landscapeInteraction', landscapeInteraction); - this.get('landscapeInteraction').on('singleClick', function(emberModel) { - if(emberModel!=undefined){ - this.set("targetType",emberModel.constructor.modelName); - this.set("targetId",emberModel.get("id")); - // console.log("Set Target:"+ Ember.get("targetType")+" "+targetId); - } - }); - }, - actions:{ - saveTarget(model,targetType,targetId){ - this.get("model").set("targetType",targetType); - this.get("model").set("targetId",targetId); - this.get("model").save(); - this.transitionToRoute("tutorial.edit.step", model); - } - } -}); diff --git a/addon/controllers/tutorial/edit/tutorial.js b/addon/controllers/tutorial/edit/tutorial.js deleted file mode 100644 index 034af4c..0000000 --- a/addon/controllers/tutorial/edit/tutorial.js +++ /dev/null @@ -1,13 +0,0 @@ -import Controller from '@ember/controller'; -import { inject as service } from "@ember/service"; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - -export default Controller.extend(AlertifyHandler,{ - tutorialService:service(), - landscapeService:service(), - actions:{ - saveTutorialChanges(tutorial){ - this.get('tutorialService').saveTutorialChanges(tutorial); - } - } -}); diff --git a/addon/controllers/tutorial/edit/tutorial/landscape.js b/addon/controllers/tutorial/edit/tutorial/landscape.js deleted file mode 100644 index 9f1550c..0000000 --- a/addon/controllers/tutorial/edit/tutorial/landscape.js +++ /dev/null @@ -1,46 +0,0 @@ -import Controller from '@ember/controller'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { inject as service } from "@ember/service"; -import { getOwner } from '@ember/application'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - - -export default Controller.extend(AlertifyHandler,{ - tagName: '', - store: service(), - targetType: null, - targetId:null, - landscapeService: service(), - renderingService: service(), - landscapeRepo: service("repos/landscape-repository"), - landscapeListener: service(), - additionalData: service(), - - init(){ - this.get('landscapeListener').initSSE(); - this.get('landscapeListener').set('pauseVisualizationReload',true); - }, - didReceiveAttrs() { - this._super(...arguments); - this.get('additionalData').openAdditionalData(); - }, - - actions:{ - openDataSelection(){ - this.get('additionalData').addComponent("visualization/page-setup/sidebar/side-form"); - this.get('additionalData').openAdditionalData(); - }, - resetView() { - this.get('renderingService').reSetupScene(); - }, - openLandscapeView(){ - this.set('landscapeRepo.latestApplication', null); - this.set('landscapeRepo.replayApplication', null); - }, - - toggleTimeline() { - this.get('renderingService').toggleTimeline(); - } - } -}); diff --git a/addon/controllers/tutorial/edit/tutorial/target.js b/addon/controllers/tutorial/edit/tutorial/target.js deleted file mode 100644 index 8e43533..0000000 --- a/addon/controllers/tutorial/edit/tutorial/target.js +++ /dev/null @@ -1,33 +0,0 @@ -import Controller from '@ember/controller'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { inject as service } from "@ember/service"; -import { getOwner } from '@ember/application'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - - -export default Controller.extend(AlertifyHandler,{ - tagName: '', - store: service(), - targetType: null, - targetId:null, - init(){ - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - this.set('landscapeInteraction', landscapeInteraction); - this.get('landscapeInteraction').on('singleClick', function(emberModel) { - if(emberModel!=undefined){ - this.set("targetType",emberModel.constructor.modelName); - this.set("targetId",emberModel.get("id")); - // console.log("Set Target:"+ Ember.get("targetType")+" "+targetId); - } - }); - }, - actions:{ - saveTarget(model,targetType,targetId){ - this.get("model").set("targetType",targetType); - this.get("model").set("targetId",targetId); - this.get("model").save(); - this.transitionToRoute("tutorial.edit.tutorial", model); - } - } -}); diff --git a/addon/controllers/tutorial/list/landscape.js b/addon/controllers/tutorial/list/landscape.js deleted file mode 100644 index d630f31..0000000 --- a/addon/controllers/tutorial/list/landscape.js +++ /dev/null @@ -1,4 +0,0 @@ -import Controller from '@ember/controller'; - -export default Controller.extend({ -}); diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js deleted file mode 100644 index c513bf3..0000000 --- a/addon/controllers/tutorial/run.js +++ /dev/null @@ -1,33 +0,0 @@ -import Controller from '@ember/controller'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { inject as service } from "@ember/service"; -import { getOwner } from '@ember/application'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; - - -export default Controller.extend(AlertifyHandler,{ - tagName: '', - store: service(), - currentTutorial:null, - currentSequence: null, - currentStep: null, - init(){ - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - this.set('landscapeInteraction', landscapeInteraction); - this.get('landscapeInteraction').on('singleClick', function(emberModel) { - if(emberModel!=undefined){ - this.set("targetType",emberModel.constructor.modelName); - this.set("targetId",emberModel.get("id")); - if(this.get('targetType')===this.get('step').targetType && this.get('targetId')===this.get('step').targetId){ - - } - } - console.log(this); - }); - }, - actions:{ - - - } -}); diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index 5bbfe3d..8c61fad 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -1,6 +1,22 @@ import DS from 'ember-data'; import Landscape from "explorviz-frontend/models/landscape" +const { belongsTo, hasMany } = DS; export default Landscape.extend({ timestamp: DS.belongsTo('tutorialtimestamp'), + events: hasMany('event', { + inverse: null, + async: false + }), + + systems: hasMany('system', { + inverse: 'parent', + async: false + }), + + // list of applicationCommunication for rendering purposes + totalApplicationCommunications: hasMany('applicationcommunication', { + inverse: null, + async: false + }), }); diff --git a/addon/routes/tutorial/edit/sequence.js b/addon/routes/tutorial/edit/sequence.js deleted file mode 100644 index 4b83983..0000000 --- a/addon/routes/tutorial/edit/sequence.js +++ /dev/null @@ -1,15 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('sequence', params.sequence_id); - }, - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } - -}); diff --git a/addon/routes/tutorial/edit/step.js b/addon/routes/tutorial/edit/step.js deleted file mode 100644 index 9454b12..0000000 --- a/addon/routes/tutorial/edit/step.js +++ /dev/null @@ -1,15 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('step', params.step_id); - }, - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } - -}); diff --git a/addon/routes/tutorial/edit/step/target.js b/addon/routes/tutorial/edit/step/target.js deleted file mode 100644 index 025e1c1..0000000 --- a/addon/routes/tutorial/edit/step/target.js +++ /dev/null @@ -1,19 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { getOwner } from '@ember/application'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('step', params.step_id); - }, - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - - - } -}); diff --git a/addon/routes/tutorial/edit/tutorial.js b/addon/routes/tutorial/edit/tutorial.js deleted file mode 100644 index 3c05e95..0000000 --- a/addon/routes/tutorial/edit/tutorial.js +++ /dev/null @@ -1,20 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('tutorial', params.tutorial_id); - }, - setupController(controller, model) { - this._super(...arguments); - controller.get('landscapeService').updateLandscapeList(); - controller.get('landscapeService').loadTutorialLandscape(model); - }, - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } - -}); diff --git a/addon/routes/tutorial/edit/tutorial/landscape.js b/addon/routes/tutorial/edit/tutorial/landscape.js deleted file mode 100644 index 5b6e7b1..0000000 --- a/addon/routes/tutorial/edit/tutorial/landscape.js +++ /dev/null @@ -1,23 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { getOwner } from '@ember/application'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('tutorial', params.tutorial_id); - }, - setupController(controller, model) { - this._super(...arguments); - controller.get('landscapeService').updateLandscapeList(); - controller.get('landscapeService').loadTutorialLandscape(model); - }, - - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } -}); diff --git a/addon/routes/tutorial/edit/tutorial/target.js b/addon/routes/tutorial/edit/tutorial/target.js deleted file mode 100644 index ff2898f..0000000 --- a/addon/routes/tutorial/edit/tutorial/target.js +++ /dev/null @@ -1,19 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import LandscapeInteraction from - 'explorviz-frontend/utils/landscape-rendering/interaction'; -import { getOwner } from '@ember/application'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('tutorial', params.tutorial_id); - }, - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - - - } -}); diff --git a/addon/routes/tutorial/list/sequence.js b/addon/routes/tutorial/list/sequence.js deleted file mode 100644 index 1455632..0000000 --- a/addon/routes/tutorial/list/sequence.js +++ /dev/null @@ -1,16 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import RSVP from 'rsvp'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model() { - return RSVP.hash({ - sequences: this.get('store').findAll('sequence') - }); - }, - actions: { - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } -}); diff --git a/addon/routes/tutorial/list/step.js b/addon/routes/tutorial/list/step.js deleted file mode 100644 index 552574c..0000000 --- a/addon/routes/tutorial/list/step.js +++ /dev/null @@ -1,16 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import RSVP from 'rsvp'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model() { - return RSVP.hash({ - steps: this.get('store').findAll('step') - }); - }, - actions: { - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } -}); diff --git a/addon/routes/tutorial/list/tutorial.js b/addon/routes/tutorial/list/tutorial.js deleted file mode 100644 index 961cdf3..0000000 --- a/addon/routes/tutorial/list/tutorial.js +++ /dev/null @@ -1,16 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import RSVP from 'rsvp'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model() { - return RSVP.hash({ - tutorials: this.get('store').findAll('tutorial') - }); - }, - actions: { - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } -}); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js deleted file mode 100644 index ac1db60..0000000 --- a/addon/routes/tutorial/run.js +++ /dev/null @@ -1,15 +0,0 @@ -import BaseRoute from 'explorviz-frontend/routes/base-route'; -import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; - -export default BaseRoute.extend(AuthenticatedRouteMixin, { - model(params) { - return this.store.findRecord('tutorial', params.tutorial_id); - }, - actions: { - // @Override BaseRoute - resetRoute() { - //const routeName = this.get('tutorial'); - }, - } - -}); diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 1094655..e6d87b2 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -4,7 +4,8 @@ export default LandscapeSerializer.extend({ serialize(snapshot, options) { let json = this._super(...arguments); json.data.attributes.landscape=JSON.stringify(json); - json.data.relationships={tutorialtimestamp: {data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}}; + debugger; + json.data.relationships.tutorialtimestamp={data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}; json.included=[{ type:"tutorialtimestamp", id:snapshot.record.get('timestamp').get('id'), diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 9ef498e..d3676ba 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -19,14 +19,6 @@ export default Service.extend(Evented, { this.set('landscapeList', landscapeList); }); }, - selectLandscape(landscapeTimestamp){ - this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp}).then((landscape) => { - this.set('landscape',landscape); - },()=>{ - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp}).then((landscape) => { - this.set('landscape',landscape); - }); - })}, loadTutorialLandscape(tutorial) { if (this.get('landscape') !== null) { if (this.get('landscape.timestamp.timestamp')!= tutorial.get('landscapeTimestamp') ){ @@ -40,29 +32,32 @@ export default Service.extend(Evented, { } }, importLandscape(landscapeTimestamp){ + var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((landscape) => { this.set('landscape',landscape); }, (e) => { var landscape = this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp", - { + var timestamprecord= { id:landscape.get('timestamp').get('id'), timestamp:landscape.get('timestamp').get('timestamp'), totalRequests:landscape.get('timestamp').get('totalRequests'), name:"new timestamp", - }); - tutorialtimestamp.save().then(()=>{ - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape", - { + }; + var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp",timestamprecord ); + tutorialtimestamp.save().then((tutorialtimestamp)=>{ + var landscaperecord= { id: landscape.get('id'), events: landscape.get('events'), systems: landscape.get('systems'), totalApplicationCommunications: landscape.get('totalApplicationCommunications'), timestamp: tutorialtimestamp , - }); + }; + this.get('store').unloadRecord(landscape); + debugger; + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape",landscaperecord); tutoriallandscape.save(); this.set('landscape',tutoriallandscape); - }); + },(e)=>{debugger;}); }); }); } diff --git a/addon/templates/components/create-form.hbs b/addon/templates/components/create-form.hbs deleted file mode 100644 index 7dc8067..0000000 --- a/addon/templates/components/create-form.hbs +++ /dev/null @@ -1,17 +0,0 @@ -{{#if sequence}} - {{#bs-form model=this onSubmit=(action "createStep" sequence) as |form|}} - {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} - {{bs-button defaultText="Create" type="primary" buttonType="submit"}} -{{/bs-form}} -{{else if tutorial}} - {{#bs-form model=this onSubmit=(action "createSequence" tutorial) as |form|}} - {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} - {{/bs-form}} -{{else}} - {{#bs-form model=this onSubmit=(action "createTutorial") as |form|}} - {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} - {{form.element controlType="text" label="Landscape" placeholder="Landscape" property="tutorial_landscape_change"}} - {{/bs-form}} -{{/if}} diff --git a/addon/templates/components/create-page.hbs b/addon/templates/components/create-page.hbs deleted file mode 100644 index e69de29..0000000 diff --git a/addon/templates/components/landscape-select/timeline.hbs b/addon/templates/components/landscape-select/timeline.hbs deleted file mode 100644 index 94d2933..0000000 --- a/addon/templates/components/landscape-select/timeline.hbs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 00b9fc6..5408482 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -85,7 +85,7 @@ {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} {{/bs-button}}
- {{landscape-select/timeline}} + {{component "timeline"}}
{{/unless}} diff --git a/addon/templates/components/timeline.hbs b/addon/templates/components/timeline.hbs new file mode 100644 index 0000000..cdc255c --- /dev/null +++ b/addon/templates/components/timeline.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/templates/components/tutorial-hierarchie.hbs b/addon/templates/components/tutorial-hierarchie.hbs deleted file mode 100644 index b7aa8e5..0000000 --- a/addon/templates/components/tutorial-hierarchie.hbs +++ /dev/null @@ -1,17 +0,0 @@ -

- {{#if tutorial}} - Tutorial "{{tutorial.title}}" - {{/if}} - {{#if sequence}} - {{#link-to "tutorial.edit.tutorial" sequence.tutorial}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/link-to}} - Sequence "{{sequence.title}}" - {{/if}} - {{#if step}} - {{#link-to "tutorial.edit.sequence" step.sequence}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/link-to}} - Step "{{step.title}}" - {{/if}} -

diff --git a/addon/templates/components/tutorial-management.hbs b/addon/templates/components/tutorial-management.hbs deleted file mode 100644 index 16d8fb2..0000000 --- a/addon/templates/components/tutorial-management.hbs +++ /dev/null @@ -1,275 +0,0 @@ -
- {{#if (eq page "main")}} -
-

Tutorials

-
-
- {{#bs-button class="d-flex-center"onClick=(action "openCreateTutorialPage") type="success" outline=true title="Add Tutorial"}} - {{svg-jar "mortar-board" class="octicon"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial - {{/bs-button}} -
-
-
- - - - - - - - - - - {{#each tutorials as |tutorial|}} - - - - - - - {{/each}} - -
IDTitleSequences
{{#link-to "tutorial.edit" tutorial class=tutorial.id}}{{tutorial.id}}{{/link-to}}{{tutorial.title}} - {{tutorial.sequences.length}} - - {{#bs-dropdown as |dd|}} - {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} - {{svg-jar "kebab-vertical" class="octicon"}} - {{/dd.button}} - {{#dd.menu as |ddm|}} - {{#ddm.item title="Edit"}} - - {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - - {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete - - {{/ddm.item}} - {{/dd.menu}} - {{/bs-dropdown}} -
-
-
- {{else if (eq page "editTutorial")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-
-
-

Tutorial {{currentTutorial.title}}

-
- {{#bs-form model=this onSubmit=(action "saveTutorialChanges") as |form|}} - {{form.element controlType="number" label="ID" property="tutorial_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Tutorial Title" property="tutorial_title_change"}} - {{form.element controlType="text" label="Landscape" placeholder="Landscape" property="tutorial_landscape_change"}} - - Sequences: - {{#bs-button onClick=(action "openCreateSequencePage" currentTutorial) type="secondary" outline=true title="Add Sequence"}} - {{svg-jar "versions" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} - {{/bs-button}} - {{#each currentTutorial.sequences as |sequence|}} - {{#bs-button onClick=(action "openEditSequencePage" currentTutorial sequence) type="secondary" outline=true title="Edit Sequence"}} - {{svg-jar "pencil" class="octicon"}}{{sequence.title}} ({{sequence.steps.length}}) - {{/bs-button}} - {{/each}} - {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
-
-
- {{else if (eq page "editSequence")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} - -
-
-
-
-
-
-

Tutorial "{{currentTutorial.title}}" - {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Sequence "{{currentSequence.title}}" -

-
- {{#bs-form model=this onSubmit=(action "saveSequenceChanges") as |form|}} - {{form.element controlType="number" label="ID" property="sequence_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="sequence_title_change"}} - Steps: - {{#bs-button onClick=(action "openCreateStepPage" currentTutorial currentSequence) type="secondary" outline=true title="Add Step"}} - {{svg-jar "list-ordered" class="octicon"}}{{svg-jar "plus-small" class="octicon"}} - {{/bs-button}} - {{#each currentSequence.steps as |step|}} - {{#bs-button onClick=(action "openEditStepPage" currentTutorial currentSequence step) type="secondary" outline=true title="Edit Step"}} - {{svg-jar "pencil" class="octicon"}}{{step.title}} - {{/bs-button}} - {{sequence.title}} - {{/each}} - {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
-
-
- {{else if (eq page "editStep")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-
-
-

Tutorial "{{currentTutorial.title}}" - {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Sequence "{{currentSequence.title}}" - {{#bs-button onClick=(action "openEditSequencePage" currentTutorial currentSequence) type="secondary" outline=true title="Back to Sequence"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Step "{{currentStep.title}}" -

-
- {{#bs-form model=this onSubmit=(action "saveStepChanges") as |form|}} - {{form.element controlType="number" label="Step ID" property="step_id_change" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="step_title_change"}} - {{#bs-button onClick=(action "openSelectTarget" currentTutorial currentSequence currentStep) type="secondary" outline=true title="Select Target"}} - {{svg-jar "search" class="octicon align-middle"}} - {{/bs-button}} - {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="step_target_id_change" disabled=true}} - {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="step_target_type_change" disabled=true}} - {{bs-button defaultText="Apply Changes" type="primary" buttonType="submit"}} - {{/bs-form}} - -
-
-
-
-
-
- {{else if (eq page "createTutorial")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-

Create Tutorial

- {{#bs-form model=this onSubmit=(action "saveTutorial") as |form|}} - {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} - {{bs-button defaultText="Create" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
- {{else if (eq page "createSequence")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-

Tutorial "{{currentTutorial.title}}" - {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}}Create Sequence

- {{#bs-form model=this onSubmit=(action "saveSequence") as |form|}} - {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} - {{bs-button defaultText="Create" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
- {{else if (eq page "createStep")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-
-
-
-

Tutorial "{{currentTutorial.title}}" - {{#bs-button onClick=(action "openEditTutorialPage" currentTutorial) type="secondary" outline=true title="Back to Tutorial"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Sequence "{{currentSequence.title}}" - {{#bs-button onClick=(action "openEditSequencePage" currentTutorial currentSequence) type="secondary" outline=true title="Back to Sequence"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - Create Step

- {{#bs-form model=this onSubmit=(action "saveStep") as |form|}} - {{form.element controlType="text" label="Title" placeholder="Title" property="title"}} - {{form.element controlType="text" label="TargetId" placeholder="TargetId" property="targetId" disabled=true}} - {{form.element controlType="text" label="TargetType" placeholder="TargetType" property="targetType" disabled=true}} - {{bs-button defaultText="Create" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
- {{else if (eq page "selectTarget")}} -
-
- {{#bs-button onClick=(action "openMainPage") type="secondary" outline=true title="Back to Tutorial List"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} -
-

Step "{{currentStep.title}}"

- Type:{{step_target_type_change}} - Id:{{step_target_id_change}} - {{#bs-button onClick=(action "setTarget" currentTutorial currentSequence currentStep landscapeInteraction.selectedTarget) type="secondary" outline=true title="Back to Step"}} - {{svg-jar "arrow-left" class="octicon align-middle"}} - {{/bs-button}} - {{#if landscapeRepo.latestLandscape.systems}} -
- {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} - - {{visualization/rendering/popups/popup-coordinator - popupData=additionalData.popupContent}} -
- {{else}} -
-
-

No Landscape Found!

-

A new landscape will be fetched every 10 seconds.

-
-
- {{ember-spinner}} -
-
- {{/if}} -
- {{/if}} -
diff --git a/addon/templates/tutorial/edit/sequence.hbs b/addon/templates/tutorial/edit/sequence.hbs deleted file mode 100644 index 847c6f8..0000000 --- a/addon/templates/tutorial/edit/sequence.hbs +++ /dev/null @@ -1,45 +0,0 @@ -
-
- {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -
-
-
-
-
-
- {{tutorial-hierarchie sequence=model}} -
- {{#bs-form model=model onSubmit=(action "saveSequenceChanges" sequence) as |form|}} - {{form.element controlType="number" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} -

Steps

-
- - - - - - {{#if tutorial}}{{/if}} - - - - {{#each model.steps as |step|}} - - - - - {{/each}} - -
IDTitleSteps
- {{#link-to "tutorial.edit.step" step}}{{step.id}}{{/link-to}} - {{step.title}}
-
- {{#link-to "tutorial.create.step" sequence}}Add new Step{{/link-to}} - {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
-
-
diff --git a/addon/templates/tutorial/edit/step.hbs b/addon/templates/tutorial/edit/step.hbs deleted file mode 100644 index e1d74c2..0000000 --- a/addon/templates/tutorial/edit/step.hbs +++ /dev/null @@ -1,40 +0,0 @@ -
-
- {{#link-to "tutorial.list.tutorial"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -
-
-
-
-
-
- {{tutorial-hierarchie step=model}} -
- {{#bs-form model=model onSubmit=(action "saveStepChanges" step) as |form|}} - {{form.element controlType="number" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} - {{#if model.sequence.tutorial.landscape.isFulfilled}} - {{#if model.sequence.tutorial.landscape}} - {{#link-to "tutorial.edit.step.target" model}}Select target{{/link-to}} - {{#if model.targetId}} {{#if model.targetType}} - Target: {{model.targetId}} {{model.targetType}} - {{/if}}{{/if}} - {{else}} - Landscape must be associated with tutorial before target can be set. - {{/if}} - {{else}} - {{#if model.sequence.tutorial.landscapeTimestamp}} -
- {{ember-spinner}} -
- {{else}} - Landscape must be associated with tutorial before target can be set. - {{/if}} - {{/if}} - {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} -
-
-
-
-
-
diff --git a/addon/templates/tutorial/edit/step/target.hbs b/addon/templates/tutorial/edit/step/target.hbs deleted file mode 100644 index fedd970..0000000 --- a/addon/templates/tutorial/edit/step/target.hbs +++ /dev/null @@ -1,23 +0,0 @@ -
-

Step "{{model.title}}"

- Id:{{#if landscapeInteraction.targetId}}{{landscapeInteraction.targetId}}{{else}}{{model.targetId}}{{/if}} - Type:{{#if landscapeInteraction.targetType}}{{landscapeInteraction.targetType}}{{else}}{{model.targetType}}{{/if}} - {{#if model.sequence.tutorial.landscape.isFulfilled}} - {{#bs-button onClick=(action "saveTarget" model landscapeInteraction.targetType landscapeInteraction.targetId) type="secondary" outline=true title="Back to Step"}} - {{svg-jar "desktop-download" class="octicon align-middle"}} - {{/bs-button}} -
- {{visualization/rendering/landscape-rendering latestLandscape=model.sequence.tutorial.landscape interaction=landscapeInteraction}} -
- - {{else}} -
-
-

Landscape loading for "{{model.sequence.tutorial.landscapeTimestamp}}"!

-
- {{ember-spinner}} -
-
-
- {{/if}} -
diff --git a/addon/templates/tutorial/edit/tutorial.hbs b/addon/templates/tutorial/edit/tutorial.hbs deleted file mode 100644 index 3604f06..0000000 --- a/addon/templates/tutorial/edit/tutorial.hbs +++ /dev/null @@ -1,51 +0,0 @@ -
-
- {{#link-to "tutorial.list.tutorial"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -
-
-
-
-
-
- {{tutorial-hierarchie tutorial=model}} -
- {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} - {{form.element controlType="text" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} - {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} - {{#link-to "tutorial.edit.tutorial.landscape" model}} - {{#if landscapeService.landscape}}edit landscape{{else}}select landscape{{/if}} - {{/link-to}} -

Sequences

-
- - - - - - - - - - {{#each model.sequences as |sequence|}} - - - - - - {{/each}} - {{#link-to "tutorial.create.sequence" model}}Add new Sequence{{/link-to}} - -
IDTitleSteps
- {{#link-to "tutorial.edit.sequence" sequence}}{{sequence.id}}{{/link-to}} - {{sequence.title}}{{sequence.steps.length}}
-
- {{bs-button defaultText="Save" type="primary" buttonType="submit"}} - {{/bs-form}} - {{#link-to "tutorial.run" model}}Run tutorial{{/link-to}} -
-
-
-
-
-
diff --git a/addon/templates/tutorial/edit/tutorial/landscape.hbs b/addon/templates/tutorial/edit/tutorial/landscape.hbs deleted file mode 100644 index 9b02727..0000000 --- a/addon/templates/tutorial/edit/tutorial/landscape.hbs +++ /dev/null @@ -1,52 +0,0 @@ -
-
- {{#bs-button - onClick=(action "openDataSelection") - title="togglesidebar" - }}asdasd{{/bs-button}} -

Tutorial "{{model.title}}"

- {{if landscapeService.persisted "Landscape imported" "Save selection to import landscape"}} - {{#if landscapeService.selected}} - {{visualization/page-setup/visualization-navbar - content=(array - (component "landscape-select/navbar/toggle-live-landscape" class="nav-item") - ) - }} -
- {{#if landscapeListener.selected}} - {{landscape-select/landscapelist selectedLandscape=tutorialLandscape.landscape}} - {{visualization/rendering/landscape-rendering latestLandscape=tutorialLandscape.tutorialLandscape interaction=landscapeInteraction}} - {{else}} - {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape interaction=landscapeInteraction}} -
- {{#bs-button - onClick=(action "toggleTimeline") - type="secondary" - outline=true - class="btn-timeline" - title=(if renderingService.showTimeline "Hide Timeline" "Show Timeline") - }} - {{#unless renderingService.showTimeline}}Show Timeline{{/unless}} - {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} - {{/bs-button}} -
- {{landscape-select/timeline landscapeTimestamp=model.landscapeTimestamp}} -
-
- {{/if}} -
- {{else}} -
-
-

Landscape loading for "{{model.landscapeTimestamp}}"!

-
- {{ember-spinner}} -
-
-
- {{/if}} -
- {{visualization/page-setup/sidebar/data-selection}} -
-
-
diff --git a/addon/templates/tutorial/edit/tutorial/target.hbs b/addon/templates/tutorial/edit/tutorial/target.hbs deleted file mode 100644 index ec557c1..0000000 --- a/addon/templates/tutorial/edit/tutorial/target.hbs +++ /dev/null @@ -1,23 +0,0 @@ -
-

Tutorial "{{model.title}}"

- Id:{{#if landscapeInteraction.targetId}}{{landscapeInteraction.targetId}}{{else}}{{model.targetId}}{{/if}} - Type:{{#if landscapeInteraction.targetType}}{{landscapeInteraction.targetType}}{{else}}{{model.targetType}}{{/if}} - {{#if model.landscape.isFulfilled}} - {{#bs-button onClick=(action "saveTarget" model landscapeInteraction.targetType landscapeInteraction.targetId) type="secondary" outline=true title="Back to Step"}} - {{svg-jar "desktop-download" class="octicon align-middle"}} - {{/bs-button}} -
- {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction}} -
- - {{else}} -
-
-

Landscape loading for "{{model.landscapeTimestamp}}"!

-
- {{ember-spinner}} -
-
-
- {{/if}} -
diff --git a/addon/templates/tutorial/list/sequence.hbs b/addon/templates/tutorial/list/sequence.hbs deleted file mode 100644 index 3f340ae..0000000 --- a/addon/templates/tutorial/list/sequence.hbs +++ /dev/null @@ -1,55 +0,0 @@ -
-

Tutorials

-
-
- {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} -
-
-
- - - - - - - - - - - {{#each model.sequences as |sequence|}} - - - - - - - {{/each}} - -
IDTitlesteps
- {{#link-to "tutorial.edit.sequence" sequence}}{{sequence.id}}{{/link-to}} - {{sequence.title}} - {{sequence.steps.length}} - - {{#bs-dropdown as |dd|}} - {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} - {{svg-jar "kebab-vertical" class="octicon"}} - {{/dd.button}} - {{#dd.menu as |ddm|}} - {{#ddm.item title="Edit"}} - - {{#link-to "tutorial.edit.sequence" sequence}} - {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} - - {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete - - {{/ddm.item}} - {{/dd.menu}} - {{/bs-dropdown}} -
-
-
diff --git a/addon/templates/tutorial/list/step.hbs b/addon/templates/tutorial/list/step.hbs deleted file mode 100644 index cf40f05..0000000 --- a/addon/templates/tutorial/list/step.hbs +++ /dev/null @@ -1,52 +0,0 @@ -
-

Tutorials

-
-
- {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} -
-
-
- - - - - - - - - - {{#each model.steps as |step|}} - - - - - - - {{/each}} - -
IDTitle
- {{#link-to "tutorial.edit.step" step}}{{step.id}}{{/link-to}} - {{step.title}} - {{#bs-dropdown as |dd|}} - {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} - {{svg-jar "kebab-vertical" class="octicon"}} - {{/dd.button}} - {{#dd.menu as |ddm|}} - {{#ddm.item title="Edit"}} - - {{#link-to "tutorial.edit.step" step}} - {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} - - {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete - - {{/ddm.item}} - {{/dd.menu}} - {{/bs-dropdown}} -
-
-
diff --git a/addon/templates/tutorial/list/tutorial.hbs b/addon/templates/tutorial/list/tutorial.hbs deleted file mode 100644 index fac4e79..0000000 --- a/addon/templates/tutorial/list/tutorial.hbs +++ /dev/null @@ -1,55 +0,0 @@ -
-

Tutorials

-
-
- {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} -
-
-
- - - - - - - - - - - {{#each model.tutorials as |tutorial|}} - - - - - - - {{/each}} - -
IDTitleSequences
- {{#link-to "tutorial.edit.tutorial" tutorial}}{{tutorial.id}}{{/link-to}} - {{tutorial.title}} - {{tutorial.sequences.length}} - - {{#bs-dropdown as |dd|}} - {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} - {{svg-jar "kebab-vertical" class="octicon"}} - {{/dd.button}} - {{#dd.menu as |ddm|}} - {{#ddm.item title="Edit"}} - - {{#link-to "tutorial.edit.tutorial" tutorial}} - {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} - - {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete - - {{/ddm.item}} - {{/dd.menu}} - {{/bs-dropdown}} -
-
-
diff --git a/app/components/create-form.js b/app/components/create-form.js deleted file mode 100644 index 2734d90..0000000 --- a/app/components/create-form.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/create-form'; \ No newline at end of file diff --git a/app/components/landscape-select/navbar/return-to-saved.js b/app/components/landscape-select/navbar/return-to-saved.js deleted file mode 100644 index 4dc47c8..0000000 --- a/app/components/landscape-select/navbar/return-to-saved.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/navbar/return-to-saved'; \ No newline at end of file diff --git a/app/components/landscape-select/navbar/save-landscape.js b/app/components/landscape-select/navbar/save-landscape.js deleted file mode 100644 index d2a1573..0000000 --- a/app/components/landscape-select/navbar/save-landscape.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/navbar/save-landscape'; \ No newline at end of file diff --git a/app/components/landscape-select/timeline.js b/app/components/landscape-select/timeline.js deleted file mode 100644 index 5527627..0000000 --- a/app/components/landscape-select/timeline.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-select/timeline'; \ No newline at end of file diff --git a/app/components/edit-page.js b/app/components/timeline.js similarity index 75% rename from app/components/edit-page.js rename to app/components/timeline.js index fc8f2ee..004baa7 100644 --- a/app/components/edit-page.js +++ b/app/components/timeline.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/components/edit-page'; \ No newline at end of file +export { default } from 'explorviz-frontend-extension-tutorial/components/timeline'; \ No newline at end of file diff --git a/app/controllers/tutorial-management.js b/app/controllers/tutorial-management.js deleted file mode 100644 index 976623b..0000000 --- a/app/controllers/tutorial-management.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial-management'; diff --git a/app/controllers/tutorial/edit/sequence.js b/app/controllers/tutorial/edit/sequence.js deleted file mode 100644 index 1dab40f..0000000 --- a/app/controllers/tutorial/edit/sequence.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/sequence'; diff --git a/app/controllers/tutorial/edit/step.js b/app/controllers/tutorial/edit/step.js deleted file mode 100644 index b987961..0000000 --- a/app/controllers/tutorial/edit/step.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/step'; diff --git a/app/controllers/tutorial/edit/step/target.js b/app/controllers/tutorial/edit/step/target.js deleted file mode 100644 index 6889e5b..0000000 --- a/app/controllers/tutorial/edit/step/target.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/step/target'; diff --git a/app/controllers/tutorial/edit/tutorial.js b/app/controllers/tutorial/edit/tutorial.js deleted file mode 100644 index 14f0c16..0000000 --- a/app/controllers/tutorial/edit/tutorial.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/tutorial'; diff --git a/app/controllers/tutorial/edit/tutorial/landscape.js b/app/controllers/tutorial/edit/tutorial/landscape.js deleted file mode 100644 index 74b8ada..0000000 --- a/app/controllers/tutorial/edit/tutorial/landscape.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/tutorial/landscape'; diff --git a/app/controllers/tutorial/edit/tutorial/target.js b/app/controllers/tutorial/edit/tutorial/target.js deleted file mode 100644 index 75afd46..0000000 --- a/app/controllers/tutorial/edit/tutorial/target.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/edit/tutorial/target'; diff --git a/app/controllers/tutorial/list/landscape.js b/app/controllers/tutorial/list/landscape.js deleted file mode 100644 index d21d731..0000000 --- a/app/controllers/tutorial/list/landscape.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/controllers/tutorial/list/landscape'; diff --git a/app/routes/tutorial/edit/sequence.js b/app/routes/tutorial/edit/sequence.js deleted file mode 100644 index ffe8b5e..0000000 --- a/app/routes/tutorial/edit/sequence.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/sequence'; diff --git a/app/routes/tutorial/edit/step.js b/app/routes/tutorial/edit/step.js deleted file mode 100644 index b8312d8..0000000 --- a/app/routes/tutorial/edit/step.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/step'; diff --git a/app/routes/tutorial/edit/step/target.js b/app/routes/tutorial/edit/step/target.js deleted file mode 100644 index f76fd27..0000000 --- a/app/routes/tutorial/edit/step/target.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/step/target'; diff --git a/app/routes/tutorial/edit/tutorial.js b/app/routes/tutorial/edit/tutorial.js deleted file mode 100644 index 91ee3ee..0000000 --- a/app/routes/tutorial/edit/tutorial.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/tutorial'; diff --git a/app/routes/tutorial/edit/tutorial/landscape.js b/app/routes/tutorial/edit/tutorial/landscape.js deleted file mode 100644 index 4a128ae..0000000 --- a/app/routes/tutorial/edit/tutorial/landscape.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/tutorial/landscape'; diff --git a/app/routes/tutorial/edit/tutorial/target.js b/app/routes/tutorial/edit/tutorial/target.js deleted file mode 100644 index 1fa5954..0000000 --- a/app/routes/tutorial/edit/tutorial/target.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/edit/tutorial/target'; diff --git a/app/routes/tutorial/list/sequence.js b/app/routes/tutorial/list/sequence.js deleted file mode 100644 index 48d33e4..0000000 --- a/app/routes/tutorial/list/sequence.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list/sequence'; diff --git a/app/routes/tutorial/list/step.js b/app/routes/tutorial/list/step.js deleted file mode 100644 index 7687173..0000000 --- a/app/routes/tutorial/list/step.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list/step'; diff --git a/app/routes/tutorial/list/tutorial.js b/app/routes/tutorial/list/tutorial.js deleted file mode 100644 index 0a78b6d..0000000 --- a/app/routes/tutorial/list/tutorial.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/routes/tutorial/list/tutorial'; diff --git a/app/templates/tutorial/edit/step.js b/app/templates/components/timeline.js similarity index 67% rename from app/templates/tutorial/edit/step.js rename to app/templates/components/timeline.js index 26254a2..397b235 100644 --- a/app/templates/tutorial/edit/step.js +++ b/app/templates/components/timeline.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/step'; +export { default } from 'explorviz-frontend-extension-tutorial/templates/components/timeline'; diff --git a/app/templates/components/tutorial-management.js b/app/templates/components/tutorial-management.js deleted file mode 100644 index 64ef129..0000000 --- a/app/templates/components/tutorial-management.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/components/tutorial-management'; diff --git a/app/templates/tutorial/edit/sequence.js b/app/templates/tutorial/edit/sequence.js deleted file mode 100644 index 4251be7..0000000 --- a/app/templates/tutorial/edit/sequence.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/sequence'; diff --git a/app/templates/tutorial/edit/step/target.js b/app/templates/tutorial/edit/step/target.js deleted file mode 100644 index ffe1b50..0000000 --- a/app/templates/tutorial/edit/step/target.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/step/target'; diff --git a/app/templates/tutorial/edit/tutorial.js b/app/templates/tutorial/edit/tutorial.js deleted file mode 100644 index 58454a8..0000000 --- a/app/templates/tutorial/edit/tutorial.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/tutorial'; diff --git a/app/templates/tutorial/edit/tutorial/landscape.js b/app/templates/tutorial/edit/tutorial/landscape.js deleted file mode 100644 index 9dc4aa1..0000000 --- a/app/templates/tutorial/edit/tutorial/landscape.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/tutorial/landscape'; diff --git a/app/templates/tutorial/edit/tutorial/target.js b/app/templates/tutorial/edit/tutorial/target.js deleted file mode 100644 index 3ab7376..0000000 --- a/app/templates/tutorial/edit/tutorial/target.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/edit/tutorial/target'; diff --git a/app/templates/tutorial/list/sequence.js b/app/templates/tutorial/list/sequence.js deleted file mode 100644 index 2ceef09..0000000 --- a/app/templates/tutorial/list/sequence.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list/sequence'; diff --git a/app/templates/tutorial/list/step.js b/app/templates/tutorial/list/step.js deleted file mode 100644 index 022d29c..0000000 --- a/app/templates/tutorial/list/step.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list/step'; diff --git a/app/templates/tutorial/list/tutorial.js b/app/templates/tutorial/list/tutorial.js deleted file mode 100644 index 9e92d5b..0000000 --- a/app/templates/tutorial/list/tutorial.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/tutorial/list/tutorial'; From 7d5bebbcf0b132ef654d26d5fcbcbbdf3128919d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Fri, 26 Apr 2019 08:24:34 +0200 Subject: [PATCH 17/30] cleanup --- addon/components/side-form-layout.js | 1 - addon/components/timeline.js | 3 +- addon/models/tutoriallandscape.js | 1 + addon/routes/tutorial/sequence.js | 8 +++-- addon/routes/tutorial/step.js | 9 +++-- addon/routes/tutorial/tutorial.js | 5 +-- addon/serializers/tutoriallandscape.js | 28 ++++++++++++--- addon/services/landscape-service.js | 36 ++++++++----------- addon/services/tutorial-service.js | 6 +++- .../landscape-select/landscapelist.hbs | 5 ++- .../templates/components/side-form-layout.hbs | 8 ++--- addon/templates/tutorial/sequence.hbs | 2 +- addon/templates/tutorial/step.hbs | 2 +- addon/templates/tutorial/tutorial.hbs | 2 +- 14 files changed, 65 insertions(+), 51 deletions(-) diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index 616715b..1260b93 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -79,7 +79,6 @@ export default Component.extend({ init(){ this._super(...arguments); - this.get('landscapeService').updateLandscapeList(); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); }, diff --git a/addon/components/timeline.js b/addon/components/timeline.js index e73f549..bb3a2b3 100644 --- a/addon/components/timeline.js +++ b/addon/components/timeline.js @@ -7,12 +7,11 @@ export default Timeline.extend(AlertifyHandler,{ layout, landscapeService: service(), chartClickHandler(evt) { - //this._super(...arguments); + this._super(...arguments); var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; if (tutorialActivePoint) { this.get('landscapeListener').set('pauseVisualizationReload',true); this.get('landscapeService').importLandscape(tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); - //this.await.clearRender(); } } }); diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index 8c61fad..b611d26 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -3,6 +3,7 @@ import Landscape from "explorviz-frontend/models/landscape" const { belongsTo, hasMany } = DS; export default Landscape.extend({ + timestamp: DS.belongsTo('tutorialtimestamp'), events: hasMany('event', { inverse: null, diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index 04c7011..103f623 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -3,12 +3,14 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { - return this.store.findRecord('sequence', params.sequence_id); + return this.get('store').findRecord('sequence', params.sequence_id); }, setupController(controller, model) { this._super(...arguments); - controller.get('landscapeService').updateLandscapeList(); - controller.get('landscapeService').loadTutorialLandscape(model); + controller.set('landscapeService.liveMode',false); + controller.get('landscapeService').updateLandscapeList(true); + debugger; + controller.get('landscapeService').loadTutorialLandscape(model.tutorial); }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index c6b71a0..82b9683 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -3,15 +3,14 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { - return this.store.findRecord('step', params.step_id); + return this.get('store').findRecord('step', params.step_id); }, setupController(controller, model) { this._super(...arguments); - controller.get('landscapeService').updateLandscapeList(); - controller.get('landscapeService').loadTutorialLandscape(model); controller.set('landscapeService.liveMode',false); - controller.set('landscapeService.',false); - + controller.get('landscapeService').updateLandscapeList(true); + debugger; + controller.get('landscapeService').loadTutorialLandscape(model.get('sequence').get('tutorial')); }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/tutorial.js b/addon/routes/tutorial/tutorial.js index 3c05e95..b730db8 100644 --- a/addon/routes/tutorial/tutorial.js +++ b/addon/routes/tutorial/tutorial.js @@ -3,12 +3,13 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { - return this.store.findRecord('tutorial', params.tutorial_id); + return this.get('store').findRecord('tutorial', params.tutorial_id); }, setupController(controller, model) { this._super(...arguments); - controller.get('landscapeService').updateLandscapeList(); + controller.get('landscapeService').updateLandscapeList(true); controller.get('landscapeService').loadTutorialLandscape(model); + controller.set('landscapeService.liveMode',false); }, actions: { // @Override BaseRoute diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index e6d87b2..902edfd 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -1,10 +1,22 @@ -import LandscapeSerializer from "explorviz-frontend/serializers/landscape" +// import LandscapeSerializer from "explorviz-frontend/serializers/landscape" +import SaveRelationshipsMixin from 'ember-data-save-relationships'; +import JSONAPISerializer from 'ember-data/serializers/json-api'; -export default LandscapeSerializer.extend({ +export default JSONAPISerializer.extend(SaveRelationshipsMixin,{ + + attrs: { + events: { serialize: true }, + //systems: { serialize: true }, + totalApplicationCommunications: { serialize: true } + }, + payloadKeyFromModelName(model){ + return model; + }, serialize(snapshot, options) { let json = this._super(...arguments); + //debugger; json.data.attributes.landscape=JSON.stringify(json); - debugger; + json.data.relationships={}; json.data.relationships.tutorialtimestamp={data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}; json.included=[{ type:"tutorialtimestamp", @@ -14,7 +26,6 @@ export default LandscapeSerializer.extend({ timestamp:snapshot.record.get('timestamp').get('timestamp') } }]; - return json; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { @@ -26,6 +37,15 @@ export default LandscapeSerializer.extend({ }else{ var json = JSON.parse(payload.data.attributes.landscape); } + if(Array.isArray(json.included)){ + if(Array.isArray(payload.included)){ + json.included=json.included+payload.included; + } + }else{ + if(payload.included!=undefined){ + json.included=payload.included; + } + } return this._super(store, primaryModelClass, json, id, requestType); } }); diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index d3676ba..2360e10 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -9,6 +9,7 @@ export default Service.extend(Evented, { landscape: null, livelandscapes: false, landscapeList: null, + updateLandscapeList(reload) { this.set('landscapeList', []); this.get('store').findAll('tutoriallandscape', { reload }) @@ -19,46 +20,37 @@ export default Service.extend(Evented, { this.set('landscapeList', landscapeList); }); }, - loadTutorialLandscape(tutorial) { + loadTutorialLandscape(tutorial) { if (this.get('landscape') !== null) { - if (this.get('landscape.timestamp.timestamp')!= tutorial.get('landscapeTimestamp') ){ + if (this.get('landscape.timestamp.timestamp')!=tutorial.get('landscapeTimestamp') ){ this.get('store').unloadRecord(this.get('landscape')); }else{ return; } } - if(tutorial.get('landscapeTimestamp')){ - this.importLandscape(tutorial.get('landscapeTimestamp')); - } }, importLandscape(landscapeTimestamp){ - - var record = this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((landscape) => { - this.set('landscape',landscape); + debugger; + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { + this.set('landscape',tutlandscape); }, (e) => { - var landscape = this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var timestamprecord= { + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + var timestamp=this.get('store').createRecord("tutorialtimestamp",{ id:landscape.get('timestamp').get('id'), timestamp:landscape.get('timestamp').get('timestamp'), totalRequests:landscape.get('timestamp').get('totalRequests'), - name:"new timestamp", - }; - var tutorialtimestamp = this.get('store').createRecord("tutorialtimestamp",timestamprecord ); - tutorialtimestamp.save().then((tutorialtimestamp)=>{ - var landscaperecord= { + name:"new timestamp" + }); + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape",{ id: landscape.get('id'), events: landscape.get('events'), systems: landscape.get('systems'), totalApplicationCommunications: landscape.get('totalApplicationCommunications'), - timestamp: tutorialtimestamp , - }; - this.get('store').unloadRecord(landscape); - debugger; - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape",landscaperecord); + timestamp:timestamp + }); tutoriallandscape.save(); this.set('landscape',tutoriallandscape); - },(e)=>{debugger;}); - }); + },(e)=>{}); }); } }) diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index 07bbe1a..73cf09a 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -28,7 +28,7 @@ export default Service.extend(Evented,AlertifyHandler, { return; } tutorial.save() - .then(()=> { + .then((tutorial)=> { const message = `Tutorial updated.`; this.get('landscapeService').loadTutorialLandscape(tutorial); this.showAlertifyMessage(message); @@ -39,4 +39,8 @@ export default Service.extend(Evented,AlertifyHandler, { this.showAlertifyMessage(`Tutorial not found.`); } }, + showReasonErrorAlert(reason) { + const {title, detail} = reason.errors[0]; + this.showAlertifyMessage(`${title}: ${detail}`); + }, }); diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index 02e4533..c25e152 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -1,7 +1,6 @@ -{{#if tutorialLandscape.selected}} -Selected Landscape:{{tutorialLandscape.selectedLandscape.timestamp}} +{{#if landscapeService.landscape}} +Selected Landscape:{{landscapeService.landscape.timestamp}} {{else}} - No Landscape selected for Tutorial {{landscapeService.landscapeList.length}} possible Landscapes:
    {{#each landscapeService.landscapeList as |landscape|}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 5408482..4a78aab 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -8,10 +8,10 @@ outline=true class="btn-timeline" title="show live landscapes" - }} + }} show live landscapes {{/bs-button}} - {{landscape-select/landscapelist model=model}} + {{landscape-select/landscapelist model=tutorial}} {{else}} {{#bs-button onClick=(action "hideLiveLandscapes") @@ -91,9 +91,7 @@ {{/unless}} {{else}}
    - {{landscape-visualization latestLandscape=landscapeService.landscape}} - {{landscapeService.landscape.timestamp.timestamp}} - Visualization not implemented! + {{landscape-visualization latestLandscape=landscapeService.landscape}}
    {{/if}}
diff --git a/addon/templates/tutorial/sequence.hbs b/addon/templates/tutorial/sequence.hbs index 5657ed0..e26f5ba 100644 --- a/addon/templates/tutorial/sequence.hbs +++ b/addon/templates/tutorial/sequence.hbs @@ -1 +1 @@ -{{side-form-layout form="sequence-form" model=model}} +{{side-form-layout form="sequence-form" model=model tutorial=model.tutorial}} diff --git a/addon/templates/tutorial/step.hbs b/addon/templates/tutorial/step.hbs index 584d8d4..049faf7 100644 --- a/addon/templates/tutorial/step.hbs +++ b/addon/templates/tutorial/step.hbs @@ -1 +1 @@ -{{side-form-layout form="step-form" model=model}} +{{side-form-layout form="step-form" model=model tutorial=model.sequence.tutorial}} diff --git a/addon/templates/tutorial/tutorial.hbs b/addon/templates/tutorial/tutorial.hbs index e8e795a..3fce9ed 100644 --- a/addon/templates/tutorial/tutorial.hbs +++ b/addon/templates/tutorial/tutorial.hbs @@ -1 +1 @@ -{{side-form-layout form="tutorial-form" model=model}} +{{side-form-layout form="tutorial-form" model=model tutorial=model}} From f3877bb8754de098bddcbd50f0d0f9ca6df6cbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Fri, 26 Apr 2019 12:28:26 +0200 Subject: [PATCH 18/30] refactor for ids --- addon/components/side-form-layout.js | 6 +- addon/models/tutorialtimestamp.js | 1 + addon/routes/tutorial/sequence.js | 3 +- addon/serializers/tutoriallandscape.js | 2 +- addon/services/landscape-service.js | 100 +++++++++++++----- addon/templates/components/sequence-form.hbs | 2 +- .../templates/components/side-form-layout.hbs | 3 +- addon/templates/tutorial/sequence.hbs | 2 +- 8 files changed, 86 insertions(+), 33 deletions(-) diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index 1260b93..6f3ff61 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -15,9 +15,9 @@ export default Component.extend({ return !this.get('landscapeRepo.latestApplication'); }), - selectMode: computed('landscapeService.landscape',function(){ + selectMode: computed('landscapeService.timestamp.landscape',function(){ if(this.get('model.constructor.modelName')=="tutorial"){ - return !this.get('landscapeService.landscape'); + return !this.get('landscapeService.timestamp.landscape'); } return false; }), @@ -51,7 +51,6 @@ export default Component.extend({ hideLiveLandscapes(){ this.set('landscapeService.livelandscapes',false); this.get('landscapeListener').set('pauseVisualizationReload',true); - } }, showTimeline() { @@ -79,6 +78,7 @@ export default Component.extend({ init(){ this._super(...arguments); + this.get('landscapeService').updateLandscapeList(); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); }, diff --git a/addon/models/tutorialtimestamp.js b/addon/models/tutorialtimestamp.js index 053381b..c4edb4c 100644 --- a/addon/models/tutorialtimestamp.js +++ b/addon/models/tutorialtimestamp.js @@ -2,5 +2,6 @@ import Timestamp from "explorviz-frontend/models/timestamp" import DS from 'ember-data'; export default Timestamp.extend({ + landscape: DS.belongsTo('tutoriallandscape'), name: DS.attr('String') }); diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index 103f623..e3bde1a 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -9,8 +9,7 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - debugger; - controller.get('landscapeService').loadTutorialLandscape(model.tutorial); + controller.get('landscapeService').loadTutorialLandscape(model.get('tutorial')); }, actions: { // @Override BaseRoute diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 902edfd..f8feb86 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -14,7 +14,7 @@ export default JSONAPISerializer.extend(SaveRelationshipsMixin,{ }, serialize(snapshot, options) { let json = this._super(...arguments); - //debugger; + debugger; json.data.attributes.landscape=JSON.stringify(json); json.data.relationships={}; json.data.relationships.tutorialtimestamp={data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}; diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 2360e10..8a5d311 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -6,7 +6,7 @@ import { inject as service } from "@ember/service"; export default Service.extend(Evented, { debug: debugLogger(), store: service(), - landscape: null, + timestamp: null, livelandscapes: false, landscapeList: null, @@ -21,36 +21,88 @@ export default Service.extend(Evented, { }); }, loadTutorialLandscape(tutorial) { - if (this.get('landscape') !== null) { - if (this.get('landscape.timestamp.timestamp')!=tutorial.get('landscapeTimestamp') ){ - this.get('store').unloadRecord(this.get('landscape')); - }else{ - return; - } + if (this.get('timestamp.landscape') !== null) { + this.get('store').queryRecord('tutoriallandscape',{ timestamp: tutorial.get('landscapeTimestamp') }).then((landscape)=>{ + if (this.get('timestamp.landscape.id')!= landscape.get('id')){ + this.get('store').unloadRecord(this.get('landscape')); + }else{ + return; + } + this.importLandscape(tutorial.get('landscapeTimestamp')); + }) } }, importLandscape(landscapeTimestamp){ - debugger; this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { this.set('landscape',tutlandscape); }, (e) => { - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var timestamp=this.get('store').createRecord("tutorialtimestamp",{ - id:landscape.get('timestamp').get('id'), - timestamp:landscape.get('timestamp').get('timestamp'), - totalRequests:landscape.get('timestamp').get('totalRequests'), - name:"new timestamp" + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutoriallandscape)=>{ + tutoriallandscape.set('systems',landscape.get('systems')); + tutoriallandscape.set('events',landscape.get('events')); + tutoriallandscape.set('totalApplicationCommunications',landscape.get('totalApplicationCommunications')); + tutoriallandscape.save(); + var tsrecord= { + id:landscape.get('timestamp.id'), + timestamp:landscape.get('timestamp.timestamp'), + landscape: tutoriallandscape + } + tsrecord= this.get('store').createRecord('tutorialtimestamp',tsrecord); + tsrecord.save(); + + }); + },{}) + + }); + }, + importLandscapeSerialize(landscapeTimestamp){ + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { + this.set('landscape',tutlandscape); + }, (e) => { + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + var lsrecord= { + id:landscape.get('id'), + systems:landscape.get('systems'), + events: landscape.get('events'), + totalApplicationCommunications:landscape.get('totalApplicationCommunications') + } + this.get('store').push('tutoriallandscape',lsrecord); + + var tsrecord= { + id:landscape.get('timestamp.id'), + timestamp:landscape.get('timestamp.timestamp'), + landscape: landscape + } + this.get('store').push('tutorialtimestamp',tsrecord); + + }); + }); + }, + importLandscapeID(landscapeTimestamp){ + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { + this.set('landscape',tutlandscape); + }, (e) => { + if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ + var tutoriallandscape = this.get('store').createRecord("tutoriallandscape",{ + id: landscape.get('id'), + events: landscape.get('events'), + systems: landscape.get('systems'), + totalApplicationCommunications: landscape.get('totalApplicationCommunications') + }); + tutoriallandscape.save(); + }else{ + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + var timestamp=this.get('store').createRecord("tutorialtimestamp",{ + id:landscape.get('timestamp').get('id'), + timestamp:landscape.get('timestamp').get('timestamp'), + totalRequests:landscape.get('timestamp').get('totalRequests'), + name:"new timestamp", + landscape: tutoriallandscape + }); + timestamp.save(); + this.set('timestamp',timestamp); }); - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape",{ - id: landscape.get('id'), - events: landscape.get('events'), - systems: landscape.get('systems'), - totalApplicationCommunications: landscape.get('totalApplicationCommunications'), - timestamp:timestamp - }); - tutoriallandscape.save(); - this.set('landscape',tutoriallandscape); - },(e)=>{}); + } }); } }) diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index aed81be..b0f4c15 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -1,5 +1,5 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -{{#bs-form model=sequence onSubmit=(action "saveSequenceChanges" sequence) as |form|}} +{{#bs-form model=model onSubmit=(action "saveSequenceChanges" sequence) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 4a78aab..65ee7e3 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -91,11 +91,12 @@ {{/unless}} {{else}}
- {{landscape-visualization latestLandscape=landscapeService.landscape}} + {{landscape-visualization latestLandscape=landscapeService.timestamp.landscape}}
{{/if}}
+ {{model}} {{component form model=model}}
diff --git a/addon/templates/tutorial/sequence.hbs b/addon/templates/tutorial/sequence.hbs index e26f5ba..dc051f4 100644 --- a/addon/templates/tutorial/sequence.hbs +++ b/addon/templates/tutorial/sequence.hbs @@ -1 +1 @@ -{{side-form-layout form="sequence-form" model=model tutorial=model.tutorial}} +{{side-form-layout form="sequence-form" model=model tutorial=model.tutorial}} \ No newline at end of file From 28717c46c801e8f56f619671641623c9b2b4e202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 6 May 2019 08:10:03 +0200 Subject: [PATCH 19/30] import landscapes --- addon/components/landscape-visualization.js | 4 +- addon/components/side-form-layout.js | 8 +- addon/models/tutoriallandscape.js | 17 +--- addon/models/tutorialtimestamp.js | 2 +- addon/routes/tutorial/step.js | 3 +- addon/serializers/tutoriallandscape.js | 53 +++++++++-- addon/services/landscape-service.js | 87 +++++-------------- .../landscape-select/landscapelist.hbs | 2 +- .../components/landscape-visualization.hbs | 5 +- .../templates/components/side-form-layout.hbs | 4 +- 10 files changed, 80 insertions(+), 105 deletions(-) diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index ae2f537..5f606f0 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -1,5 +1,5 @@ -// import layout from '../templates/components/landscape-visualization'; -import layout from 'explorviz-frontend/templates/components/visualization/rendering/landscape-rendering' + import layout from '../templates/components/landscape-visualization'; +//import layout from 'explorviz-frontend/templates/components/visualization/rendering/landscape-rendering' import LandscapeRendering from 'explorviz-frontend/components/visualization/rendering/landscape-rendering' export default LandscapeRendering.extend({ diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index 6f3ff61..a032be4 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -15,9 +15,9 @@ export default Component.extend({ return !this.get('landscapeRepo.latestApplication'); }), - selectMode: computed('landscapeService.timestamp.landscape',function(){ + selectMode: computed('landscapeService.landscape',function(){ if(this.get('model.constructor.modelName')=="tutorial"){ - return !this.get('landscapeService.timestamp.landscape'); + return !this.get('landscapeService.landscape'); } return false; }), @@ -35,12 +35,10 @@ export default Component.extend({ resetView() { this.get('renderingService').reSetupScene(); }, - openLandscapeView() { this.set('landscapeRepo.latestApplication', null); this.set('landscapeRepo.replayApplication', null); }, - toggleTimeline() { this.get('renderingService').toggleTimeline(); }, @@ -78,7 +76,7 @@ export default Component.extend({ init(){ this._super(...arguments); - this.get('landscapeService').updateLandscapeList(); + this.get('landscapeService').updateLandscapeList(true); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); }, diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index b611d26..b798b06 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -3,21 +3,6 @@ import Landscape from "explorviz-frontend/models/landscape" const { belongsTo, hasMany } = DS; export default Landscape.extend({ + timestamp: DS.belongsTo('tutorialtimestamp',{inverse:'landscape'}), - timestamp: DS.belongsTo('tutorialtimestamp'), - events: hasMany('event', { - inverse: null, - async: false - }), - - systems: hasMany('system', { - inverse: 'parent', - async: false - }), - - // list of applicationCommunication for rendering purposes - totalApplicationCommunications: hasMany('applicationcommunication', { - inverse: null, - async: false - }), }); diff --git a/addon/models/tutorialtimestamp.js b/addon/models/tutorialtimestamp.js index c4edb4c..eb3fe5b 100644 --- a/addon/models/tutorialtimestamp.js +++ b/addon/models/tutorialtimestamp.js @@ -2,6 +2,6 @@ import Timestamp from "explorviz-frontend/models/timestamp" import DS from 'ember-data'; export default Timestamp.extend({ - landscape: DS.belongsTo('tutoriallandscape'), + landscape: DS.belongsTo('tutoriallandscape',{inverse:'timestamp'}), name: DS.attr('String') }); diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index 82b9683..3eec03c 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -9,8 +9,7 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - debugger; - controller.get('landscapeService').loadTutorialLandscape(model.get('sequence').get('tutorial')); + controller.get('landscapeService').loadTutorialLandscape(model.get('sequence.tutorial')); }, actions: { // @Override BaseRoute diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index f8feb86..3e619cb 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -7,35 +7,72 @@ export default JSONAPISerializer.extend(SaveRelationshipsMixin,{ attrs: { events: { serialize: true }, //systems: { serialize: true }, - totalApplicationCommunications: { serialize: true } + totalApplicationCommunications: { serialize: true } }, payloadKeyFromModelName(model){ return model; }, serialize(snapshot, options) { let json = this._super(...arguments); - debugger; - json.data.attributes.landscape=JSON.stringify(json); - json.data.relationships={}; - json.data.relationships.tutorialtimestamp={data:{type:'tutorialtimestamp',id:snapshot.record.get('timestamp').get('id')}}; - json.included=[{ + + json.included=[]; + // snapshot.hasMany('events').forEach(function(v,k){ + // json.included.push(v.serialize()); + // }); + snapshot.hasMany('systems').forEach(function(v,k){ + debugger; + json.included.push(v.serialize()); + }); + // snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ + // json.included.push(v.serialize()); + // }); +// json.included.push({type:"tutorialtimestamp", +// id:snapshot.record.get('timestamp').get('id'), +// attributes: { +// name:snapshot.record.get('timestamp').get('name'), +// timestamp:snapshot.record.get('timestamp').get('timestamp') +// }}); +// json.data.relationships.timestamp={ +// type:"tutorialtimestamp", +// id:snapshot.record.get('timestamp').get('id') +// }; + var newjson={ + data:{ + id: snapshot.record.get('id'), + type: "tutoriallandscape", + attributes:{ + landscape:JSON.stringify(json), + }, + relationships:{ + timestamp:{ + data:{ + type:'tutorialtimestamp', + id:snapshot.record.get('timestamp').get('id') + } + } + } + }, + included:[{ type:"tutorialtimestamp", id:snapshot.record.get('timestamp').get('id'), attributes: { name:snapshot.record.get('timestamp').get('name'), timestamp:snapshot.record.get('timestamp').get('timestamp') } - }]; - return json; + }] + }; + return newjson; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { if(Array.isArray(payload.data)){ var json = {data:[]}; payload.data.forEach(function(v,k){ json.data[k]=JSON.parse(v.attributes.landscape).data; + json.data[k].relationships.timestamp=v.relationships.timestamp; }); }else{ var json = JSON.parse(payload.data.attributes.landscape); + json.data.relationships.timestamp=payload.data.relationships.timestamp; } if(Array.isArray(json.included)){ if(Array.isArray(payload.included)){ diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 8a5d311..6162b80 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -6,7 +6,7 @@ import { inject as service } from "@ember/service"; export default Service.extend(Evented, { debug: debugLogger(), store: service(), - timestamp: null, + landscape: null, livelandscapes: false, landscapeList: null, @@ -21,88 +21,41 @@ export default Service.extend(Evented, { }); }, loadTutorialLandscape(tutorial) { - if (this.get('timestamp.landscape') !== null) { + if (this.get('landscape') !== null) { this.get('store').queryRecord('tutoriallandscape',{ timestamp: tutorial.get('landscapeTimestamp') }).then((landscape)=>{ - if (this.get('timestamp.landscape.id')!= landscape.get('id')){ + if (this.get('landscape.id')!= landscape.get('id')){ this.get('store').unloadRecord(this.get('landscape')); }else{ return; } - this.importLandscape(tutorial.get('landscapeTimestamp')); - }) + }); + } + if(tutorial.get('landscapeTimestamp')!=""){ + this.importLandscape(tutorial.get('landscapeTimestamp')); } }, importLandscape(landscapeTimestamp){ this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { this.set('landscape',tutlandscape); }, (e) => { - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutoriallandscape)=>{ - tutoriallandscape.set('systems',landscape.get('systems')); - tutoriallandscape.set('events',landscape.get('events')); - tutoriallandscape.set('totalApplicationCommunications',landscape.get('totalApplicationCommunications')); - tutoriallandscape.save(); - var tsrecord= { - id:landscape.get('timestamp.id'), - timestamp:landscape.get('timestamp.timestamp'), - landscape: tutoriallandscape - } - tsrecord= this.get('store').createRecord('tutorialtimestamp',tsrecord); - tsrecord.save(); - - }); - },{}) - - }); - }, - importLandscapeSerialize(landscapeTimestamp){ - this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { - this.set('landscape',tutlandscape); - }, (e) => { - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var lsrecord= { - id:landscape.get('id'), - systems:landscape.get('systems'), - events: landscape.get('events'), - totalApplicationCommunications:landscape.get('totalApplicationCommunications') - } - this.get('store').push('tutoriallandscape',lsrecord); - - var tsrecord= { + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + var landscaperecord = this.get('store').createRecord("tutoriallandscape",{ + id:landscape.get('id'), + systems:landscape.get('systems'), + events:landscape.get('events'), + totalApplicationCommunications:landscape.get('totalApplicationCommunications'), + }); + var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ id:landscape.get('timestamp.id'), timestamp:landscape.get('timestamp.timestamp'), - landscape: landscape - } - this.get('store').push('tutorialtimestamp',tsrecord); - - }); - }); - }, - importLandscapeID(landscapeTimestamp){ - this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { - this.set('landscape',tutlandscape); - }, (e) => { - if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ - var tutoriallandscape = this.get('store').createRecord("tutoriallandscape",{ - id: landscape.get('id'), - events: landscape.get('events'), - systems: landscape.get('systems'), - totalApplicationCommunications: landscape.get('totalApplicationCommunications') - }); - tutoriallandscape.save(); - }else{ - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var timestamp=this.get('store').createRecord("tutorialtimestamp",{ - id:landscape.get('timestamp').get('id'), - timestamp:landscape.get('timestamp').get('timestamp'), - totalRequests:landscape.get('timestamp').get('totalRequests'), + totalRequests:landscape.get('timestamp.totalRequests'), name:"new timestamp", - landscape: tutoriallandscape + landscape: landscaperecord }); - timestamp.save(); - this.set('timestamp',timestamp); + timestamprecord.save(); + landscaperecord.save(); + this.set('landscape',landscaperecord); }); - } }); } }) diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index c25e152..fdf83cf 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -6,7 +6,7 @@ Selected Landscape:{{landscapeService.landscape.timestamp}} {{#each landscapeService.landscapeList as |landscape|}}
  • - {{landscape.timestamp.timestamp}} + {{landscape.timestamp.name}}
  • {{/each}} diff --git a/addon/templates/components/landscape-visualization.hbs b/addon/templates/components/landscape-visualization.hbs index 889d9ee..71c3380 100644 --- a/addon/templates/components/landscape-visualization.hbs +++ b/addon/templates/components/landscape-visualization.hbs @@ -1 +1,4 @@ -{{yield}} +Rendering:{{latestLandscape}} +{{latestLandscape.systems.length}} + + diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 65ee7e3..299e86b 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -35,6 +35,7 @@
    {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape}} + {{visualization/rendering/popups/popup-coordinator popupData=additionalData.popupContent}}
    @@ -91,12 +92,11 @@ {{/unless}} {{else}}
    - {{landscape-visualization latestLandscape=landscapeService.timestamp.landscape}} + {{landscape-visualization latestLandscape=landscapeService.landscape}}
    {{/if}}
    - {{model}} {{component form model=model}}
    From 6e701ea7ff792bf6dfc66aa3742dd67bf512cb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 6 May 2019 16:15:18 +0200 Subject: [PATCH 20/30] landscape recursive relationships --- .vscode/launch.json | 14 +++++ addon/components/side-form-layout.js | 11 ++++ addon/models/tutoriallandscape.js | 17 ++++- addon/models/tutorialtimestamp.js | 1 - addon/serializers/tutoriallandscape.js | 86 +++++++++++++++++++++----- addon/services/landscape-service.js | 17 ++--- 6 files changed, 119 insertions(+), 27 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..943ff82 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceFolder}\\serve" + } + ] +} \ No newline at end of file diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index a032be4..e95b492 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -28,6 +28,17 @@ export default Component.extend({ } return false; }), + init() { + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + landscapeInteraction.handleSingleClick = function(mouse) { + // console.log(mouse); + // do your stuff, but keep in mind that the pre-defined functionality + // is now gone + }; + + this.set('landscapeInteraction', landscapeInteraction); + }, + // showLandscape: false, // selectMode: false, // livemode: false, diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index b798b06..e33ec08 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -3,6 +3,21 @@ import Landscape from "explorviz-frontend/models/landscape" const { belongsTo, hasMany } = DS; export default Landscape.extend({ - timestamp: DS.belongsTo('tutorialtimestamp',{inverse:'landscape'}), + timestamp: DS.belongsTo('tutorialtimestamp'), + events: hasMany('event', { + inverse: null, + async: false + }), + + systems: hasMany('system', { + inverse: 'parent', + async: false + }), + + // list of applicationCommunication for rendering purposes + totalApplicationCommunications: hasMany('applicationcommunication', { + inverse: null, + async: false + }), }); diff --git a/addon/models/tutorialtimestamp.js b/addon/models/tutorialtimestamp.js index eb3fe5b..053381b 100644 --- a/addon/models/tutorialtimestamp.js +++ b/addon/models/tutorialtimestamp.js @@ -2,6 +2,5 @@ import Timestamp from "explorviz-frontend/models/timestamp" import DS from 'ember-data'; export default Timestamp.extend({ - landscape: DS.belongsTo('tutoriallandscape',{inverse:'timestamp'}), name: DS.attr('String') }); diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 3e619cb..6a00c43 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -1,28 +1,72 @@ -// import LandscapeSerializer from "explorviz-frontend/serializers/landscape" +import LandscapeSerializer from "explorviz-frontend/serializers/landscape" import SaveRelationshipsMixin from 'ember-data-save-relationships'; import JSONAPISerializer from 'ember-data/serializers/json-api'; +import { inject as service } from "@ember/service"; -export default JSONAPISerializer.extend(SaveRelationshipsMixin,{ + + +export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ attrs: { - events: { serialize: true }, - //systems: { serialize: true }, + systems: { serialize: true}, totalApplicationCommunications: { serialize: true } }, payloadKeyFromModelName(model){ return model; }, + serializeRecordForIncluded(key,relationship){ + if(this.serializedTypes.indexOf(key)!==-1){ + return; + } + if (relationship.kind === 'belongsTo') { + var nextSnapshot = this.belongsTo(key); + nextSnapshot.serializedTypes=this.serializedTypes; + nextSnapshot.included=this.included; + this.serializedTypes.push(key); + nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; + this.included.push(nextSnapshot.record.serialize({includeId:true})); + nextSnapshot.eachRelationship(this.serializeRecordForIncluded,nextSnapshot) + this.included.concat(nextSnapshot.included); + }else if (relationship.kind === 'hasMany') { + var self=this; + var key=key; + var hasmany=this.hasMany(key); + hasmany.forEach(function(v){ + self.included.push(v.record.serialize({includeId:true})); + hasmany.forEach(function(value){ + value.serializedTypes=self.serializedTypes; + value.included=self.included; + self.serializedTypes.push(key); + value.serializeRecordForIncluded=self.serializeRecordForIncluded; + value.eachRelationship(self.serializeRecordForIncluded,value); + self.included.concat(value.included); + }); + }); + } + }, serialize(snapshot, options) { let json = this._super(...arguments); - - json.included=[]; + var included=[]; + //json.included=[]; // snapshot.hasMany('events').forEach(function(v,k){ // json.included.push(v.serialize()); - // }); + // }); + + snapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; + snapshot.serializedTypes=[]; + snapshot.included=[]; + snapshot.eachRelationship(this.serializeRecordForIncluded,snapshot); + snapshot.hasMany('systems').forEach(function(v,k){ - debugger; - json.included.push(v.serialize()); + delete json.data.relationships.systems.data[k].attributes.threeJSModel; + }); + //snapshot.hasMany('events').forEach(function(v,k){ + // delete json.data.relationships.events.data[k].attributes.threeJSModel; + //}); + snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ + delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel; }); + // snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ // json.included.push(v.serialize()); // }); @@ -36,6 +80,7 @@ export default JSONAPISerializer.extend(SaveRelationshipsMixin,{ // type:"tutorialtimestamp", // id:snapshot.record.get('timestamp').get('id') // }; +json.included=snapshot.included; var newjson={ data:{ id: snapshot.record.get('id'), @@ -52,15 +97,22 @@ export default JSONAPISerializer.extend(SaveRelationshipsMixin,{ } } }, - included:[{ - type:"tutorialtimestamp", - id:snapshot.record.get('timestamp').get('id'), - attributes: { - name:snapshot.record.get('timestamp').get('name'), - timestamp:snapshot.record.get('timestamp').get('timestamp') - } - }] + included:[ + {id: snapshot.record.get('timestamp').get('id'), + type: "tutorialtimestamp", + attributes:{ + timestamp:snapshot.record.get('timestamp').get('timestamp'), + name:snapshot.record.get('timestamp').get('name') + } + } + ] }; + debugger; + debugger; + debugger; + debugger; + + return newjson; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 6162b80..7c44f03 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -9,7 +9,7 @@ export default Service.extend(Evented, { landscape: null, livelandscapes: false, landscapeList: null, - + updateLandscapeList(reload) { this.set('landscapeList', []); this.get('store').findAll('tutoriallandscape', { reload }) @@ -39,21 +39,22 @@ export default Service.extend(Evented, { this.set('landscape',tutlandscape); }, (e) => { this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var landscaperecord = this.get('store').createRecord("tutoriallandscape",{ - id:landscape.get('id'), - systems:landscape.get('systems'), - events:landscape.get('events'), - totalApplicationCommunications:landscape.get('totalApplicationCommunications'), - }); var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ id:landscape.get('timestamp.id'), timestamp:landscape.get('timestamp.timestamp'), totalRequests:landscape.get('timestamp.totalRequests'), name:"new timestamp", - landscape: landscaperecord + }); + var landscaperecord = this.get('store').createRecord("tutoriallandscape",{ + id:landscape.get('id'), + systems:landscape.get('systems'), + events:landscape.get('events'), + totalApplicationCommunications:landscape.get('totalApplicationCommunications'), + timestamp:timestamprecord }); timestamprecord.save(); landscaperecord.save(); + this.set('landscape',landscaperecord); }); }); From f1261efce48393f0fec85284da49be70f0218d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Sun, 26 May 2019 18:52:07 +0200 Subject: [PATCH 21/30] play tutorials --- addon/components/landscape-interaction.js | 4 +- addon/components/landscape-visualization.js | 8 +- addon/components/side-form-layout.js | 87 ++++++++++++++----- addon/components/step-form.js | 35 ++++---- addon/controllers/tutorial/list.js | 12 +++ addon/controllers/tutorial/run.js | 23 +++++ addon/models/sequence.js | 4 +- addon/models/step.js | 5 +- addon/models/tutorial.js | 2 - addon/models/tutoriallandscape.js | 1 - addon/routes/tutorial/run.js | 23 +++++ addon/routes/tutorial/sequence.js | 7 +- addon/routes/tutorial/step.js | 9 +- addon/routes/tutorial/tutoriallandscape.js | 1 + addon/serializers/tutoriallandscape.js | 55 +++++++----- addon/services/landscape-service.js | 8 +- addon/services/tutorial-service.js | 62 +++++++++++++ .../components/landscape-visualization.hbs | 3 +- .../templates/components/side-form-layout.hbs | 8 +- addon/templates/components/step-form.hbs | 23 ++++- addon/templates/components/tutorial-form.hbs | 2 - addon/templates/tutorial/list.hbs | 12 ++- addon/templates/tutorial/run.hbs | 18 +--- addon/templates/tutorial/tutorial.hbs | 2 +- 24 files changed, 307 insertions(+), 107 deletions(-) create mode 100644 addon/controllers/tutorial/run.js create mode 100644 addon/routes/tutorial/run.js create mode 100644 addon/routes/tutorial/tutoriallandscape.js diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index 533af1f..e3ad620 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -1,8 +1,8 @@ //import layout from '../templates/components/landscape-interaction'; -import layout from 'explorviz-frontend/templates/utils/landscape-rendering/interaction' +//import layout from 'explorviz-frontend/templates/utils/landscape-rendering/interaction' import Interaction from 'explorviz-frontend/utils/landscape-rendering/interaction' export default Interaction.extend({ - layout + }); diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 5f606f0..fe1b6a5 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -1,7 +1,11 @@ import layout from '../templates/components/landscape-visualization'; + import { getOwner } from '@ember/application'; //import layout from 'explorviz-frontend/templates/components/visualization/rendering/landscape-rendering' - +//import LandscapeInteraction from '../components/landscape-interaction'; +import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' import LandscapeRendering from 'explorviz-frontend/components/visualization/rendering/landscape-rendering' +import { inject as service } from '@ember/service'; export default LandscapeRendering.extend({ - layout + layout, + renderingService: service(), }); diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index e95b492..a4dda9a 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -2,46 +2,91 @@ import Component from '@ember/component'; import layout from '../templates/components/side-form-layout'; import { inject as service } from "@ember/service"; import { computed } from '@ember/object'; +import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' +import { getOwner } from '@ember/application'; export default Component.extend({ layout, store: service(), + tutorialService: service(), landscapeService: service(), renderingService: service(), landscapeRepo: service("repos/landscape-repository"), landscapeListener: service(), - showLandscape: computed('landscapeRepo.latestApplication', function() { return !this.get('landscapeRepo.latestApplication'); }), - selectMode: computed('landscapeService.landscape',function(){ if(this.get('model.constructor.modelName')=="tutorial"){ return !this.get('landscapeService.landscape'); } return false; }), - liveMode: computed('landscapeService.livelandscapes','selectMode', function() { if(this.get('model.constructor.modelName')=="tutorial"){ return this.get('selectMode') && this.get('landscapeService.livelandscapes'); } return false; }), - init() { - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - landscapeInteraction.handleSingleClick = function(mouse) { - // console.log(mouse); - // do your stuff, but keep in mind that the pre-defined functionality - // is now gone - }; - - this.set('landscapeInteraction', landscapeInteraction); + completeStep(laststep){ + var step = this.get('tutorialService').getNextStep(laststep); + console.log(step); + this.set('model',step); }, + init(){ + this._super(...arguments); + this.get('landscapeService').updateLandscapeList(true); + this.get('landscapeListener').initSSE(); + this.get('landscapeListener').set('pauseVisualizationReload',true); + - // showLandscape: false, - // selectMode: false, - // livemode: false, + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + if(this.get('runmode')){ + var step = this.get('tutorialService').getNextStep(); + this.set('activeStep',step); + landscapeInteraction.set('model',step); + landscapeInteraction.set('runMode',true); + landscapeInteraction.set('tutorialService',this.get('tutorialService')); + landscapeInteraction.set('completed',this.completeStep); + } + this.set('interaction', landscapeInteraction); + this.get('interaction').on('singleClick', function(emberModel) { + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.constructor.modelName); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","singleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ + console.log("Right action!"); + if(this.get("runMode")){ + this.completed(this.get('model')); + } + }else{ + console.log("Wrong Action: Single Click: "+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); + console.log("Expected: "+this.get("model.targetId")+" "+this.get("model.targetType")+" "+this.get("model.actionType")); + } + } + } + }); + this.get('interaction').on('doubleClick', function(emberModel) { + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.constructor.modelName); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","doubleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id") && this.get('model.actionType')=="doubleClick"){ + console.log("Right action!"); + }else{ + console.log("Wrong Action DoubleClick:"+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); + } + } + } + }); +}, actions: { resetView() { this.get('renderingService').reSetupScene(); @@ -60,6 +105,10 @@ export default Component.extend({ hideLiveLandscapes(){ this.set('landscapeService.livelandscapes',false); this.get('landscapeListener').set('pauseVisualizationReload',true); + }, + toggleSelectTarget(interaction,model){ + interaction.set('model',model); + interaction.set('selectTarget',!interaction.get('selectTarget')); } }, showTimeline() { @@ -84,11 +133,5 @@ export default Component.extend({ this._super(...arguments); this.get('additionalData').off('showWindow', this, this.onShowWindow); }, - - init(){ - this._super(...arguments); - this.get('landscapeService').updateLandscapeList(true); - this.get('landscapeListener').initSSE(); - this.get('landscapeListener').set('pauseVisualizationReload',true); - }, }); +; diff --git a/addon/components/step-form.js b/addon/components/step-form.js index 8a5e013..cce2eeb 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -5,24 +5,25 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Component.extend(AlertifyHandler,{ layout, actions:{ - saveStepChanges(step) { - if(step) { - // check for valid input - if(!step.get('title') || step.get('title').length === 0) { - this.showAlertifyMessage('Title cannot be empty.'); - return; + saveStepChanges(step) { + if(step) { + // check for valid input + if(!step.get('title') || step.get('title').length === 0) { + this.showAlertifyMessage('Title cannot be empty.'); + return; + } + step.save() + .then((stepy)=> { + console.log(stepy); + const message = `Step updated.`; + this.showAlertifyMessage(message); + }, (reason) => { + this.showReasonErrorAlert(reason); + }); + } else { + this.showAlertifyMessage(`Step not found.`); } - step.save() - .then(()=> { - const message = `Step updated.`; - this.showAlertifyMessage(message); - }, (reason) => { - this.showReasonErrorAlert(reason); - }); - } else { - this.showAlertifyMessage(`Step not found.`); - } - }, + }, }, showReasonErrorAlert(reason) { const {title, detail} = reason.errors[0]; diff --git a/addon/controllers/tutorial/list.js b/addon/controllers/tutorial/list.js index 5fdee48..aca63c8 100644 --- a/addon/controllers/tutorial/list.js +++ b/addon/controllers/tutorial/list.js @@ -1,5 +1,17 @@ import Controller from '@ember/controller'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import { inject as service } from "@ember/service"; export default Controller.extend(AlertifyHandler,{ + tutorialService: service(), + actions: { + toggleTutorial(tutorial){ + tutorial.set('expanded',!tutorial.get('expanded')); + //this.get('tutorialService').expandTutorial(tutorial); + }, + toggleSequence(sequence){ + sequence.set('expanded',!sequence.get('expanded')); + //this.get('tutorialService').expandTutorial(tutorial); + } + } }); diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js new file mode 100644 index 0000000..0995680 --- /dev/null +++ b/addon/controllers/tutorial/run.js @@ -0,0 +1,23 @@ +import Controller from '@ember/controller'; +import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; + + +export default Controller.extend({ + tutorialService:service(), + landscapeService:service(), + activeStep:null, + steps:[], + sequences:[], + activateNextStep(){ + // if(this.get('activeStep')){ + // this.get('tutorialService').getSequence(this.get('activeStep')).then((sequence)=>{ + // sequence.get('steps').forEach(function(v){ + // console.log(v); + // }); + // }) + // } + } + + +}); diff --git a/addon/models/sequence.js b/addon/models/sequence.js index 2ac898e..bef0811 100644 --- a/addon/models/sequence.js +++ b/addon/models/sequence.js @@ -3,6 +3,6 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), - tutorial: DS.belongsTo('tutorial',{inverse:"sequences"}), - steps: DS.hasMany('step',{inverse:"sequence"}), + tutorial: DS.belongsTo('tutorial',{inverse:"sequences",async:false}), + steps: DS.hasMany('step',{inverse:"sequence",async:false}), }); diff --git a/addon/models/step.js b/addon/models/step.js index 83dc828..eebf52f 100644 --- a/addon/models/step.js +++ b/addon/models/step.js @@ -3,7 +3,8 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), - sequence: DS.belongsTo('sequence',{inverse:"steps"}), targetId: DS.attr('string'), - targetType: DS.attr('string') + targetType: DS.attr('string'), + actionType: DS.attr('string'), + sequence: DS.belongsTo('sequence',{inverse:"steps",async:false}) }); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index b1671f5..a01ce74 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -3,8 +3,6 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), - targetId: DS.attr('string'), - targetType: DS.attr('string'), landscapeTimestamp: DS.attr('string'), sequences: DS.hasMany('sequence',{inverse:"tutorial"}), }); diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index e33ec08..506ee28 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -4,7 +4,6 @@ const { belongsTo, hasMany } = DS; export default Landscape.extend({ timestamp: DS.belongsTo('tutorialtimestamp'), - events: hasMany('event', { inverse: null, async: false diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js new file mode 100644 index 0000000..d5d69bb --- /dev/null +++ b/addon/routes/tutorial/run.js @@ -0,0 +1,23 @@ +import BaseRoute from 'explorviz-frontend/routes/base-route'; +import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; +import RSVP from 'rsvp'; + +export default BaseRoute.extend(AuthenticatedRouteMixin, { + model(params) { + var val = this.get('store').findRecord('tutorial', params.tutorial_id); + return val; + }, + setupController(controller, model) { + this._super(...arguments); + controller.get('tutorialService').initService(model); + controller.get('landscapeService').updateLandscapeList(true); + controller.get('landscapeService').loadTutorialLandscape(model); + controller.set('landscapeService.liveMode',false); + }, + actions: { + // @Override BaseRoute + resetRoute() { + //const routeName = this.get('tutorial'); + }, + } +}); diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index e3bde1a..a1d6a58 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -9,7 +9,12 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService').loadTutorialLandscape(model.get('tutorial')); + controller.get('tutorialService').getTutorial(model).then((tutorial)=>{ + controller.get('landscapeService').loadTutorialLandscape(tutorial); + }); + + + //controller.get('landscapeService').loadTutorialLandscape(model.get('tutorial')); }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index 3eec03c..d9858e2 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -3,13 +3,18 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { - return this.get('store').findRecord('step', params.step_id); + return this.get('store').findRecord('step',params.step_id); }, setupController(controller, model) { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService').loadTutorialLandscape(model.get('sequence.tutorial')); + controller.get('tutorialService').getSequence(model).then((sequence)=>{ + controller.get('tutorialService').getTutorial(sequence).then((tutorial)=>{ + controller.get('landscapeService').loadTutorialLandscape(tutorial); + }); + }); + }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/tutoriallandscape.js b/addon/routes/tutorial/tutoriallandscape.js new file mode 100644 index 0000000..b8942df --- /dev/null +++ b/addon/routes/tutorial/tutoriallandscape.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/models/tutoriallandscape'; diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 6a00c43..91c4f97 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -8,8 +8,8 @@ import { inject as service } from "@ember/service"; export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ attrs: { - systems: { serialize: true}, - totalApplicationCommunications: { serialize: true } + systems:{serialize:true}, + totalApplicationCommunications:{serialize:true} }, payloadKeyFromModelName(model){ return model; @@ -22,25 +22,42 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ var nextSnapshot = this.belongsTo(key); nextSnapshot.serializedTypes=this.serializedTypes; nextSnapshot.included=this.included; - this.serializedTypes.push(key); - nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; - this.included.push(nextSnapshot.record.serialize({includeId:true})); - nextSnapshot.eachRelationship(this.serializeRecordForIncluded,nextSnapshot) - this.included.concat(nextSnapshot.included); + if(nextSnapshot.record.threeJSModel!=undefined){ + nextSnapshot.record.set('threeJSModel', null); + } + if(this.serializedTypes.indexOf(key)==-1){ + this.serializedTypes.push(key); + nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; + if(nextSnapshot.record.get('id')!=undefined){ + this.included.push(nextSnapshot.record.serialize({includeId:true}).data); + } + nextSnapshot.eachRelationship(this.serializeRecordForIncluded,nextSnapshot) + this.included.concat(nextSnapshot.included); + } }else if (relationship.kind === 'hasMany') { var self=this; var key=key; var hasmany=this.hasMany(key); hasmany.forEach(function(v){ - self.included.push(v.record.serialize({includeId:true})); + if(v.record.threeJSModel!=undefined){ + v.record.set('threeJSModel', null); + } + if(self.included==undefined){ + self.included=[]; + } + if(v.record.get('id')!=undefined){ + self.included.push(v.record.serialize({includeId:true}).data); hasmany.forEach(function(value){ - value.serializedTypes=self.serializedTypes; - value.included=self.included; - self.serializedTypes.push(key); - value.serializeRecordForIncluded=self.serializeRecordForIncluded; - value.eachRelationship(self.serializeRecordForIncluded,value); - self.included.concat(value.included); + value.serializedTypes=self.serializedTypes; + value.included=self.included; + if(self.serializedTypes.indexOf(key)==-1){ + self.serializedTypes.push(key); + } + value.serializeRecordForIncluded=self.serializeRecordForIncluded; + value.eachRelationship(self.serializeRecordForIncluded,value); + self.included.concat(value.included); }); + } }); } }, @@ -50,7 +67,7 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ //json.included=[]; // snapshot.hasMany('events').forEach(function(v,k){ // json.included.push(v.serialize()); - // }); + // }); snapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; snapshot.serializedTypes=[]; @@ -107,12 +124,6 @@ json.included=snapshot.included; } ] }; - debugger; - debugger; - debugger; - debugger; - - return newjson; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { @@ -128,7 +139,7 @@ json.included=snapshot.included; } if(Array.isArray(json.included)){ if(Array.isArray(payload.included)){ - json.included=json.included+payload.included; + json.included=json.included.concat(payload.included); } }else{ if(payload.included!=undefined){ diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 7c44f03..6f8316e 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -9,7 +9,6 @@ export default Service.extend(Evented, { landscape: null, livelandscapes: false, landscapeList: null, - updateLandscapeList(reload) { this.set('landscapeList', []); this.get('store').findAll('tutoriallandscape', { reload }) @@ -20,7 +19,7 @@ export default Service.extend(Evented, { this.set('landscapeList', landscapeList); }); }, - loadTutorialLandscape(tutorial) { + loadTutorialLandscape(tutorial) { if (this.get('landscape') !== null) { this.get('store').queryRecord('tutoriallandscape',{ timestamp: tutorial.get('landscapeTimestamp') }).then((landscape)=>{ if (this.get('landscape.id')!= landscape.get('id')){ @@ -39,6 +38,7 @@ export default Service.extend(Evented, { this.set('landscape',tutlandscape); }, (e) => { this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ id:landscape.get('timestamp.id'), timestamp:landscape.get('timestamp.timestamp'), @@ -54,8 +54,10 @@ export default Service.extend(Evented, { }); timestamprecord.save(); landscaperecord.save(); - this.set('landscape',landscaperecord); + }else{ + this.get('store').set('landscape',landscape); + } }); }); } diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index 73cf09a..6ab9abc 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -9,7 +9,69 @@ export default Service.extend(Evented,AlertifyHandler, { store: service(), landscapeService:service(), tutorialList: null, + activeStep:null, + steps:[], + sequences:[], + initService(model){ + this.set('sequences',model.get('sequences')); + this.get('sequences').forEach((k)=>{ + k.get('steps').forEach((s)=>{ + this.get('steps').push(s); + }); + }); + }, + getNextStep(step){ + if(step==undefined){ + return this.get('steps')[0]; + } + debugger; + var nextStep=false; + var step; + this.get('steps').forEach(function(s){ + if(nextStep==true){ + step=s; + } + if(s.get('id')==step.get('id')){ + nextStep=true; + } + }); + return step; + }, + getSequence(step){ + return this.get('store').findAll('tutorial').then((tutorials)=>{ + return new Ember.RSVP.Promise( + function(resolve){ + tutorials.forEach(function(k1){ + k1.get('sequences').then((sequences)=>{ + sequences.forEach(function(k2){ + k2.get('steps').forEach(function(k3){ + if(k3.get('id')==step.get('id')){ + resolve(k2); + } + }); + }); + }); + }) + }); + }); + }, + getTutorial(sequence){ + return this.get('store').findAll('tutorial').then((tutorials)=>{ + return new Ember.RSVP.Promise( + function(resolve){ + tutorials.forEach(function(k1){ + k1.get('sequences').then((sequences)=>{ + sequences.forEach(function(k2){ + if(k2.get('id')==sequence.get('id')){ + resolve(k1); + } + }); + }); + }) + }); + }); + }, updateTutorialList(reload) { this.set('tutorialList', []); this.get('store').findAll('tutorial', { reload }) diff --git a/addon/templates/components/landscape-visualization.hbs b/addon/templates/components/landscape-visualization.hbs index 71c3380..2ce0231 100644 --- a/addon/templates/components/landscape-visualization.hbs +++ b/addon/templates/components/landscape-visualization.hbs @@ -1,4 +1,3 @@ -Rendering:{{latestLandscape}} -{{latestLandscape.systems.length}} +Rendering: diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 299e86b..2b4a48c 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -92,11 +92,15 @@ {{/unless}} {{else}}
    - {{landscape-visualization latestLandscape=landscapeService.landscape}} + {{landscape-visualization latestLandscape=landscapeService.landscape interaction=interaction toggleSelect=(action 'toggleSelectTarget' interaction model) }}
    {{/if}}
    - {{component form model=model}} + {{#unless runmode}} + {{component form model=model interaction=interaction toggleSelect=(action 'toggleSelectTarget' interaction model) runmode=runmode}} + {{else}} + {{component "step-form" model=activeStep interaction=interaction runmode=runmode}} + {{/unless}}
    diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index d6f99a3..9dedfdb 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -1,6 +1,27 @@ +{{#unless runmode}} {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} {{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} + {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} + {{form.element controlType="textarea" label="Text" placeholder="Text" property="text"}} + {{form.element controlType="text" label="Text" placeholder="Text" property="targetType" disabled=true}} + {{form.element controlType="text" label="Text" placeholder="Text" property="targetId" disabled=true}} + {{form.element controlType="text" label="Text" placeholder="Text" property="actionType" disabled=true}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} +{{#bs-button + onClick=(action toggleSelect) + type="secondary" + outline=true + title="select target" +}} +{{if interaction.selectTarget "selecting" "select target"}} +{{/bs-button}} +{{else}} +{{model.targetId}} +{{model.targetType}} +{{model.actionType}} + +

    title:{{model.title}}

    +

    {{model.text}}

    +{{/unless}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index 62ab71d..7cc8d72 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -3,8 +3,6 @@ {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} - - {{!-- {{#link-to "tutorial.edit.tutorial.landscape" model}} {{#if landscapeService.landscape}}edit landscape{{else}}select landscape{{/if}} {{/link-to}} --}} diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index ddfc5da..5c9356d 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -9,7 +9,7 @@ - + @@ -19,7 +19,7 @@ {{#each model.tutorials as |tutorial|}} - + @@ -50,9 +50,10 @@ {{/bs-dropdown}} + {{#if tutorial.expanded}} {{#each tutorial.sequences as |sequence|}} - + @@ -83,9 +84,10 @@ {{/bs-dropdown}} + {{#if sequence.expanded}} {{#each sequence.steps as |step|}} - + @@ -116,7 +118,9 @@ {{/each}} + {{/if}} {{/each}} + {{/if}} {{/each}}
    + ID Title Sequences
    {{#bs-button onClick=(action "toggleTutorial" tutorial)}}{{if tutorial.expanded '-' '+'}}{{/bs-button}} {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.id}}{{/link-to}}
    >{{#bs-button onClick=(action "toggleSequence" sequence)}}{{if sequence.expanded '-' '+'}}{{/bs-button}} {{#link-to "tutorial.sequence" sequence}}{{sequence.id}}{{/link-to}}
    >> {{#link-to "tutorial.step" step}}{{step.id}}{{/link-to}}
    diff --git a/addon/templates/tutorial/run.hbs b/addon/templates/tutorial/run.hbs index 1101b34..c83f557 100644 --- a/addon/templates/tutorial/run.hbs +++ b/addon/templates/tutorial/run.hbs @@ -1,17 +1 @@ -{{#if model.landscape.isFulfilled}} - {{landscapeInteraction.currentStep.title}} -
    - {{visualization/rendering/landscape-rendering latestLandscape=model.landscape interaction=landscapeInteraction tutorial=model}} -
    -{{else if model.landscapeTimestamp}} -
    -
    -

    Landscape loading for "{{model.landscapeTimestamp}}"!

    -
    - {{ember-spinner}} -
    -
    -
    -{{else}} - {{#link-to "tutorial.edit.tutorial" model}} Tutorial needs to have a set Landscape to be executable. {{/link-to}} -{{/if}} +{{side-form-layout form="tutorial-form" model=model tutorial=model runmode=true}} diff --git a/addon/templates/tutorial/tutorial.hbs b/addon/templates/tutorial/tutorial.hbs index 3fce9ed..6c416b5 100644 --- a/addon/templates/tutorial/tutorial.hbs +++ b/addon/templates/tutorial/tutorial.hbs @@ -1 +1 @@ -{{side-form-layout form="tutorial-form" model=model tutorial=model}} +{{side-form-layout form="tutorial-form" model=model tutorial=model runmode=false}} From 804c1e27b8b4d0a305600482d36537cd237a7241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Fri, 31 May 2019 19:39:27 +0200 Subject: [PATCH 22/30] landscape in sequence --- .../landscape-select/landscapelist.js | 4 +- addon/components/sequence-form.js | 10 ++- addon/components/side-form-layout.js | 60 ++---------------- addon/components/step-form.js | 1 - addon/components/tutorial-form.js | 2 +- addon/controllers/tutorial/run.js | 28 +++++---- addon/models/sequence.js | 2 + addon/routes/tutorial/run.js | 18 +++++- addon/routes/tutorial/sequence.js | 14 +++-- addon/routes/tutorial/step.js | 10 ++- addon/routes/tutorial/tutorial.js | 2 +- addon/services/landscape-service.js | 61 +++++++++++++++++-- addon/services/tutorial-service.js | 13 ++-- .../landscape-select/landscapelist.hbs | 2 +- addon/templates/components/sequence-form.hbs | 12 +++- .../templates/components/side-form-layout.hbs | 6 +- addon/templates/components/tutorial-form.hbs | 2 +- 17 files changed, 145 insertions(+), 102 deletions(-) diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js index 8b50b57..7720fb4 100644 --- a/addon/components/landscape-select/landscapelist.js +++ b/addon/components/landscape-select/landscapelist.js @@ -9,8 +9,8 @@ export default Component.extend({ landscapeService: service(), tutorialService: service(), actions:{ - setTutorialTimestamp(tutorial,timestamp){ - tutorial.set('landscapeTimestamp',timestamp); + setTimestamp(model,timestamp){ + model.set('landscapeTimestamp',timestamp); }, showLiveLandscapes(){ this.set("landscapeService.livelandscapes",true); diff --git a/addon/components/sequence-form.js b/addon/components/sequence-form.js index 615bb61..2486ad0 100644 --- a/addon/components/sequence-form.js +++ b/addon/components/sequence-form.js @@ -1,10 +1,18 @@ import Component from '@ember/component'; import layout from '../templates/components/sequence-form'; +import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Component.extend(AlertifyHandler,{ layout, + tutorialService: service(), + landscapeService: service(), actions:{ + resetLandscape(){ + if(this.get('landscapeService.landscape')!=null){ + this.set('landscapeService.landscape',null); + } + }, saveSequenceChanges(sequence) { if(sequence) { // check for valid input @@ -12,7 +20,6 @@ export default Component.extend(AlertifyHandler,{ this.showAlertifyMessage('Title cannot be empty.'); return; } - sequence.save() .then(()=> { const message = `Sequence updated.`; @@ -21,6 +28,7 @@ export default Component.extend(AlertifyHandler,{ this.showReasonErrorAlert(reason); }); } else { + console.log(sequence); this.showAlertifyMessage(`Sequence not found.`); } }, diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index a4dda9a..e606957 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -4,8 +4,9 @@ import { inject as service } from "@ember/service"; import { computed } from '@ember/object'; import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' import { getOwner } from '@ember/application'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Component.extend({ +export default Component.extend(AlertifyHandler,{ layout, store: service(), tutorialService: service(), @@ -17,75 +18,22 @@ export default Component.extend({ return !this.get('landscapeRepo.latestApplication'); }), selectMode: computed('landscapeService.landscape',function(){ - if(this.get('model.constructor.modelName')=="tutorial"){ + if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ return !this.get('landscapeService.landscape'); } return false; }), liveMode: computed('landscapeService.livelandscapes','selectMode', function() { - if(this.get('model.constructor.modelName')=="tutorial"){ + if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ return this.get('selectMode') && this.get('landscapeService.livelandscapes'); } return false; }), - completeStep(laststep){ - var step = this.get('tutorialService').getNextStep(laststep); - console.log(step); - this.set('model',step); - }, init(){ this._super(...arguments); this.get('landscapeService').updateLandscapeList(true); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); - - - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - if(this.get('runmode')){ - var step = this.get('tutorialService').getNextStep(); - this.set('activeStep',step); - landscapeInteraction.set('model',step); - landscapeInteraction.set('runMode',true); - landscapeInteraction.set('tutorialService',this.get('tutorialService')); - landscapeInteraction.set('completed',this.completeStep); - } - this.set('interaction', landscapeInteraction); - this.get('interaction').on('singleClick', function(emberModel) { - if(emberModel!=undefined){ - if(this.get('selectTarget')){ - this.set("model.targetType",emberModel.constructor.modelName); - this.set("model.targetId",emberModel.get("id")); - this.set("model.actionType","singleClick"); - this.set('selectTarget',false); - }else{ - if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ - console.log("Right action!"); - if(this.get("runMode")){ - this.completed(this.get('model')); - } - }else{ - console.log("Wrong Action: Single Click: "+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); - console.log("Expected: "+this.get("model.targetId")+" "+this.get("model.targetType")+" "+this.get("model.actionType")); - } - } - } - }); - this.get('interaction').on('doubleClick', function(emberModel) { - if(emberModel!=undefined){ - if(this.get('selectTarget')){ - this.set("model.targetType",emberModel.constructor.modelName); - this.set("model.targetId",emberModel.get("id")); - this.set("model.actionType","doubleClick"); - this.set('selectTarget',false); - }else{ - if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id") && this.get('model.actionType')=="doubleClick"){ - console.log("Right action!"); - }else{ - console.log("Wrong Action DoubleClick:"+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); - } - } - } - }); }, actions: { resetView() { diff --git a/addon/components/step-form.js b/addon/components/step-form.js index cce2eeb..3157bef 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -14,7 +14,6 @@ export default Component.extend(AlertifyHandler,{ } step.save() .then((stepy)=> { - console.log(stepy); const message = `Step updated.`; this.showAlertifyMessage(message); }, (reason) => { diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js index 94bce20..4403874 100644 --- a/addon/components/tutorial-form.js +++ b/addon/components/tutorial-form.js @@ -11,7 +11,7 @@ export default Component.extend(AlertifyHandler,{ saveTutorialChanges(tutorial){ this.get('tutorialService').saveTutorialChanges(tutorial); }, - selectNewLandscape(){ + resetLandscape(){ if(this.get('landscapeService.landscape')!=null){ this.set('landscapeService.landscape',null); } diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js index 0995680..60c08ce 100644 --- a/addon/controllers/tutorial/run.js +++ b/addon/controllers/tutorial/run.js @@ -6,18 +6,20 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Controller.extend({ tutorialService:service(), landscapeService:service(), - activeStep:null, - steps:[], - sequences:[], - activateNextStep(){ - // if(this.get('activeStep')){ - // this.get('tutorialService').getSequence(this.get('activeStep')).then((sequence)=>{ - // sequence.get('steps').forEach(function(v){ - // console.log(v); - // }); - // }) - // } + activateNextStep(laststep){ + var step = this.get('tutorialService').getNextStep(laststep); + if(step){ + this.get('tutorialService').getSequence(step).then((sequence)=>{ + if(sequence.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(sequence); + }else{ + this.get('landscapeService').loadLandscape(model); + } + }); + this.get('tutorialService').set('activeStep',step); + this.set('model',step); + }else{ + this.showAlertifyMessage(`Last step completed.`); + } } - - }); diff --git a/addon/models/sequence.js b/addon/models/sequence.js index bef0811..11be0dd 100644 --- a/addon/models/sequence.js +++ b/addon/models/sequence.js @@ -3,6 +3,8 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), + landscapeTimestamp: DS.attr('string'), + tutorial: DS.belongsTo('tutorial',{inverse:"sequences",async:false}), steps: DS.hasMany('step',{inverse:"sequence",async:false}), }); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js index d5d69bb..81e2218 100644 --- a/addon/routes/tutorial/run.js +++ b/addon/routes/tutorial/run.js @@ -10,9 +10,25 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { setupController(controller, model) { this._super(...arguments); controller.get('tutorialService').initService(model); + controller.get('landscapeService').initListeners(true); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService').loadTutorialLandscape(model); controller.set('landscapeService.liveMode',false); + var step = controller.get('tutorialService').getNextStep(); + controller.set('tutorialService.activeStep',step); + controller.get('tutorialService').getSequence(step).then((sequence)=>{ + if(sequence.get('landscapeTimestamp')!=undefined){ + controller.get('landscapeService').loadLandscape(sequence); + }else{ + controller.get('landscapeService').loadLandscape(model); + } + }); + controller.set('landscapeService.interaction.model',step); + controller.set('landscapeService.interaction.runMode',true); + controller.set('landscapeService.interaction.tutorialService',controller.get('tutorialService')); + controller.set('landscapeService.interaction.landscapeService',controller.get('landscapeService')); + + controller.set('landscapeService.interaction.completed',controller.activateNextStep); + }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index a1d6a58..e198dad 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -9,12 +9,14 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - controller.get('tutorialService').getTutorial(model).then((tutorial)=>{ - controller.get('landscapeService').loadTutorialLandscape(tutorial); - }); - - - //controller.get('landscapeService').loadTutorialLandscape(model.get('tutorial')); + if(model.get('landscapeTimestamp')!=undefined){ + controller.get('landscapeService').loadLandscape(model); + }else{ + controller.get('tutorialService').getTutorial(model).then((tutorial)=>{ + controller.get('landscapeService').loadLandscape(tutorial); + }); + } + //controller.get('landscapeService').loadLandscape(model.get('tutorial')); }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index d9858e2..5925f8d 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -10,10 +10,14 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); controller.get('tutorialService').getSequence(model).then((sequence)=>{ - controller.get('tutorialService').getTutorial(sequence).then((tutorial)=>{ - controller.get('landscapeService').loadTutorialLandscape(tutorial); + if(sequence.get('landscapeTimestamp')!=undefined){ + controller.get('landscapeService').loadLandscape(sequence); + }else{ + controller.get('tutorialService').getTutorial(sequence).then((tutorial)=>{ + controller.get('landscapeService').loadLandscape(tutorial); + }); + } }); - }); }, actions: { diff --git a/addon/routes/tutorial/tutorial.js b/addon/routes/tutorial/tutorial.js index b730db8..a600c76 100644 --- a/addon/routes/tutorial/tutorial.js +++ b/addon/routes/tutorial/tutorial.js @@ -8,7 +8,7 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { setupController(controller, model) { this._super(...arguments); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService').loadTutorialLandscape(model); + controller.get('landscapeService').loadLandscape(model); controller.set('landscapeService.liveMode',false); }, actions: { diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 6f8316e..7398311 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -2,10 +2,13 @@ import Service from '@ember/service'; import Evented from '@ember/object/evented'; import debugLogger from 'ember-debug-logger'; import { inject as service } from "@ember/service"; +import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' +import { getOwner } from '@ember/application'; export default Service.extend(Evented, { debug: debugLogger(), store: service(), + landscapeService: service(), landscape: null, livelandscapes: false, landscapeList: null, @@ -19,9 +22,9 @@ export default Service.extend(Evented, { this.set('landscapeList', landscapeList); }); }, - loadTutorialLandscape(tutorial) { + loadLandscape(model) { if (this.get('landscape') !== null) { - this.get('store').queryRecord('tutoriallandscape',{ timestamp: tutorial.get('landscapeTimestamp') }).then((landscape)=>{ + this.get('store').queryRecord('tutoriallandscape',{ timestamp: model.get('landscapeTimestamp') }).then((landscape)=>{ if (this.get('landscape.id')!= landscape.get('id')){ this.get('store').unloadRecord(this.get('landscape')); }else{ @@ -29,8 +32,8 @@ export default Service.extend(Evented, { } }); } - if(tutorial.get('landscapeTimestamp')!=""){ - this.importLandscape(tutorial.get('landscapeTimestamp')); + if(model.get('landscapeTimestamp')!=""){ + this.importLandscape(model.get('landscapeTimestamp')); } }, importLandscape(landscapeTimestamp){ @@ -60,5 +63,53 @@ export default Service.extend(Evented, { } }); }); - } + }, + clickListenerSingle(emberModel){ + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.constructor.modelName); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","singleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ + console.log("Right action!"); + if(this.get("runMode")){ + this.completed(this.get('model')); + } + }else{ + console.log("Wrong Action: Singleclick: "+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); + console.log("Expected: "+this.get("model.targetId")+" "+this.get("model.targetType")+" "+this.get("model.actionType")); + } + } + } + }, + clickListenerDouble(emberModel){ + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.constructor.modelName); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","singleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleclick"){ + console.log("Right action!"); + if(this.get("runMode")){ + this.completed(this.get('model')); + } + }else{ + console.log("Wrong Action: Doubleclick: "+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); + console.log("Expected: "+this.get("model.targetId")+" "+this.get("model.targetType")+" "+this.get("model.actionType")); + } + } + } + }, + initListeners(){ + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + this.set('interaction', landscapeInteraction); + this.get('interaction').on('singleClick', this.clickListenerSingle); + this.get('interaction').on('doubleClick', this.clickListenerDouble); + console.log(); + } + }) diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index 6ab9abc..00f5827 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -20,22 +20,23 @@ export default Service.extend(Evented,AlertifyHandler, { }); }); }, - getNextStep(step){ - if(step==undefined){ + getNextStep(prevstep){ + if(prevstep==undefined){ return this.get('steps')[0]; } - debugger; var nextStep=false; var step; this.get('steps').forEach(function(s){ if(nextStep==true){ step=s; } - if(s.get('id')==step.get('id')){ + if(s.get('id')==prevstep.get('id')){ nextStep=true; - } }); + if(step==undefined && nextStep==true){ + return false; + } return step; }, getSequence(step){ @@ -92,7 +93,7 @@ export default Service.extend(Evented,AlertifyHandler, { tutorial.save() .then((tutorial)=> { const message = `Tutorial updated.`; - this.get('landscapeService').loadTutorialLandscape(tutorial); + this.get('landscapeService').loadLandscape(tutorial); this.showAlertifyMessage(message); }, (reason) => { this.showReasonErrorAlert(reason); diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index fdf83cf..127977e 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -5,7 +5,7 @@ Selected Landscape:{{landscapeService.landscape.timestamp}}
      {{#each landscapeService.landscapeList as |landscape|}}
    • - + {{landscape.timestamp.name}}
    • diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index b0f4c15..cf83d1b 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -1,6 +1,16 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -{{#bs-form model=model onSubmit=(action "saveSequenceChanges" sequence) as |form|}} +{{#bs-form model=model onSubmit=(action "saveSequenceChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} + {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} +{{#bs-button + onClick=(action "resetLandscape") + type="secondary" + outline=true + class="btn-timeline" + title="change landscape" +}} +change landscape +{{/bs-button}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 2b4a48c..27c8f9a 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -11,7 +11,7 @@ }} show live landscapes {{/bs-button}} - {{landscape-select/landscapelist model=tutorial}} + {{landscape-select/landscapelist model=model}} {{else}} {{#bs-button onClick=(action "hideLiveLandscapes") @@ -92,7 +92,7 @@ {{/unless}} {{else}}
      - {{landscape-visualization latestLandscape=landscapeService.landscape interaction=interaction toggleSelect=(action 'toggleSelectTarget' interaction model) }} + {{landscape-visualization latestLandscape=landscapeService.landscape interaction=landscapeService.interaction toggleSelect=(action 'toggleSelectTarget' interaction model) }}
      {{/if}} @@ -100,7 +100,7 @@ {{#unless runmode}} {{component form model=model interaction=interaction toggleSelect=(action 'toggleSelectTarget' interaction model) runmode=runmode}} {{else}} - {{component "step-form" model=activeStep interaction=interaction runmode=runmode}} + {{component "step-form" model=tutorialService.activeStep interaction=landscapeService.interaction runmode=runmode}} {{/unless}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index 7cc8d72..370aeff 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -9,7 +9,7 @@ {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} {{#bs-button - onClick=(action "selectNewLandscape") + onClick=(action "resetLandscape") type="secondary" outline=true class="btn-timeline" From ff2665e82d2509c99f4336b2c3a17c0cc0d6e17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Sat, 1 Jun 2019 16:26:26 +0200 Subject: [PATCH 23/30] cleanup --- addon/components/landscape-interaction.js | 5 +-- .../landscape-select/landscapelist.js | 4 +- .../navbar/toggle-live-landscape.js | 2 +- addon/components/landscape-visualization.js | 6 +-- addon/components/sequence-form.js | 1 - addon/components/side-form-layout.js | 7 +--- addon/components/step-form.js | 2 +- addon/controllers/tutorial/run.js | 4 +- addon/helpers/is-selected-timestamp.js | 10 +++++ addon/models/tutoriallandscape.js | 3 +- addon/models/tutorialtimestamp.js | 3 +- addon/routes/tutorial/run.js | 1 - addon/routes/tutorial/tutoriallandscape.js | 1 - addon/serializers/tutoriallandscape.js | 39 +++++-------------- addon/services/landscape-service.js | 12 +----- addon/services/tutorial-service.js | 11 ++++-- .../landscape-select/landscapelist.hbs | 5 +++ addon/templates/components/sequence-form.hbs | 13 ++++++- .../templates/components/side-form-layout.hbs | 19 --------- addon/templates/components/tutorial-form.hbs | 17 +++++++- addon/templates/tutorial/list.hbs | 9 ++++- app/helpers/is-selected-timestamp.js | 1 + .../helpers/is-selected-timestamp-test.js | 17 ++++++++ 23 files changed, 101 insertions(+), 91 deletions(-) create mode 100644 addon/helpers/is-selected-timestamp.js delete mode 100644 addon/routes/tutorial/tutoriallandscape.js create mode 100644 app/helpers/is-selected-timestamp.js create mode 100644 tests/integration/helpers/is-selected-timestamp-test.js diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index e3ad620..eb39fa0 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -1,8 +1,5 @@ -//import layout from '../templates/components/landscape-interaction'; -//import layout from 'explorviz-frontend/templates/utils/landscape-rendering/interaction' - import Interaction from 'explorviz-frontend/utils/landscape-rendering/interaction' export default Interaction.extend({ - + }); diff --git a/addon/components/landscape-select/landscapelist.js b/addon/components/landscape-select/landscapelist.js index 7720fb4..0bad192 100644 --- a/addon/components/landscape-select/landscapelist.js +++ b/addon/components/landscape-select/landscapelist.js @@ -19,6 +19,6 @@ export default Component.extend({ hideLiveLandscapes(){ this.set("landscapeService.livelandscapes",false); this.get('landscapeListener').set('pauseVisualizationReload',true); - } - } + }, + }, }); diff --git a/addon/components/landscape-select/navbar/toggle-live-landscape.js b/addon/components/landscape-select/navbar/toggle-live-landscape.js index c0511b1..9b1b23f 100644 --- a/addon/components/landscape-select/navbar/toggle-live-landscape.js +++ b/addon/components/landscape-select/navbar/toggle-live-landscape.js @@ -4,10 +4,10 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; import {inject as service} from '@ember/service'; export default Component.extend(AlertifyHandler,{ + layout, tagName:'li', landscapeListener: service(), landscapeService: service(), - layout, actions:{ toggleVisualizationReload() { this.get('landscapeListener').toggleVisualizationReload(); diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index fe1b6a5..7159526 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -1,8 +1,4 @@ - import layout from '../templates/components/landscape-visualization'; - import { getOwner } from '@ember/application'; -//import layout from 'explorviz-frontend/templates/components/visualization/rendering/landscape-rendering' -//import LandscapeInteraction from '../components/landscape-interaction'; -import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' +import layout from '../templates/components/landscape-visualization'; import LandscapeRendering from 'explorviz-frontend/components/visualization/rendering/landscape-rendering' import { inject as service } from '@ember/service'; export default LandscapeRendering.extend({ diff --git a/addon/components/sequence-form.js b/addon/components/sequence-form.js index 2486ad0..7aa66d9 100644 --- a/addon/components/sequence-form.js +++ b/addon/components/sequence-form.js @@ -28,7 +28,6 @@ export default Component.extend(AlertifyHandler,{ this.showReasonErrorAlert(reason); }); } else { - console.log(sequence); this.showAlertifyMessage(`Sequence not found.`); } }, diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index e606957..99370c7 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -2,11 +2,8 @@ import Component from '@ember/component'; import layout from '../templates/components/side-form-layout'; import { inject as service } from "@ember/service"; import { computed } from '@ember/object'; -import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' -import { getOwner } from '@ember/application'; -import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Component.extend(AlertifyHandler,{ +export default Component.extend({ layout, store: service(), tutorialService: service(), @@ -14,6 +11,7 @@ export default Component.extend(AlertifyHandler,{ renderingService: service(), landscapeRepo: service("repos/landscape-repository"), landscapeListener: service(), + showLandscape: computed('landscapeRepo.latestApplication', function() { return !this.get('landscapeRepo.latestApplication'); }), @@ -82,4 +80,3 @@ export default Component.extend(AlertifyHandler,{ this.get('additionalData').off('showWindow', this, this.onShowWindow); }, }); -; diff --git a/addon/components/step-form.js b/addon/components/step-form.js index 3157bef..48c7654 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -13,7 +13,7 @@ export default Component.extend(AlertifyHandler,{ return; } step.save() - .then((stepy)=> { + .then(()=> { const message = `Step updated.`; this.showAlertifyMessage(message); }, (reason) => { diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js index 60c08ce..662cc58 100644 --- a/addon/controllers/tutorial/run.js +++ b/addon/controllers/tutorial/run.js @@ -3,7 +3,7 @@ import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Controller.extend({ +export default Controller.extend(AlertifyHandler,{ tutorialService:service(), landscapeService:service(), activateNextStep(laststep){ @@ -13,7 +13,7 @@ export default Controller.extend({ if(sequence.get('landscapeTimestamp')!=undefined){ this.get('landscapeService').loadLandscape(sequence); }else{ - this.get('landscapeService').loadLandscape(model); + this.get('landscapeService').loadLandscape(this.get('model')); } }); this.get('tutorialService').set('activeStep',step); diff --git a/addon/helpers/is-selected-timestamp.js b/addon/helpers/is-selected-timestamp.js new file mode 100644 index 0000000..d0c85d8 --- /dev/null +++ b/addon/helpers/is-selected-timestamp.js @@ -0,0 +1,10 @@ +import { helper } from '@ember/component/helper'; + +export function isSelectedTimestamp([model,timestamp]/*, hash*/) { + if(model.get('landscapeTimestamp')==timestamp.get('timestamp.timestamp')){ + return true; + } + return false; +} + +export default helper(isSelectedTimestamp); diff --git a/addon/models/tutoriallandscape.js b/addon/models/tutoriallandscape.js index 506ee28..5a53c86 100644 --- a/addon/models/tutoriallandscape.js +++ b/addon/models/tutoriallandscape.js @@ -3,7 +3,8 @@ import Landscape from "explorviz-frontend/models/landscape" const { belongsTo, hasMany } = DS; export default Landscape.extend({ - timestamp: DS.belongsTo('tutorialtimestamp'), + timestamp: belongsTo('tutorialtimestamp'), + events: hasMany('event', { inverse: null, async: false diff --git a/addon/models/tutorialtimestamp.js b/addon/models/tutorialtimestamp.js index 053381b..9f30ee5 100644 --- a/addon/models/tutorialtimestamp.js +++ b/addon/models/tutorialtimestamp.js @@ -2,5 +2,6 @@ import Timestamp from "explorviz-frontend/models/timestamp" import DS from 'ember-data'; export default Timestamp.extend({ - name: DS.attr('String') + name: DS.attr('String'), + timestamp: DS.attr('String') }); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js index 81e2218..31d380d 100644 --- a/addon/routes/tutorial/run.js +++ b/addon/routes/tutorial/run.js @@ -1,6 +1,5 @@ import BaseRoute from 'explorviz-frontend/routes/base-route'; import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; -import RSVP from 'rsvp'; export default BaseRoute.extend(AuthenticatedRouteMixin, { model(params) { diff --git a/addon/routes/tutorial/tutoriallandscape.js b/addon/routes/tutorial/tutoriallandscape.js deleted file mode 100644 index b8942df..0000000 --- a/addon/routes/tutorial/tutoriallandscape.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/models/tutoriallandscape'; diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 91c4f97..2524222 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -1,7 +1,5 @@ import LandscapeSerializer from "explorviz-frontend/serializers/landscape" import SaveRelationshipsMixin from 'ember-data-save-relationships'; -import JSONAPISerializer from 'ember-data/serializers/json-api'; -import { inject as service } from "@ember/service"; @@ -36,8 +34,8 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ } }else if (relationship.kind === 'hasMany') { var self=this; - var key=key; - var hasmany=this.hasMany(key); + var nkey=key; + var hasmany=this.hasMany(nkey); hasmany.forEach(function(v){ if(v.record.threeJSModel!=undefined){ v.record.set('threeJSModel', null); @@ -50,8 +48,8 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ hasmany.forEach(function(value){ value.serializedTypes=self.serializedTypes; value.included=self.included; - if(self.serializedTypes.indexOf(key)==-1){ - self.serializedTypes.push(key); + if(self.serializedTypes.indexOf(nkey)==-1){ + self.serializedTypes.push(nkey); } value.serializeRecordForIncluded=self.serializeRecordForIncluded; value.eachRelationship(self.serializeRecordForIncluded,value); @@ -61,13 +59,8 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ }); } }, - serialize(snapshot, options) { + serialize(snapshot) { let json = this._super(...arguments); - var included=[]; - //json.included=[]; - // snapshot.hasMany('events').forEach(function(v,k){ - // json.included.push(v.serialize()); - // }); snapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; snapshot.serializedTypes=[]; @@ -77,26 +70,11 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ snapshot.hasMany('systems').forEach(function(v,k){ delete json.data.relationships.systems.data[k].attributes.threeJSModel; }); - //snapshot.hasMany('events').forEach(function(v,k){ - // delete json.data.relationships.events.data[k].attributes.threeJSModel; - //}); + snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel; }); - // snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ - // json.included.push(v.serialize()); - // }); -// json.included.push({type:"tutorialtimestamp", -// id:snapshot.record.get('timestamp').get('id'), -// attributes: { -// name:snapshot.record.get('timestamp').get('name'), -// timestamp:snapshot.record.get('timestamp').get('timestamp') -// }}); -// json.data.relationships.timestamp={ -// type:"tutorialtimestamp", -// id:snapshot.record.get('timestamp').get('id') -// }; json.included=snapshot.included; var newjson={ data:{ @@ -127,14 +105,15 @@ json.included=snapshot.included; return newjson; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { + var json = {}; if(Array.isArray(payload.data)){ - var json = {data:[]}; + json = {data:[]}; payload.data.forEach(function(v,k){ json.data[k]=JSON.parse(v.attributes.landscape).data; json.data[k].relationships.timestamp=v.relationships.timestamp; }); }else{ - var json = JSON.parse(payload.data.attributes.landscape); + json = JSON.parse(payload.data.attributes.landscape); json.data.relationships.timestamp=payload.data.relationships.timestamp; } if(Array.isArray(json.included)){ diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 7398311..dd3c47d 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -12,6 +12,7 @@ export default Service.extend(Evented, { landscape: null, livelandscapes: false, landscapeList: null, + updateLandscapeList(reload) { this.set('landscapeList', []); this.get('store').findAll('tutoriallandscape', { reload }) @@ -39,7 +40,7 @@ export default Service.extend(Evented, { importLandscape(landscapeTimestamp){ this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { this.set('landscape',tutlandscape); - }, (e) => { + }, () => { this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ @@ -73,13 +74,9 @@ export default Service.extend(Evented, { this.set('selectTarget',false); }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ - console.log("Right action!"); if(this.get("runMode")){ this.completed(this.get('model')); } - }else{ - console.log("Wrong Action: Singleclick: "+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); - console.log("Expected: "+this.get("model.targetId")+" "+this.get("model.targetType")+" "+this.get("model.actionType")); } } } @@ -93,13 +90,9 @@ export default Service.extend(Evented, { this.set('selectTarget',false); }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleclick"){ - console.log("Right action!"); if(this.get("runMode")){ this.completed(this.get('model')); } - }else{ - console.log("Wrong Action: Doubleclick: "+emberModel.get("id")+" "+emberModel.get('constructor.modelName')); - console.log("Expected: "+this.get("model.targetId")+" "+this.get("model.targetType")+" "+this.get("model.actionType")); } } } @@ -109,7 +102,6 @@ export default Service.extend(Evented, { this.set('interaction', landscapeInteraction); this.get('interaction').on('singleClick', this.clickListenerSingle); this.get('interaction').on('doubleClick', this.clickListenerDouble); - console.log(); } }) diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index 00f5827..b73f792 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -3,6 +3,7 @@ import Evented from '@ember/object/evented'; import debugLogger from 'ember-debug-logger'; import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import { Promise } from 'rsvp'; export default Service.extend(Evented,AlertifyHandler, { debug: debugLogger(), @@ -10,9 +11,11 @@ export default Service.extend(Evented,AlertifyHandler, { landscapeService:service(), tutorialList: null, activeStep:null, - steps:[], - sequences:[], + steps:null, + sequences:null, initService(model){ + this.set('sequences',[]); + this.set('steps',[]); this.set('sequences',model.get('sequences')); this.get('sequences').forEach((k)=>{ k.get('steps').forEach((s)=>{ @@ -41,7 +44,7 @@ export default Service.extend(Evented,AlertifyHandler, { }, getSequence(step){ return this.get('store').findAll('tutorial').then((tutorials)=>{ - return new Ember.RSVP.Promise( + return new Promise( function(resolve){ tutorials.forEach(function(k1){ k1.get('sequences').then((sequences)=>{ @@ -59,7 +62,7 @@ export default Service.extend(Evented,AlertifyHandler, { }, getTutorial(sequence){ return this.get('store').findAll('tutorial').then((tutorials)=>{ - return new Ember.RSVP.Promise( + return new Promise( function(resolve){ tutorials.forEach(function(k1){ k1.get('sequences').then((sequences)=>{ diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index 127977e..94f7f03 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -6,6 +6,11 @@ Selected Landscape:{{landscapeService.landscape.timestamp}} {{#each landscapeService.landscapeList as |landscape|}}
    • + {{#if (is-selected-timestamp model landscape)}} + selected + {{else}} + unselected + {{/if}} {{landscape.timestamp.name}}
    • diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index cf83d1b..dd38157 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -2,9 +2,9 @@ {{#bs-form model=model onSubmit=(action "saveSequenceChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} - {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} +{{#if model.landscapeTimestamp}} {{#bs-button onClick=(action "resetLandscape") type="secondary" @@ -14,3 +14,14 @@ }} change landscape {{/bs-button}} +{{else}} +{{#bs-button + onClick=(action "resetLandscape") + type="secondary" + outline=true + class="btn-timeline" + title="change landscape" +}} +select landscape +{{/bs-button}} +{{/if}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 27c8f9a..ae7ec52 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -24,18 +24,9 @@ {{/bs-button}} {{#if showLandscape}} {{#if landscapeRepo.latestLandscape.systems}} - {{!-- {{visualization/page-setup/visualization-navbar - content=(array - (component "visualization/page-setup/navbar/reset-visualization") - (component "visualization/page-setup/navbar/pause-reload") - (component "visualization/page-setup/navbar/event-opener") - ) - }} --}} -
      {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape}} - {{visualization/rendering/popups/popup-coordinator popupData=additionalData.popupContent}}
      @@ -51,16 +42,6 @@ {{/if}} {{else}} - {{!-- {{visualization/page-setup/visualization-navbar - content=(array - (component "visualization/page-setup/navbar/reset-visualization") - (component "visualization/page-setup/navbar/pause-reload") - (component "visualization/page-setup/navbar/trace-overview") - (component "visualization/page-setup/navbar/sql-opener") - (component "visualization/page-setup/navbar/application-opener") - (component "visualization/page-setup/navbar/application-search") - ) - }} --}}
      {{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index 370aeff..f2b1539 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -1,13 +1,17 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} + +{{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} - {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} + {{!-- {{#link-to "tutorial.edit.tutorial.landscape" model}} {{#if landscapeService.landscape}}edit landscape{{else}}select landscape{{/if}} {{/link-to}} --}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}} +{{#if model.landscapeTimestamp}} {{#bs-button onClick=(action "resetLandscape") type="secondary" @@ -17,3 +21,14 @@ }} change landscape {{/bs-button}} +{{else}} +{{#bs-button + onClick=(action "resetLandscape") + type="secondary" + outline=true + class="btn-timeline" + title="change landscape" +}} +select landscape +{{/bs-button}} +{{/if}} diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index 5c9356d..6b8863f 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -33,9 +33,16 @@ {{svg-jar "kebab-vertical" class="octicon"}} {{/dd.button}} {{#dd.menu as |ddm|}} + {{#ddm.item title="Run"}} + + {{#link-to "tutorial.run" tutorial}} + {{svg-jar "play" class="octicon" id="run-button"}}Run + {{/link-to}} + + {{/ddm.item}} {{#ddm.item title="Edit"}} - {{#link-to "tutorial.edit.tutorial" tutorial}} + {{#link-to "tutorial.tutorial" tutorial}} {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit {{/link-to}} diff --git a/app/helpers/is-selected-timestamp.js b/app/helpers/is-selected-timestamp.js new file mode 100644 index 0000000..6683e43 --- /dev/null +++ b/app/helpers/is-selected-timestamp.js @@ -0,0 +1 @@ +export { default, isSelectedTimestamp } from 'explorviz-frontend-extension-tutorial/helpers/is-selected-timestamp'; diff --git a/tests/integration/helpers/is-selected-timestamp-test.js b/tests/integration/helpers/is-selected-timestamp-test.js new file mode 100644 index 0000000..1f60ca1 --- /dev/null +++ b/tests/integration/helpers/is-selected-timestamp-test.js @@ -0,0 +1,17 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import hbs from 'htmlbars-inline-precompile'; + +module('Integration | Helper | isSelectedTimestamp', function(hooks) { + setupRenderingTest(hooks); + + // Replace this with your real tests. + test('it renders', async function(assert) { + this.set('inputValue', '1234'); + + await render(hbs`{{is-selected-timestamp inputValue}}`); + + assert.equal(this.element.textContent.trim(), '1234'); + }); +}); From b7c54a7a0b585f4910e9b9c329d8051723ebd452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 3 Jun 2019 16:40:26 +0200 Subject: [PATCH 24/30] more cleanup --- addon/adapters/tutoriallandscape.js | 2 +- addon/components/side-form-layout.js | 28 +++++++-- addon/components/timeline.js | 13 ++-- addon/components/tutorial-form.js | 22 ++++++- addon/controllers/tutorial/list.js | 26 +++++++- addon/helpers/is-selected-timestamp.js | 10 --- addon/services/landscape-service.js | 17 +++-- .../landscape-select/landscapelist.hbs | 2 +- addon/templates/components/timeline.hbs | 21 ++++++- addon/templates/components/tutorial-form.hbs | 62 ++++++++++++------- addon/templates/tutorial/list.hbs | 41 ++++-------- app/helpers/is-selected-timestamp.js | 1 - package-lock.json | 41 ++++-------- package.json | 3 +- .../helpers/is-selected-timestamp-test.js | 17 ----- 15 files changed, 179 insertions(+), 127 deletions(-) delete mode 100644 addon/helpers/is-selected-timestamp.js delete mode 100644 app/helpers/is-selected-timestamp.js delete mode 100644 tests/integration/helpers/is-selected-timestamp-test.js diff --git a/addon/adapters/tutoriallandscape.js b/addon/adapters/tutoriallandscape.js index 4ac473b..a199614 100644 --- a/addon/adapters/tutoriallandscape.js +++ b/addon/adapters/tutoriallandscape.js @@ -30,7 +30,7 @@ export default JSONAPIAdapter.extend(DataAdapterMixin,{ // @Override urlForQueryRecord() { const baseUrl = this.buildURL(); - return `${baseUrl}/v1/tutorials/landscapes/by-timestamp`; + return `${baseUrl}/v1/tutorials/landscapes`; }, urlForFindRecord(id) { const baseUrl = this.buildURL(); diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index 99370c7..a97cc0d 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -16,9 +16,9 @@ export default Component.extend({ return !this.get('landscapeRepo.latestApplication'); }), selectMode: computed('landscapeService.landscape',function(){ - if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ - return !this.get('landscapeService.landscape'); - } + if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ + return !this.get('landscapeService.landscape'); + } return false; }), liveMode: computed('landscapeService.livelandscapes','selectMode', function() { @@ -32,8 +32,28 @@ export default Component.extend({ this.get('landscapeService').updateLandscapeList(true); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); -}, + }, actions: { + addNewTutorial(){ + let newTutorial = this.get('store').createRecord("tutorial",{ + title: "new tutorial" + }) + this.set("newSequence",newTutorial) + }, + addNewSequence(tutorial){ + let newSequence = this.get('store').createRecord("sequence",{ + title: "new sequence" + }) + tutorial.get('sequences').push(newSequence); + this.set("newSequence",newSequence) + }, + addNewStep(sequence){ + let newStep = this.get('store').createRecord("tutorial",{ + title: "new tutorial" + }) + sequence.get('steps').push(newSequence); + this.set("newStep",newStep) + }, resetView() { this.get('renderingService').reSetupScene(); }, diff --git a/addon/components/timeline.js b/addon/components/timeline.js index bb3a2b3..85e1d37 100644 --- a/addon/components/timeline.js +++ b/addon/components/timeline.js @@ -8,10 +8,15 @@ export default Timeline.extend(AlertifyHandler,{ landscapeService: service(), chartClickHandler(evt) { this._super(...arguments); - var tutorialActivePoint = this.get('timelineChart').getElementAtEvent(evt)[0]; - if (tutorialActivePoint) { + this.set('importLandscape',true); + this.set('tutorialActivePoint',this.get('timelineChart').getElementAtEvent(evt)[0]); + }, + actions:{ + submit(){ + if ( this.get('tutorialActivePoint')) { this.get('landscapeListener').set('pauseVisualizationReload',true); - this.get('landscapeService').importLandscape(tutorialActivePoint._chart.data.datasets[tutorialActivePoint._datasetIndex].data[tutorialActivePoint._index].x); - } + this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName')); + } + } } }); diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js index 4403874..1c4f71c 100644 --- a/addon/components/tutorial-form.js +++ b/addon/components/tutorial-form.js @@ -15,6 +15,26 @@ export default Component.extend(AlertifyHandler,{ if(this.get('landscapeService.landscape')!=null){ this.set('landscapeService.landscape',null); } - } + }, + addNewTutorial(){ + let newTutorial = this.get('store').createRecord("tutorial",{ + title: "new tutorial" + }) + newTutorial.save(); + }, + addNewSequence(tutorial){ + let newSequence = this.get('store').createRecord("sequence",{ + title: "new sequence" + }) + tutorial.get('sequences').push(newSequence); + tutorial.save(); + }, + addNewStep(sequence){ + let newStep = this.get('store').createRecord("step",{ + title: "new step" + }) + sequence.get('steps').push(newSequence); + sequence.save(); + }, } }); diff --git a/addon/controllers/tutorial/list.js b/addon/controllers/tutorial/list.js index aca63c8..819acd1 100644 --- a/addon/controllers/tutorial/list.js +++ b/addon/controllers/tutorial/list.js @@ -12,6 +12,30 @@ export default Controller.extend(AlertifyHandler,{ toggleSequence(sequence){ sequence.set('expanded',!sequence.get('expanded')); //this.get('tutorialService').expandTutorial(tutorial); - } + }, + addNewTutorial(){ + let newTutorial = this.get('store').createRecord("tutorial",{ + title: "new tutorial" + }) + newTutorial.save(); + }, + addNewSequence(tutorial){ + let newSequence = this.get('store').createRecord("sequence",{ + title: "new sequence" + }) + tutorial.get('sequences').pushObject(newSequence); + newSequence.save().then(function () { + tutorial.save(); + }); + }, + addNewStep(sequence){ + let newStep = this.get('store').createRecord("step",{ + title: "new step" + }) + sequence.get('steps').pushObject(newStep); + newStep.save().then(function () { + sequence.save(); + }); + }, } }); diff --git a/addon/helpers/is-selected-timestamp.js b/addon/helpers/is-selected-timestamp.js deleted file mode 100644 index d0c85d8..0000000 --- a/addon/helpers/is-selected-timestamp.js +++ /dev/null @@ -1,10 +0,0 @@ -import { helper } from '@ember/component/helper'; - -export function isSelectedTimestamp([model,timestamp]/*, hash*/) { - if(model.get('landscapeTimestamp')==timestamp.get('timestamp.timestamp')){ - return true; - } - return false; -} - -export default helper(isSelectedTimestamp); diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index dd3c47d..1282135 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -33,21 +33,25 @@ export default Service.extend(Evented, { } }); } - if(model.get('landscapeTimestamp')!=""){ - this.importLandscape(model.get('landscapeTimestamp')); + if(model.get('landscapeTimestamp')!=undefined && model.get('landscapeTimestamp')!=""){ + this.importLandscape(model.get('landscapeTimestamp'),""); } }, - importLandscape(landscapeTimestamp){ + importLandscape(landscapeTimestamp,name){ + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { this.set('landscape',tutlandscape); }, () => { this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ + if(name=="" ||name == undefined){ + name="new landscape"; + } var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ id:landscape.get('timestamp.id'), timestamp:landscape.get('timestamp.timestamp'), totalRequests:landscape.get('timestamp.totalRequests'), - name:"new timestamp", + name:name, }); var landscaperecord = this.get('store').createRecord("tutoriallandscape",{ id:landscape.get('id'), @@ -59,8 +63,11 @@ export default Service.extend(Evented, { timestamprecord.save(); landscaperecord.save(); this.set('landscape',landscaperecord); + }else{ - this.get('store').set('landscape',landscape); + this.get('store').set('tutoriallandscape',landscape); + this.set('landscape',landscape); + } }); }); diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index 94f7f03..f432494 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -6,7 +6,7 @@ Selected Landscape:{{landscapeService.landscape.timestamp}} {{#each landscapeService.landscapeList as |landscape|}}
    • - {{#if (is-selected-timestamp model landscape)}} + {{#if (eq model.landscapeTimestamp landscape.timestamp.timestamp)}} selected {{else}} unselected diff --git a/addon/templates/components/timeline.hbs b/addon/templates/components/timeline.hbs index cdc255c..2123576 100644 --- a/addon/templates/components/timeline.hbs +++ b/addon/templates/components/timeline.hbs @@ -1 +1,20 @@ - \ No newline at end of file + + +{{#bs-modal + open=importLandscape + title="import landscape" + closeTitle="closeTitle" + submitTitle="submitTitle" + closeButton="closeButton" + onSubmit=(action "submit" ) + onHidden=(action (mut importLandscape) false) + renderInPlace=true as |modal|}} + {{#modal.body}} + Import landscape + {{input type="text" value=landscapeName placehoder="new landscape"}} + {{/modal.body}} + {{#modal.footer}} + {{#bs-button onClick=(action modal.close)}}Cancel{{/bs-button}} + {{#bs-button type="success" onClick=(action modal.submit)}}Save{{/bs-button}} + {{/modal.footer}} +{{/bs-modal}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index f2b1539..7bd2c9a 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -1,5 +1,43 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} - + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Run"}} + + {{#link-to "tutorial.run" model}} + {{svg-jar "play" class="octicon" id="run-button"}}Run + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="Edit"}} + + {{#link-to "tutorial.tutorial" model}} + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="set landscape"}} + + {{svg-jar "globe" class="octicon" id="change-landscape"}} + {{#if model.landscapeTimestamp}} + change landscape + {{else}} + select landscape + {{/if}} + + {{/ddm.item}} + {{#ddm.item title="new sequence"}} + + {{svg-jar "plus" class="octicon" id="new-sequence"}} + new sequence + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} @@ -11,24 +49,4 @@ {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} -{{#if model.landscapeTimestamp}} -{{#bs-button - onClick=(action "resetLandscape") - type="secondary" - outline=true - class="btn-timeline" - title="change landscape" -}} -change landscape -{{/bs-button}} -{{else}} -{{#bs-button - onClick=(action "resetLandscape") - type="secondary" - outline=true - class="btn-timeline" - title="change landscape" -}} -select landscape -{{/bs-button}} -{{/if}} + diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index 6b8863f..42480fc 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -2,7 +2,7 @@

      Tutorials

      - {{!-- {{#link-to "tutorial.create"}}{{svg-jar "plus-small" class="octicon"}}Add Tutorial{{/link-to}} --}} + {{svg-jar "plus-small" class="octicon"}}Add Tutorial
      @@ -10,7 +10,6 @@ - ID Title Sequences @@ -20,10 +19,7 @@ {{#each model.tutorials as |tutorial|}} {{#bs-button onClick=(action "toggleTutorial" tutorial)}}{{if tutorial.expanded '-' '+'}}{{/bs-button}} - - {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.id}}{{/link-to}} - - {{tutorial.title}} + {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.title}}{{/link-to}} {{tutorial.sequences.length}} @@ -47,10 +43,10 @@ {{/link-to}} {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete + {{#ddm.item title="new sequence"}} + + {{svg-jar "plus" class="octicon" id="new-sequence"}}new {{/ddm.item}} {{/dd.menu}} @@ -61,10 +57,7 @@ {{#each tutorial.sequences as |sequence|}} {{#bs-button onClick=(action "toggleSequence" sequence)}}{{if sequence.expanded '-' '+'}}{{/bs-button}} - - {{#link-to "tutorial.sequence" sequence}}{{sequence.id}}{{/link-to}} - - {{sequence.title}} + {{#link-to "tutorial.sequence" sequence}}{{sequence.title}}{{/link-to}} {{sequence.steps.length}} @@ -81,12 +74,6 @@ {{/link-to}} {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete - - {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}} @@ -95,10 +82,7 @@ {{#each sequence.steps as |step|}} - - {{#link-to "tutorial.step" step}}{{step.id}}{{/link-to}} - - {{step.title}} + {{#link-to "tutorial.step" step}}{{step.title}}{{/link-to}} @@ -114,10 +98,10 @@ {{/link-to}} {{/ddm.item}} - {{#ddm.item title="Delete"}} - - {{svg-jar "x" class="octicon" id="delete-button"}}Delete + {{#ddm.item title="new step"}} + + {{svg-jar "plus" class="octicon" id="new-step"}}new {{/ddm.item}} {{/dd.menu}} @@ -132,4 +116,5 @@
      +
    • diff --git a/app/helpers/is-selected-timestamp.js b/app/helpers/is-selected-timestamp.js deleted file mode 100644 index 6683e43..0000000 --- a/app/helpers/is-selected-timestamp.js +++ /dev/null @@ -1 +0,0 @@ -export { default, isSelectedTimestamp } from 'explorviz-frontend-extension-tutorial/helpers/is-selected-timestamp'; diff --git a/package-lock.json b/package-lock.json index 82019f3..784f9b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6693,8 +6693,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -6715,14 +6714,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6737,20 +6734,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -6867,8 +6861,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -6880,7 +6873,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6895,7 +6887,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6903,14 +6894,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6929,7 +6918,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7010,8 +6998,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7023,7 +7010,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7109,8 +7095,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -7146,7 +7131,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7166,7 +7150,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7210,14 +7193,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/package.json b/package.json index 686bf05..52ca7ef 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ }, "dependencies": { "ember-cli-babel": "^7.1.2", - "ember-cli-htmlbars": "^3.0.0" + "ember-cli-htmlbars": "^3.0.0", + "ember-data-save-relationships": "0.0.10" }, "devDependencies": { "@ember/optional-features": "^0.6.3", diff --git a/tests/integration/helpers/is-selected-timestamp-test.js b/tests/integration/helpers/is-selected-timestamp-test.js deleted file mode 100644 index 1f60ca1..0000000 --- a/tests/integration/helpers/is-selected-timestamp-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; - -module('Integration | Helper | isSelectedTimestamp', function(hooks) { - setupRenderingTest(hooks); - - // Replace this with your real tests. - test('it renders', async function(assert) { - this.set('inputValue', '1234'); - - await render(hbs`{{is-selected-timestamp inputValue}}`); - - assert.equal(this.element.textContent.trim(), '1234'); - }); -}); From b5e7afdc729a082151013cf9a4a7eb1b6da00bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Mon, 10 Jun 2019 23:09:51 +0200 Subject: [PATCH 25/30] fixes to runmode and loading --- addon/adapters/tutoriallandscape.js | 4 +- addon/components/application-interaction.js | 6 + addon/components/application-visualization.js | 85 +++++++++ addon/components/landscape-interaction.js | 3 +- .../navbar/toggle-live-landscape.js | 4 +- addon/components/landscape-visualization.js | 87 ++++++++- addon/components/side-form-layout.js | 16 +- addon/components/step-form.js | 27 +++ addon/components/timeline.js | 5 +- addon/controllers/tutorial.js | 11 ++ addon/controllers/tutorial/list.js | 2 + addon/controllers/tutorial/run.js | 1 + addon/models/sequence.js | 4 +- addon/models/step.js | 1 - addon/models/tutorial.js | 3 +- addon/routes/tutorial/run.js | 10 +- addon/routes/tutorial/sequence.js | 3 + addon/routes/tutorial/step.js | 4 + addon/routes/tutorial/tutorial.js | 3 + addon/serializers/tutoriallandscape.js | 6 +- addon/services/landscape-service.js | 60 ++---- addon/services/tutorial-service.js | 59 +++--- .../components/application-interaction.hbs | 1 + .../components/application-visualization.hbs | 2 + .../components/landscape-visualization.hbs | 1 - addon/templates/components/sequence-form.hbs | 39 ++-- .../templates/components/side-form-layout.hbs | 32 +++- addon/templates/components/step-form.hbs | 58 +++++- addon/templates/components/timeline.hbs | 5 +- addon/templates/components/tutorial-form.hbs | 65 +++---- addon/templates/tutorial/list.hbs | 42 +++-- addon/templates/tutorial/run.hbs | 2 +- addon/templates/tutorial/sequence.hbs | 2 +- addon/templates/tutorial/step.hbs | 2 +- app/components/application-interaction.js | 1 + app/components/application-visualization.js | 1 + app/templates/components/timeline.js | 1 - app/templates/tutorial/index.js | 2 +- package-lock.json | 174 +++++------------- 39 files changed, 505 insertions(+), 329 deletions(-) create mode 100644 addon/components/application-interaction.js create mode 100644 addon/components/application-visualization.js create mode 100644 addon/templates/components/application-interaction.hbs create mode 100644 addon/templates/components/application-visualization.hbs create mode 100644 app/components/application-interaction.js create mode 100644 app/components/application-visualization.js delete mode 100644 app/templates/components/timeline.js diff --git a/addon/adapters/tutoriallandscape.js b/addon/adapters/tutoriallandscape.js index a199614..5579174 100644 --- a/addon/adapters/tutoriallandscape.js +++ b/addon/adapters/tutoriallandscape.js @@ -25,12 +25,12 @@ export default JSONAPIAdapter.extend(DataAdapterMixin,{ }, urlForFindAll() { const baseUrl = this.buildURL(); - return `${baseUrl}/v1/tutorials/landscapes/`; + return `${baseUrl}/v1/tutorials/landscapes/all`; }, // @Override urlForQueryRecord() { const baseUrl = this.buildURL(); - return `${baseUrl}/v1/tutorials/landscapes`; + return `${baseUrl}/v1/tutorials/landscapes/by-timestamp`; }, urlForFindRecord(id) { const baseUrl = this.buildURL(); diff --git a/addon/components/application-interaction.js b/addon/components/application-interaction.js new file mode 100644 index 0000000..3f98756 --- /dev/null +++ b/addon/components/application-interaction.js @@ -0,0 +1,6 @@ +import Interaction from 'explorviz-frontend/utils/application-rendering/interaction' +import { inject as service } from "@ember/service"; + +export default Interaction.extend({ + landscapeService: service() +}); diff --git a/addon/components/application-visualization.js b/addon/components/application-visualization.js new file mode 100644 index 0000000..3d3cb07 --- /dev/null +++ b/addon/components/application-visualization.js @@ -0,0 +1,85 @@ +import layout from '../templates/components/application-visualization'; +import ApplicationRendering from 'explorviz-frontend/components/visualization/rendering/application-rendering'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import { inject as service } from '@ember/service'; +export default ApplicationRendering.extend(AlertifyHandler,{ + layout, + renderingService: service(), + tutorialService: service(), + landscapeService: service(), + interactionModel:null, + initInteraction(){ + this._super(...arguments); + const self = this; + if(this.get('runmode')){ + this.set('interaction.model',this.get('tutorialService.activeStep')); + }else{ + this.set('interaction.model',this.get('interactionModel')); + } + + this.set('interaction.tutorialService',this.get('tutorialService')); + this.set('interaction.landscapeService',this.get('landscapeService')); + + + this.set('interaction.completed',this.get('completed')); + this.set('interaction.runmode',this.get('runmode')); + this.get('interaction').on('singleClick', this.get('clickListenerSingle')); + this.get('interaction').on('doubleClick', this.get('clickListenerDouble')); + }, + clickListenerSingle(emberModel){ + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.get('constructor.modelName')); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","singleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ + if(this.get("runmode")){ + this.completed(this.get('model')); + } + } + } + } + }, + clickListenerDouble(emberModel){ + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.get('constructor.modelName')); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","doubleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){ + if(this.get("runmode")){ + this.completed(this.get('model')); + } + } + } + } + }, + completed(laststep){ + if(this.get('runmode')){ + var step = this.get('tutorialService').getNextStep(laststep); + if(step){ + this.get('tutorialService').getSequence(step).then((sequence)=>{ + if(sequence.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(sequence); + }else{ + this.get('tutorialService').getTutorial(sequence).then((tutorial)=>{ + if(tutorial.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(tutorial); + }else{ + console.log("no landscape defined"); + } + }); + } + }); + this.get('tutorialService').set('activeStep',step); + this.set('model',step); + }else{ + this.showAlertifyMessage(`Last step completed.`); + } + } + } +}); diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index eb39fa0..bd069fd 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -1,5 +1,6 @@ import Interaction from 'explorviz-frontend/utils/landscape-rendering/interaction' +import { inject as service } from "@ember/service"; export default Interaction.extend({ - + landscapeService: service() }); diff --git a/addon/components/landscape-select/navbar/toggle-live-landscape.js b/addon/components/landscape-select/navbar/toggle-live-landscape.js index 9b1b23f..e893fd0 100644 --- a/addon/components/landscape-select/navbar/toggle-live-landscape.js +++ b/addon/components/landscape-select/navbar/toggle-live-landscape.js @@ -11,10 +11,10 @@ export default Component.extend(AlertifyHandler,{ actions:{ toggleVisualizationReload() { this.get('landscapeListener').toggleVisualizationReload(); - if(this.get('landscapeListener').pauseVisualizationReload){ + if(this.get('landscapeListener,pauseVisualizationReload')){ this.get('landscapeService').set('selected',null); } - this.handleMessageForUser(this.get('landscapeListener').pauseVisualizationReload); + this.handleMessageForUser(this.get('landscapeListener.pauseVisualizationReload')); } }, handleMessageForUser(pauseReload) { diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 7159526..1ca2f16 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -1,7 +1,92 @@ import layout from '../templates/components/landscape-visualization'; import LandscapeRendering from 'explorviz-frontend/components/visualization/rendering/landscape-rendering' import { inject as service } from '@ember/service'; +import { getOwner } from '@ember/application'; + + export default LandscapeRendering.extend({ layout, - renderingService: service(), + landscapeService:service(), + tutorialService:service(), + interactionModel: null, + setSelectTarget(value){ + this.set('interaction,selectTarget',value); + }, + initInteraction(){ + this._super(...arguments); + const self = this; + + if(this.get('runmode')){ + this.set('interaction.model',this.get('tutorialService.activeStep')); + }else{ + this.set('interaction.model',this.get('interactionModel')); + } + this.set('interaction.completed',this.get('completed')); + + this.set('interaction.tutorialService',this.get('tutorialService')); + this.set('interaction.landscapeService',this.get('landscapeService')); + + this.set('interaction.runmode',this.get('runmode')); + this.get('interaction').on('showApplication', function (emberModel) { + self.set('landscapeService.application', emberModel); + }); + this.get('interaction').on('singleClick', this.get('clickListenerSingle')); + this.get('interaction').on('doubleClick', this.get('clickListenerDouble')); + }, + clickListenerSingle(emberModel){ + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.get('constructor.modelName')); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","singleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ + if(this.get("runmode")){ + this.completed(this.get('model')); + } + } + } + } + }, + clickListenerDouble(emberModel){ + if(emberModel!=undefined){ + if(this.get('selectTarget')){ + this.set("model.targetType",emberModel.get('constructor.modelName')); + this.set("model.targetId",emberModel.get("id")); + this.set("model.actionType","doubleClick"); + this.set('selectTarget',false); + }else{ + if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){ + if(this.get("runmode")){ + this.completed(this.get('model')); + } + } + } + } + }, + completed(laststep){ + if(this.get('runmode')){ + var step = this.get('tutorialService').getNextStep(laststep); + if(step){ + this.get('tutorialService').getSequence(step).then((sequence)=>{ + if(sequence.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(sequence); + }else{ + this.get('tutorialService').getTutorial(sequence).then((tutorial)=>{ + if(tutorial.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(tutorial); + }else{ + console.log("no landscape defined"); + } + }); + } + }); + this.get('tutorialService').set('activeStep',step); + this.set('model',step); + }else{ + this.showAlertifyMessage(`Last step completed.`); + } + } + } }); diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index a97cc0d..133e9c1 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -11,9 +11,11 @@ export default Component.extend({ renderingService: service(), landscapeRepo: service("repos/landscape-repository"), landscapeListener: service(), + currentUser: service(), - showLandscape: computed('landscapeRepo.latestApplication', function() { - return !this.get('landscapeRepo.latestApplication'); + + showLandscape: computed('landscapeService.application', function() { + return !this.get('landscapeService.application'); }), selectMode: computed('landscapeService.landscape',function(){ if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ @@ -29,7 +31,7 @@ export default Component.extend({ }), init(){ this._super(...arguments); - this.get('landscapeService').updateLandscapeList(true); + //this.get('landscapeService').updateLandscapeList(true); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); }, @@ -58,8 +60,7 @@ export default Component.extend({ this.get('renderingService').reSetupScene(); }, openLandscapeView() { - this.set('landscapeRepo.latestApplication', null); - this.set('landscapeRepo.replayApplication', null); + this.set('landscapeService.application', null); }, toggleTimeline() { this.get('renderingService').toggleTimeline(); @@ -72,10 +73,6 @@ export default Component.extend({ this.set('landscapeService.livelandscapes',false); this.get('landscapeListener').set('pauseVisualizationReload',true); }, - toggleSelectTarget(interaction,model){ - interaction.set('model',model); - interaction.set('selectTarget',!interaction.get('selectTarget')); - } }, showTimeline() { this.set('renderingService.showTimeline', true); @@ -97,6 +94,7 @@ export default Component.extend({ // @Override cleanup() { this._super(...arguments); + this.get('landscapeListener').set('pauseVisualizationReload',false); this.get('additionalData').off('showWindow', this, this.onShowWindow); }, }); diff --git a/addon/components/step-form.js b/addon/components/step-form.js index 48c7654..8118fc7 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -1,10 +1,33 @@ import Component from '@ember/component'; import layout from '../templates/components/step-form'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; +import { inject as service } from "@ember/service"; export default Component.extend(AlertifyHandler,{ layout, + tutorialService: service(), + landscapeService: service(), actions:{ + skipStep(){ + var step = this.get('tutorialService').getNextStep(this.get('model')); + if(step){ + this.get('tutorialService').getSequence(step).then((sequence)=>{ + if(sequence.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(sequence); + }else{ + this.get('tutorialService').getTutorial(sequence).then((tutorial)=>{ + if(tutorial.get('landscapeTimestamp')!=undefined){ + this.get('landscapeService').loadLandscape(tutorial); + }else{ + console.log("no landscape defined"); + } + }); + } + }); + this.get('tutorialService').set('activeStep',step); + this.set('model',step); + } + }, saveStepChanges(step) { if(step) { // check for valid input @@ -23,6 +46,10 @@ export default Component.extend(AlertifyHandler,{ this.showAlertifyMessage(`Step not found.`); } }, + toggleSelectTarget(){ + this.set('landscapeService.landscapeinteraction.selectTarget',!this.get('landscapeService.landscapeinteraction.selectTarget')); + this.set('landscapeService.applicationinteraction.selectTarget',!this.get('landscapeService.applicationinteraction.selectTarget')); + } }, showReasonErrorAlert(reason) { const {title, detail} = reason.errors[0]; diff --git a/addon/components/timeline.js b/addon/components/timeline.js index 85e1d37..aa8df76 100644 --- a/addon/components/timeline.js +++ b/addon/components/timeline.js @@ -1,5 +1,8 @@ import Timeline from 'explorviz-frontend/components/visualization/page-setup/timeline/timeline'; -import layout from 'explorviz-frontend/templates/components/visualization/page-setup/timeline/timeline' +//import layout from 'explorviz-frontend/templates/components/visualization/page-setup/timeline/timeline' + +import layout from '../templates/components/timeline' + import {inject as service} from '@ember/service'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index 6a8005d..b3d74e1 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -8,4 +8,15 @@ export default Controller.extend({ // update your entity and then call this.get('renderingService').redrawScene(); }, + setupController(controller, model) { + this._super(controller, model); + controller.initRendering(); + + }, + + actions: { + resetRoute() { + //const routeName = this.get('tutorial'); + } + } }); diff --git a/addon/controllers/tutorial/list.js b/addon/controllers/tutorial/list.js index 819acd1..019d5ae 100644 --- a/addon/controllers/tutorial/list.js +++ b/addon/controllers/tutorial/list.js @@ -4,6 +4,8 @@ import { inject as service } from "@ember/service"; export default Controller.extend(AlertifyHandler,{ tutorialService: service(), + currentUser: service(), + actions: { toggleTutorial(tutorial){ tutorial.set('expanded',!tutorial.get('expanded')); diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js index 662cc58..bf304ad 100644 --- a/addon/controllers/tutorial/run.js +++ b/addon/controllers/tutorial/run.js @@ -6,6 +6,7 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Controller.extend(AlertifyHandler,{ tutorialService:service(), landscapeService:service(), + currentUser: service(), activateNextStep(laststep){ var step = this.get('tutorialService').getNextStep(laststep); if(step){ diff --git a/addon/models/sequence.js b/addon/models/sequence.js index 11be0dd..bbfa0ba 100644 --- a/addon/models/sequence.js +++ b/addon/models/sequence.js @@ -4,7 +4,5 @@ export default DS.Model.extend({ title: DS.attr('string'), text: DS.attr('string'), landscapeTimestamp: DS.attr('string'), - - tutorial: DS.belongsTo('tutorial',{inverse:"sequences",async:false}), - steps: DS.hasMany('step',{inverse:"sequence",async:false}), + steps: DS.hasMany('step',{async:false}), }); diff --git a/addon/models/step.js b/addon/models/step.js index eebf52f..293f5b5 100644 --- a/addon/models/step.js +++ b/addon/models/step.js @@ -6,5 +6,4 @@ export default DS.Model.extend({ targetId: DS.attr('string'), targetType: DS.attr('string'), actionType: DS.attr('string'), - sequence: DS.belongsTo('sequence',{inverse:"steps",async:false}) }); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index a01ce74..9da50f0 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -2,7 +2,6 @@ import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), - text: DS.attr('string'), landscapeTimestamp: DS.attr('string'), - sequences: DS.hasMany('sequence',{inverse:"tutorial"}), + sequences: DS.hasMany('sequence',{async:false}), }); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js index 31d380d..3824814 100644 --- a/addon/routes/tutorial/run.js +++ b/addon/routes/tutorial/run.js @@ -9,25 +9,19 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { setupController(controller, model) { this._super(...arguments); controller.get('tutorialService').initService(model); - controller.get('landscapeService').initListeners(true); controller.get('landscapeService').updateLandscapeList(true); controller.set('landscapeService.liveMode',false); var step = controller.get('tutorialService').getNextStep(); controller.set('tutorialService.activeStep',step); controller.get('tutorialService').getSequence(step).then((sequence)=>{ if(sequence.get('landscapeTimestamp')!=undefined){ + console.log(sequence.get('landscapeTimestamp')); controller.get('landscapeService').loadLandscape(sequence); }else{ + console.log(model.get('landscapeTimestamp')); controller.get('landscapeService').loadLandscape(model); } }); - controller.set('landscapeService.interaction.model',step); - controller.set('landscapeService.interaction.runMode',true); - controller.set('landscapeService.interaction.tutorialService',controller.get('tutorialService')); - controller.set('landscapeService.interaction.landscapeService',controller.get('landscapeService')); - - controller.set('landscapeService.interaction.completed',controller.activateNextStep); - }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index e198dad..be395c2 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -9,6 +9,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); + if(controller.get('currentUser.user.isAdmin')){ + controller.set('runmode',false); + } if(model.get('landscapeTimestamp')!=undefined){ controller.get('landscapeService').loadLandscape(model); }else{ diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index 5925f8d..7f63030 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -9,6 +9,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); + if(controller.get('currentUser.user.isAdmin')){ + controller.set('runmode',false); + } controller.get('tutorialService').getSequence(model).then((sequence)=>{ if(sequence.get('landscapeTimestamp')!=undefined){ controller.get('landscapeService').loadLandscape(sequence); @@ -19,6 +22,7 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { } }); + }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/tutorial.js b/addon/routes/tutorial/tutorial.js index a600c76..fef083f 100644 --- a/addon/routes/tutorial/tutorial.js +++ b/addon/routes/tutorial/tutorial.js @@ -10,6 +10,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { controller.get('landscapeService').updateLandscapeList(true); controller.get('landscapeService').loadLandscape(model); controller.set('landscapeService.liveMode',false); + if(controller.get('currentUser.user.isAdmin')){ + controller.set('runmode',false); + } }, actions: { // @Override BaseRoute diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 2524222..f181ee5 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -106,7 +106,7 @@ json.included=snapshot.included; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { var json = {}; - if(Array.isArray(payload.data)){ + if(Array.isArray(payload.data) ){ json = {data:[]}; payload.data.forEach(function(v,k){ json.data[k]=JSON.parse(v.attributes.landscape).data; @@ -125,6 +125,10 @@ json.included=snapshot.included; json.included=payload.included; } } + // if(requestType=="queryRecord"){ + // json.data=json.data[0]; + // return this._super(store, primaryModelClass, json, id, requestType); + // } return this._super(store, primaryModelClass, json, id, requestType); } }); diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 1282135..3200ac2 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -2,17 +2,30 @@ import Service from '@ember/service'; import Evented from '@ember/object/evented'; import debugLogger from 'ember-debug-logger'; import { inject as service } from "@ember/service"; -import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' +//import LandscapeInteraction from 'explorviz-frontend/utils/landscape-rendering/interaction' +import LandscapeInteraction from '../components/landscape-interaction'; +import ApplicationInteraction from '../components/application-interaction'; + import { getOwner } from '@ember/application'; export default Service.extend(Evented, { debug: debugLogger(), store: service(), - landscapeService: service(), landscape: null, + application: null, livelandscapes: false, landscapeList: null, + landscapeinteraction:null, + applicationinteraction:null, + init() { + this._super(...arguments); + const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); + const applicationInteraction = ApplicationInteraction.create(getOwner(this).ownerInjection()); + this.set('landscapeinteraction',landscapeInteraction); + this.set('applicationinteraction',applicationInteraction); + + }, updateLandscapeList(reload) { this.set('landscapeList', []); this.get('store').findAll('tutoriallandscape', { reload }) @@ -38,7 +51,6 @@ export default Service.extend(Evented, { } }, importLandscape(landscapeTimestamp,name){ - this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { this.set('landscape',tutlandscape); }, () => { @@ -63,52 +75,10 @@ export default Service.extend(Evented, { timestamprecord.save(); landscaperecord.save(); this.set('landscape',landscaperecord); - }else{ - this.get('store').set('tutoriallandscape',landscape); this.set('landscape',landscape); - } }); }); }, - clickListenerSingle(emberModel){ - if(emberModel!=undefined){ - if(this.get('selectTarget')){ - this.set("model.targetType",emberModel.constructor.modelName); - this.set("model.targetId",emberModel.get("id")); - this.set("model.actionType","singleClick"); - this.set('selectTarget',false); - }else{ - if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ - if(this.get("runMode")){ - this.completed(this.get('model')); - } - } - } - } - }, - clickListenerDouble(emberModel){ - if(emberModel!=undefined){ - if(this.get('selectTarget')){ - this.set("model.targetType",emberModel.constructor.modelName); - this.set("model.targetId",emberModel.get("id")); - this.set("model.actionType","singleClick"); - this.set('selectTarget',false); - }else{ - if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleclick"){ - if(this.get("runMode")){ - this.completed(this.get('model')); - } - } - } - } - }, - initListeners(){ - const landscapeInteraction = LandscapeInteraction.create(getOwner(this).ownerInjection()); - this.set('interaction', landscapeInteraction); - this.get('interaction').on('singleClick', this.clickListenerSingle); - this.get('interaction').on('doubleClick', this.clickListenerDouble); - } - }) diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index b73f792..c73d006 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -4,7 +4,7 @@ import debugLogger from 'ember-debug-logger'; import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; import { Promise } from 'rsvp'; - +import { computed } from '@ember/object'; export default Service.extend(Evented,AlertifyHandler, { debug: debugLogger(), store: service(), @@ -13,6 +13,12 @@ export default Service.extend(Evented,AlertifyHandler, { activeStep:null, steps:null, sequences:null, + skipButton: computed('activeStep', function() { + if(this.get('activeStep.targetId')!=="" && this.get('activeStep.targetType')!=="" && this.get('activeStep.actionType')!==""){ + return false; + } + return true; + }), initService(model){ this.set('sequences',[]); this.set('steps',[]); @@ -29,9 +35,11 @@ export default Service.extend(Evented,AlertifyHandler, { } var nextStep=false; var step; + debugger; this.get('steps').forEach(function(s){ if(nextStep==true){ step=s; + nextStep=false; } if(s.get('id')==prevstep.get('id')){ nextStep=true; @@ -44,37 +52,32 @@ export default Service.extend(Evented,AlertifyHandler, { }, getSequence(step){ return this.get('store').findAll('tutorial').then((tutorials)=>{ - return new Promise( - function(resolve){ - tutorials.forEach(function(k1){ - k1.get('sequences').then((sequences)=>{ - sequences.forEach(function(k2){ - k2.get('steps').forEach(function(k3){ - if(k3.get('id')==step.get('id')){ - resolve(k2); - } - }); - }); - }); - }) - }); + var returnSequence; + tutorials.forEach(function(tutorial){ + tutorial.get('sequences').forEach(function(sequence){ + sequence.get('steps').forEach(function(stepcompare){ + if(stepcompare.get('id')==step.get('id')){ + returnSequence=sequence; + } + }); + }); }); - }, + return returnSequence; + }); +}, getTutorial(sequence){ return this.get('store').findAll('tutorial').then((tutorials)=>{ - return new Promise( - function(resolve){ - tutorials.forEach(function(k1){ - k1.get('sequences').then((sequences)=>{ - sequences.forEach(function(k2){ - if(k2.get('id')==sequence.get('id')){ - resolve(k1); - } - }); - }); - }) - }); + var returnTutorial; + tutorials.forEach(function(tutorial){ + tutorial.get('sequences').forEach(function(sequencecompare){ + if(sequencecompare.get('id')==sequence.get('id')){ + returnTutorial=tutorial; + } + }); }); + return returnTutorial; + }); + }, updateTutorialList(reload) { this.set('tutorialList', []); diff --git a/addon/templates/components/application-interaction.hbs b/addon/templates/components/application-interaction.hbs new file mode 100644 index 0000000..fb5c4b1 --- /dev/null +++ b/addon/templates/components/application-interaction.hbs @@ -0,0 +1 @@ +{{yield}} \ No newline at end of file diff --git a/addon/templates/components/application-visualization.hbs b/addon/templates/components/application-visualization.hbs new file mode 100644 index 0000000..1c2b5e4 --- /dev/null +++ b/addon/templates/components/application-visualization.hbs @@ -0,0 +1,2 @@ + + diff --git a/addon/templates/components/landscape-visualization.hbs b/addon/templates/components/landscape-visualization.hbs index 2ce0231..1c2b5e4 100644 --- a/addon/templates/components/landscape-visualization.hbs +++ b/addon/templates/components/landscape-visualization.hbs @@ -1,3 +1,2 @@ -Rendering: diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index dd38157..1e659cd 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -4,24 +4,21 @@ {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} -{{#if model.landscapeTimestamp}} -{{#bs-button - onClick=(action "resetLandscape") - type="secondary" - outline=true - class="btn-timeline" - title="change landscape" -}} -change landscape -{{/bs-button}} -{{else}} -{{#bs-button - onClick=(action "resetLandscape") - type="secondary" - outline=true - class="btn-timeline" - title="change landscape" -}} -select landscape -{{/bs-button}} -{{/if}} +{{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="set landscape"}} + + {{svg-jar "globe" class="octicon" id="change-landscape"}} + {{#if model.landscapeTimestamp}} + change landscape + {{else}} + select landscape + {{/if}} + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index ae7ec52..ef9baed 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -12,7 +12,7 @@ show live landscapes {{/bs-button}} {{landscape-select/landscapelist model=model}} - {{else}} + {{else}} {{#bs-button onClick=(action "hideLiveLandscapes") type="secondary" @@ -25,7 +25,7 @@ {{#if showLandscape}} {{#if landscapeRepo.latestLandscape.systems}}
      - {{visualization/rendering/landscape-rendering latestLandscape=landscapeRepo.latestLandscape}} + {{landscape-visualization latestLandscape=landscapeRepo.latestLandscape interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} {{visualization/rendering/popups/popup-coordinator popupData=additionalData.popupContent}} @@ -48,10 +48,7 @@ {{svg-jar "reply" class="octicon align-middle"}} {{/bs-button}}
      - {{visualization/rendering/application-rendering latestApplication=landscapeRepo.latestApplication}} - - {{visualization/rendering/popups/popup-coordinator - popupData=additionalData.popupContent}} + {{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }}
      {{/if}} @@ -72,16 +69,31 @@ {{/unless}} {{else}} -
      - {{landscape-visualization latestLandscape=landscapeService.landscape interaction=landscapeService.interaction toggleSelect=(action 'toggleSelectTarget' interaction model) }} + {{#if showLandscape}} +
      + {{landscape-visualization latestLandscape=landscapeService.landscape interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }}
      + {{else}} +
      +
      + {{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
      + {{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }} +
      + {{/if}} {{/if}}
      {{#unless runmode}} - {{component form model=model interaction=interaction toggleSelect=(action 'toggleSelectTarget' interaction model) runmode=runmode}} + {{#if this.currentUser.user.isAdmin}} + {{component form model=model runmode=runmode}} + {{else}} + {{component "step-form" model=tutorialService.activeStep runmode=true}} + {{/if}} {{else}} - {{component "step-form" model=tutorialService.activeStep interaction=landscapeService.interaction runmode=runmode}} + {{component "step-form" model=tutorialService.activeStep runmode=true}} {{/unless}}
      diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index 9dedfdb..596f7e6 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -4,23 +4,65 @@ {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} {{form.element controlType="textarea" label="Text" placeholder="Text" property="text"}} - {{form.element controlType="text" label="Text" placeholder="Text" property="targetType" disabled=true}} - {{form.element controlType="text" label="Text" placeholder="Text" property="targetId" disabled=true}} - {{form.element controlType="text" label="Text" placeholder="Text" property="actionType" disabled=true}} +
      + {{#unless model.targetType}} + {{#unless model.actionType}} + {{#unless model.targetId}} + no target selected + {{/unless}} + {{/unless}} + {{/unless}} +{{#if model.targetType}} + Target: {{model.targetType}} +{{/if}} +
      +{{#if model.actionType}} + Action: {{model.actionType}} +{{/if}} +
      {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} +{{#unless landscapeService.application}} {{#bs-button - onClick=(action toggleSelect) + onClick=(action "toggleSelectTarget") type="secondary" outline=true title="select target" }} -{{if interaction.selectTarget "selecting" "select target"}} +{{if landscapeService.landscapeinteraction.selectTarget "selecting" "select target"}} {{/bs-button}} {{else}} -{{model.targetId}} -{{model.targetType}} -{{model.actionType}} +{{#bs-button + onClick=(action "toggleSelectTarget") + type="secondary" + outline=true + title="select target" +}} +{{if landscapeService.applicationinteraction.selectTarget "selecting" "select target"}} +{{/bs-button}} +{{/unless}} +{{else}} +{{#unless model.targetType}} + {{#unless model.actionType}} + {{#unless model.targetId}} + {{#bs-button + onClick=(action "skipStep") + type="secondary" + outline=true + title="next step" + }} + next + {{/bs-button}} + {{/unless}} + {{/unless}} +{{/unless}} +{{#if model.targetType}} + Target: {{model.targetType}} +{{/if}} +
      +{{#if model.actionType}} + Action: {{model.actionType}} +{{/if}}

      title:{{model.title}}

      {{model.text}}

      diff --git a/addon/templates/components/timeline.hbs b/addon/templates/components/timeline.hbs index 2123576..4a1d52a 100644 --- a/addon/templates/components/timeline.hbs +++ b/addon/templates/components/timeline.hbs @@ -1,6 +1,5 @@ - -{{#bs-modal +{{#bs-modal open=importLandscape title="import landscape" closeTitle="closeTitle" @@ -10,7 +9,7 @@ onHidden=(action (mut importLandscape) false) renderInPlace=true as |modal|}} {{#modal.body}} - Import landscape + Import landscape {{input type="text" value=landscapeName placehoder="new landscape"}} {{/modal.body}} {{#modal.footer}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index 7bd2c9a..dc8bc95 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -1,43 +1,4 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} - {{#bs-dropdown as |dd|}} - {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} - {{svg-jar "kebab-vertical" class="octicon"}} - {{/dd.button}} - {{#dd.menu as |ddm|}} - {{#ddm.item title="Run"}} - - {{#link-to "tutorial.run" model}} - {{svg-jar "play" class="octicon" id="run-button"}}Run - {{/link-to}} - - {{/ddm.item}} - {{#ddm.item title="Edit"}} - - {{#link-to "tutorial.tutorial" model}} - {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} - - {{/ddm.item}} - {{#ddm.item title="set landscape"}} - - {{svg-jar "globe" class="octicon" id="change-landscape"}} - {{#if model.landscapeTimestamp}} - change landscape - {{else}} - select landscape - {{/if}} - - {{/ddm.item}} - {{#ddm.item title="new sequence"}} - - {{svg-jar "plus" class="octicon" id="new-sequence"}} - new sequence - - {{/ddm.item}} - {{/dd.menu}} - {{/bs-dropdown}} {{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} {{form.element controlType="text" label="ID" property="id" disabled=true}} @@ -49,4 +10,28 @@ {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} - +{{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Run"}} + + {{#link-to "tutorial.run" model}} + {{svg-jar "play" class="octicon" id="run-button"}}Run + {{/link-to}} + + {{/ddm.item}} + {{#ddm.item title="set landscape"}} + + {{svg-jar "globe" class="octicon" id="change-landscape"}} + {{#if model.landscapeTimestamp}} + change landscape + {{else}} + select landscape + {{/if}} + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index 42480fc..bc0d7fc 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -1,28 +1,37 @@

      Tutorials

      + {{#if this.currentUser.user.isAdmin}} + {{/if}}
      - + {{#if this.currentUser.user.isAdmin}} + + {{/if}} + - - + + {{#if this.currentUser.user.isAdmin}} + + {{/if}} {{#each model.tutorials as |tutorial|}} - + {{#if this.currentUser.user.isAdmin}}{{/if}} + + {{#if this.currentUser.user.isAdmin}} + {{/if}} + {{#if this.currentUser.user.isAdmin}} {{#if tutorial.expanded}} {{#each tutorial.sequences as |sequence|}} + @@ -82,6 +100,7 @@ {{#each sequence.steps as |step|}} + @@ -98,12 +117,6 @@ {{/link-to}} {{/ddm.item}} - {{#ddm.item title="new step"}} - - {{svg-jar "plus" class="octicon" id="new-step"}}new - - {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}} @@ -112,6 +125,7 @@ {{/if}} {{/each}} {{/if}} + {{/if}} {{/each}}
      Type TitleSequencesChildren
      {{#bs-button onClick=(action "toggleTutorial" tutorial)}}{{if tutorial.expanded '-' '+'}}{{/bs-button}}{{#bs-button onClick=(action "toggleTutorial" tutorial)}}{{if tutorial.expanded '-' '+'}}{{/bs-button}}tutorial {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.title}}{{/link-to}} - {{tutorial.sequences.length}} + {{tutorial.sequences.length}} sequences {{#bs-dropdown as |dd|}} {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} @@ -46,20 +55,23 @@ {{#ddm.item title="new sequence"}} - {{svg-jar "plus" class="octicon" id="new-sequence"}}new + {{svg-jar "plus" class="octicon" id="new-sequence"}}New sequence {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}}
      {{#bs-button onClick=(action "toggleSequence" sequence)}}{{if sequence.expanded '-' '+'}}{{/bs-button}}sequence {{#link-to "tutorial.sequence" sequence}}{{sequence.title}}{{/link-to}} - {{sequence.steps.length}} + {{sequence.steps.length}} steps {{#bs-dropdown as |dd|}} @@ -74,6 +86,12 @@ {{/link-to}} {{/ddm.item}} + {{#ddm.item title="new sequence"}} + + {{svg-jar "plus" class="octicon" id="new-step"}}New step + + {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}}
      step {{#link-to "tutorial.step" step}}{{step.title}}{{/link-to}}
      diff --git a/addon/templates/tutorial/run.hbs b/addon/templates/tutorial/run.hbs index c83f557..d4317fb 100644 --- a/addon/templates/tutorial/run.hbs +++ b/addon/templates/tutorial/run.hbs @@ -1 +1 @@ -{{side-form-layout form="tutorial-form" model=model tutorial=model runmode=true}} +{{side-form-layout form="tutorial-form" model=model tutorial=model runmode=true }} diff --git a/addon/templates/tutorial/sequence.hbs b/addon/templates/tutorial/sequence.hbs index dc051f4..a04cbc4 100644 --- a/addon/templates/tutorial/sequence.hbs +++ b/addon/templates/tutorial/sequence.hbs @@ -1 +1 @@ -{{side-form-layout form="sequence-form" model=model tutorial=model.tutorial}} \ No newline at end of file +{{side-form-layout form="sequence-form" model=model tutorial=model.tutorial runmode=false}} diff --git a/addon/templates/tutorial/step.hbs b/addon/templates/tutorial/step.hbs index 049faf7..8d8eb81 100644 --- a/addon/templates/tutorial/step.hbs +++ b/addon/templates/tutorial/step.hbs @@ -1 +1 @@ -{{side-form-layout form="step-form" model=model tutorial=model.sequence.tutorial}} +{{side-form-layout form="step-form" model=model tutorial=model.sequence.tutorial runmode=false}} diff --git a/app/components/application-interaction.js b/app/components/application-interaction.js new file mode 100644 index 0000000..0afe532 --- /dev/null +++ b/app/components/application-interaction.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/landscape-interaction'; \ No newline at end of file diff --git a/app/components/application-visualization.js b/app/components/application-visualization.js new file mode 100644 index 0000000..49b90a3 --- /dev/null +++ b/app/components/application-visualization.js @@ -0,0 +1 @@ +export { default } from 'explorviz-frontend-extension-tutorial/components/application-visualization'; diff --git a/app/templates/components/timeline.js b/app/templates/components/timeline.js deleted file mode 100644 index 397b235..0000000 --- a/app/templates/components/timeline.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'explorviz-frontend-extension-tutorial/templates/components/timeline'; diff --git a/app/templates/tutorial/index.js b/app/templates/tutorial/index.js index d696132..0e0687b 100644 --- a/app/templates/tutorial/index.js +++ b/app/templates/tutorial/index.js @@ -1 +1 @@ -export { default } from 'explorviz-frontend-extension-tutorial//tutorial'; \ No newline at end of file +export { default } from 'explorviz-frontend-extension-tutorial/tutorial'; diff --git a/package-lock.json b/package-lock.json index 784f9b2..d0acdc2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1203,7 +1203,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, "requires": { "chalk": "^1.1.3", "esutils": "^2.0.2", @@ -1213,20 +1212,17 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "chalk": { "version": "1.1.3", "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, "requires": { "ansi-styles": "^2.2.1", "escape-string-regexp": "^1.0.2", @@ -1238,14 +1234,12 @@ "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, "strip-ansi": { "version": "3.0.1", "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" } @@ -1253,8 +1247,7 @@ "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" } } }, @@ -1262,7 +1255,6 @@ "version": "6.26.3", "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", - "dev": true, "requires": { "babel-code-frame": "^6.26.0", "babel-generator": "^6.26.0", @@ -1289,7 +1281,6 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, "requires": { "ms": "2.0.0" } @@ -1297,14 +1288,12 @@ "json5": { "version": "0.5.1", "resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -1312,7 +1301,6 @@ "version": "6.26.1", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", - "dev": true, "requires": { "babel-messages": "^6.23.0", "babel-runtime": "^6.26.0", @@ -1327,8 +1315,7 @@ "jsesc": { "version": "1.3.0", "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=" } } }, @@ -1336,7 +1323,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", - "dev": true, "requires": { "babel-helper-explode-assignable-expression": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1347,7 +1333,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", - "dev": true, "requires": { "babel-helper-hoist-variables": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1359,7 +1344,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", - "dev": true, "requires": { "babel-helper-function-name": "^6.24.1", "babel-runtime": "^6.26.0", @@ -1371,7 +1355,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-traverse": "^6.24.1", @@ -1382,7 +1365,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", - "dev": true, "requires": { "babel-helper-get-function-arity": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1395,7 +1377,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-types": "^6.24.1" @@ -1405,7 +1386,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-types": "^6.24.1" @@ -1415,7 +1395,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-types": "^6.24.1" @@ -1425,7 +1404,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", - "dev": true, "requires": { "babel-runtime": "^6.26.0", "babel-types": "^6.26.0", @@ -1436,7 +1414,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", - "dev": true, "requires": { "babel-helper-function-name": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1449,7 +1426,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", - "dev": true, "requires": { "babel-helper-optimise-call-expression": "^6.24.1", "babel-messages": "^6.23.0", @@ -1463,7 +1439,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-template": "^6.24.1" @@ -1473,7 +1448,6 @@ "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1482,7 +1456,6 @@ "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1524,26 +1497,22 @@ "babel-plugin-syntax-async-functions": { "version": "6.13.0", "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", - "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", - "dev": true + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=" }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", "resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", - "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", - "dev": true + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=" }, "babel-plugin-syntax-trailing-function-commas": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", - "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", - "dev": true + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=" }, "babel-plugin-transform-async-to-generator": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", - "dev": true, "requires": { "babel-helper-remap-async-to-generator": "^6.24.1", "babel-plugin-syntax-async-functions": "^6.8.0", @@ -1554,7 +1523,6 @@ "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1563,7 +1531,6 @@ "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1572,7 +1539,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", - "dev": true, "requires": { "babel-runtime": "^6.26.0", "babel-template": "^6.26.0", @@ -1585,7 +1551,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", - "dev": true, "requires": { "babel-helper-define-map": "^6.24.1", "babel-helper-function-name": "^6.24.1", @@ -1602,7 +1567,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-template": "^6.24.1" @@ -1612,7 +1576,6 @@ "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1621,7 +1584,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-types": "^6.24.1" @@ -1631,7 +1593,6 @@ "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1640,7 +1601,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", - "dev": true, "requires": { "babel-helper-function-name": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1651,7 +1611,6 @@ "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1660,7 +1619,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", - "dev": true, "requires": { "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1671,7 +1629,6 @@ "version": "6.26.2", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", - "dev": true, "requires": { "babel-plugin-transform-strict-mode": "^6.24.1", "babel-runtime": "^6.26.0", @@ -1683,7 +1640,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", - "dev": true, "requires": { "babel-helper-hoist-variables": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1694,7 +1650,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", - "dev": true, "requires": { "babel-plugin-transform-es2015-modules-amd": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1705,7 +1660,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", - "dev": true, "requires": { "babel-helper-replace-supers": "^6.24.1", "babel-runtime": "^6.22.0" @@ -1715,7 +1669,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", - "dev": true, "requires": { "babel-helper-call-delegate": "^6.24.1", "babel-helper-get-function-arity": "^6.24.1", @@ -1729,7 +1682,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-types": "^6.24.1" @@ -1739,7 +1691,6 @@ "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1748,7 +1699,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", - "dev": true, "requires": { "babel-helper-regex": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1759,7 +1709,6 @@ "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1768,7 +1717,6 @@ "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", - "dev": true, "requires": { "babel-runtime": "^6.22.0" } @@ -1777,7 +1725,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", - "dev": true, "requires": { "babel-helper-regex": "^6.24.1", "babel-runtime": "^6.22.0", @@ -1787,14 +1734,12 @@ "jsesc": { "version": "0.5.0", "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" }, "regexpu-core": { "version": "2.0.0", "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", - "dev": true, "requires": { "regenerate": "^1.2.1", "regjsgen": "^0.2.0", @@ -1804,14 +1749,12 @@ "regjsgen": { "version": "0.2.0", "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", - "dev": true + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=" }, "regjsparser": { "version": "0.1.5", "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", - "dev": true, "requires": { "jsesc": "~0.5.0" } @@ -1822,7 +1765,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", - "dev": true, "requires": { "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", "babel-plugin-syntax-exponentiation-operator": "^6.8.0", @@ -1833,7 +1775,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", - "dev": true, "requires": { "regenerator-transform": "^0.10.0" }, @@ -1842,7 +1783,6 @@ "version": "0.10.1", "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", - "dev": true, "requires": { "babel-runtime": "^6.18.0", "babel-types": "^6.19.0", @@ -1855,7 +1795,6 @@ "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", - "dev": true, "requires": { "babel-runtime": "^6.22.0", "babel-types": "^6.24.1" @@ -1865,7 +1804,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", - "dev": true, "requires": { "babel-runtime": "^6.26.0", "core-js": "^2.5.0", @@ -1875,8 +1813,7 @@ "regenerator-runtime": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", - "dev": true + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=" } } }, @@ -1884,7 +1821,6 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz", "integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==", - "dev": true, "requires": { "babel-plugin-check-es2015-constants": "^6.22.0", "babel-plugin-syntax-trailing-function-commas": "^6.22.0", @@ -1922,7 +1858,6 @@ "version": "3.2.8", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==", - "dev": true, "requires": { "caniuse-lite": "^1.0.30000844", "electron-to-chromium": "^1.3.47" @@ -1934,7 +1869,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "dev": true, "requires": { "babel-core": "^6.26.0", "babel-runtime": "^6.26.0", @@ -1949,7 +1883,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true, "requires": { "core-js": "^2.4.0", "regenerator-runtime": "^0.11.0" @@ -1959,7 +1892,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "dev": true, "requires": { "babel-runtime": "^6.26.0", "babel-traverse": "^6.26.0", @@ -1972,7 +1904,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "dev": true, "requires": { "babel-code-frame": "^6.26.0", "babel-messages": "^6.23.0", @@ -1989,7 +1920,6 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, "requires": { "ms": "2.0.0" } @@ -1997,14 +1927,12 @@ "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -2012,7 +1940,6 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "dev": true, "requires": { "babel-runtime": "^6.26.0", "esutils": "^2.0.2", @@ -2023,16 +1950,14 @@ "to-fast-properties": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" } } }, "babylon": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" }, "backbone": { "version": "1.3.3", @@ -3989,7 +3914,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true, "requires": { "repeating": "^2.0.0" } @@ -4733,7 +4657,6 @@ "version": "0.0.10", "resolved": "https://registry.npmjs.org/ember-data-save-relationships/-/ember-data-save-relationships-0.0.10.tgz", "integrity": "sha1-vXigw+p2J8KjHumlAzIp+jZt8Sc=", - "dev": true, "requires": { "ember-cli-babel": "^6.12.0" }, @@ -4742,7 +4665,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/amd-name-resolver/-/amd-name-resolver-1.2.0.tgz", "integrity": "sha512-hlSTWGS1t6/xq5YCed7YALg7tKZL3rkl7UwEZ/eCIkn8JxmM6fU6Qs/1hwtjQqfuYxlffuUcgYEm0f5xP4YKaA==", - "dev": true, "requires": { "ensure-posix-path": "^1.0.1" } @@ -4751,7 +4673,6 @@ "version": "6.5.1", "resolved": "https://registry.npmjs.org/broccoli-babel-transpiler/-/broccoli-babel-transpiler-6.5.1.tgz", "integrity": "sha512-w6GcnkxvHcNCte5FcLGEG1hUdQvlfvSN/6PtGWU/otg69Ugk8rUk51h41R0Ugoc+TNxyeFG1opRt2RlA87XzNw==", - "dev": true, "requires": { "babel-core": "^6.26.0", "broccoli-funnel": "^2.0.1", @@ -4769,7 +4690,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/broccoli-merge-trees/-/broccoli-merge-trees-2.0.1.tgz", "integrity": "sha512-WjaexJ+I8BxP5V5RNn6um/qDRSmKoiBC/QkRi79FT9ClHfldxRyCDs9mcV7mmoaPlsshmmPaUz5jdtcKA6DClQ==", - "dev": true, "requires": { "broccoli-plugin": "^1.3.0", "merge-trees": "^1.0.1" @@ -4779,7 +4699,6 @@ "version": "6.18.0", "resolved": "https://registry.npmjs.org/ember-cli-babel/-/ember-cli-babel-6.18.0.tgz", "integrity": "sha512-7ceC8joNYxY2wES16iIBlbPSxwKDBhYwC8drU3ZEvuPDMwVv1KzxCNu1fvxyFEBWhwaRNTUxSCsEVoTd9nosGA==", - "dev": true, "requires": { "amd-name-resolver": "1.2.0", "babel-plugin-debug-macros": "^0.2.0-beta.6", @@ -4800,7 +4719,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-trees/-/merge-trees-1.0.1.tgz", "integrity": "sha1-zL5nRWl4f53vF/1G5lJfVwC70j4=", - "dev": true, "requires": { "can-symlink": "^1.0.0", "fs-tree-diff": "^0.5.4", @@ -6693,7 +6611,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6714,12 +6633,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6734,17 +6655,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6861,7 +6785,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6873,6 +6798,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6887,6 +6813,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6894,12 +6821,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6918,6 +6847,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6998,7 +6928,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7010,6 +6941,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7095,7 +7027,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7131,6 +7064,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7150,6 +7084,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7193,12 +7128,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -7552,7 +7489,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" }, @@ -7560,8 +7496,7 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" } } }, @@ -7722,7 +7657,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true, "requires": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.1" @@ -8057,7 +7991,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, "requires": { "number-is-nan": "^1.0.0" } @@ -9482,8 +9415,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-assign": { "version": "4.1.1", @@ -9655,8 +9587,7 @@ "os-homedir": { "version": "1.0.2", "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, "os-shim": { "version": "0.1.3", @@ -10450,7 +10381,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, "requires": { "is-finite": "^1.0.0" } @@ -10785,8 +10715,7 @@ "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" }, "slice-ansi": { "version": "1.0.0", @@ -11076,7 +11005,6 @@ "version": "0.4.18", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, "requires": { "source-map": "^0.5.6" } From 20a743a1b26f02ee8344bb3e345581b8e3db3294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Tue, 11 Jun 2019 17:45:22 +0200 Subject: [PATCH 26/30] bugfixes --- addon/components/landscape-visualization.js | 2 + addon/components/side-form-layout.js | 37 +++++------------ addon/components/step-form.js | 2 + addon/components/timeline.js | 3 ++ addon/components/tutorial-form.js | 21 +--------- addon/controllers/tutorial/run.js | 18 +------- addon/routes/tutorial/run.js | 4 +- addon/serializers/tutoriallandscape.js | 10 +---- addon/services/tutorial-service.js | 1 - .../templates/components/side-form-layout.hbs | 4 +- addon/templates/components/step-form.hbs | 6 ++- addon/templates/tutorial/list.hbs | 20 ++++----- package-lock.json | 41 +++++-------------- 13 files changed, 51 insertions(+), 118 deletions(-) diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 1ca2f16..396bfb3 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -27,9 +27,11 @@ export default LandscapeRendering.extend({ this.set('interaction.landscapeService',this.get('landscapeService')); this.set('interaction.runmode',this.get('runmode')); + this.get('interaction').on('showApplication', function (emberModel) { self.set('landscapeService.application', emberModel); }); + this.get('interaction').on('singleClick', this.get('clickListenerSingle')); this.get('interaction').on('doubleClick', this.get('clickListenerDouble')); }, diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index 133e9c1..c190c8c 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -12,10 +12,9 @@ export default Component.extend({ landscapeRepo: service("repos/landscape-repository"), landscapeListener: service(), currentUser: service(), - - - showLandscape: computed('landscapeService.application', function() { - return !this.get('landscapeService.application'); + + showLandscape: computed('landscapeRepo.latestApplication', function() { + return !this.get('landscapeRepo.latestApplication'); }), selectMode: computed('landscapeService.landscape',function(){ if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ @@ -31,36 +30,17 @@ export default Component.extend({ }), init(){ this._super(...arguments); - //this.get('landscapeService').updateLandscapeList(true); + this.get('landscapeService').updateLandscapeList(true); this.get('landscapeListener').initSSE(); this.get('landscapeListener').set('pauseVisualizationReload',true); }, actions: { - addNewTutorial(){ - let newTutorial = this.get('store').createRecord("tutorial",{ - title: "new tutorial" - }) - this.set("newSequence",newTutorial) - }, - addNewSequence(tutorial){ - let newSequence = this.get('store').createRecord("sequence",{ - title: "new sequence" - }) - tutorial.get('sequences').push(newSequence); - this.set("newSequence",newSequence) - }, - addNewStep(sequence){ - let newStep = this.get('store').createRecord("tutorial",{ - title: "new tutorial" - }) - sequence.get('steps').push(newSequence); - this.set("newStep",newStep) - }, resetView() { this.get('renderingService').reSetupScene(); }, openLandscapeView() { - this.set('landscapeService.application', null); + this.set('landscapeRepo.latestApplication', null); + this.set('landscapeRepo.replayApplication', null); }, toggleTimeline() { this.get('renderingService').toggleTimeline(); @@ -73,6 +53,10 @@ export default Component.extend({ this.set('landscapeService.livelandscapes',false); this.get('landscapeListener').set('pauseVisualizationReload',true); }, + toggleSelectTarget(interaction,model){ + interaction.set('model',model); + interaction.set('selectTarget',!interaction.get('selectTarget')); + } }, showTimeline() { this.set('renderingService.showTimeline', true); @@ -94,7 +78,6 @@ export default Component.extend({ // @Override cleanup() { this._super(...arguments); - this.get('landscapeListener').set('pauseVisualizationReload',false); this.get('additionalData').off('showWindow', this, this.onShowWindow); }, }); diff --git a/addon/components/step-form.js b/addon/components/step-form.js index 8118fc7..ab59dad 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -26,6 +26,8 @@ export default Component.extend(AlertifyHandler,{ }); this.get('tutorialService').set('activeStep',step); this.set('model',step); + }else{ + this.showAlertifyMessage(`Last step completed.`); } }, saveStepChanges(step) { diff --git a/addon/components/timeline.js b/addon/components/timeline.js index aa8df76..dc52578 100644 --- a/addon/components/timeline.js +++ b/addon/components/timeline.js @@ -19,6 +19,9 @@ export default Timeline.extend(AlertifyHandler,{ if ( this.get('tutorialActivePoint')) { this.get('landscapeListener').set('pauseVisualizationReload',true); this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName')); + this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x); + this.get('landscapeListener').set('livelandscapes',false); + } } } diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js index 1c4f71c..910002e 100644 --- a/addon/components/tutorial-form.js +++ b/addon/components/tutorial-form.js @@ -16,25 +16,6 @@ export default Component.extend(AlertifyHandler,{ this.set('landscapeService.landscape',null); } }, - addNewTutorial(){ - let newTutorial = this.get('store').createRecord("tutorial",{ - title: "new tutorial" - }) - newTutorial.save(); - }, - addNewSequence(tutorial){ - let newSequence = this.get('store').createRecord("sequence",{ - title: "new sequence" - }) - tutorial.get('sequences').push(newSequence); - tutorial.save(); - }, - addNewStep(sequence){ - let newStep = this.get('store').createRecord("step",{ - title: "new step" - }) - sequence.get('steps').push(newSequence); - sequence.save(); - }, + } }); diff --git a/addon/controllers/tutorial/run.js b/addon/controllers/tutorial/run.js index bf304ad..e229e23 100644 --- a/addon/controllers/tutorial/run.js +++ b/addon/controllers/tutorial/run.js @@ -6,21 +6,5 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Controller.extend(AlertifyHandler,{ tutorialService:service(), landscapeService:service(), - currentUser: service(), - activateNextStep(laststep){ - var step = this.get('tutorialService').getNextStep(laststep); - if(step){ - this.get('tutorialService').getSequence(step).then((sequence)=>{ - if(sequence.get('landscapeTimestamp')!=undefined){ - this.get('landscapeService').loadLandscape(sequence); - }else{ - this.get('landscapeService').loadLandscape(this.get('model')); - } - }); - this.get('tutorialService').set('activeStep',step); - this.set('model',step); - }else{ - this.showAlertifyMessage(`Last step completed.`); - } - } + currentUser: service() }); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js index 3824814..fc0f681 100644 --- a/addon/routes/tutorial/run.js +++ b/addon/routes/tutorial/run.js @@ -14,11 +14,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { var step = controller.get('tutorialService').getNextStep(); controller.set('tutorialService.activeStep',step); controller.get('tutorialService').getSequence(step).then((sequence)=>{ - if(sequence.get('landscapeTimestamp')!=undefined){ - console.log(sequence.get('landscapeTimestamp')); + if(sequence!=undefined && sequence.get('landscapeTimestamp')!=undefined){ controller.get('landscapeService').loadLandscape(sequence); }else{ - console.log(model.get('landscapeTimestamp')); controller.get('landscapeService').loadLandscape(model); } }); diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index f181ee5..dbdd684 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -13,9 +13,6 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ return model; }, serializeRecordForIncluded(key,relationship){ - if(this.serializedTypes.indexOf(key)!==-1){ - return; - } if (relationship.kind === 'belongsTo') { var nextSnapshot = this.belongsTo(key); nextSnapshot.serializedTypes=this.serializedTypes; @@ -23,8 +20,8 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ if(nextSnapshot.record.threeJSModel!=undefined){ nextSnapshot.record.set('threeJSModel', null); } - if(this.serializedTypes.indexOf(key)==-1){ - this.serializedTypes.push(key); + if(this.serializedTypes.indexOf(nextSnapshot.get('id'))==-1){ + this.serializedTypes.push(nextSnapshot.get('id')); nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; if(nextSnapshot.record.get('id')!=undefined){ this.included.push(nextSnapshot.record.serialize({includeId:true}).data); @@ -48,9 +45,6 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ hasmany.forEach(function(value){ value.serializedTypes=self.serializedTypes; value.included=self.included; - if(self.serializedTypes.indexOf(nkey)==-1){ - self.serializedTypes.push(nkey); - } value.serializeRecordForIncluded=self.serializeRecordForIncluded; value.eachRelationship(self.serializeRecordForIncluded,value); self.included.concat(value.included); diff --git a/addon/services/tutorial-service.js b/addon/services/tutorial-service.js index c73d006..0bf6ce4 100644 --- a/addon/services/tutorial-service.js +++ b/addon/services/tutorial-service.js @@ -35,7 +35,6 @@ export default Service.extend(Evented,AlertifyHandler, { } var nextStep=false; var step; - debugger; this.get('steps').forEach(function(s){ if(nextStep==true){ step=s; diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index ef9baed..ee4c6a5 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -49,6 +49,8 @@ {{/bs-button}}
      {{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }} + {{visualization/rendering/popups/popup-coordinator + popupData=additionalData.popupContent}}
      {{/if}} @@ -64,7 +66,7 @@ {{svg-jar "chevron-up" id="hidetimeline-icon" class=(if renderingService.showTimeline "octicon align-middle hidetimeline-icon-down" "octicon align-middle")}} {{/bs-button}}
      - {{component "timeline"}} + {{component "timeline" model=model}}
      {{/unless}} diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index 596f7e6..bab87e5 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -1,3 +1,4 @@ +{{#if model.title}} {{#unless runmode}} {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} {{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} @@ -64,6 +65,9 @@ Action: {{model.actionType}} {{/if}} -

      title:{{model.title}}

      +

      {{model.title}}

      {{model.text}}

      {{/unless}} +{{else}} + no step loaded +{{/if}} \ No newline at end of file diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index bc0d7fc..ed0c43a 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -39,23 +39,23 @@ {{/dd.button}} {{#dd.menu as |ddm|}} {{#ddm.item title="Run"}} - {{#link-to "tutorial.run" tutorial}} + {{svg-jar "play" class="octicon" id="run-button"}}Run - {{/link-to}} + {{/link-to}} {{/ddm.item}} {{#ddm.item title="Edit"}} + {{#link-to "tutorial.tutorial" tutorial}} - {{#link-to "tutorial.tutorial" tutorial}} {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} + {{/link-to}} {{/ddm.item}} {{#ddm.item title="new sequence"}} - {{svg-jar "plus" class="octicon" id="new-sequence"}}New sequence + {{action "addNewSequence" tutorial}}> + {{svg-jar "plus" class="octicon" id="new-sequence"}}New sequence {{/ddm.item}} {{/dd.menu}} @@ -80,11 +80,11 @@ {{/dd.button}} {{#dd.menu as |ddm|}} {{#ddm.item title="Edit"}} + {{#link-to "tutorial.sequence" sequence}} - {{#link-to "tutorial.sequence" sequence}} {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} + {{/link-to}} {{/ddm.item}} {{#ddm.item title="new sequence"}} - {{#link-to "tutorial.step" step}} {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - {{/link-to}} + {{/link-to}} {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}} diff --git a/package-lock.json b/package-lock.json index d0acdc2..ded9cef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6611,8 +6611,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -6633,14 +6632,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6655,20 +6652,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -6785,8 +6779,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -6798,7 +6791,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6813,7 +6805,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6821,14 +6812,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6847,7 +6836,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6928,8 +6916,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -6941,7 +6928,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7027,8 +7013,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -7064,7 +7049,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7084,7 +7068,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7128,14 +7111,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, From 94e69a5287bab0a29b9f56ad68ecd522f020c38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Tue, 11 Jun 2019 23:43:51 +0200 Subject: [PATCH 27/30] mock landscapeservice --- addon/components/application-interaction.js | 3 +- addon/components/landscape-interaction.js | 3 +- addon/components/landscape-visualization.js | 5 +- addon/components/step-form.js | 5 ++ addon/serializers/tutoriallandscape.js | 38 +++++----- addon/services/landscape-service.js | 72 ++++++++++-------- addon/templates/components/sequence-form.hbs | 1 - addon/templates/components/step-form.hbs | 77 +++++++++----------- addon/templates/components/tutorial-form.hbs | 9 +-- 9 files changed, 110 insertions(+), 103 deletions(-) diff --git a/addon/components/application-interaction.js b/addon/components/application-interaction.js index 3f98756..8f0cfda 100644 --- a/addon/components/application-interaction.js +++ b/addon/components/application-interaction.js @@ -1,6 +1,7 @@ import Interaction from 'explorviz-frontend/utils/application-rendering/interaction' import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Interaction.extend({ +export default Interaction.extend(AlertifyHandler,{ landscapeService: service() }); diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index bd069fd..8824316 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -1,6 +1,7 @@ import Interaction from 'explorviz-frontend/utils/landscape-rendering/interaction' import { inject as service } from "@ember/service"; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default Interaction.extend({ +export default Interaction.extend(AlertifyHandler,{ landscapeService: service() }); diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 396bfb3..96ed2ba 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -2,9 +2,10 @@ import layout from '../templates/components/landscape-visualization'; import LandscapeRendering from 'explorviz-frontend/components/visualization/rendering/landscape-rendering' import { inject as service } from '@ember/service'; import { getOwner } from '@ember/application'; +import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; -export default LandscapeRendering.extend({ +export default LandscapeRendering.extend(AlertifyHandler,{ layout, landscapeService:service(), tutorialService:service(), @@ -31,7 +32,7 @@ export default LandscapeRendering.extend({ this.get('interaction').on('showApplication', function (emberModel) { self.set('landscapeService.application', emberModel); }); - + this.get('interaction').on('singleClick', this.get('clickListenerSingle')); this.get('interaction').on('doubleClick', this.get('clickListenerDouble')); }, diff --git a/addon/components/step-form.js b/addon/components/step-form.js index ab59dad..ab79eea 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -51,6 +51,11 @@ export default Component.extend(AlertifyHandler,{ toggleSelectTarget(){ this.set('landscapeService.landscapeinteraction.selectTarget',!this.get('landscapeService.landscapeinteraction.selectTarget')); this.set('landscapeService.applicationinteraction.selectTarget',!this.get('landscapeService.applicationinteraction.selectTarget')); + }, + removeTarget(){ + this.set('model.targetType',""); + this.set('model.targetId',""); + this.set('model.actionType',""); } }, showReasonErrorAlert(reason) { diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index dbdd684..7a26de5 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -6,6 +6,7 @@ import SaveRelationshipsMixin from 'ember-data-save-relationships'; export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ attrs: { + events:{serialize:true}, systems:{serialize:true}, totalApplicationCommunications:{serialize:true} }, @@ -13,6 +14,9 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ return model; }, serializeRecordForIncluded(key,relationship){ + if(this.serializedTypes.indexOf(key)!==-1){ + return; + } if (relationship.kind === 'belongsTo') { var nextSnapshot = this.belongsTo(key); nextSnapshot.serializedTypes=this.serializedTypes; @@ -20,8 +24,8 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ if(nextSnapshot.record.threeJSModel!=undefined){ nextSnapshot.record.set('threeJSModel', null); } - if(this.serializedTypes.indexOf(nextSnapshot.get('id'))==-1){ - this.serializedTypes.push(nextSnapshot.get('id')); + if(this.serializedTypes.indexOf(key)==-1){ + this.serializedTypes.push(key); nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; if(nextSnapshot.record.get('id')!=undefined){ this.included.push(nextSnapshot.record.serialize({includeId:true}).data); @@ -33,9 +37,10 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ var self=this; var nkey=key; var hasmany=this.hasMany(nkey); + if(hasmany!=undefined){ hasmany.forEach(function(v){ if(v.record.threeJSModel!=undefined){ - v.record.set('threeJSModel', null); + v.record.set('threeJSModel', null); } if(self.included==undefined){ self.included=[]; @@ -45,6 +50,9 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ hasmany.forEach(function(value){ value.serializedTypes=self.serializedTypes; value.included=self.included; + if(self.serializedTypes.indexOf(nkey)==-1){ + self.serializedTypes.push(nkey); + } value.serializeRecordForIncluded=self.serializeRecordForIncluded; value.eachRelationship(self.serializeRecordForIncluded,value); self.included.concat(value.included); @@ -52,24 +60,24 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ } }); } + } }, serialize(snapshot) { let json = this._super(...arguments); + // snapshot.hasMany('systems').forEach(function(v,k){ + // delete json.data.relationships.systems.data[k].attributes.threeJSModel; + // }); + // + // snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ + // delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel; + // }); snapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; snapshot.serializedTypes=[]; snapshot.included=[]; snapshot.eachRelationship(this.serializeRecordForIncluded,snapshot); - snapshot.hasMany('systems').forEach(function(v,k){ - delete json.data.relationships.systems.data[k].attributes.threeJSModel; - }); - - snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ - delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel; - }); - -json.included=snapshot.included; + json.included=snapshot.included; var newjson={ data:{ id: snapshot.record.get('id'), @@ -100,7 +108,7 @@ json.included=snapshot.included; }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { var json = {}; - if(Array.isArray(payload.data) ){ + if(Array.isArray(payload.data)){ json = {data:[]}; payload.data.forEach(function(v,k){ json.data[k]=JSON.parse(v.attributes.landscape).data; @@ -119,10 +127,6 @@ json.included=snapshot.included; json.included=payload.included; } } - // if(requestType=="queryRecord"){ - // json.data=json.data[0]; - // return this._super(store, primaryModelClass, json, id, requestType); - // } return this._super(store, primaryModelClass, json, id, requestType); } }); diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 3200ac2..8c2727e 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -51,34 +51,48 @@ export default Service.extend(Evented, { } }, importLandscape(landscapeTimestamp,name){ - this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { - this.set('landscape',tutlandscape); - }, () => { - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ - if(name=="" ||name == undefined){ - name="new landscape"; - } - var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ - id:landscape.get('timestamp.id'), - timestamp:landscape.get('timestamp.timestamp'), - totalRequests:landscape.get('timestamp.totalRequests'), - name:name, - }); - var landscaperecord = this.get('store').createRecord("tutoriallandscape",{ - id:landscape.get('id'), - systems:landscape.get('systems'), - events:landscape.get('events'), - totalApplicationCommunications:landscape.get('totalApplicationCommunications'), - timestamp:timestamprecord - }); - timestamprecord.save(); - landscaperecord.save(); - this.set('landscape',landscaperecord); - }else{ - this.set('landscape',landscape); - } - }); - }); + var mockBackend= true; + if(mockBackend){ + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ + id:landscape.get('timestamp.id'), + timestamp:landscape.get('timestamp.timestamp'), + totalRequests:landscape.get('timestamp.totalRequests'), + name:name, + }); + timestamprecord.save(); + this.set('landscape',landscape); + }); + }else{ + this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { + this.set('landscape',tutlandscape); + }, () => { + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ + if(name=="" ||name == undefined){ + name="new landscape"; + } + var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ + id:landscape.get('timestamp.id'), + timestamp:landscape.get('timestamp.timestamp'), + totalRequests:landscape.get('timestamp.totalRequests'), + name:name, + }); + var landscaperecord = this.get('store').createRecord("tutoriallandscape",{ + id:landscape.get('id'), + systems:landscape.get('systems'), + events:landscape.get('events'), + totalApplicationCommunications:landscape.get('totalApplicationCommunications'), + timestamp:timestamprecord + }); + timestamprecord.save(); + landscaperecord.save(); + this.set('landscape',landscaperecord); + }else{ + this.set('landscape',landscape); + } + }); + }); + } }, }) diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index 1e659cd..1fba2f5 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -1,6 +1,5 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} {{#bs-form model=model onSubmit=(action "saveSequenceChanges" model) as |form|}} - {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index bab87e5..25bba55 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -5,43 +5,40 @@ {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} {{form.element controlType="textarea" label="Text" placeholder="Text" property="text"}} -
      - {{#unless model.targetType}} - {{#unless model.actionType}} - {{#unless model.targetId}} - no target selected - {{/unless}} - {{/unless}} - {{/unless}} -{{#if model.targetType}} - Target: {{model.targetType}} -{{/if}} -
      -{{#if model.actionType}} - Action: {{model.actionType}} -{{/if}} -
      {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} -{{#unless landscapeService.application}} -{{#bs-button - onClick=(action "toggleSelectTarget") - type="secondary" - outline=true - title="select target" -}} -{{if landscapeService.landscapeinteraction.selectTarget "selecting" "select target"}} -{{/bs-button}} -{{else}} -{{#bs-button - onClick=(action "toggleSelectTarget") - type="secondary" - outline=true - title="select target" -}} -{{if landscapeService.applicationinteraction.selectTarget "selecting" "select target"}} -{{/bs-button}} -{{/unless}} +{{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Run"}} + + {{svg-jar "play" class="octicon" id="run-button"}}Select Target + + {{/ddm.item}} + {{#ddm.item title="Run"}} + + {{svg-jar "trashcan" class="octicon" id="run-button"}}Remove target + + {{/ddm.item}} + {{#ddm.item title="Info"}} + {{#unless model.targetType}} + {{#unless model.actionType}} + {{#unless model.targetId}} + no target selected + {{/unless}} + {{/unless}} + {{/unless}} + {{#if model.targetType}} + Target: {{model.targetType}} + {{/if}} + {{#if model.actionType}} + Action: {{model.actionType}} + {{/if}} + {{/ddm.item}} + {{/dd.menu}} +{{/bs-dropdown}} {{else}} {{#unless model.targetType}} {{#unless model.actionType}} @@ -57,17 +54,9 @@ {{/unless}} {{/unless}} {{/unless}} -{{#if model.targetType}} - Target: {{model.targetType}} -{{/if}} -
      -{{#if model.actionType}} - Action: {{model.actionType}} -{{/if}} -

      {{model.title}}

      {{model.text}}

      {{/unless}} {{else}} no step loaded -{{/if}} \ No newline at end of file +{{/if}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index dc8bc95..07a55da 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -1,14 +1,7 @@ {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -{{form.element controlType="text" label="Landscape" placeholder="Enter landscape timestamp" property="landscapeTimestamp"}} {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} - {{form.element controlType="text" label="ID" property="id" disabled=true}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} - - {{!-- {{#link-to "tutorial.edit.tutorial.landscape" model}} - {{#if landscapeService.landscape}}edit landscape{{else}}select landscape{{/if}} - {{/link-to}} --}} -{{bs-button defaultText="Save" type="primary" buttonType="submit"}} - +{{bs-button defaultText="Save it" type="primary" buttonType="submit"}} {{/bs-form}} {{#bs-dropdown as |dd|}} {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} From 1cdb8699e160ab69ba95e5b95b263ea6ec93f2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Wed, 12 Jun 2019 16:38:45 +0200 Subject: [PATCH 28/30] inserted tutorial and new interaction binding --- addon/components/application-interaction.js | 4 +- addon/components/application-visualization.js | 7 +- addon/components/landscape-interaction.js | 4 +- addon/components/landscape-visualization.js | 23 +++- addon/components/sequence-form.js | 7 +- addon/components/side-form-layout.js | 31 ++--- addon/components/step-form.js | 26 +++- addon/components/timeline.js | 17 +-- addon/components/tutorial-form.js | 7 +- addon/controllers/tutorial.js | 1 - addon/controllers/tutorial/list.js | 9 ++ addon/controllers/tutorial/tutorial.js | 2 +- addon/routes/tutorial/run.js | 3 + addon/routes/tutorial/sequence.js | 2 + addon/routes/tutorial/step.js | 12 +- addon/routes/tutorial/tutorial.js | 1 + addon/services/landscape-service.js | 36 +++--- .../landscape-select/landscapelist.hbs | 6 +- addon/templates/components/sequence-form.hbs | 23 +++- .../templates/components/side-form-layout.hbs | 32 ++--- addon/templates/components/step-form.hbs | 113 +++++++++--------- addon/templates/components/tutorial-form.hbs | 21 +++- addon/templates/tutorial/list.hbs | 39 +++++- 23 files changed, 262 insertions(+), 164 deletions(-) diff --git a/addon/components/application-interaction.js b/addon/components/application-interaction.js index 8f0cfda..0368cf2 100644 --- a/addon/components/application-interaction.js +++ b/addon/components/application-interaction.js @@ -3,5 +3,7 @@ import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Interaction.extend(AlertifyHandler,{ - landscapeService: service() + landscapeService: service(), + tutorialService: service(), + store: service() }); diff --git a/addon/components/application-visualization.js b/addon/components/application-visualization.js index 3d3cb07..78c05ab 100644 --- a/addon/components/application-visualization.js +++ b/addon/components/application-visualization.js @@ -16,11 +16,6 @@ export default ApplicationRendering.extend(AlertifyHandler,{ }else{ this.set('interaction.model',this.get('interactionModel')); } - - this.set('interaction.tutorialService',this.get('tutorialService')); - this.set('interaction.landscapeService',this.get('landscapeService')); - - this.set('interaction.completed',this.get('completed')); this.set('interaction.runmode',this.get('runmode')); this.get('interaction').on('singleClick', this.get('clickListenerSingle')); @@ -33,6 +28,7 @@ export default ApplicationRendering.extend(AlertifyHandler,{ this.set("model.targetId",emberModel.get("id")); this.set("model.actionType","singleClick"); this.set('selectTarget',false); + this.showAlertifyMessage(`Target selected 'single click' on '`+emberModel.get('constructor.modelName')+"' with name '"+emberModel.get('name')+"'"); }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ if(this.get("runmode")){ @@ -49,6 +45,7 @@ export default ApplicationRendering.extend(AlertifyHandler,{ this.set("model.targetId",emberModel.get("id")); this.set("model.actionType","doubleClick"); this.set('selectTarget',false); + this.showAlertifyMessage(`Target selected 'double click' on '`+emberModel.get('constructor.modelName')+"'"); }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){ if(this.get("runmode")){ diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index 8824316..575ec29 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -3,5 +3,7 @@ import { inject as service } from "@ember/service"; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Interaction.extend(AlertifyHandler,{ - landscapeService: service() + landscapeService: service(), + tutorialService: service(), + store: service() }); diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 96ed2ba..5bf8b39 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -23,18 +23,19 @@ export default LandscapeRendering.extend(AlertifyHandler,{ this.set('interaction.model',this.get('interactionModel')); } this.set('interaction.completed',this.get('completed')); - - this.set('interaction.tutorialService',this.get('tutorialService')); - this.set('interaction.landscapeService',this.get('landscapeService')); - this.set('interaction.runmode',this.get('runmode')); this.get('interaction').on('showApplication', function (emberModel) { self.set('landscapeService.application', emberModel); }); - this.get('interaction').on('singleClick', this.get('clickListenerSingle')); - this.get('interaction').on('doubleClick', this.get('clickListenerDouble')); + this.get('interaction').on('singleClick', this.clickListenerSingle); + this.get('interaction').on('doubleClick', this.clickListenerDouble); + }, + willDestroyElement(){ + this._super(...arguments); + this.get('interaction').off('singleClick',this, this.clickListenerSingle); + this.get('interaction').off('doubleClick',this, this.clickListenerDouble); }, clickListenerSingle(emberModel){ if(emberModel!=undefined){ @@ -43,6 +44,7 @@ export default LandscapeRendering.extend(AlertifyHandler,{ this.set("model.targetId",emberModel.get("id")); this.set("model.actionType","singleClick"); this.set('selectTarget',false); + this.showAlertifyMessage(`Target selected 'single click' on '`+emberModel.get('constructor.modelName')+"' with name '"+emberModel.get('name')+"'"); }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="singleClick"){ if(this.get("runmode")){ @@ -59,6 +61,8 @@ export default LandscapeRendering.extend(AlertifyHandler,{ this.set("model.targetId",emberModel.get("id")); this.set("model.actionType","doubleClick"); this.set('selectTarget',false); + this.showAlertifyMessage(`Target selected 'double click' on '`+emberModel.get('constructor.modelName')+"'"); + }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){ if(this.get("runmode")){ @@ -68,6 +72,13 @@ export default LandscapeRendering.extend(AlertifyHandler,{ } } }, + getLandscape(){ + if(this.get('landscapeService.livelandscapes')){ + return this.get('landscapeRepo.latestLandscape'); + }else{ + return this.get('landscapeService.landscape'); + } + }, completed(laststep){ if(this.get('runmode')){ var step = this.get('tutorialService').getNextStep(laststep); diff --git a/addon/components/sequence-form.js b/addon/components/sequence-form.js index 7aa66d9..cd3527c 100644 --- a/addon/components/sequence-form.js +++ b/addon/components/sequence-form.js @@ -7,11 +7,10 @@ export default Component.extend(AlertifyHandler,{ layout, tutorialService: service(), landscapeService: service(), + tagName: "", actions:{ - resetLandscape(){ - if(this.get('landscapeService.landscape')!=null){ - this.set('landscapeService.landscape',null); - } + toggleSetLandscape(){ + this.set('landscapeService.selectLandscape',!this.get('landscapeService.selectLandscape')); }, saveSequenceChanges(sequence) { if(sequence) { diff --git a/addon/components/side-form-layout.js b/addon/components/side-form-layout.js index c190c8c..4d92fa0 100644 --- a/addon/components/side-form-layout.js +++ b/addon/components/side-form-layout.js @@ -5,6 +5,7 @@ import { computed } from '@ember/object'; export default Component.extend({ layout, + tagName: "", store: service(), tutorialService: service(), landscapeService: service(), @@ -12,14 +13,13 @@ export default Component.extend({ landscapeRepo: service("repos/landscape-repository"), landscapeListener: service(), currentUser: service(), - - showLandscape: computed('landscapeRepo.latestApplication', function() { - return !this.get('landscapeRepo.latestApplication'); + showLandscape: computed('landscapeService.application', function() { + return !this.get('landscapeService.application'); }), - selectMode: computed('landscapeService.landscape',function(){ - if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ - return !this.get('landscapeService.landscape'); - } + selectMode: computed('landscapeService.selectLandscape',function(){ + if(this.get('model.constructor.modelName')=="tutorial" || this.get('model.constructor.modelName')=="sequence"){ + return this.get('landscapeService.selectLandscape') ; + } return false; }), liveMode: computed('landscapeService.livelandscapes','selectMode', function() { @@ -28,19 +28,13 @@ export default Component.extend({ } return false; }), - init(){ - this._super(...arguments); - this.get('landscapeService').updateLandscapeList(true); - this.get('landscapeListener').initSSE(); - this.get('landscapeListener').set('pauseVisualizationReload',true); - }, actions: { + resetView() { this.get('renderingService').reSetupScene(); }, openLandscapeView() { - this.set('landscapeRepo.latestApplication', null); - this.set('landscapeRepo.replayApplication', null); + this.set('landscapeService.application', null); }, toggleTimeline() { this.get('renderingService').toggleTimeline(); @@ -58,6 +52,12 @@ export default Component.extend({ interaction.set('selectTarget',!interaction.get('selectTarget')); } }, + init(){ + this._super(...arguments); + this.get('landscapeService').updateLandscapeList(true); + this.get('landscapeListener').initSSE(); + this.get('landscapeListener').set('pauseVisualizationReload',true); + }, showTimeline() { this.set('renderingService.showTimeline', true); }, @@ -80,4 +80,5 @@ export default Component.extend({ this._super(...arguments); this.get('additionalData').off('showWindow', this, this.onShowWindow); }, + }); diff --git a/addon/components/step-form.js b/addon/components/step-form.js index ab79eea..1161ba4 100644 --- a/addon/components/step-form.js +++ b/addon/components/step-form.js @@ -2,11 +2,27 @@ import Component from '@ember/component'; import layout from '../templates/components/step-form'; import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; import { inject as service } from "@ember/service"; +import { computed } from '@ember/object'; export default Component.extend(AlertifyHandler,{ layout, + tagName: "", tutorialService: service(), landscapeService: service(), + store: service(), + nextStepAvailable: computed("model",function(){ + return this.get('tutorialService').getNextStep(this.get('model')); + }), + targetName: computed("model.targetId","model.targetType",function(){ + if(this.get("model.targetType")==undefined ||this.get("model.targetId")==undefined){ + return ""; + } + let object = this.get('store').peekRecord(this.get("model.targetType"),this.get("model.targetId")); + if(object!=undefined){ + return object.get('name'); + } + return ""; + }), actions:{ skipStep(){ var step = this.get('tutorialService').getNextStep(this.get('model')); @@ -25,7 +41,7 @@ export default Component.extend(AlertifyHandler,{ } }); this.get('tutorialService').set('activeStep',step); - this.set('model',step); + this.get('landscapeService').setInteractionModel(step); }else{ this.showAlertifyMessage(`Last step completed.`); } @@ -49,8 +65,12 @@ export default Component.extend(AlertifyHandler,{ } }, toggleSelectTarget(){ - this.set('landscapeService.landscapeinteraction.selectTarget',!this.get('landscapeService.landscapeinteraction.selectTarget')); - this.set('landscapeService.applicationinteraction.selectTarget',!this.get('landscapeService.applicationinteraction.selectTarget')); + if(this.get('landscapeService.application')){ + this.set('landscapeService.applicationinteraction.selectTarget',!this.get('landscapeService.applicationinteraction.selectTarget')); + this.set('') + }else{ + this.set('landscapeService.landscapeinteraction.selectTarget',!this.get('landscapeService.landscapeinteraction.selectTarget')); + } }, removeTarget(){ this.set('model.targetType',""); diff --git a/addon/components/timeline.js b/addon/components/timeline.js index dc52578..348ad55 100644 --- a/addon/components/timeline.js +++ b/addon/components/timeline.js @@ -9,6 +9,7 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Timeline.extend(AlertifyHandler,{ layout, landscapeService: service(), + landscapeListener: service(), chartClickHandler(evt) { this._super(...arguments); this.set('importLandscape',true); @@ -16,13 +17,15 @@ export default Timeline.extend(AlertifyHandler,{ }, actions:{ submit(){ - if ( this.get('tutorialActivePoint')) { - this.get('landscapeListener').set('pauseVisualizationReload',true); - this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName')); - this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x); - this.get('landscapeListener').set('livelandscapes',false); - - } + if ( this.get('tutorialActivePoint')) { + this.get('landscapeListener').set('pauseVisualizationReload',true); + this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName')); + this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x); + this.get('landscapeService').set('livelandscapes',false); + } + }, + close(){ + this.get('landscapeListener').set('pauseVisualizationReload',false); } } }); diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js index 910002e..b3ed577 100644 --- a/addon/components/tutorial-form.js +++ b/addon/components/tutorial-form.js @@ -7,14 +7,13 @@ export default Component.extend(AlertifyHandler,{ layout, tutorialService: service(), landscapeService: service(), + tagName: "", actions:{ saveTutorialChanges(tutorial){ this.get('tutorialService').saveTutorialChanges(tutorial); }, - resetLandscape(){ - if(this.get('landscapeService.landscape')!=null){ - this.set('landscapeService.landscape',null); - } + toggleSetLandscape(){ + this.set('landscapeService.selectLandscape',!this.get('landscapeService.selectLandscape')); }, } diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index b3d74e1..dfa8485 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -13,7 +13,6 @@ export default Controller.extend({ controller.initRendering(); }, - actions: { resetRoute() { //const routeName = this.get('tutorial'); diff --git a/addon/controllers/tutorial/list.js b/addon/controllers/tutorial/list.js index 019d5ae..70cbfba 100644 --- a/addon/controllers/tutorial/list.js +++ b/addon/controllers/tutorial/list.js @@ -39,5 +39,14 @@ export default Controller.extend(AlertifyHandler,{ sequence.save(); }); }, + deleteStep(step){ + step.destroyRecord(); + }, + deleteSequence(sequence){ + sequence.destroyRecord(); + }, + deleteTutorial(tutorial){ + tutorial.destroyRecord(); + } } }); diff --git a/addon/controllers/tutorial/tutorial.js b/addon/controllers/tutorial/tutorial.js index 84885dc..86f41a8 100644 --- a/addon/controllers/tutorial/tutorial.js +++ b/addon/controllers/tutorial/tutorial.js @@ -4,5 +4,5 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Controller.extend(AlertifyHandler,{ tutorialService:service(), - landscapeService:service() + landscapeService:service(), }); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js index fc0f681..99edad7 100644 --- a/addon/routes/tutorial/run.js +++ b/addon/routes/tutorial/run.js @@ -13,6 +13,8 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { controller.set('landscapeService.liveMode',false); var step = controller.get('tutorialService').getNextStep(); controller.set('tutorialService.activeStep',step); + controller.get('landscapeService.landscape',null); + controller.get('tutorialService').getSequence(step).then((sequence)=>{ if(sequence!=undefined && sequence.get('landscapeTimestamp')!=undefined){ controller.get('landscapeService').loadLandscape(sequence); @@ -20,6 +22,7 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { controller.get('landscapeService').loadLandscape(model); } }); + }, actions: { // @Override BaseRoute diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index be395c2..104f125 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -9,6 +9,8 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); + controller.get('landscapeService.landscape',null); + if(controller.get('currentUser.user.isAdmin')){ controller.set('runmode',false); } diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index 7f63030..9ce826e 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -6,12 +6,10 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { return this.get('store').findRecord('step',params.step_id); }, setupController(controller, model) { - this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - if(controller.get('currentUser.user.isAdmin')){ - controller.set('runmode',false); - } + controller.get('landscapeService.landscape',null); + controller.get('tutorialService').getSequence(model).then((sequence)=>{ if(sequence.get('landscapeTimestamp')!=undefined){ controller.get('landscapeService').loadLandscape(sequence); @@ -21,7 +19,11 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { }); } }); - + + if(controller.get('currentUser.user.isAdmin')){ + controller.set('runmode',false); + } + this._super(...arguments); }, actions: { diff --git a/addon/routes/tutorial/tutorial.js b/addon/routes/tutorial/tutorial.js index fef083f..fc54559 100644 --- a/addon/routes/tutorial/tutorial.js +++ b/addon/routes/tutorial/tutorial.js @@ -8,6 +8,7 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { setupController(controller, model) { this._super(...arguments); controller.get('landscapeService').updateLandscapeList(true); + controller.get('landscapeService.landscape',null); controller.get('landscapeService').loadLandscape(model); controller.set('landscapeService.liveMode',false); if(controller.get('currentUser.user.isAdmin')){ diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index 8c2727e..e1f3818 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -9,9 +9,12 @@ import ApplicationInteraction from '../components/application-interaction'; import { getOwner } from '@ember/application'; export default Service.extend(Evented, { + mockBackend: true, debug: debugLogger(), store: service(), + renderingService: service(), landscape: null, + selectLandscape: false, application: null, livelandscapes: false, landscapeList: null, @@ -24,7 +27,10 @@ export default Service.extend(Evented, { const applicationInteraction = ApplicationInteraction.create(getOwner(this).ownerInjection()); this.set('landscapeinteraction',landscapeInteraction); this.set('applicationinteraction',applicationInteraction); - + }, + setInteractionModel(model){ + this.set('landscapeinteraction.model',model); + this.set('applicationinteraction.model',model); }, updateLandscapeList(reload) { this.set('landscapeList', []); @@ -38,30 +44,26 @@ export default Service.extend(Evented, { }, loadLandscape(model) { if (this.get('landscape') !== null) { - this.get('store').queryRecord('tutoriallandscape',{ timestamp: model.get('landscapeTimestamp') }).then((landscape)=>{ - if (this.get('landscape.id')!= landscape.get('id')){ - this.get('store').unloadRecord(this.get('landscape')); - }else{ - return; - } - }); + if(!this.get('mockBackend')){ + this.get('store').queryRecord('tutoriallandscape',{ timestamp: model.get('landscapeTimestamp') }).then((landscape)=>{ + if (this.get('landscape.id')!= landscape.get('id')){ + this.get('store').unloadRecord(this.get('landscape')); + }else{ + return; + } + }); + } } if(model.get('landscapeTimestamp')!=undefined && model.get('landscapeTimestamp')!=""){ this.importLandscape(model.get('landscapeTimestamp'),""); } + }, importLandscape(landscapeTimestamp,name){ - var mockBackend= true; - if(mockBackend){ + if(this.get('mockBackend')){ this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - var timestamprecord=this.get('store').createRecord("tutorialtimestamp",{ - id:landscape.get('timestamp.id'), - timestamp:landscape.get('timestamp.timestamp'), - totalRequests:landscape.get('timestamp.totalRequests'), - name:name, - }); - timestamprecord.save(); this.set('landscape',landscape); + this.get('renderingService').reSetupScene(); }); }else{ this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { diff --git a/addon/templates/components/landscape-select/landscapelist.hbs b/addon/templates/components/landscape-select/landscapelist.hbs index f432494..3459ada 100644 --- a/addon/templates/components/landscape-select/landscapelist.hbs +++ b/addon/templates/components/landscape-select/landscapelist.hbs @@ -1,7 +1,5 @@ -{{#if landscapeService.landscape}} -Selected Landscape:{{landscapeService.landscape.timestamp}} -{{else}} - {{landscapeService.landscapeList.length}} possible Landscapes: +{{#if landscapeService.selectLandscape}} + {{landscapeService.landscapeList.length}} possible landscapes:
        {{#each landscapeService.landscapeList as |landscape|}}
      • diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index 1fba2f5..e0fcbe7 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -3,6 +3,9 @@ {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} {{/bs-form}} +{{#if model.isDirty}} + there are unsaved changes +{{/if}} {{#bs-dropdown as |dd|}} {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} {{svg-jar "kebab-vertical" class="octicon"}} @@ -10,14 +13,22 @@ {{#dd.menu as |ddm|}} {{#ddm.item title="set landscape"}} + {{action "toggleSetLandscape"}}> {{svg-jar "globe" class="octicon" id="change-landscape"}} - {{#if model.landscapeTimestamp}} - change landscape + {{#unless landscapeService.selectLandscape}} + {{#if model.landscapeTimestamp}} + change landscape + {{else}} + select landscape + {{/if}} {{else}} - select landscape - {{/if}} + {{#if model.landscapeTimestamp}} + stop changing landscape + {{else}} + stop selecting landscape + {{/if}} + {{/unless}} {{/ddm.item}} {{/dd.menu}} - {{/bs-dropdown}} +{{/bs-dropdown}} diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index ee4c6a5..7992639 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -12,20 +12,20 @@ show live landscapes {{/bs-button}} {{landscape-select/landscapelist model=model}} - {{else}} - {{#bs-button - onClick=(action "hideLiveLandscapes") - type="secondary" - outline=true - class="btn-timeline" - title="hide live landscapes" - }} - hide live landscapes - {{/bs-button}} + {{else}} + {{#bs-button + onClick=(action "hideLiveLandscapes") + type="secondary" + outline=true + class="btn-timeline" + title="hide live landscapes" + }} + hide live landscapes + {{/bs-button}} {{#if showLandscape}} {{#if landscapeRepo.latestLandscape.systems}}
        - {{landscape-visualization latestLandscape=landscapeRepo.latestLandscape interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} + {{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} {{visualization/rendering/popups/popup-coordinator popupData=additionalData.popupContent}} @@ -53,8 +53,8 @@ popupData=additionalData.popupContent}}
        {{/if}} - -
        + +
        {{#bs-button onClick=(action "toggleTimeline") type="secondary" @@ -72,11 +72,11 @@ {{/unless}} {{else}} {{#if showLandscape}} -
        - {{landscape-visualization latestLandscape=landscapeService.landscape interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} +
        + {{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }}
        {{else}} -
        +
        {{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}} {{svg-jar "reply" class="octicon align-middle"}} diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index 25bba55..cbcd5a1 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -1,62 +1,61 @@ -{{#if model.title}} {{#unless runmode}} -{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} -{{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} - {{form.element controlType="text" label="ID" property="id" disabled=true}} - {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} - {{form.element controlType="textarea" label="Text" placeholder="Text" property="text"}} -{{bs-button defaultText="Save" type="primary" buttonType="submit"}} -{{/bs-form}} -{{#bs-dropdown as |dd|}} - {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} - {{svg-jar "kebab-vertical" class="octicon"}} - {{/dd.button}} - {{#dd.menu as |ddm|}} - {{#ddm.item title="Run"}} - - {{svg-jar "play" class="octicon" id="run-button"}}Select Target - - {{/ddm.item}} - {{#ddm.item title="Run"}} - - {{svg-jar "trashcan" class="octicon" id="run-button"}}Remove target - - {{/ddm.item}} - {{#ddm.item title="Info"}} - {{#unless model.targetType}} - {{#unless model.actionType}} - {{#unless model.targetId}} - no target selected - {{/unless}} - {{/unless}} - {{/unless}} - {{#if model.targetType}} - Target: {{model.targetType}} - {{/if}} - {{#if model.actionType}} - Action: {{model.actionType}} - {{/if}} - {{/ddm.item}} - {{/dd.menu}} -{{/bs-dropdown}} -{{else}} -{{#unless model.targetType}} - {{#unless model.actionType}} + {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} + {{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} + {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} + {{form.element controlType="textarea" label="Text" rows=18 placeholder="Text" property="text"}} + {{bs-button defaultText="Save" type="primary" buttonType="submit"}} + {{/bs-form}} + {{#if model.isDirty}} + there are unsaved changes + {{/if}} + {{#bs-dropdown as |dd|}} + {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} + {{svg-jar "kebab-vertical" class="octicon"}} + {{/dd.button}} + {{#dd.menu as |ddm|}} + {{#ddm.item title="Run"}} + + {{svg-jar "play" class="octicon" id="run-button"}} + {{#if landscapeService.application}}{{if landscapeService.applicationinteraction.selectTarget "Selecting target" "Select target" }}{{else}}{{if landscapeService.landscapeinteraction.selectTarget "Select target" "Selecting target"}}{{/if}} + + + {{/ddm.item}} + {{#ddm.item title="Run"}} + + {{svg-jar "trashcan" class="octicon" id="run-button"}}Remove target + + {{/ddm.item}} + {{/dd.menu}} + {{/bs-dropdown}} + {{#unless model.targetType}} + {{#unless model.actionType}} {{#unless model.targetId}} - {{#bs-button - onClick=(action "skipStep") - type="secondary" - outline=true - title="next step" - }} - next - {{/bs-button}} + no target selected {{/unless}} + {{/unless}} {{/unless}} -{{/unless}} -

        {{model.title}}

        -

        {{model.text}}

        -{{/unless}} {{else}} - no step loaded -{{/if}} +

        {{model.title}}

        +
        {{model.text}}
        + {{#unless model.targetType}} + {{#unless model.actionType}} + {{#unless model.targetId}} + {{#if nextStepAvailable}} + {{#bs-button + onClick=(action "skipStep") + type="secondary" + outline=true + title="next step" + }} + next + {{/bs-button}} + {{/if}} + {{/unless}} + {{/unless}} + {{/unless}} + {{#if model.actionType }} + {{#let (concat model.actionType " on " targetName) as |text| }} + {{help-tooltip title=text}} + {{/let}} + {{/if}} +{{/unless}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index 07a55da..5161187 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -3,6 +3,9 @@ {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{bs-button defaultText="Save it" type="primary" buttonType="submit"}} {{/bs-form}} +{{#if model.isDirty}} + there are unsaved changes +{{/if}} {{#bs-dropdown as |dd|}} {{#dd.button class="removecaret d-flex-center" size="sm" title="Options"}} {{svg-jar "kebab-vertical" class="octicon"}} @@ -17,13 +20,21 @@ {{/ddm.item}} {{#ddm.item title="set landscape"}} + {{action "toggleSetLandscape"}}> {{svg-jar "globe" class="octicon" id="change-landscape"}} - {{#if model.landscapeTimestamp}} - change landscape + {{#unless landscapeService.selectLandscape}} + {{#if model.landscapeTimestamp}} + change landscape + {{else}} + select landscape + {{/if}} {{else}} - select landscape - {{/if}} + {{#if model.landscapeTimestamp}} + stop changing landscape + {{else}} + stop selecting landscape + {{/if}} + {{/unless}} {{/ddm.item}} {{/dd.menu}} diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index ed0c43a..5d5fefe 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -58,6 +58,15 @@ {{svg-jar "plus" class="octicon" id="new-sequence"}}New sequence {{/ddm.item}} + {{#ddm.item}} +
        + {{/ddm.item}} + {{#ddm.item title="delete tutorial"}} + + {{svg-jar "trashcan" class="octicon" id="delete-tutorial"}}Delete Tutorial + + {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}} @@ -91,6 +100,15 @@ {{action "addNewStep" sequence}}> {{svg-jar "plus" class="octicon" id="new-step"}}New step + {{/ddm.item}} + {{#ddm.item}} +
        + {{/ddm.item}} + {{#ddm.item title="delete sequence"}} + + {{svg-jar "trashcan" class="octicon" id="delete-sequence"}}Delete sequence + {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}} @@ -110,13 +128,22 @@ {{svg-jar "kebab-vertical" class="octicon"}} {{/dd.button}} {{#dd.menu as |ddm|}} - {{#ddm.item title="Edit"}} - {{#link-to "tutorial.step" step}} - - {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit - - {{/link-to}} + {{#ddm.item title="Edit"}} + {{#link-to "tutorial.step" step}} + + {{svg-jar "pencil" class="octicon" id="edit-button"}}Edit + + {{/link-to}} + {{/ddm.item}} + {{#ddm.item}} +
        {{/ddm.item}} + {{#ddm.item title="delete step"}} + + {{svg-jar "trashcan" class="octicon" id="delete-step"}}Delete step + + {{/ddm.item}} {{/dd.menu}} {{/bs-dropdown}} From 90564613ddf03784a5f08bcd0d79b0293f17bacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Thu, 13 Jun 2019 16:29:00 +0200 Subject: [PATCH 29/30] evaluation version --- addon/components/landscape-interaction.js | 2 +- addon/components/landscape-visualization.js | 9 ++++-- addon/components/timeline.js | 11 +++++-- addon/components/tutorial-form.js | 2 ++ addon/controllers/tutorial.js | 6 +--- addon/routes/tutorial/run.js | 7 +++-- addon/routes/tutorial/step.js | 4 ++- addon/routes/tutorial/tutorial.js | 4 ++- addon/services/landscape-service.js | 20 +++++++++---- .../templates/components/side-form-layout.hbs | 30 +++++++++---------- addon/templates/components/step-form.hbs | 6 +++- addon/templates/tutorial/list.hbs | 8 +++-- 12 files changed, 72 insertions(+), 37 deletions(-) diff --git a/addon/components/landscape-interaction.js b/addon/components/landscape-interaction.js index 575ec29..789de05 100644 --- a/addon/components/landscape-interaction.js +++ b/addon/components/landscape-interaction.js @@ -5,5 +5,5 @@ import AlertifyHandler from 'explorviz-frontend/mixins/alertify-handler'; export default Interaction.extend(AlertifyHandler,{ landscapeService: service(), tutorialService: service(), - store: service() + store: service(), }); diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 5bf8b39..90928e4 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -15,7 +15,7 @@ export default LandscapeRendering.extend(AlertifyHandler,{ }, initInteraction(){ this._super(...arguments); - const self = this; + //const self = this; if(this.get('runmode')){ this.set('interaction.model',this.get('tutorialService.activeStep')); @@ -26,12 +26,17 @@ export default LandscapeRendering.extend(AlertifyHandler,{ this.set('interaction.runmode',this.get('runmode')); this.get('interaction').on('showApplication', function (emberModel) { - self.set('landscapeService.application', emberModel); + this.set('landscapeService.application', emberModel); }); this.get('interaction').on('singleClick', this.clickListenerSingle); this.get('interaction').on('doubleClick', this.clickListenerDouble); }, + cleanup(){ + this._super(...arguments); + this.get('interaction').off('singleClick',this, this.clickListenerSingle); + this.get('interaction').off('doubleClick',this, this.clickListenerDouble); + }, willDestroyElement(){ this._super(...arguments); this.get('interaction').off('singleClick',this, this.clickListenerSingle); diff --git a/addon/components/timeline.js b/addon/components/timeline.js index 348ad55..cb2abb9 100644 --- a/addon/components/timeline.js +++ b/addon/components/timeline.js @@ -12,8 +12,10 @@ export default Timeline.extend(AlertifyHandler,{ landscapeListener: service(), chartClickHandler(evt) { this._super(...arguments); - this.set('importLandscape',true); - this.set('tutorialActivePoint',this.get('timelineChart').getElementAtEvent(evt)[0]); + if(this.get('timelineChart').getElementAtEvent(evt)[0]){ + this.set('importLandscape',true); + this.set('tutorialActivePoint',this.get('timelineChart').getElementAtEvent(evt)[0]); + } }, actions:{ submit(){ @@ -22,6 +24,11 @@ export default Timeline.extend(AlertifyHandler,{ this.get('landscapeService').importLandscape(this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x,this.get('landscapeName')); this.set('model.landscapeTimestamp',this.get('tutorialActivePoint')._chart.data.datasets[this.get('tutorialActivePoint')._datasetIndex].data[this.get('tutorialActivePoint')._index].x); this.get('landscapeService').set('livelandscapes',false); + if(this.get('landscapeService.mockBackend')){ + this.get('landscapeService').set('selectLandscape',false); + this.showAlertifyMessage("Mock landscape is active. Saved landscapes cannot be selected."); + this.showAlertifyMessage("Please click 'Save it' to persist the selected Lanscape."); + } } }, close(){ diff --git a/addon/components/tutorial-form.js b/addon/components/tutorial-form.js index b3ed577..5311969 100644 --- a/addon/components/tutorial-form.js +++ b/addon/components/tutorial-form.js @@ -11,6 +11,8 @@ export default Component.extend(AlertifyHandler,{ actions:{ saveTutorialChanges(tutorial){ this.get('tutorialService').saveTutorialChanges(tutorial); + this.set('landscapeService.livelandscapes',false); + this.set('landscapeService.selectLandscape',false); }, toggleSetLandscape(){ this.set('landscapeService.selectLandscape',!this.get('landscapeService.selectLandscape')); diff --git a/addon/controllers/tutorial.js b/addon/controllers/tutorial.js index dfa8485..f7d3838 100644 --- a/addon/controllers/tutorial.js +++ b/addon/controllers/tutorial.js @@ -4,11 +4,7 @@ import { inject as service } from "@ember/service"; export default Controller.extend({ store: service(), renderingService: service("rendering-service"), - updateModel() { - // update your entity and then call - this.get('renderingService').redrawScene(); - }, - setupController(controller, model) { + setupController(controller, model) { this._super(controller, model); controller.initRendering(); diff --git a/addon/routes/tutorial/run.js b/addon/routes/tutorial/run.js index 99edad7..deeead6 100644 --- a/addon/routes/tutorial/run.js +++ b/addon/routes/tutorial/run.js @@ -11,10 +11,13 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { controller.get('tutorialService').initService(model); controller.get('landscapeService').updateLandscapeList(true); controller.set('landscapeService.liveMode',false); + var step = controller.get('tutorialService').getNextStep(); controller.set('tutorialService.activeStep',step); - controller.get('landscapeService.landscape',null); - + + controller.set('landscapeService.landscape',null); + controller.set('landscapeService.application', null); + controller.get('tutorialService').getSequence(step).then((sequence)=>{ if(sequence!=undefined && sequence.get('landscapeTimestamp')!=undefined){ controller.get('landscapeService').loadLandscape(sequence); diff --git a/addon/routes/tutorial/step.js b/addon/routes/tutorial/step.js index 9ce826e..731c022 100644 --- a/addon/routes/tutorial/step.js +++ b/addon/routes/tutorial/step.js @@ -8,7 +8,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { setupController(controller, model) { controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService.landscape',null); + + controller.set('landscapeService.landscape',null); + controller.set('landscapeService.application', null); controller.get('tutorialService').getSequence(model).then((sequence)=>{ if(sequence.get('landscapeTimestamp')!=undefined){ diff --git a/addon/routes/tutorial/tutorial.js b/addon/routes/tutorial/tutorial.js index fc54559..6abe5c9 100644 --- a/addon/routes/tutorial/tutorial.js +++ b/addon/routes/tutorial/tutorial.js @@ -8,7 +8,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { setupController(controller, model) { this._super(...arguments); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService.landscape',null); + controller.set('landscapeService.landscape',null); + controller.set('landscapeService.application', null); + controller.get('landscapeService').loadLandscape(model); controller.set('landscapeService.liveMode',false); if(controller.get('currentUser.user.isAdmin')){ diff --git a/addon/services/landscape-service.js b/addon/services/landscape-service.js index e1f3818..2f18db7 100644 --- a/addon/services/landscape-service.js +++ b/addon/services/landscape-service.js @@ -33,6 +33,10 @@ export default Service.extend(Evented, { this.set('applicationinteraction.model',model); }, updateLandscapeList(reload) { + if(this.get('mockBackend')){ + this.set('landscapeList', []); + this.set('landscapeList', this.get('store').peekAll('tutoriallandscape')); + }else{ this.set('landscapeList', []); this.get('store').findAll('tutoriallandscape', { reload }) .then(landscapes => { @@ -41,6 +45,7 @@ export default Service.extend(Evented, { landscapeList.sort((landscape1, landscape2) => parseInt(landscape1.id) < parseInt(landscape2.id) ? -1 : 1); this.set('landscapeList', landscapeList); }); + } }, loadLandscape(model) { if (this.get('landscape') !== null) { @@ -55,19 +60,22 @@ export default Service.extend(Evented, { } } if(model.get('landscapeTimestamp')!=undefined && model.get('landscapeTimestamp')!=""){ - this.importLandscape(model.get('landscapeTimestamp'),""); + if(model.get('landscapeTimestamp')!=this.get('landscape.timestamp.timestamp')){ + this.importLandscape(model.get('landscapeTimestamp'),""); + } } }, importLandscape(landscapeTimestamp,name){ if(this.get('mockBackend')){ - this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { - this.set('landscape',landscape); - this.get('renderingService').reSetupScene(); - }); + this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { + this.set('landscape',landscape); + this.get('renderingService').reSetupScene(); + }); }else{ this.get('store').queryRecord('tutoriallandscape', { timestamp: landscapeTimestamp }).then((tutlandscape) => { this.set('landscape',tutlandscape); + this.get('renderingService').reSetupScene(); }, () => { this.get('store').queryRecord('landscape', { timestamp: landscapeTimestamp }).then((landscape) => { if(!this.get('store').hasRecordForId('tutoriallandscape',landscape.get('id'))){ @@ -90,8 +98,10 @@ export default Service.extend(Evented, { timestamprecord.save(); landscaperecord.save(); this.set('landscape',landscaperecord); + this.get('renderingService').reSetupScene(); }else{ this.set('landscape',landscape); + this.get('renderingService').reSetupScene(); } }); }); diff --git a/addon/templates/components/side-form-layout.hbs b/addon/templates/components/side-form-layout.hbs index 7992639..518a6e7 100644 --- a/addon/templates/components/side-form-layout.hbs +++ b/addon/templates/components/side-form-layout.hbs @@ -23,7 +23,7 @@ hide live landscapes {{/bs-button}} {{#if showLandscape}} - {{#if landscapeRepo.latestLandscape.systems}} + {{#if landscapeService.latestLandscape.systems}}
        {{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} @@ -48,7 +48,7 @@ {{svg-jar "reply" class="octicon align-middle"}} {{/bs-button}}
        - {{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }} + {{application-visualization latestApplication=landscapeRepo.latestApplication interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }} {{visualization/rendering/popups/popup-coordinator popupData=additionalData.popupContent}}
        @@ -70,24 +70,24 @@
        {{/unless}} - {{else}} + {{else}} {{#if showLandscape}} -
        - {{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} -
        +
        + {{landscape-visualization interaction=landscapeService.landscapeinteraction interactionModel=model runmode=runmode }} +
        {{else}} -
        -
        - {{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}} - {{svg-jar "reply" class="octicon align-middle"}} - {{/bs-button}} +
        +
        + {{#bs-button onClick=(action "openLandscapeView") type="secondary" outline=true title="Back to Landscape"}} + {{svg-jar "reply" class="octicon align-middle"}} + {{/bs-button}} +
        + {{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }}
        - {{application-visualization latestApplication=landscapeService.application interaction=landscapeService.applicationinteraction interactionModel=model runmode=runmode }} -
        - {{/if}} {{/if}} + {{/if}}
        -
        +
        {{#unless runmode}} {{#if this.currentUser.user.isAdmin}} {{component form model=model runmode=runmode}} diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index cbcd5a1..9b72aef 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -16,7 +16,11 @@ {{#ddm.item title="Run"}} {{svg-jar "play" class="octicon" id="run-button"}} - {{#if landscapeService.application}}{{if landscapeService.applicationinteraction.selectTarget "Selecting target" "Select target" }}{{else}}{{if landscapeService.landscapeinteraction.selectTarget "Select target" "Selecting target"}}{{/if}} + {{#if landscapeService.application}} + {{if landscapeService.applicationinteraction.selectTarget "Selecting target" "Select target" }} + {{else}} + {{if landscapeService.landscapeinteraction.selectTarget "Selecting target" "Select target"}} + {{/if}} {{/ddm.item}} diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index 5d5fefe..1706a5a 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -13,6 +13,7 @@ {{#if this.currentUser.user.isAdmin}} + {{/if}} Type Title @@ -26,6 +27,7 @@ {{#each model.tutorials as |tutorial|}} {{#if this.currentUser.user.isAdmin}}{{#bs-button onClick=(action "toggleTutorial" tutorial)}}{{if tutorial.expanded '-' '+'}}{{/bs-button}}{{/if}} + tutorial {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.title}}{{/link-to}} @@ -76,8 +78,9 @@ {{#if tutorial.expanded}} {{#each tutorial.sequences as |sequence|}} - {{#bs-button onClick=(action "toggleSequence" sequence)}}{{if sequence.expanded '-' '+'}}{{/bs-button}} - sequence + + {{#bs-button onClick=(action "toggleSequence" sequence)}}{{if sequence.expanded '-' '+'}}{{/bs-button}} + sequence {{#link-to "tutorial.sequence" sequence}}{{sequence.title}}{{/link-to}} {{sequence.steps.length}} steps @@ -118,6 +121,7 @@ {{#each sequence.steps as |step|}} + step {{#link-to "tutorial.step" step}}{{step.title}}{{/link-to}} From ed662a35ebfc90eadddfb623e98dbc38d2f9d845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helge=20M=C3=BCller?= Date: Fri, 21 Jun 2019 16:55:39 +0200 Subject: [PATCH 30/30] changes after eval --- addon/components/application-visualization.js | 10 +++++ addon/components/landscape-visualization.js | 2 +- addon/controllers/tutorial/list.js | 2 + addon/models/sequence.js | 3 ++ addon/models/tutorial.js | 3 ++ addon/routes/tutorial/sequence.js | 4 +- addon/serializers/tutoriallandscape.js | 37 +++++++++---------- addon/templates/components/sequence-form.hbs | 2 +- addon/templates/components/step-form.hbs | 21 ++++++++++- addon/templates/components/tutorial-form.hbs | 2 +- addon/templates/tutorial/list.hbs | 6 +-- 11 files changed, 64 insertions(+), 28 deletions(-) diff --git a/addon/components/application-visualization.js b/addon/components/application-visualization.js index 78c05ab..0dca032 100644 --- a/addon/components/application-visualization.js +++ b/addon/components/application-visualization.js @@ -21,6 +21,16 @@ export default ApplicationRendering.extend(AlertifyHandler,{ this.get('interaction').on('singleClick', this.get('clickListenerSingle')); this.get('interaction').on('doubleClick', this.get('clickListenerDouble')); }, + cleanup(){ + this._super(...arguments); + this.get('interaction').off('singleClick',this, this.clickListenerSingle); + this.get('interaction').off('doubleClick',this, this.clickListenerDouble); + }, + willDestroyElement(){ + this._super(...arguments); + this.get('interaction').off('singleClick',this, this.clickListenerSingle); + this.get('interaction').off('doubleClick',this, this.clickListenerDouble); + }, clickListenerSingle(emberModel){ if(emberModel!=undefined){ if(this.get('selectTarget')){ diff --git a/addon/components/landscape-visualization.js b/addon/components/landscape-visualization.js index 90928e4..3bed31e 100644 --- a/addon/components/landscape-visualization.js +++ b/addon/components/landscape-visualization.js @@ -27,6 +27,7 @@ export default LandscapeRendering.extend(AlertifyHandler,{ this.get('interaction').on('showApplication', function (emberModel) { this.set('landscapeService.application', emberModel); + // this.trigger('doubleClick', emberModel); }); this.get('interaction').on('singleClick', this.clickListenerSingle); @@ -67,7 +68,6 @@ export default LandscapeRendering.extend(AlertifyHandler,{ this.set("model.actionType","doubleClick"); this.set('selectTarget',false); this.showAlertifyMessage(`Target selected 'double click' on '`+emberModel.get('constructor.modelName')+"'"); - }else{ if(this.get("model.targetType")==emberModel.get('constructor.modelName') && this.get("model.targetId")==emberModel.get("id")&& this.get('model.actionType')=="doubleClick"){ if(this.get("runmode")){ diff --git a/addon/controllers/tutorial/list.js b/addon/controllers/tutorial/list.js index 70cbfba..bf7e02d 100644 --- a/addon/controllers/tutorial/list.js +++ b/addon/controllers/tutorial/list.js @@ -25,6 +25,7 @@ export default Controller.extend(AlertifyHandler,{ let newSequence = this.get('store').createRecord("sequence",{ title: "new sequence" }) + tutorial.set('expanded',true); tutorial.get('sequences').pushObject(newSequence); newSequence.save().then(function () { tutorial.save(); @@ -34,6 +35,7 @@ export default Controller.extend(AlertifyHandler,{ let newStep = this.get('store').createRecord("step",{ title: "new step" }) + sequence.set('expanded',true); sequence.get('steps').pushObject(newStep); newStep.save().then(function () { sequence.save(); diff --git a/addon/models/sequence.js b/addon/models/sequence.js index bbfa0ba..6ce81d3 100644 --- a/addon/models/sequence.js +++ b/addon/models/sequence.js @@ -5,4 +5,7 @@ export default DS.Model.extend({ text: DS.attr('string'), landscapeTimestamp: DS.attr('string'), steps: DS.hasMany('step',{async:false}), + containsSteps: function() { + return this.get('steps.length')>0; + }.property('steps') }); diff --git a/addon/models/tutorial.js b/addon/models/tutorial.js index 9da50f0..fd88709 100644 --- a/addon/models/tutorial.js +++ b/addon/models/tutorial.js @@ -4,4 +4,7 @@ export default DS.Model.extend({ title: DS.attr('string'), landscapeTimestamp: DS.attr('string'), sequences: DS.hasMany('sequence',{async:false}), + containsSequences: function() { + return this.get('sequences.length')>0; + }.property('sequences') }); diff --git a/addon/routes/tutorial/sequence.js b/addon/routes/tutorial/sequence.js index 104f125..e15df58 100644 --- a/addon/routes/tutorial/sequence.js +++ b/addon/routes/tutorial/sequence.js @@ -9,7 +9,9 @@ export default BaseRoute.extend(AuthenticatedRouteMixin, { this._super(...arguments); controller.set('landscapeService.liveMode',false); controller.get('landscapeService').updateLandscapeList(true); - controller.get('landscapeService.landscape',null); + + controller.set('landscapeService.landscape',null); + controller.set('landscapeService.application', null); if(controller.get('currentUser.user.isAdmin')){ controller.set('runmode',false); diff --git a/addon/serializers/tutoriallandscape.js b/addon/serializers/tutoriallandscape.js index 7a26de5..c7ae62a 100644 --- a/addon/serializers/tutoriallandscape.js +++ b/addon/serializers/tutoriallandscape.js @@ -6,7 +6,6 @@ import SaveRelationshipsMixin from 'ember-data-save-relationships'; export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ attrs: { - events:{serialize:true}, systems:{serialize:true}, totalApplicationCommunications:{serialize:true} }, @@ -14,9 +13,6 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ return model; }, serializeRecordForIncluded(key,relationship){ - if(this.serializedTypes.indexOf(key)!==-1){ - return; - } if (relationship.kind === 'belongsTo') { var nextSnapshot = this.belongsTo(key); nextSnapshot.serializedTypes=this.serializedTypes; @@ -24,8 +20,8 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ if(nextSnapshot.record.threeJSModel!=undefined){ nextSnapshot.record.set('threeJSModel', null); } - if(this.serializedTypes.indexOf(key)==-1){ - this.serializedTypes.push(key); + if(this.serializedTypes.indexOf(nextSnapshot.get('id'))==-1){ + this.serializedTypes.push(nextSnapshot.get('id')); nextSnapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; if(nextSnapshot.record.get('id')!=undefined){ this.included.push(nextSnapshot.record.serialize({includeId:true}).data); @@ -37,10 +33,9 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ var self=this; var nkey=key; var hasmany=this.hasMany(nkey); - if(hasmany!=undefined){ hasmany.forEach(function(v){ if(v.record.threeJSModel!=undefined){ - v.record.set('threeJSModel', null); + v.record.set('threeJSModel', null); } if(self.included==undefined){ self.included=[]; @@ -51,7 +46,7 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ value.serializedTypes=self.serializedTypes; value.included=self.included; if(self.serializedTypes.indexOf(nkey)==-1){ - self.serializedTypes.push(nkey); + self.serializedTypes.push(nextSnapshot.get('id')); } value.serializeRecordForIncluded=self.serializeRecordForIncluded; value.eachRelationship(self.serializeRecordForIncluded,value); @@ -60,24 +55,24 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ } }); } - } }, serialize(snapshot) { let json = this._super(...arguments); - // snapshot.hasMany('systems').forEach(function(v,k){ - // delete json.data.relationships.systems.data[k].attributes.threeJSModel; - // }); - // - // snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ - // delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel; - // }); snapshot.serializeRecordForIncluded=this.serializeRecordForIncluded; snapshot.serializedTypes=[]; snapshot.included=[]; snapshot.eachRelationship(this.serializeRecordForIncluded,snapshot); - json.included=snapshot.included; + snapshot.hasMany('systems').forEach(function(v,k){ + delete json.data.relationships.systems.data[k].attributes.threeJSModel; + }); + + snapshot.hasMany('totalApplicationCommunications').forEach(function(v,k){ + delete json.data.relationships.totalApplicationCommunications.data[k].attributes.threeJSModel; + }); + +json.included=snapshot.included; var newjson={ data:{ id: snapshot.record.get('id'), @@ -108,7 +103,7 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ }, normalizeResponse(store, primaryModelClass, payload, id, requestType) { var json = {}; - if(Array.isArray(payload.data)){ + if(Array.isArray(payload.data) ){ json = {data:[]}; payload.data.forEach(function(v,k){ json.data[k]=JSON.parse(v.attributes.landscape).data; @@ -127,6 +122,10 @@ export default LandscapeSerializer.extend(SaveRelationshipsMixin,{ json.included=payload.included; } } + // if(requestType=="queryRecord"){ + // json.data=json.data[0]; + // return this._super(store, primaryModelClass, json, id, requestType); + // } return this._super(store, primaryModelClass, json, id, requestType); } }); diff --git a/addon/templates/components/sequence-form.hbs b/addon/templates/components/sequence-form.hbs index e0fcbe7..f7f7d0e 100644 --- a/addon/templates/components/sequence-form.hbs +++ b/addon/templates/components/sequence-form.hbs @@ -1,4 +1,4 @@ -{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}} Back{{/link-to}} {{#bs-form model=model onSubmit=(action "saveSequenceChanges" model) as |form|}} {{form.element controlType="text" label="Title" placeholder="Enter New Sequence Title" property="title"}} {{bs-button defaultText="Save" type="primary" buttonType="submit"}} diff --git a/addon/templates/components/step-form.hbs b/addon/templates/components/step-form.hbs index 9b72aef..aa9f0b7 100644 --- a/addon/templates/components/step-form.hbs +++ b/addon/templates/components/step-form.hbs @@ -1,5 +1,5 @@ {{#unless runmode}} - {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} + {{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}} Back{{/link-to}} {{#bs-form model=model onSubmit=(action "saveStepChanges" model) as |form|}} {{form.element controlType="text" label="Title" placeholder="Enter New Step Title" property="title"}} {{form.element controlType="textarea" label="Text" rows=18 placeholder="Text" property="text"}} @@ -38,6 +38,22 @@ {{/unless}} {{/unless}} {{/unless}} + + {{#if model.targetType}} + {{#if model.actionType}} + {{#if model.targetId}} + {{#if landscapeService.landscape.systems}} + Target: {{model.actionType}} on {{targetName}} + {{else}} + Target: {{model.actionType}} on {{help-tooltip title=model.targetId}} +
        + +
        + {{/if}} + {{/if}} + {{/if}} + {{/if}} + {{else}}

        {{model.title}}

        {{model.text}}
        @@ -49,7 +65,8 @@ onClick=(action "skipStep") type="secondary" outline=true - title="next step" + disabled=(not landscapeService.landscape.systems) + title="next step" as |button| }} next {{/bs-button}} diff --git a/addon/templates/components/tutorial-form.hbs b/addon/templates/components/tutorial-form.hbs index 5161187..d0eb0ff 100644 --- a/addon/templates/components/tutorial-form.hbs +++ b/addon/templates/components/tutorial-form.hbs @@ -1,4 +1,4 @@ -{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}}{{/link-to}} +{{#link-to "tutorial.list"}}{{svg-jar "reply" class="octicon align-middle"}} Back{{/link-to}} {{#bs-form model=model onSubmit=(action "saveTutorialChanges" model) as |form|}} {{form.element controlType="text" label="Title" placeholder="Enter new tutorial title" property="title"}} {{bs-button defaultText="Save it" type="primary" buttonType="submit"}} diff --git a/addon/templates/tutorial/list.hbs b/addon/templates/tutorial/list.hbs index 1706a5a..927ff42 100644 --- a/addon/templates/tutorial/list.hbs +++ b/addon/templates/tutorial/list.hbs @@ -3,7 +3,7 @@ {{#if this.currentUser.user.isAdmin}}
        - {{svg-jar "plus-small" class="octicon"}}New tutorial + {{#bs-button type="default" onClick=(action "addNewTutorial")}}{{svg-jar "plus-small"}} New tutorial{{/bs-button}}
        {{/if}} @@ -26,7 +26,7 @@ {{#each model.tutorials as |tutorial|}} - {{#if this.currentUser.user.isAdmin}}{{#bs-button onClick=(action "toggleTutorial" tutorial)}}{{if tutorial.expanded '-' '+'}}{{/bs-button}}{{/if}} + {{#if this.currentUser.user.isAdmin}}{{#if tutorial.containsSequences}}{{#bs-button type="default" onClick=(action "toggleTutorial" tutorial)}}{{svg-jar (if tutorial.expanded 'chevron-down' 'chevron-right') color=white}}{{/bs-button}}{{/if}}{{/if}} tutorial {{#link-to "tutorial.tutorial" tutorial}}{{tutorial.title}}{{/link-to}} @@ -79,7 +79,7 @@ {{#each tutorial.sequences as |sequence|}} - {{#bs-button onClick=(action "toggleSequence" sequence)}}{{if sequence.expanded '-' '+'}}{{/bs-button}} + {{#if sequence.containsSteps}}{{#bs-button type="default" onClick=(action "toggleSequence" sequence)}}{{svg-jar (if sequence.expanded 'chevron-down' 'chevron-right')}}{{/bs-button}}{{/if}} sequence {{#link-to "tutorial.sequence" sequence}}{{sequence.title}}{{/link-to}}