mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 03:00:13 +00:00
Compare commits
16 Commits
condition-
...
activity-v
Author | SHA1 | Date | |
---|---|---|---|
b7a94a9dd5 | |||
2b11b8d63c | |||
006e99fb07 | |||
63dc4b6253 | |||
85868f690e | |||
b1f34f7cd7 | |||
8785d9a9d7 | |||
3a6e1fd301 | |||
8161e4fc89 | |||
abf7654027 | |||
8fba707321 | |||
8ad5cca936 | |||
754d484501 | |||
74717b59c3 | |||
ffdb19787b | |||
5dc0d8c7f8 |
@ -68,6 +68,7 @@
|
|||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
openmct.install(openmct.plugins.SummaryWidget());
|
openmct.install(openmct.plugins.SummaryWidget());
|
||||||
|
openmct.install(openmct.plugins.ActivityModes());
|
||||||
openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0});
|
openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0});
|
||||||
openmct.time.timeSystem('utc');
|
openmct.time.timeSystem('utc');
|
||||||
openmct.start();
|
openmct.start();
|
||||||
|
@ -49,7 +49,8 @@ requirejs.config({
|
|||||||
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
"d3-format": "node_modules/d3-format/build/d3-format.min",
|
||||||
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
"d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min",
|
||||||
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
"d3-time": "node_modules/d3-time/build/d3-time.min",
|
||||||
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min"
|
"d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min",
|
||||||
|
"d3-dsv": "node_modules/d3-dsv/build/d3-dsv.min"
|
||||||
},
|
},
|
||||||
"shim": {
|
"shim": {
|
||||||
"angular": {
|
"angular": {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
"d3-axis": "^1.0.4",
|
"d3-axis": "^1.0.4",
|
||||||
"d3-collection": "^1.0.2",
|
"d3-collection": "^1.0.2",
|
||||||
"d3-color": "^1.0.2",
|
"d3-color": "^1.0.2",
|
||||||
|
"d3-dsv": "^1.0.8",
|
||||||
"d3-format": "^1.0.2",
|
"d3-format": "^1.0.2",
|
||||||
"d3-interpolate": "^1.1.3",
|
"d3-interpolate": "^1.1.3",
|
||||||
"d3-scale": "^1.0.4",
|
"d3-scale": "^1.0.4",
|
||||||
|
@ -32,6 +32,7 @@ define([
|
|||||||
"./src/controllers/TimelineTOIController",
|
"./src/controllers/TimelineTOIController",
|
||||||
"./src/controllers/ActivityModeValuesController",
|
"./src/controllers/ActivityModeValuesController",
|
||||||
"./src/capabilities/ActivityTimespanCapability",
|
"./src/capabilities/ActivityTimespanCapability",
|
||||||
|
"./src/capabilities/ActivityValueCapability",
|
||||||
"./src/capabilities/TimelineTimespanCapability",
|
"./src/capabilities/TimelineTimespanCapability",
|
||||||
"./src/capabilities/UtilizationCapability",
|
"./src/capabilities/UtilizationCapability",
|
||||||
"./src/capabilities/GraphCapability",
|
"./src/capabilities/GraphCapability",
|
||||||
@ -42,6 +43,7 @@ define([
|
|||||||
"./src/services/ObjectLoader",
|
"./src/services/ObjectLoader",
|
||||||
"./src/chart/MCTTimelineChart",
|
"./src/chart/MCTTimelineChart",
|
||||||
"text!./res/templates/values.html",
|
"text!./res/templates/values.html",
|
||||||
|
"text!./res/templates/activity-view.html",
|
||||||
"text!./res/templates/timeline.html",
|
"text!./res/templates/timeline.html",
|
||||||
"text!./res/templates/activity-gantt.html",
|
"text!./res/templates/activity-gantt.html",
|
||||||
"text!./res/templates/tabular-swimlane-cols-tree.html",
|
"text!./res/templates/tabular-swimlane-cols-tree.html",
|
||||||
@ -64,6 +66,7 @@ define([
|
|||||||
TimelineTOIController,
|
TimelineTOIController,
|
||||||
ActivityModeValuesController,
|
ActivityModeValuesController,
|
||||||
ActivityTimespanCapability,
|
ActivityTimespanCapability,
|
||||||
|
ActivityValueCapability,
|
||||||
TimelineTimespanCapability,
|
TimelineTimespanCapability,
|
||||||
UtilizationCapability,
|
UtilizationCapability,
|
||||||
GraphCapability,
|
GraphCapability,
|
||||||
@ -74,6 +77,7 @@ define([
|
|||||||
ObjectLoader,
|
ObjectLoader,
|
||||||
MCTTimelineChart,
|
MCTTimelineChart,
|
||||||
valuesTemplate,
|
valuesTemplate,
|
||||||
|
activityTemplate,
|
||||||
timelineTemplate,
|
timelineTemplate,
|
||||||
activityGanttTemplate,
|
activityGanttTemplate,
|
||||||
tabularSwimlaneColsTreeTemplate,
|
tabularSwimlaneColsTreeTemplate,
|
||||||
@ -204,7 +208,9 @@ define([
|
|||||||
"composition": [],
|
"composition": [],
|
||||||
"start": {
|
"start": {
|
||||||
"timestamp": 0
|
"timestamp": 0
|
||||||
}
|
},
|
||||||
|
"activityStart": {},
|
||||||
|
"activityDuration": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -304,6 +310,17 @@ define([
|
|||||||
],
|
],
|
||||||
"editable": false
|
"editable": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "activityValues",
|
||||||
|
"name": "Activity Values",
|
||||||
|
"cssClass": "icon-activity",
|
||||||
|
"template": activityTemplate,
|
||||||
|
"type": "activity",
|
||||||
|
"uses": [
|
||||||
|
"activityValue"
|
||||||
|
],
|
||||||
|
"editable": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "timeline",
|
"key": "timeline",
|
||||||
"name": "Timeline",
|
"name": "Timeline",
|
||||||
@ -555,6 +572,10 @@ define([
|
|||||||
{
|
{
|
||||||
"key": "cost",
|
"key": "cost",
|
||||||
"implementation": CostCapability
|
"implementation": CostCapability
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "activityValue",
|
||||||
|
"implementation": ActivityValueCapability
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directives": [
|
"directives": [
|
||||||
|
27
platform/features/timeline/res/templates/activity-view.html
Normal file
27
platform/features/timeline/res/templates/activity-view.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!--
|
||||||
|
Open MCT, Copyright (c) 2009-2016, 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.
|
||||||
|
-->
|
||||||
|
<ul ng-controller="ActivityModeValuesController as controller" class="cols cols-2-ff properties">
|
||||||
|
<li ng-repeat="(key, value) in activityValue" class="l-row s-row">
|
||||||
|
<span class="col col-100px s-title"></span>
|
||||||
|
<span class="col s-value">{{value}}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
@ -21,27 +21,48 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define(
|
define(
|
||||||
[],
|
['EventEmitter'],
|
||||||
function () {
|
function (EventEmitter) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the time span of an activity object.
|
* Describes the time span of an activity object.
|
||||||
* @param model the activity's object model
|
* @param model the activity's object model
|
||||||
*/
|
*/
|
||||||
function ActivityTimespan(model, mutation) {
|
function ActivityTimespan(model, mutation, parentTimeline) {
|
||||||
|
var parentTimelineModel = parentTimeline.getModel(),
|
||||||
|
parentMutation = parentTimeline.getCapability('mutation');
|
||||||
|
|
||||||
|
function getTimelineActivityStart (domainObjectModel) {
|
||||||
|
if (domainObjectModel.activityStart && domainObjectModel.activityStart[model.id]) {
|
||||||
|
return domainObjectModel.activityStart[model.id];
|
||||||
|
} else {
|
||||||
|
return model.start.timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTimelineActivityDuration (domainObjectModel) {
|
||||||
|
if (domainObjectModel.activityDuration && domainObjectModel.activityDuration[model.id]) {
|
||||||
|
return domainObjectModel.activityDuration[model.id];
|
||||||
|
} else {
|
||||||
|
return model.duration.timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get the start time for this timeline
|
// Get the start time for this timeline
|
||||||
function getStart() {
|
function getStart() {
|
||||||
return model.start.timestamp;
|
return getTimelineActivityStart(parentTimelineModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the end time for this timeline
|
// Get the end time for this timeline
|
||||||
function getEnd() {
|
function getEnd() {
|
||||||
return model.start.timestamp + model.duration.timestamp;
|
var start = getTimelineActivityStart(parentTimelineModel),
|
||||||
|
duration = getTimelineActivityDuration(parentTimelineModel);
|
||||||
|
|
||||||
|
return start + duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the duration of this timeline
|
// Get the duration of this timeline
|
||||||
function getDuration() {
|
function getDuration() {
|
||||||
return model.duration.timestamp;
|
return getTimelineActivityDuration(parentTimelineModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the epoch used by this timeline
|
// Get the epoch used by this timeline
|
||||||
@ -52,26 +73,41 @@ define(
|
|||||||
// Set the start time associated with this object
|
// Set the start time associated with this object
|
||||||
function setStart(value) {
|
function setStart(value) {
|
||||||
var end = getEnd();
|
var end = getEnd();
|
||||||
mutation.mutate(function (m) {
|
|
||||||
m.start.timestamp = Math.max(value, 0);
|
parentMutation.mutate(function (m) {
|
||||||
// Update duration to keep end time
|
m.activityStart[model.id] = Math.max(value,0);
|
||||||
m.duration.timestamp = Math.max(end - value, 0);
|
m.activityDuration[model.id] = Math.max(end - value, 0);
|
||||||
}, model.modified);
|
});
|
||||||
|
|
||||||
|
// mutation.mutate(function (m) {
|
||||||
|
// m.start.timestamp = Math.max(value, 0);
|
||||||
|
// // Update duration to keep end time
|
||||||
|
// m.duration.timestamp = Math.max(end - value, 0);
|
||||||
|
// }, model.modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the duration associated with this object
|
// Set the duration associated with this object
|
||||||
function setDuration(value) {
|
function setDuration(value) {
|
||||||
mutation.mutate(function (m) {
|
parentMutation.mutate(function (m) {
|
||||||
m.duration.timestamp = Math.max(value, 0);
|
m.activityDuration[model.id] = Math.max(value, 0);
|
||||||
}, model.modified);
|
});
|
||||||
|
|
||||||
|
// mutation.mutate(function (m) {
|
||||||
|
// m.duration.timestamp = Math.max(value, 0);
|
||||||
|
// }, model.modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the end time associated with this object
|
// Set the end time associated with this object
|
||||||
function setEnd(value) {
|
function setEnd(value) {
|
||||||
var start = getStart();
|
var start = getStart();
|
||||||
mutation.mutate(function (m) {
|
|
||||||
m.duration.timestamp = Math.max(value - start, 0);
|
parentMutation.mutate(function (m) {
|
||||||
}, model.modified);
|
m.activityDuration[model.id] = Math.max(value - start, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// mutation.mutate(function (m) {
|
||||||
|
// m.duration.timestamp = Math.max(value - start, 0);
|
||||||
|
// }, model.modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -32,11 +32,26 @@ define(
|
|||||||
* @param {DomainObject} domainObject the Activity
|
* @param {DomainObject} domainObject the Activity
|
||||||
*/
|
*/
|
||||||
function ActivityTimespanCapability($q, domainObject) {
|
function ActivityTimespanCapability($q, domainObject) {
|
||||||
|
|
||||||
|
function findTimeline (object) {
|
||||||
|
var parent = domainObject.getCapability('context').parentObject;
|
||||||
|
|
||||||
|
while (parent.getModel().type !== 'timeline') {
|
||||||
|
parent = parent.getCapability('context').parentObject;
|
||||||
|
findTimeline(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
var parent = findTimeline(domainObject);
|
||||||
|
|
||||||
// Promise time span
|
// Promise time span
|
||||||
function promiseTimeSpan() {
|
function promiseTimeSpan() {
|
||||||
return $q.when(new ActivityTimespan(
|
return $q.when(new ActivityTimespan(
|
||||||
domainObject.getModel(),
|
domainObject.getModel(),
|
||||||
domainObject.getCapability('mutation')
|
domainObject.getCapability('mutation'),
|
||||||
|
parent
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2009-2016, 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 () {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exposes costs associated with a subsystem mode.
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function ActivityValueCapability(domainObject) {
|
||||||
|
var model = domainObject.getModel();
|
||||||
|
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Get a list of resource types which have associated
|
||||||
|
* costs for this object. Returned values are machine-readable
|
||||||
|
* keys, and should be paired with external metadata for
|
||||||
|
* presentation (see category of extension `resources`).
|
||||||
|
* @returns {string[]} resource types
|
||||||
|
*/
|
||||||
|
resources: function () {
|
||||||
|
return Object.keys(model.resources || {}).sort();
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Get the cost associated with a resource of an identified
|
||||||
|
* type (typically, one of the types reported from a
|
||||||
|
* `resources` call.)
|
||||||
|
* @param {string} key the resource type
|
||||||
|
* @returns {number} the associated cost
|
||||||
|
*/
|
||||||
|
cost: function (key) {
|
||||||
|
return (model.resources || {})[key] || 0;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Get an object containing key-value pairs describing
|
||||||
|
* resource utilization as described by this object.
|
||||||
|
* Keys are resource types; values are levels of associated
|
||||||
|
* resource utilization.
|
||||||
|
* @returns {object} resource utilizations
|
||||||
|
*/
|
||||||
|
invoke: function () {
|
||||||
|
return {key: 'deep is the best'};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only applies to subsystem modes.
|
||||||
|
ActivityValueCapability.appliesTo = function (model) {
|
||||||
|
return (model || {}).type === 'activity';
|
||||||
|
};
|
||||||
|
|
||||||
|
return ActivityValueCapability;
|
||||||
|
}
|
||||||
|
);
|
@ -30,7 +30,7 @@ define(
|
|||||||
*/
|
*/
|
||||||
function CostCapability(domainObject) {
|
function CostCapability(domainObject) {
|
||||||
var model = domainObject.getModel();
|
var model = domainObject.getModel();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Get a list of resource types which have associated
|
* Get a list of resource types which have associated
|
||||||
|
47
src/plugins/activityModes/plugin.js
Normal file
47
src/plugins/activityModes/plugin.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
define(['./src/actions/activityModesImportAction'], function (ActivityModes) {
|
||||||
|
function plugin() {
|
||||||
|
|
||||||
|
return function install(openmct) {
|
||||||
|
|
||||||
|
openmct.legacyRegistry.register("src/plugins/activityModes", {
|
||||||
|
"name": "Activity Import",
|
||||||
|
"description": "Defines a root named My Items",
|
||||||
|
"extensions": {
|
||||||
|
"roots": [
|
||||||
|
{
|
||||||
|
"id": "activity-import"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"id": "activity-import",
|
||||||
|
"model": {
|
||||||
|
"name": "Activity Import",
|
||||||
|
"type": "folder",
|
||||||
|
"composition": [],
|
||||||
|
"location": "ROOT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
openmct.legacyRegistry.enable("src/plugins/activityModes");
|
||||||
|
|
||||||
|
openmct.legacyExtension('actions', {
|
||||||
|
key: "import-csv",
|
||||||
|
category: ["contextual"],
|
||||||
|
implementation: ActivityModes,
|
||||||
|
cssClass: "major icon-import",
|
||||||
|
name: "Import Activity Definitions from CSV",
|
||||||
|
description: "Import activities from a CSV file",
|
||||||
|
depends: [
|
||||||
|
"dialogService",
|
||||||
|
"openmct"
|
||||||
|
]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugin;
|
||||||
|
});
|
@ -0,0 +1,127 @@
|
|||||||
|
define(['d3-dsv'], function (d3Dsv) {
|
||||||
|
|
||||||
|
function ActivityModesImportAction(dialogService, openmct, context) {
|
||||||
|
this.dialogService = dialogService;
|
||||||
|
this.openmct = openmct;
|
||||||
|
this.context = context;
|
||||||
|
this.parent = this.context.domainObject;
|
||||||
|
this.instantiate = this.openmct.$injector.get("instantiate");
|
||||||
|
|
||||||
|
this.instantiateActivities = this.instantiateActivities.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityModesImportAction.prototype.perform = function () {
|
||||||
|
this.dialogService.getUserInput(this.getFormModel(), function () {})
|
||||||
|
.then(function (form) {
|
||||||
|
if(form.selectFile.name.slice(-3) !== 'csv'){
|
||||||
|
this.displayError();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.csvParse(form.selectFile.body).then(this.instantiateActivities);
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModesImportAction.prototype.csvParse = function (csvString) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var parsedObject = d3Dsv.csvParse(csvString);
|
||||||
|
|
||||||
|
return parsedObject ? resolve(parsedObject) : reject('Could not parse provided file');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModesImportAction.prototype.instantiateActivities = function (csvObjects) {
|
||||||
|
var parent = this.context.domainObject,
|
||||||
|
parentId = parent.getId(),
|
||||||
|
parentComposition = parent.getCapability("composition"),
|
||||||
|
activitiesObjects = [],
|
||||||
|
activityModesObjects = [];
|
||||||
|
|
||||||
|
csvObjects.forEach(function (activity) {
|
||||||
|
var newActivity = {},
|
||||||
|
newActivityMode = {};
|
||||||
|
|
||||||
|
newActivity.name = activity.name;
|
||||||
|
newActivity.start = {timestamp: 0, epoch: "SET"};
|
||||||
|
newActivity.duration = {timestamp: Number(activity.duration), epoch: "SET"};
|
||||||
|
newActivity.type = "activity";
|
||||||
|
newActivity.relationships = {modes: []};
|
||||||
|
|
||||||
|
activitiesObjects.push(newActivity);
|
||||||
|
|
||||||
|
newActivityMode.name = activity.name + ' Resources';
|
||||||
|
newActivityMode.resources = {comms: Number(activity.comms), power: Number(activity.power)};
|
||||||
|
newActivityMode.type = 'mode';
|
||||||
|
|
||||||
|
activityModesObjects.push(newActivityMode);
|
||||||
|
});
|
||||||
|
|
||||||
|
var folderComposition = this.createActivityModesFolder().getCapability('composition');
|
||||||
|
|
||||||
|
activityModesObjects.forEach(function (activityMode, index) {
|
||||||
|
var newActivityModeInstance = this.instantiate(activityMode, 'activity-mode-' + index);
|
||||||
|
|
||||||
|
newActivityModeInstance.getCapability('location').setPrimaryLocation('activity-modes-folder');
|
||||||
|
folderComposition.add(newActivityModeInstance);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
activitiesObjects.forEach(function (activity, index) {
|
||||||
|
activity.relationships.modes.push('activity-mode-' + index);
|
||||||
|
activity.id = 'activity-' + index;
|
||||||
|
|
||||||
|
var newActivityInstance = this.instantiate(activity, 'activity-' + index);
|
||||||
|
|
||||||
|
newActivityInstance.getCapability('location').setPrimaryLocation(parentId);
|
||||||
|
parentComposition.add(newActivityInstance);
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModesImportAction.prototype.createActivityModesFolder = function () {
|
||||||
|
var folderInstance = this.instantiate({name: 'Activity-Modes', type: 'folder', composition: []}, 'activity-modes-folder');
|
||||||
|
folderInstance.getCapability('location').setPrimaryLocation(this.parent.getId());
|
||||||
|
this.parent.getCapability('composition').add(folderInstance);
|
||||||
|
|
||||||
|
return folderInstance;
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModesImportAction.prototype.displayError = function () {
|
||||||
|
var dialog,
|
||||||
|
perform = this.perform.bind(this),
|
||||||
|
model = {
|
||||||
|
title: "Invalid File",
|
||||||
|
actionText: "The selected file was not a valid CSV file",
|
||||||
|
severity: "error",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "Ok",
|
||||||
|
callback: function () {
|
||||||
|
dialog.dismiss();
|
||||||
|
perform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
dialog = this.dialogService.showBlockingMessage(model);
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModesImportAction.prototype.getFormModel = function () {
|
||||||
|
return {
|
||||||
|
name: 'Import activities from CSV',
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
name: 'Import A File',
|
||||||
|
rows: [
|
||||||
|
{
|
||||||
|
name: 'Select File',
|
||||||
|
key: 'selectFile',
|
||||||
|
control: 'file-input',
|
||||||
|
required: true,
|
||||||
|
text: 'Select File'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return ActivityModesImportAction;
|
||||||
|
});
|
@ -30,6 +30,7 @@ define([
|
|||||||
'../../platform/import-export/bundle',
|
'../../platform/import-export/bundle',
|
||||||
'./summaryWidget/plugin',
|
'./summaryWidget/plugin',
|
||||||
'./URLIndicatorPlugin/URLIndicatorPlugin',
|
'./URLIndicatorPlugin/URLIndicatorPlugin',
|
||||||
|
'./activityModes/plugin',
|
||||||
'./telemetryMean/plugin'
|
'./telemetryMean/plugin'
|
||||||
], function (
|
], function (
|
||||||
_,
|
_,
|
||||||
@ -41,6 +42,7 @@ define([
|
|||||||
ImportExport,
|
ImportExport,
|
||||||
SummaryWidget,
|
SummaryWidget,
|
||||||
URLIndicatorPlugin,
|
URLIndicatorPlugin,
|
||||||
|
ActivityModes,
|
||||||
TelemetryMean
|
TelemetryMean
|
||||||
) {
|
) {
|
||||||
var bundleMap = {
|
var bundleMap = {
|
||||||
@ -129,6 +131,7 @@ define([
|
|||||||
plugins.SummaryWidget = SummaryWidget;
|
plugins.SummaryWidget = SummaryWidget;
|
||||||
plugins.TelemetryMean = TelemetryMean;
|
plugins.TelemetryMean = TelemetryMean;
|
||||||
plugins.URLIndicatorPlugin = URLIndicatorPlugin;
|
plugins.URLIndicatorPlugin = URLIndicatorPlugin;
|
||||||
|
plugins.ActivityModes = ActivityModes;
|
||||||
|
|
||||||
return plugins;
|
return plugins;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user