mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 15:18:12 +00:00
[Non-Editable Folder Plugin] Created new non-editable folder plugin (#3617)
* new non-edtiable folder plugin as well as updates for folder views to accept this type * tests for new plugin * remove fdescribe * correcting a test expectation * added a constnats file for folder view types Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
@ -22,18 +22,22 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'./components/GridView.vue',
|
'./components/GridView.vue',
|
||||||
|
'./constants.js',
|
||||||
'vue'
|
'vue'
|
||||||
], function (
|
], function (
|
||||||
GridViewComponent,
|
GridViewComponent,
|
||||||
|
constants,
|
||||||
Vue
|
Vue
|
||||||
) {
|
) {
|
||||||
function FolderGridView(openmct) {
|
function FolderGridView(openmct) {
|
||||||
|
const ALLOWED_FOLDER_TYPES = constants.ALLOWED_FOLDER_TYPES;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
key: 'grid',
|
key: 'grid',
|
||||||
name: 'Grid View',
|
name: 'Grid View',
|
||||||
cssClass: 'icon-thumbs-strip',
|
cssClass: 'icon-thumbs-strip',
|
||||||
canView: function (domainObject) {
|
canView: function (domainObject) {
|
||||||
return domainObject.type === 'folder';
|
return ALLOWED_FOLDER_TYPES.includes(domainObject.type);
|
||||||
},
|
},
|
||||||
view: function (domainObject) {
|
view: function (domainObject) {
|
||||||
let component;
|
let component;
|
||||||
|
@ -22,20 +22,24 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'./components/ListView.vue',
|
'./components/ListView.vue',
|
||||||
|
'./constants.js',
|
||||||
'vue',
|
'vue',
|
||||||
'moment'
|
'moment'
|
||||||
], function (
|
], function (
|
||||||
ListViewComponent,
|
ListViewComponent,
|
||||||
|
constants,
|
||||||
Vue,
|
Vue,
|
||||||
Moment
|
Moment
|
||||||
) {
|
) {
|
||||||
function FolderListView(openmct) {
|
function FolderListView(openmct) {
|
||||||
|
const ALLOWED_FOLDER_TYPES = constants.ALLOWED_FOLDER_TYPES;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
key: 'list-view',
|
key: 'list-view',
|
||||||
name: 'List View',
|
name: 'List View',
|
||||||
cssClass: 'icon-list-view',
|
cssClass: 'icon-list-view',
|
||||||
canView: function (domainObject) {
|
canView: function (domainObject) {
|
||||||
return domainObject.type === 'folder';
|
return ALLOWED_FOLDER_TYPES.includes(domainObject.type);
|
||||||
},
|
},
|
||||||
view: function (domainObject) {
|
view: function (domainObject) {
|
||||||
let component;
|
let component;
|
||||||
|
23
src/plugins/folderView/constants.js
Normal file
23
src/plugins/folderView/constants.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
export const ALLOWED_FOLDER_TYPES = ['folder', 'noneditable.folder'];
|
33
src/plugins/nonEditableFolder/plugin.js
Normal file
33
src/plugins/nonEditableFolder/plugin.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2020, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
export default function () {
|
||||||
|
return function (openmct) {
|
||||||
|
openmct.types.addType("noneditable.folder", {
|
||||||
|
name: "Non-Editable Folder",
|
||||||
|
key: "noneditable.folder",
|
||||||
|
description: "Create folders to organize other objects or links to objects without the ability to edit it's properties.",
|
||||||
|
cssClass: "icon-folder",
|
||||||
|
creatable: false
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
50
src/plugins/nonEditableFolder/pluginSpec.js
Normal file
50
src/plugins/nonEditableFolder/pluginSpec.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2020, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
import {
|
||||||
|
createOpenMct,
|
||||||
|
resetApplicationState
|
||||||
|
} from 'utils/testing';
|
||||||
|
|
||||||
|
describe("the plugin", () => {
|
||||||
|
const NON_EDITABLE_FOLDER_KEY = 'noneditable.folder';
|
||||||
|
let openmct;
|
||||||
|
|
||||||
|
beforeEach((done) => {
|
||||||
|
openmct = createOpenMct();
|
||||||
|
openmct.install(openmct.plugins.NonEditableFolder());
|
||||||
|
|
||||||
|
openmct.on('start', done);
|
||||||
|
openmct.startHeadless();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
return resetApplicationState(openmct);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('adds the new non-editable folder type', () => {
|
||||||
|
const type = openmct.types.get(NON_EDITABLE_FOLDER_KEY);
|
||||||
|
|
||||||
|
expect(type).toBeDefined();
|
||||||
|
expect(type.definition.creatable).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -56,6 +56,7 @@ define([
|
|||||||
'./URLTimeSettingsSynchronizer/plugin',
|
'./URLTimeSettingsSynchronizer/plugin',
|
||||||
'./notificationIndicator/plugin',
|
'./notificationIndicator/plugin',
|
||||||
'./newFolderAction/plugin',
|
'./newFolderAction/plugin',
|
||||||
|
'./nonEditableFolder/plugin',
|
||||||
'./persistence/couch/plugin',
|
'./persistence/couch/plugin',
|
||||||
'./defaultRootName/plugin',
|
'./defaultRootName/plugin',
|
||||||
'./timeline/plugin',
|
'./timeline/plugin',
|
||||||
@ -98,6 +99,7 @@ define([
|
|||||||
URLTimeSettingsSynchronizer,
|
URLTimeSettingsSynchronizer,
|
||||||
NotificationIndicator,
|
NotificationIndicator,
|
||||||
NewFolderAction,
|
NewFolderAction,
|
||||||
|
NonEditableFolder,
|
||||||
CouchDBPlugin,
|
CouchDBPlugin,
|
||||||
DefaultRootName,
|
DefaultRootName,
|
||||||
Timeline,
|
Timeline,
|
||||||
@ -194,6 +196,7 @@ define([
|
|||||||
plugins.URLTimeSettingsSynchronizer = URLTimeSettingsSynchronizer.default;
|
plugins.URLTimeSettingsSynchronizer = URLTimeSettingsSynchronizer.default;
|
||||||
plugins.NotificationIndicator = NotificationIndicator.default;
|
plugins.NotificationIndicator = NotificationIndicator.default;
|
||||||
plugins.NewFolderAction = NewFolderAction.default;
|
plugins.NewFolderAction = NewFolderAction.default;
|
||||||
|
plugins.NonEditableFolder = NonEditableFolder.default;
|
||||||
plugins.ISOTimeFormat = ISOTimeFormat.default;
|
plugins.ISOTimeFormat = ISOTimeFormat.default;
|
||||||
plugins.DefaultRootName = DefaultRootName.default;
|
plugins.DefaultRootName = DefaultRootName.default;
|
||||||
plugins.Timeline = Timeline.default;
|
plugins.Timeline = Timeline.default;
|
||||||
|
Reference in New Issue
Block a user