diff --git a/bower.json b/bower.json index 369dcdc81b5..754dafbc8e1 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ "screenfull": "^3.0.0", "node-uuid": "^1.4.7", "comma-separated-values": "^3.6.4", - "FileSaver.js": "^0.0.2", + "file-saver": "^1.3.3", "zepto": "^1.1.6", "eventemitter3": "^1.2.0", "lodash": "3.10.1", @@ -25,4 +25,4 @@ "html2canvas": "^0.4.1", "moment-timezone": "^0.5.13" } -} +} \ No newline at end of file diff --git a/example/notebook/bundle.js b/example/notebook/bundle.js index d9a7e475bd2..11ef67a2b68 100644 --- a/example/notebook/bundle.js +++ b/example/notebook/bundle.js @@ -139,7 +139,11 @@ define([ "key": "mctEntryDnd", "implementation": MCTEntryDnd, "depends": [ - "$rootScope","$compile","dndService","typeService" + "$rootScope", + "$compile", + "dndService", + "typeService", + "notificationService" ] } ], @@ -166,7 +170,22 @@ define([ "dndService", "$rootScope", ] - }, + }, + + { + "key": "remove-embed", + "implementation": removeEmbedAction, + "name": "Remove...", + "cssClass": "icon-trash labeled", + "description": "Remove this embed", + "category": [ + "embed", + "embed-no-snap" + ], + "depends":[ + "dialogService" + ] + }, { "key": "remove-snapshot", "implementation": removeSnapshotAction, @@ -189,20 +208,6 @@ define([ "$compile" ] }, - { - "key": "remove-embed", - "implementation": removeEmbedAction, - "name": "Remove...", - "cssClass": "icon-trash labeled", - "description": "Remove this embed", - "category": [ - "embed", - "embed-no-snap" - ], - "depends":[ - "dialogService" - ] - }, { "key": "notebook-new-entry", "implementation": newEntryAction, diff --git a/example/notebook/res/templates/controls/embedControl.html b/example/notebook/res/templates/controls/embedControl.html index ec5e7524173..560cac16093 100644 --- a/example/notebook/res/templates/controls/embedControl.html +++ b/example/notebook/res/templates/controls/embedControl.html @@ -31,7 +31,7 @@
{{objectName}}
-
{{snapshot.modified| date:'yyyy-MM-dd hh:mm:ss'}}
+
{{snapshot.modified| date:'yyyy-MM-dd HH:mm:ss'}}
@@ -39,7 +39,7 @@
{{objectName}} - {{snapshot.modified| date:'yyyy-MM-dd hh:mm:ss'}} + {{snapshot.modified| date:'yyyy-MM-dd HH:mm:ss'}}
diff --git a/example/notebook/res/templates/notebook.html b/example/notebook/res/templates/notebook.html index b5344767eee..484ebe4cf2d 100644 --- a/example/notebook/res/templates/notebook.html +++ b/example/notebook/res/templates/notebook.html @@ -54,7 +54,7 @@
-
{{embed.id| date:'yyyy-MM-dd hh:mm:ss'}}
+
{{embed.id| date:'yyyy-MM-dd HH:mm:ss'}}
diff --git a/example/notebook/src/actions/annotateSnapshot.js b/example/notebook/src/actions/annotateSnapshot.js index 7966dd9e0e5..dc67a3798fb 100644 --- a/example/notebook/src/actions/annotateSnapshot.js +++ b/example/notebook/src/actions/annotateSnapshot.js @@ -96,6 +96,8 @@ define( function saveNotes(param){ if(param=='ok'){ painterro.save(); + }else{ + rootscope.snapshot = "annotationCancelled"; } } diff --git a/example/notebook/src/actions/newEntryContextual.js b/example/notebook/src/actions/newEntryContextual.js index 33d1911bc89..1aee59756b5 100644 --- a/example/notebook/src/actions/newEntryContextual.js +++ b/example/notebook/src/actions/newEntryContextual.js @@ -36,6 +36,7 @@ define( name: 'Entry', key: 'entry', control: 'textarea', + required: true, "cssClass": "l-textarea-sm" }, { @@ -90,15 +91,23 @@ define( var linkService = this.linkService; var dialogService = this.dialogService; var rootScope = this.$rootScope; + rootScope.newEntryText = ''; // Create the overlay element and add it to the document's body this.$rootScope.selObj = domainObj; this.$rootScope.selValue = ""; - var element = this.$compile(SNAPSHOT_TEMPLATE)(this.$rootScope); + var newScope = rootScope.$new(); + newScope.selObj = domainObj; + newScope.selValue = ""; + var element = this.$compile(SNAPSHOT_TEMPLATE)(newScope); + //newScope.$destroy(); this.$rootScope.$watch("snapshot", setSnapshot); function setSnapshot(value){ - if(value){ + if(value === "annotationCancelled"){ + rootScope.snapshot = rootScope.lastValue; + rootScope.lastValue = ''; + }else if(value && value !== rootScope.lastValue){ var overlayModel = { title: NEW_TASK_FORM.name, message: NEW_TASK_FORM.message, @@ -111,19 +120,16 @@ define( return overlayModel.value; } - if(value !== rootScope.lastValue){ - rootScope.currentDialog = overlayModel; + rootScope.currentDialog = overlayModel; - dialogService.getDialogResponse( - "overlay-dialog", - overlayModel, - resultGetter - ).then(addNewEntry); - } - + dialogService.getDialogResponse( + "overlay-dialog", + overlayModel, + resultGetter + ).then(addNewEntry); rootScope.lastValue = value; - } + } } function addNewEntry(options){ @@ -139,12 +145,8 @@ define( if(!options.withSnapshot){ options.snapshot = ''; } - - if (options.saveNotebook.getModel().composition.indexOf(options.embedObject.getId()) !== -1) { - createSnap(options) - }else{ - linkService.perform(options.embedObject, options.saveNotebook).then(createSnap(options)); - } + + createSnap(options); } function createSnap(options){ @@ -179,8 +181,6 @@ define( notification.info({ title: "Notebook Entry created" }); - - self.$rootScope.newEntryText = ''; } }; diff --git a/example/notebook/src/actions/viewSnapshot.js b/example/notebook/src/actions/viewSnapshot.js index 7f08ed1eaa6..b8ae4a7274a 100644 --- a/example/notebook/src/actions/viewSnapshot.js +++ b/example/notebook/src/actions/viewSnapshot.js @@ -103,9 +103,9 @@ define( ''+ ''+ @@ -115,7 +115,7 @@ define( '
'+ ''+ ' '+ - 'SNAPSHOT {{snapDate | date:\'yyyy-MM-dd hh:mm:ss\'}}'+ + 'SNAPSHOT {{snapDate | date:\'yyyy-MM-dd HH:mm:ss\'}}'+ '
'+ ''+ 'Annotate'+ diff --git a/example/notebook/src/controllers/notebookController.js b/example/notebook/src/controllers/notebookController.js index f30e1c07c4c..3a03892b9b2 100644 --- a/example/notebook/src/controllers/notebookController.js +++ b/example/notebook/src/controllers/notebookController.js @@ -55,6 +55,7 @@ define( $scope.entrySearch = ''; $scope.entryTypes = []; $scope.embedActions = []; + $scope.currentEntryValue = ''; /*--seconds in an hour--*/ @@ -126,12 +127,21 @@ define( }); }; + $scope.textFocus = function($event){ + if($event.currentTarget && $event.currentTarget.value){ + $scope.currentEntryValue = $event.currentTarget.value; + } + } + $scope.textBlur = function($event,entryId){ if($event.target && $event.target.value !== ""){ var elementPos = $scope.domainObject.model.entries.map(function(x) {return x.createdOn}).indexOf(+(entryId)); - $scope.domainObject.model.entries[elementPos].text = $event.target.value; + $scope.domainObject.model.entries[elementPos].text = $event.target.value; + if($scope.currentEntryValue !== $event.target.value){ + $scope.domainObject.model.entries[elementPos].createdOn = now(); + } $scope.domainObject.useCapability('mutation', function(model) {}); - } + } } $scope.finished = function(model){ @@ -182,11 +192,12 @@ define( - function actionToMenuOption(action) { + $scope.actionToMenuOption = function(action) { return { - key: action, + key: action.getMetadata().key, name: action.getMetadata().name, - cssClass: action.getMetadata().cssClass + cssClass: action.getMetadata().cssClass, + perform: action.perform }; }; @@ -204,10 +215,6 @@ define( $scope.menuActions = $scope.action ? $scope.action.getActions({key: 'window'}) : []; - - if($scope.action){ - $scope.menuActions.push(actionToMenuOption($scope.action.getActions({key: 'navigate'})[0])); - } }; // Update set of actions whenever the action capability @@ -215,7 +222,9 @@ define( $scope.$watch("action", updateActions); $scope.navigate = function($event,embedType){ - $event.preventDefault(); + if($event){ + $event.preventDefault(); + } $scope.getDomainObj(embedType).then(function(resp){ navigationService.setNavigation(resp[embedType]); }); @@ -250,10 +259,20 @@ define( /*---popups menu embeds----*/ - function getEmbedActions(embedType){ + function getEmbedActions(embedType){ + var self = this; if(!$scope.embedActions.length){ $scope.getDomainObj(embedType).then(function(resp){ - $scope.embedActions = $scope.action.getActions({key: 'window',selectedObject:resp[embedType]}); + $scope.embedActions = []; + $scope.embedActions.push($scope.actionToMenuOption( + $scope.action.getActions({key: 'window',selectedObject:resp[embedType]})[0] + )); + $scope.embedActions.push({ + key:'navigate', + name: 'Go to Original', + cssClass: '', + perform: function(){$scope.navigate('',embedType)} + }); }); } }; diff --git a/example/notebook/src/directives/MCTSnapshot.js b/example/notebook/src/directives/MCTSnapshot.js index e5381b4af00..beafd385b19 100644 --- a/example/notebook/src/directives/MCTSnapshot.js +++ b/example/notebook/src/directives/MCTSnapshot.js @@ -30,8 +30,7 @@ define([ function MCTSnapshot($rootScope,$document,exportImageService,dialogService,notificationService) { var document = $document[0]; - function link($scope, $element) { - + function link($scope, $element,$attrs) { var element = $element[0]; var layoutContainer = element.parentElement, toggleOverlay, @@ -50,7 +49,8 @@ define([ layoutContainer.remove(); } document.body.removeChild(snapshot); - snapshot = undefined; + snapshot = undefined; + $element.remove(); } toggleOverlay = function () { @@ -90,6 +90,7 @@ define([ 'modified':Date.now() }; closeOverlay(false); + scope.$destroy(); }; } @@ -119,6 +120,7 @@ define([ $scope.$on('$destroy', function () { $element.off('click', toggleOverlay); + $element.remove(); }); } diff --git a/example/notebook/src/directives/entryDnd.js b/example/notebook/src/directives/entryDnd.js index 7fe2eb078fa..63f32aa0282 100644 --- a/example/notebook/src/directives/entryDnd.js +++ b/example/notebook/src/directives/entryDnd.js @@ -30,7 +30,7 @@ define([ 'mct-object="selObj">'+ ''; - function entryDnd($rootScope,$compile,dndService,typeService) { + function entryDnd($rootScope,$compile,dndService,typeService,notificationService) { function link($scope, $element) { var domainObj = $scope.domainObject; @@ -71,6 +71,9 @@ define([ } $scope.scrollToTop(); + notificationService.info({ + title: "Notebook Entry created" + }); }else{ @@ -107,6 +110,7 @@ define([ if($(e.currentTarget).hasClass('drag-active')){ $(e.currentTarget).removeClass('drag-active'); } + } function dragover(e) { diff --git a/openmct.js b/openmct.js index 788535cf5e6..b2f20048911 100644 --- a/openmct.js +++ b/openmct.js @@ -33,7 +33,7 @@ requirejs.config({ "moment": "bower_components/moment/moment", "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", "moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data", - "saveAs": "bower_components/FileSaver.js/FileSaver.min", + "saveAs": "bower_components/file-saver/FileSaver.min", "screenfull": "bower_components/screenfull/dist/screenfull.min", "text": "bower_components/text/text", "uuid": "bower_components/node-uuid/uuid", diff --git a/test-main.js b/test-main.js index d108b826319..428eb27ae7b 100644 --- a/test-main.js +++ b/test-main.js @@ -59,10 +59,11 @@ requirejs.config({ "moment": "bower_components/moment/moment", "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", "moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data", - "saveAs": "bower_components/FileSaver.js/FileSaver.min", + "saveAs": "bower_components/file-saver/FileSaver.min", "screenfull": "bower_components/screenfull/dist/screenfull.min", "text": "bower_components/text/text", "uuid": "bower_components/node-uuid/uuid", + "vue": "node_modules/vue/dist/vue.min", "zepto": "bower_components/zepto/zepto.min", "lodash": "bower_components/lodash/lodash", "d3-selection": "node_modules/d3-selection/build/d3-selection.min", @@ -124,4 +125,4 @@ requirejs.config({ window.__karma__.start.apply(window.__karma__, args); }); } -}); +}); \ No newline at end of file