diff --git a/app/components/plot-abstract.js b/app/components/plot-abstract.js index 47f1dd7..f8a7b51 100644 --- a/app/components/plot-abstract.js +++ b/app/components/plot-abstract.js @@ -20,6 +20,8 @@ export default Ember.Component.extend(Resizable, Draggable, { editing: false, grid: false, + simulator: 0, + disabled_resize: false, autoHide_resize: false, grid_resize: [ 10, 10 ], @@ -29,6 +31,39 @@ export default Ember.Component.extend(Resizable, Draggable, { grid_drag: [ 10, 10 ], scroll_drag: true, + _popoverDisplayed: false, + + didInsertElement() { + this._super(); + + if (this.get('editing') === true) { + // create popover + var self = this; + + this.$().popover({ + html: true, + placement: 'auto right', + content: function () { + return self.$('.popover-content').html(); + }, + viewport: { selector: '.plots', padding: 10 } + }); + + // register popover events + this.$().on('show.bs.popover', function() { + + }); + + this.$().on('shown.bs.popover', function() { + self._popoverDisplayed = true; + }); + + this.$().on('hide.bs.popover', function() { + self._popoverDisplayed = false; + }); + } + }, + style: function() { return Ember.String.htmlSafe('width: ' + this.get('plot.width') + 'px; height: ' + this.get('plot.height') + 'px; left: ' + this.get('plot.x') + 'px; top: ' + this.get('plot.y') + 'px;'); }.property('plot'), @@ -41,11 +76,23 @@ export default Ember.Component.extend(Resizable, Draggable, { this.set('plot.height', height); }, + resize_resize(event, ui) { + if (this._popoverDisplayed === true) { + this.$().popover('show'); + } + }, + stop_drag(event, ui) { this.set('plot.x', ui.position.left); this.set('plot.y', ui.position.top); }, + drag_drag(event, ui) { + if (this._popoverDisplayed === true) { + this.$().popover('show'); + } + }, + _updateUI: function() { if (this.get('editing') === true) { this.set('disabled_resize', false); @@ -64,5 +111,11 @@ export default Ember.Component.extend(Resizable, Draggable, { this.set('grid_resize', false); this.set('grid_drag', false); } - }.observes('editing', 'grid').on('init') + }.observes('editing', 'grid').on('init'), + + actions: { + savePlot() { + this.$().popover('hide'); + } + } }); diff --git a/app/components/plot-container.js b/app/components/plot-container.js index de61a77..9556975 100644 --- a/app/components/plot-container.js +++ b/app/components/plot-container.js @@ -19,7 +19,12 @@ export default Ember.Component.extend({ grid: true, style: function() { - return Ember.String.htmlSafe('height: ' + this._calculateHeight() + 'px;'); + var height = this._calculateHeight(); + if (this.get('editing') === true && height < 400) { + height = 400; + } + + return Ember.String.htmlSafe('height: ' + height + 'px;'); }.property('plots.@each.height', 'plots.@each.y'), _calculateHeight() { diff --git a/app/controllers/simulation-model/index.js b/app/controllers/simulation-model/index.js index 74b0a77..3481e21 100644 --- a/app/controllers/simulation-model/index.js +++ b/app/controllers/simulation-model/index.js @@ -15,7 +15,7 @@ export default Ember.Controller.extend({ }.property('simulationData.values.@each'), _getData: function() { - if (this.get('model.simulation.running') == true) { + if (this.get('model.simulation.running') === true) { var simulator = this.get('model.simulator'); if (simulator == null) { return; diff --git a/app/mixins/websocket-live-stream-mixin.js b/app/mixins/websocket-live-stream-mixin.js index bbf6ecf..c225d6a 100644 --- a/app/mixins/websocket-live-stream-mixin.js +++ b/app/mixins/websocket-live-stream-mixin.js @@ -51,7 +51,7 @@ export default Ember.Mixin.create({ } }.observes('runningSimulation.simulation'), - onopen(event) { + onopen(/*event*/) { Ember.debug('websocket opened'); }, @@ -76,7 +76,7 @@ export default Ember.Mixin.create({ } }, - onerror(event) { + onerror(/*event*/) { Ember.debug('websocket error'); }, diff --git a/app/models/plot.js b/app/models/plot.js index e7dd0ba..17ab769 100644 --- a/app/models/plot.js +++ b/app/models/plot.js @@ -14,6 +14,7 @@ import { belongsTo } from 'ember-data/relationships'; export default Model.extend({ name: attr('string'), signal: attr('string'), + simulator: attr('number', { defaultValue: 1 }), width: attr('number', { defaultValue: 100 }), height: attr('number', { defaultValue: 100 }), title: attr('string'), diff --git a/app/models/simulation-model.js b/app/models/simulation-model.js index 4a4b445..9493dd9 100644 --- a/app/models/simulation-model.js +++ b/app/models/simulation-model.js @@ -9,7 +9,7 @@ import Model from 'ember-data/model'; import attr from 'ember-data/attr'; -import { belongsTo, hasMany } from 'ember-data/relationships'; +import { belongsTo/*, hasMany*/ } from 'ember-data/relationships'; export default Model.extend({ name: attr('string'), diff --git a/app/services/running-simulation.js b/app/services/running-simulation.js index ca8ff7b..40aa46b 100644 --- a/app/services/running-simulation.js +++ b/app/services/running-simulation.js @@ -27,12 +27,12 @@ export default Ember.Service.extend({ var newSimulation = null; simulations.forEach(function(simulation) { - if (simulation.get('running') == true) { + if (simulation.get('running') === true) { newSimulation = simulation; } }); - if (newSimulation != self.get('simulation')) { + if (newSimulation !== self.get('simulation')) { self.set('simulation', newSimulation); } }); diff --git a/app/styles/app.css b/app/styles/app.css index 9aa9008..575e542 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -168,6 +168,8 @@ footer { border: 0; border-collapse: collapse; + + background-color: #f6f6f6; } .table-full-width th, td { @@ -232,3 +234,21 @@ footer { .form-create-record button:hover { background: #373; } + +/** + * + */ +.popover { + z-index: 1010; + + width: 120px; + height: 100px; +} + +.arrow { + border-right-color: red !important; +} + +.hidden { + visibility: hidden; +} diff --git a/app/styles/plots.css b/app/styles/plots.css index 34ee417..a3807eb 100644 --- a/app/styles/plots.css +++ b/app/styles/plots.css @@ -42,6 +42,18 @@ } +.plot-edit-container { + width: 200px !important; + + background-color: #ddd; + + border: 1px dotted black; +} + +.plot-edit-form { + +} + /** * Component: plot-table */ diff --git a/app/styles/projects.css b/app/styles/projects.css index 5bc1e13..43f0f1b 100644 --- a/app/styles/projects.css +++ b/app/styles/projects.css @@ -25,3 +25,22 @@ .projects-new-container { margin-top: 20px; } + +/** + * Route: project.index + */ +.project-index-container { + margin-top: 20px; +} + +.project-index-row-controls { + float: right; +} + +.project-index-row-controls a { + margin:left: 10px; +} + +.project-index-new-visualization { + margin-top: 20px; +} diff --git a/app/styles/simulations.css b/app/styles/simulations.css index 9c6a94f..0580e36 100644 --- a/app/styles/simulations.css +++ b/app/styles/simulations.css @@ -29,7 +29,6 @@ /** * Route: simulation/index */ - .simulation-index-models-container { margin-top: 20px; } diff --git a/app/templates/components/plot-value.hbs b/app/templates/components/plot-value.hbs index af53c9c..74d6f2a 100644 --- a/app/templates/components/plot-value.hbs +++ b/app/templates/components/plot-value.hbs @@ -1 +1,31 @@ Value + + diff --git a/app/templates/project/index.hbs b/app/templates/project/index.hbs index d35cd7f..93dcedb 100644 --- a/app/templates/project/index.hbs +++ b/app/templates/project/index.hbs @@ -1,24 +1,27 @@

{{model.name}}

-
- -

-

Visualizations

- -