From d6f6fa6b6c790d5b1fecf7768d17114c16b41fc6 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 31 Dec 2014 13:43:47 -0800 Subject: [PATCH] [Autoflow] Bring in example taxonomy Bring in example taxonomy and gitignore changes from topic branch for WTD-614 into open-source-friendly branch, in preparation to merge. --- .gitignore | 1 + example/taxonomy/bundle.json | 29 +++++++++++ .../src/ExampleTaxonomyModelProvider.js | 48 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 example/taxonomy/bundle.json create mode 100644 example/taxonomy/src/ExampleTaxonomyModelProvider.js diff --git a/.gitignore b/.gitignore index 4ac1605459..e034b4100b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.tgz *.DS_Store *.idea +*.sass-cache # External dependencies diff --git a/example/taxonomy/bundle.json b/example/taxonomy/bundle.json new file mode 100644 index 0000000000..167cadc055 --- /dev/null +++ b/example/taxonomy/bundle.json @@ -0,0 +1,29 @@ +{ + "name": "Example taxonomy", + "description": "Example illustrating the addition of a static top-level hierarchy", + "extensions": { + "roots": [ + { + "id": "exampleTaxonomy", + "model": { + "type": "folder", + "name": "Stub Subsystems", + "composition": [ + "examplePacket0", + "examplePacket1", + "examplePacket2" + ] + } + } + ], + "components": [ + { + "provides": "modelService", + "type": "provider", + "implementation": "ExampleTaxonomyModelProvider.js", + "depends": [ "$q" ] + } + ] + + } +} \ No newline at end of file diff --git a/example/taxonomy/src/ExampleTaxonomyModelProvider.js b/example/taxonomy/src/ExampleTaxonomyModelProvider.js new file mode 100644 index 0000000000..342418143e --- /dev/null +++ b/example/taxonomy/src/ExampleTaxonomyModelProvider.js @@ -0,0 +1,48 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + function ExampleTaxonomyModelProvider($q) { + var models = {}, + packetId, + telemetryId, + i, + j; + + // Add some "subsystems" + for (i = 0; i < 3; i += 1) { + packetId = "examplePacket" + i; + + models[packetId] = { + name: "Stub Subsystem " + (i + 1), + type: "telemetry.panel", + composition: [] + }; + + // Add some "telemetry points" + for (j = 0; j < 100 * (i + 1); j += 1) { + telemetryId = "exampleTelemetry" + j; + models[telemetryId] = { + name: "SWG" + i + "." + j, + type: "generator", + telemetry: { + period: 10 + i + j + } + }; + models[packetId].composition.push(telemetryId); + } + } + + return { + getModels: function () { + return $q.when(models); + } + }; + } + + return ExampleTaxonomyModelProvider; + } +); \ No newline at end of file