From e6e5b6a64ae2ced969e56139474d906a6d227d32 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Mon, 1 Oct 2018 11:42:12 -0700 Subject: [PATCH] remove angular list/folder view --- platform/commonUI/browse/bundle.js | 34 ---- .../browse/res/templates/items/grid-item.html | 45 ----- .../browse/res/templates/items/items.html | 27 --- platform/features/listview/bundle.js | 64 ------- .../listview/res/templates/listview.html | 88 ---------- .../src/controllers/ListViewController.js | 70 -------- .../listview/src/directives/MCTGesture.js | 44 ----- .../controllers/ListViewControllerSpec.js | 157 ------------------ .../test/directives/MCTGestureSpec.js | 86 ---------- src/defaultRegistry.js | 2 - 10 files changed, 617 deletions(-) delete mode 100644 platform/commonUI/browse/res/templates/items/grid-item.html delete mode 100644 platform/commonUI/browse/res/templates/items/items.html delete mode 100644 platform/features/listview/bundle.js delete mode 100644 platform/features/listview/res/templates/listview.html delete mode 100644 platform/features/listview/src/controllers/ListViewController.js delete mode 100644 platform/features/listview/src/directives/MCTGesture.js delete mode 100644 platform/features/listview/test/controllers/ListViewControllerSpec.js delete mode 100644 platform/features/listview/test/directives/MCTGestureSpec.js diff --git a/platform/commonUI/browse/bundle.js b/platform/commonUI/browse/bundle.js index 70dbffd07e..415f58b3e7 100644 --- a/platform/commonUI/browse/bundle.js +++ b/platform/commonUI/browse/bundle.js @@ -35,12 +35,10 @@ define([ "./src/windowing/WindowTitler", "./res/templates/browse.html", "./res/templates/browse-object.html", - "./res/templates/items/grid-item.html", "./res/templates/browse/object-header.html", "./res/templates/browse/object-header-frame.html", "./res/templates/menu-arrow.html", "./res/templates/back-arrow.html", - "./res/templates/items/items.html", "./res/templates/browse/object-properties.html", "./res/templates/browse/inspector-region.html", 'legacyRegistry' @@ -59,12 +57,10 @@ define([ WindowTitler, browseTemplate, browseObjectTemplate, - gridItemTemplate, objectHeaderTemplate, objectHeaderFrameTemplate, menuArrowTemplate, backArrowTemplate, - itemsTemplate, objectPropertiesTemplate, inspectorRegionTemplate, legacyRegistry @@ -156,19 +152,6 @@ define([ "view" ] }, - { - "key": "grid-item", - "template": gridItemTemplate, - "uses": [ - "type", - "action", - "location" - ], - "gestures": [ - "info", - "menu" - ] - }, { "key": "object-header", "template": objectHeaderTemplate, @@ -251,23 +234,6 @@ define([ "priority": "default" } ], - "views": [ - { - "key": "items", - "name": "Grid", - "cssClass": "icon-thumbs-strip", - "description": "Grid of available items", - "template": itemsTemplate, - "uses": [ - "composition" - ], - "gestures": [ - "drop" - ], - "type": "folder", - "editable": false - } - ], "runs": [ { "implementation": WindowTitler, diff --git a/platform/commonUI/browse/res/templates/items/grid-item.html b/platform/commonUI/browse/res/templates/items/grid-item.html deleted file mode 100644 index 6c041298b4..0000000000 --- a/platform/commonUI/browse/res/templates/items/grid-item.html +++ /dev/null @@ -1,45 +0,0 @@ - - -
-
-
- - -
-
- - - -
-
-
-
{{model.name}}
-
- {{type.getName()}} - - - {{model.composition.length}} Items - -
-
-
-
diff --git a/platform/commonUI/browse/res/templates/items/items.html b/platform/commonUI/browse/res/templates/items/items.html deleted file mode 100644 index ac74c3c9c6..0000000000 --- a/platform/commonUI/browse/res/templates/items/items.html +++ /dev/null @@ -1,27 +0,0 @@ - -
- - -
diff --git a/platform/features/listview/bundle.js b/platform/features/listview/bundle.js deleted file mode 100644 index 59c6758410..0000000000 --- a/platform/features/listview/bundle.js +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ - -define([ - './src/controllers/ListViewController', - './src/directives/MCTGesture', - './res/templates/listview.html', - 'legacyRegistry' -], function ( - ListViewController, - MCTGesture, - listViewTemplate, - legacyRegistry -) { - legacyRegistry.register("platform/features/listview", { - "name": "List View Plugin", - "description": "Allows folder contents to be shown in list format", - "extensions": - { - "views": [ - { - "key": "list", - "type": "folder", - "name": "List", - "cssClass": "icon-list-view", - "template": listViewTemplate - } - ], - "controllers": [ - { - "key": "ListViewController", - "implementation": ListViewController, - "depends": ["$scope", "formatService"] - } - ], - "directives": [ - { - "key": "mctGesture", - "implementation" : MCTGesture, - "depends": ["gestureService"] - } - ] - } - }); -}); diff --git a/platform/features/listview/res/templates/listview.html b/platform/features/listview/res/templates/listview.html deleted file mode 100644 index 41fba357e0..0000000000 --- a/platform/features/listview/res/templates/listview.html +++ /dev/null @@ -1,88 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - -
- Name - - Type - - Created Date - - Update Date -
-
- - - - {{child.title}} -
-
{{child.type}}{{child.persisted}}{{child.modified}}
-
diff --git a/platform/features/listview/src/controllers/ListViewController.js b/platform/features/listview/src/controllers/ListViewController.js deleted file mode 100644 index 514a858775..0000000000 --- a/platform/features/listview/src/controllers/ListViewController.js +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ - -define(function () { - function ListViewController($scope, formatService) { - this.$scope = $scope; - $scope.orderByField = 'title'; - $scope.reverseSort = false; - - this.updateView(); - var unlisten = $scope.domainObject.getCapability('mutation') - .listen(this.updateView.bind(this)); - - this.utc = formatService.getFormat('utc'); - - //Trigger digestive cycle with $apply to update list view - setTimeout(function () { - $scope.$apply(); - }); - - $scope.$on('$destroy', function () { - unlisten(); - }); - - } - ListViewController.prototype.updateView = function () { - this.$scope.domainObject.useCapability('composition') - .then(function (children) { - var formattedChildren = this.formatChildren(children); - this.$scope.children = formattedChildren; - this.$scope.data = {children: formattedChildren}; - }.bind(this) - ); - }; - ListViewController.prototype.formatChildren = function (children) { - return children.map(function (child) { - return { - icon: child.getCapability('type').getCssClass(), - title: child.getModel().name, - type: child.getCapability('type').getName(), - persisted: this.utc.format(child.getModel().persisted), - modified: this.utc.format(child.getModel().modified), - asDomainObject: child, - location: child.getCapability('location'), - action: child.getCapability('action') - }; - }, this); - }; - - return ListViewController; -}); diff --git a/platform/features/listview/src/directives/MCTGesture.js b/platform/features/listview/src/directives/MCTGesture.js deleted file mode 100644 index 86b85ddde1..0000000000 --- a/platform/features/listview/src/directives/MCTGesture.js +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ - -define(function () { - function MCTGesture(gestureService) { - return { - restrict : 'A', - scope: { - domainObject: '=mctObject' - }, - link : function ($scope, $element, attrs) { - var activeGestures = gestureService.attachGestures( - $element, - $scope.domainObject, - $scope.$eval(attrs.mctGesture) - ); - $scope.$on('$destroy', function () { - activeGestures.destroy(); - delete this.activeGestures; - }); - } - }; - } - return MCTGesture; -}); diff --git a/platform/features/listview/test/controllers/ListViewControllerSpec.js b/platform/features/listview/test/controllers/ListViewControllerSpec.js deleted file mode 100644 index 7d95981ef3..0000000000 --- a/platform/features/listview/test/controllers/ListViewControllerSpec.js +++ /dev/null @@ -1,157 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. -*****************************************************************************/ - -define( - ["../../src/controllers/ListViewController"], - function (ListViewController) { - describe("The Controller for the ListView", function () { - var scope, - unlistenFunc, - domainObject, - childObject, - childModel, - typeCapability, - mutationCapability, - formatService, - compositionPromise, - controller; - - beforeEach(function () { - unlistenFunc = jasmine.createSpy("unlisten"); - - mutationCapability = jasmine.createSpyObj( - "mutationCapability", - ["listen"] - ); - mutationCapability.listen.and.returnValue(unlistenFunc); - - formatService = jasmine.createSpyObj( - "formatService", - ["getFormat"] - ); - formatService.getFormat.and.returnValue(jasmine.createSpyObj( - 'utc', - ["format"] - )); - formatService.getFormat().format.and.callFake(function (v) { - return "formatted " + v; - }); - - typeCapability = jasmine.createSpyObj( - "typeCapability", - ["getCssClass", "getName"] - ); - typeCapability.getCssClass.and.returnValue("icon-folder"); - typeCapability.getName.and.returnValue("Folder"); - - - childModel = jasmine.createSpyObj( - "childModel", - ["persisted", "modified", "name"] - ); - childModel.persisted = 1496867697303; - childModel.modified = 1496867697303; - childModel.name = "Battery Charge Status"; - - childObject = jasmine.createSpyObj( - "childObject", - ["getModel", "getCapability"] - ); - childObject.getModel.and.returnValue( - childModel - ); - - childObject.getCapability.and.callFake(function (arg) { - if (arg === 'location') { - return ''; - } else if (arg === 'type') { - return typeCapability; - } - }); - childObject.location = ''; - - domainObject = jasmine.createSpyObj( - "domainObject", - ["getCapability", "useCapability"] - ); - compositionPromise = Promise.resolve([childObject]); - domainObject.useCapability.and.returnValue(compositionPromise); - domainObject.getCapability.and.returnValue( - mutationCapability - ); - - scope = jasmine.createSpyObj( - "$scope", - ["$on", "$apply"] - ); - scope.domainObject = domainObject; - - controller = new ListViewController(scope, formatService); - - return compositionPromise; - }); - - it("uses the UTC time format", function () { - expect(formatService.getFormat).toHaveBeenCalledWith('utc'); - }); - - it("updates the view", function () { - var child = scope.children[0]; - var testChild = { - icon: "icon-folder", - title: "Battery Charge Status", - type: "Folder", - persisted: formatService.getFormat('utc') - .format(childModel.persisted), - modified: formatService.getFormat('utc') - .format(childModel.modified), - asDomainObject: childObject, - location: '', - action: childObject.getCapability('action') - }; - - expect(child).toEqual(testChild); - }); - it("updates the scope when mutation occurs", function () { - var applyPromise = new Promise(function (resolve) { - scope.$apply.and.callFake(resolve); - }); - - domainObject.useCapability.and.returnValue(Promise.resolve([])); - expect(mutationCapability.listen).toHaveBeenCalledWith(jasmine.any(Function)); - mutationCapability.listen.calls.mostRecent().args[0](); - - return applyPromise.then(function () { - expect(scope.children.length).toEqual(0); - expect(scope.$apply).toHaveBeenCalled(); - }); - }); - it("releases listeners on $destroy", function () { - expect(scope.$on).toHaveBeenCalledWith('$destroy', jasmine.any(Function)); - scope.$on.calls.mostRecent().args[1](); - expect(unlistenFunc).toHaveBeenCalled(); - }); - - - }); - } -); diff --git a/platform/features/listview/test/directives/MCTGestureSpec.js b/platform/features/listview/test/directives/MCTGestureSpec.js deleted file mode 100644 index 8a7cd50cd4..0000000000 --- a/platform/features/listview/test/directives/MCTGestureSpec.js +++ /dev/null @@ -1,86 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT is licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * Open MCT includes source code licensed under additional open source - * licenses. See the Open Source Licenses file (LICENSES.md) included with - * this source code distribution or the Licensing information page available - * at runtime from the About dialog for additional information. - *****************************************************************************/ - -define( - ["../../src/directives/MCTGesture"], - function (MCTGesture) { - describe("The Gesture Listener for the ListView items", function () { - var mctGesture, - gestureService, - scope, - element, - attrs, - attachedGesture; - beforeEach(function () { - attachedGesture = jasmine.createSpyObj( - "attachedGesture", - ['destroy'] - ); - gestureService = jasmine.createSpyObj( - "gestureService", - ["attachGestures"] - ); - gestureService.attachGestures.and.returnValue( - attachedGesture - ); - mctGesture = MCTGesture(gestureService); - }); - it("creates a directive Object", function () { - expect(mctGesture).toBeDefined(); - }); - it("has link function that attaches gesture to gestureService", - function () { - attrs = { - mctGesture: "menu,info" - }; - element = jasmine.createSpy("element"); - scope = jasmine.createSpyObj( - "$scope", - ["$on", "$eval"] - ); - scope.domainObject = "fake domainObject"; - mctGesture.link(scope, element, attrs); - expect(gestureService.attachGestures).toHaveBeenCalled(); - } - ); - it("release gesture service on $destroy", function () { - attrs = { - mctGesture: "menu,info" - }; - element = jasmine.createSpy("element"); - scope = jasmine.createSpyObj( - "$scope", - ["$on", "$eval"] - ); - scope.domainObject = "fake domainObject"; - mctGesture.link(scope, element, attrs); - expect(scope.$on).toHaveBeenCalledWith( - '$destroy', - jasmine.any(Function) - ); - scope.$on.calls.mostRecent().args[1](); - expect(attachedGesture.destroy).toHaveBeenCalled(); - }); - - }); - } -); diff --git a/src/defaultRegistry.js b/src/defaultRegistry.js index 0437e0d04e..cbd4d677fc 100644 --- a/src/defaultRegistry.js +++ b/src/defaultRegistry.js @@ -57,7 +57,6 @@ define([ '../platform/features/fixed/bundle', '../platform/features/imagery/bundle', '../platform/features/layout/bundle', - '../platform/features/listview/bundle', '../platform/features/my-items/bundle', '../platform/features/pages/bundle', '../platform/features/hyperlink/bundle', @@ -101,7 +100,6 @@ define([ 'platform/features/fixed', 'platform/features/imagery', 'platform/features/layout', - 'platform/features/listview', 'platform/features/pages', 'platform/features/hyperlink', 'platform/features/timeline',