mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 10:46:42 +00:00
[Plots] #638 New plot display options
This commit is contained in:
parent
2dd9a16bf3
commit
6fb6761abf
1
main.js
1
main.js
@ -71,6 +71,7 @@ define([
|
||||
'./platform/entanglement/bundle',
|
||||
'./platform/search/bundle',
|
||||
'./platform/status/bundle',
|
||||
'./platform/commonUI/regions/bundle',
|
||||
|
||||
'./example/imagery/bundle',
|
||||
'./example/eventGenerator/bundle',
|
||||
|
@ -36,6 +36,7 @@ define([
|
||||
"./src/creation/CreateActionProvider",
|
||||
"./src/creation/CreationService",
|
||||
"./src/windowing/WindowTitler",
|
||||
"./src/TypeRegionDecorator",
|
||||
'legacyRegistry'
|
||||
], function (
|
||||
BrowseController,
|
||||
@ -52,6 +53,7 @@ define([
|
||||
CreateActionProvider,
|
||||
CreationService,
|
||||
WindowTitler,
|
||||
TypeRegionDecorator,
|
||||
legacyRegistry
|
||||
) {
|
||||
"use strict";
|
||||
@ -192,6 +194,14 @@ define([
|
||||
"context"
|
||||
],
|
||||
"templateUrl": "templates/back-arrow.html"
|
||||
},
|
||||
{
|
||||
"key": "object-properties",
|
||||
"templateUrl": "templates/browse/object-properties.html"
|
||||
},
|
||||
{
|
||||
"key": "inspector-region",
|
||||
"templateUrl": "templates/browse/inspector-region.html"
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
@ -280,7 +290,12 @@ define([
|
||||
"$q",
|
||||
"$log"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"provides": "typeService",
|
||||
"type": "decorator",
|
||||
"implementation": TypeRegionDecorator
|
||||
},
|
||||
],
|
||||
"runs": [
|
||||
{
|
||||
|
@ -0,0 +1,30 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web 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 Web 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="RegionController as regionController">
|
||||
<div ng-repeat="part in regions.inspector.parts">
|
||||
<mct-representation
|
||||
key="part.content.key"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel">
|
||||
</mct-representation>
|
||||
</div>
|
||||
</div><!--/ PaneController -->
|
@ -0,0 +1,61 @@
|
||||
<!--
|
||||
Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
Open MCT Web 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 Web 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="ObjectInspectorController as controller">
|
||||
<div class="pane-header flex-elem">Inspection</div>
|
||||
<ul class="flex-elem grows vscroll">
|
||||
<li>
|
||||
<em>Properties</em>
|
||||
<div class="inspector-properties"
|
||||
ng-repeat="data in metadata"
|
||||
ng-class="{ first:$index === 0 }">
|
||||
<div class="label">{{ data.name }}</div>
|
||||
<div class="value">{{ data.value }}</div>
|
||||
</div>
|
||||
</li>
|
||||
<li ng-if="contextutalParents.length > 0">
|
||||
<em title="The location of this linked object.">Location</em>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in contextutalParents"
|
||||
ng-class="{ last:($index + 1) === contextualParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = parent"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-if="primaryParents.length > 0">
|
||||
<em title="The location of the original object that this was linked from.">Original Location</em>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in primaryParents"
|
||||
ng-class="{ last:($index + 1) === primaryParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = parent"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--/ holder-inspector -->
|
69
platform/commonUI/browse/src/InspectorRegion.js
Normal file
69
platform/commonUI/browse/src/InspectorRegion.js
Normal file
@ -0,0 +1,69 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[
|
||||
'../../regions/src/Region'
|
||||
],
|
||||
function (Region) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Defines the a default Inspector region. Captured in a class to
|
||||
* allow for modular extension and customization of regions based on
|
||||
* the typical case.
|
||||
* @memberOf platform/commonUI/regions
|
||||
* @constructor
|
||||
*/
|
||||
function InspectorRegion() {
|
||||
Region.call(this);
|
||||
|
||||
this.buildRegion();
|
||||
}
|
||||
|
||||
InspectorRegion.prototype = Object.create(Region.prototype);
|
||||
InspectorRegion.prototype.constructor = Region;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
InspectorRegion.prototype.buildRegion = function() {
|
||||
var metadataPart = {
|
||||
name: 'properties-location',
|
||||
title: 'Properties and Location',
|
||||
// Which modes should the region part be visible in? If
|
||||
// nothing provided here, then assumed that part is visible
|
||||
// in both. The visibility or otherwise of a region part
|
||||
// should be decided by a policy. In this case, 'modes' is a
|
||||
// shortcut that is used by the EditableRegionPolicy.
|
||||
modes: ['browse', 'edit'],
|
||||
content: {
|
||||
key: 'object-properties'
|
||||
}
|
||||
};
|
||||
this.addPart(metadataPart, 0);
|
||||
}
|
||||
|
||||
return InspectorRegion;
|
||||
}
|
||||
);
|
89
platform/commonUI/browse/src/TypeRegionDecorator.js
Normal file
89
platform/commonUI/browse/src/TypeRegionDecorator.js
Normal file
@ -0,0 +1,89 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[
|
||||
'./InspectorRegion'
|
||||
],
|
||||
function (InspectorRegion) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Adds default screen regions to Type definitions. Screen regions
|
||||
* are sections of the browse and edit view of an object that can be
|
||||
* customized on a per-type basis. Within {@link Region}s are {@link RegionPart}s.
|
||||
* Policies can be used to decide which parts are visible or not based on object state.
|
||||
* @memberOf platform/commonUI/regions
|
||||
* @see {@link Region}, {@link RegionPart}, {@link EditableRegionPolicy}
|
||||
* @constructor
|
||||
*/
|
||||
function TypeRegionDecorator(typeService) {
|
||||
this.typeService = typeService
|
||||
}
|
||||
|
||||
/**
|
||||
* Read Type bundle definition, and add default region definitions
|
||||
* if none provided.
|
||||
* @private
|
||||
* @param type
|
||||
* @returns {*}
|
||||
*/
|
||||
TypeRegionDecorator.prototype.decorateType = function (type) {
|
||||
var regions = type.getDefinition().regions || {};
|
||||
|
||||
regions.inspector = regions.inspector || new InspectorRegion();
|
||||
|
||||
type.getDefinition().regions = regions;
|
||||
|
||||
return type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Override the provider functions in order to return decorated Type
|
||||
* objects.
|
||||
* @returns {Array|*}
|
||||
*/
|
||||
TypeRegionDecorator.prototype.listTypes = function() {
|
||||
var self = this,
|
||||
types = this.typeService.listTypes();
|
||||
|
||||
return types.map(function (type) {
|
||||
return self.decorateType(type);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Override the provider function in order to return decorated Type
|
||||
* objects.
|
||||
* @param key
|
||||
*/
|
||||
TypeRegionDecorator.prototype.getType = function(key) {
|
||||
var self = this,
|
||||
type = this.typeService.getType(key);
|
||||
|
||||
return self.decorateType(type);
|
||||
};
|
||||
|
||||
return TypeRegionDecorator;
|
||||
}
|
||||
);
|
@ -19,49 +19,16 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<span class="l-inspect" ng-controller="ObjectInspectorController as controller">
|
||||
<span class="l-inspect">
|
||||
<div ng-controller="PaneController as modelPaneEdit">
|
||||
<mct-split-pane class='abs contents split-layout' anchor='bottom'>
|
||||
<div class="split-pane-component pane top">
|
||||
<div class="split-pane-component pane top" style="overflow-y:auto;">
|
||||
<div class="abs holder holder-inspector l-flex-col">
|
||||
<div class="pane-header flex-elem">Inspection</div>
|
||||
<ul class="flex-elem grows vscroll">
|
||||
<li>
|
||||
<em>Properties</em>
|
||||
<div class="inspector-properties"
|
||||
ng-repeat="data in metadata"
|
||||
ng-class="{ first:$index === 0 }">
|
||||
<div class="label">{{ data.name }}</div>
|
||||
<div class="value">{{ data.value }}</div>
|
||||
</div>
|
||||
</li>
|
||||
<li ng-if="contextutalParents.length > 0">
|
||||
<em title="The location of this linked object.">Location</em>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in contextutalParents"
|
||||
ng-class="{ last:($index + 1) === contextualParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = parent"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-if="primaryParents.length > 0">
|
||||
<em title="The location of the original object that this was linked from.">Original Location</em>
|
||||
<span class="inspector-location"
|
||||
ng-repeat="parent in primaryParents"
|
||||
ng-class="{ last:($index + 1) === primaryParents.length }">
|
||||
<mct-representation key="'label'"
|
||||
mct-object="parent"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = parent"
|
||||
class="location-item">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<mct-representation
|
||||
key="'inspector-region'"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel">
|
||||
</mct-representation>
|
||||
</div><!--/ holder-inspector -->
|
||||
</div><!--/ split-pane-component -->
|
||||
<mct-splitter class="splitter-inspect-panel mobile-hide"></mct-splitter>
|
||||
|
55
platform/commonUI/regions/bundle.js
Normal file
55
platform/commonUI/regions/bundle.js
Normal file
@ -0,0 +1,55 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'./src/RegionController',
|
||||
'./src/EditableRegionPolicy',
|
||||
'legacyRegistry'
|
||||
], function (
|
||||
RegionController,
|
||||
EditableRegionPolicy,
|
||||
legacyRegistry
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
legacyRegistry.register("platform/commonUI/regions", {
|
||||
"extensions": {
|
||||
"controllers": [
|
||||
{
|
||||
"key": "RegionController",
|
||||
"implementation": RegionController,
|
||||
"depends": [
|
||||
"$scope",
|
||||
"policyService"
|
||||
]
|
||||
}
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"category": "region",
|
||||
"implementation": EditableRegionPolicy
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
57
platform/commonUI/regions/src/EditableRegionPolicy.js
Normal file
57
platform/commonUI/regions/src/EditableRegionPolicy.js
Normal file
@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A policy for determining whether a region part should be visible or
|
||||
* not, based on its editability and the current state of the domain
|
||||
* object .
|
||||
* @constructor
|
||||
* @implements {Policy}
|
||||
* @memberof platform/commonUI/regions
|
||||
*/
|
||||
function EditableRegionPolicy() {
|
||||
}
|
||||
|
||||
EditableRegionPolicy.prototype.allow = function (regionPart, domainObject) {
|
||||
if (!regionPart.modes){
|
||||
return true;
|
||||
}
|
||||
if (domainObject.getCapability('status').get('editing')){
|
||||
//If the domain object is in edit mode, only include a part
|
||||
// if it is marked editable
|
||||
return regionPart.modes.indexOf('edit') != -1;
|
||||
} else {
|
||||
//If the domain object is not in edit mode, return any parts
|
||||
// that are not explicitly marked editable
|
||||
return regionPart.modes.indexOf('browse') != -1;
|
||||
}
|
||||
};
|
||||
|
||||
return EditableRegionPolicy;
|
||||
}
|
||||
);
|
94
platform/commonUI/regions/src/Region.js
Normal file
94
platform/commonUI/regions/src/Region.js
Normal file
@ -0,0 +1,94 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @typeDef {object} PartContents
|
||||
* @property {string} key If the part is defined as a
|
||||
* representation, the key corresponding to the representation.
|
||||
* @memberOf platform/commonUI/regions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typeDef {object} RegionPart
|
||||
* @property {string} name A unique name for this region part
|
||||
* @property {PartContents} content the details of the region part
|
||||
* being defined
|
||||
* @property {Array<string>} [modes] the modes that this region part
|
||||
* should be included in. Options are 'edit' and 'browse'. By
|
||||
* default, will be included in both. Inclusion of region parts is
|
||||
* determined by policies of category 'region'. By default, the
|
||||
* {EditableRegionPolicy} will be applied.
|
||||
* @memberOf platform/commonUI/regions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines the interface for a screen region. A screen region is a
|
||||
* section of the browse an edit screens for an object. Regions are
|
||||
* declared in object type definitions.
|
||||
* @memberOf platform/commonUI/regions
|
||||
* @abstract
|
||||
* @constructor
|
||||
*/
|
||||
function Region() {
|
||||
this.parts = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a part to this region.
|
||||
* @param {RegionPart} part the part to add
|
||||
* @param {number} [index] the position to insert the part. By default
|
||||
* will add to the end
|
||||
*/
|
||||
Region.prototype.addPart = function (part, index){
|
||||
if (index) {
|
||||
this.parts.splice(index, 0, part);
|
||||
} else {
|
||||
this.parts.push(part);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a part from this region.
|
||||
* @param {RegionPart} part the part to add
|
||||
* @param {number} [index] the position to insert the part. By default
|
||||
* will add to the end
|
||||
*/
|
||||
Region.prototype.removePart = function (part){
|
||||
if (typeof part === 'number') {
|
||||
this.parts.splice(part, 1);
|
||||
} else if (typeof part === 'string'){
|
||||
this.parts
|
||||
}
|
||||
else {
|
||||
this.parts.splice(this.parts.indexOf(part), 1);
|
||||
}
|
||||
};
|
||||
|
||||
return Region;
|
||||
}
|
||||
);
|
64
platform/commonUI/regions/src/RegionController.js
Normal file
64
platform/commonUI/regions/src/RegionController.js
Normal file
@ -0,0 +1,64 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* The RegionController adds region data for a domain object's type
|
||||
* to the scope.
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function RegionController($scope, policyService) {
|
||||
var domainObject = $scope.domainObject,
|
||||
typeCapability = domainObject.getCapability('type');
|
||||
|
||||
/**
|
||||
* TODO: Refactor this out, probably to a directive.
|
||||
* Or, alternatively, could have a regionCapability that returns
|
||||
* regions and parts filtered for applicability to current
|
||||
* object state.
|
||||
* @param regions
|
||||
* @returns {*}
|
||||
*/
|
||||
function filterParts(regions) {
|
||||
//Dupe so we're not modifying the type definition.
|
||||
var filteredRegions = {};
|
||||
for (var regionName in regions) {
|
||||
filteredRegions[regionName] = Object.create(regions[regionName]);
|
||||
filteredRegions[regionName].parts = regions[regionName].parts.filter(function(part){
|
||||
return policyService.allow('region', part, domainObject);
|
||||
});
|
||||
}
|
||||
return filteredRegions;
|
||||
}
|
||||
|
||||
$scope.regions = filterParts(typeCapability.getDefinition().regions);
|
||||
}
|
||||
|
||||
return RegionController;
|
||||
}
|
||||
);
|
45
platform/commonUI/regions/test/InspectorRegionSpec.js
Normal file
45
platform/commonUI/regions/test/InspectorRegionSpec.js
Normal file
@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
|
||||
|
||||
/**
|
||||
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
|
||||
*/
|
||||
define(
|
||||
["../src/InspectorRegion"],
|
||||
function (InspectorRegion) {
|
||||
"use strict";
|
||||
|
||||
describe("The inspector region", function () {
|
||||
var inspectorRegion;
|
||||
|
||||
beforeEach(function () {
|
||||
inspectorRegion = new InspectorRegion;
|
||||
});
|
||||
|
||||
it("creates default region parts", function () {
|
||||
expect(inspectorRegion.parts().length).toBe(2);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
3
platform/commonUI/regions/test/suite.json
Normal file
3
platform/commonUI/regions/test/suite.json
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
"InspectorRegion"
|
||||
]
|
@ -25,15 +25,45 @@ define([
|
||||
"./src/LayoutController",
|
||||
"./src/FixedController",
|
||||
"./src/LayoutCompositionPolicy",
|
||||
"../../commonUI/browse/src/InspectorRegion",
|
||||
"./src/PlotOptionsController",
|
||||
'legacyRegistry'
|
||||
], function (
|
||||
LayoutController,
|
||||
FixedController,
|
||||
LayoutCompositionPolicy,
|
||||
InspectorRegion,
|
||||
PlotOptionsController,
|
||||
legacyRegistry
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Customize and extend the default 'Inspector' region for the panel
|
||||
* type, to add display options for plots. This should be moved to a
|
||||
* dedicated type.
|
||||
* @type {InspectorRegion}
|
||||
*/
|
||||
var plotInspector = new InspectorRegion(),
|
||||
plotOptionsBrowsePart = {
|
||||
name: "plot-options",
|
||||
title: "Plot Options",
|
||||
modes: ['browse'],
|
||||
content: {
|
||||
key: "plot-options-browse"
|
||||
}
|
||||
},
|
||||
plotOptionsEditPart = {
|
||||
name: "plot-options",
|
||||
title: "Plot Options",
|
||||
modes: ['edit'],
|
||||
content: {
|
||||
key: "plot-options-browse"
|
||||
}
|
||||
};
|
||||
plotInspector.addPart(plotOptionsBrowsePart);
|
||||
plotInspector.addPart(plotOptionsEditPart);
|
||||
|
||||
legacyRegistry.register("platform/features/layout", {
|
||||
"name": "Layout components.",
|
||||
"description": "Plug in adding Layout capabilities.",
|
||||
@ -192,6 +222,10 @@ define([
|
||||
{
|
||||
"key": "frame",
|
||||
"templateUrl": "templates/frame.html"
|
||||
},
|
||||
{
|
||||
"key": "plot-options-browse",
|
||||
"templateUrl": "templates/plot-options-browse.html"
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
@ -213,6 +247,13 @@ define([
|
||||
"telemetryFormatter",
|
||||
"throttle"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "PlotOptionsController",
|
||||
"implementation": PlotOptionsController,
|
||||
"depends": [
|
||||
"$scope"
|
||||
]
|
||||
}
|
||||
],
|
||||
"templates": [
|
||||
@ -312,7 +353,12 @@ define([
|
||||
"property": "layoutGrid",
|
||||
"conversion": "number[]"
|
||||
}
|
||||
]
|
||||
],
|
||||
"regions": {
|
||||
"inspector": plotInspector
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
<style>
|
||||
.l-inspect .inspector-plot-options .plot-options-form .label {
|
||||
text-transform: none;
|
||||
}
|
||||
.l-inspect .inspector-plot-options .plot-options-form .form .controls {
|
||||
width: 50%;
|
||||
}
|
||||
.l-inspect .inspector-plot-options .plot-options-form .form .label {
|
||||
width: 50%;
|
||||
min-width: 50px;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.l-inspect .inspector-plot-options .plot-options-form {
|
||||
padding-left: 20px;
|
||||
}
|
||||
.l-inspect .inspector-plot-options .plot-options-form .form-row {
|
||||
border-top: none;
|
||||
}
|
||||
.l-inspect .inspector-plot-options .plot-options-form .form .form-row.first {
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
</style>
|
||||
<div ng-controller="PlotOptionsController" class="inspector-plot-options">
|
||||
<em>Display</em>
|
||||
<ul class="first flex-elem grows vscroll">
|
||||
<ul class="tree">
|
||||
<li ng-repeat="child in children">
|
||||
<span ng-controller="ToggleController as toggle">
|
||||
<span ng-controller="TreeNodeController as treeNode">
|
||||
<span class="tree-item menus-to-left">
|
||||
<span
|
||||
class='ui-symbol view-control flex-elem'
|
||||
ng-class="{ 'has-children': model.composition !== undefined, expanded: toggle.isActive() }"
|
||||
ng-click="toggle.toggle(); treeNode.trackExpansion()">
|
||||
</span>
|
||||
<mct-representation
|
||||
class="rep-object-label"
|
||||
key="'label'"
|
||||
mct-object="child">
|
||||
</mct-representation>
|
||||
</span>
|
||||
</span>
|
||||
<div class="plot-options-form">
|
||||
<mct-form
|
||||
ng-class="{hidden: !toggle.isActive()}"
|
||||
ng-model="plotOptionsModel"
|
||||
structure="plotOptionsStructure"
|
||||
name="plotOptionsState"
|
||||
class="flex-elem">
|
||||
</mct-form>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
87
platform/features/layout/src/PlotOptionsController.js
Normal file
87
platform/features/layout/src/PlotOptionsController.js
Normal file
@ -0,0 +1,87 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT Web 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 Web 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.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* This bundle implements object types and associated views for
|
||||
* display-building.
|
||||
* @namespace platform/features/layout
|
||||
*/
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* The LayoutController is responsible for supporting the
|
||||
* Layout view. It arranges frames according to saved configuration
|
||||
* and provides methods for updating these based on mouse
|
||||
* movement.
|
||||
* @memberof platform/features/layout
|
||||
* @constructor
|
||||
* @param {Scope} $scope the controller's Angular scope
|
||||
*/
|
||||
function PlotOptionsController($scope) {
|
||||
var self = this,
|
||||
plotOptionsStructure = {
|
||||
'name':'Plot Options',
|
||||
'sections': [{
|
||||
'rows':[
|
||||
{
|
||||
'name': 'Markers',
|
||||
'control': 'checkbox',
|
||||
'key': 'markers'
|
||||
},
|
||||
{
|
||||
'name': 'No Line',
|
||||
'control': 'checkbox',
|
||||
'key': 'noLine'
|
||||
},
|
||||
{
|
||||
'name': 'Step Line',
|
||||
'control': 'checkbox',
|
||||
'key': 'stepLine'
|
||||
},
|
||||
{
|
||||
'name': 'Linear Line',
|
||||
'control': 'checkbox',
|
||||
'key': 'linearLine'
|
||||
}
|
||||
]
|
||||
}]},
|
||||
plotOptionsModel = {};
|
||||
|
||||
$scope.plotOptionsStructure = plotOptionsStructure;
|
||||
$scope.plotOptionsModel = plotOptionsModel;
|
||||
|
||||
$scope.domainObject.useCapability('composition').then(function(children){
|
||||
$scope.children = children;
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return PlotOptionsController;
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user