remove angular list/folder view

This commit is contained in:
Pete Richards 2018-10-01 11:42:12 -07:00
parent 58da916d18
commit e6e5b6a64a
10 changed files with 0 additions and 617 deletions

View File

@ -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,

View File

@ -1,45 +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.
-->
<!-- For selected, add class 'selected' to outer div -->
<div class='item grid-item' ng-click='action.perform("navigate")'>
<div class='contents abs'>
<div class='top-bar bar abs'>
<span class='icon-people' title='Shared'></span>
<mct-representation class="desktop-hide" key="'info-button'" mct-object="domainObject"></mct-representation>
</div>
<div class='item-main abs lg'>
<span class="t-item-icon" ng-class="{ 'l-icon-link':location.isLink() }">
<span class="t-item-icon-glyph ng-binding {{type.getCssClass()}}"></span>
</span>
<div class='abs item-open icon-pointer-right'></div>
</div>
<div class='bottom-bar bar abs'>
<div class='title'>{{model.name}}</div>
<div class='details'>
<span>{{type.getName()}}</span>
<span ng-show="model.composition !== undefined">
- {{model.composition.length}} Item<span ng-show="model.composition.length > 1">s</span>
</span>
</div>
</div>
</div>
</div>

View File

@ -1,27 +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.
-->
<div class='items-holder grid abs'>
<mct-representation key="'grid-item'"
ng-repeat="childObject in composition"
mct-object="childObject">
</mct-representation>
</div>

View File

@ -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"]
}
]
}
});
});

View File

@ -1,88 +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.
-->
<div ng-controller="ListViewController">
<table class="list-view">
<thead>
<tr>
<th class="sortable"
ng-click="reverseSort = (orderByField === 'title')? !reverseSort:false; orderByField='title';"
ng-class="{
sort: orderByField == 'title',
asc: !reverseSort,
desc: reverseSort
}">
Name
</th>
<th class="sortable"
ng-click="reverseSort = (orderByField === 'type')? !reverseSort:false; orderByField='type';"
ng-class="{
sort: orderByField == 'type',
asc: !reverseSort,
desc: reverseSort
}">
Type
</th>
<th class="sortable"
ng-click="reverseSort = (orderByField === 'persisted')? !reverseSort:true; orderByField='persisted';"
ng-class="{
sort: orderByField == 'persisted',
asc: !reverseSort,
desc: reverseSort
}">
Created Date
</th>
<th class="sortable"
ng-click="reverseSort = (orderByField === 'modified')? !reverseSort:true; orderByField='modified';"
ng-class="{
sort: orderByField == 'modified',
asc: !reverseSort,
desc: reverseSort
}">
Update Date
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="child in children|orderBy:orderByField:reverseSort"
mct-gesture="['menu','info']"
mct-object="child.asDomainObject"
ng-click="child.action.perform('navigate')">
<td>
<div class="l-flex-row">
<span class="flex-elem t-item-icon" ng-class="{ 'l-icon-link': child.location.isLink()}">
<span class="t-item-icon-glyph {{child.icon}}"></span>
</span>
<span class="t-title-label flex-elem grows">{{child.title}}</span>
</div>
</td>
<td>{{child.type}}</td>
<td>{{child.persisted}}</td>
<td>{{child.modified}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -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;
});

View File

@ -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;
});

View File

@ -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();
});
});
}
);

View File

@ -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();
});
});
}
);

View File

@ -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',