[API] Miscellaneous platform updates

Adds miscellaneous platform updates to include templates
via the RequireJS text plugin; to support modification of
asset paths; and to support priority order for gestures.

Supports integration of new API, #1124.
This commit is contained in:
Victor Woeltjen 2016-09-30 10:25:22 -07:00
parent 7439d949c4
commit a93f41f1c3
7 changed files with 41 additions and 14 deletions

View File

@ -41,6 +41,7 @@ define([
"text!./res/templates/items/items.html", "text!./res/templates/items/items.html",
"text!./res/templates/browse/object-properties.html", "text!./res/templates/browse/object-properties.html",
"text!./res/templates/browse/inspector-region.html", "text!./res/templates/browse/inspector-region.html",
"text!./res/templates/view-object.html",
'legacyRegistry' 'legacyRegistry'
], function ( ], function (
BrowseController, BrowseController,
@ -63,6 +64,7 @@ define([
itemsTemplate, itemsTemplate,
objectPropertiesTemplate, objectPropertiesTemplate,
inspectorRegionTemplate, inspectorRegionTemplate,
viewObjectTemplate,
legacyRegistry legacyRegistry
) { ) {
@ -142,7 +144,7 @@ define([
"representations": [ "representations": [
{ {
"key": "view-object", "key": "view-object",
"templateUrl": "templates/view-object.html" "template": viewObjectTemplate
}, },
{ {
"key": "browse-object", "key": "browse-object",

View File

@ -48,6 +48,7 @@ define([
"./src/directives/MCTSplitPane", "./src/directives/MCTSplitPane",
"./src/directives/MCTSplitter", "./src/directives/MCTSplitter",
"./src/directives/MCTTree", "./src/directives/MCTTree",
"./src/filters/ReverseFilter.js",
"text!./res/templates/bottombar.html", "text!./res/templates/bottombar.html",
"text!./res/templates/controls/action-button.html", "text!./res/templates/controls/action-button.html",
"text!./res/templates/controls/input-filter.html", "text!./res/templates/controls/input-filter.html",
@ -96,6 +97,7 @@ define([
MCTSplitPane, MCTSplitPane,
MCTSplitter, MCTSplitter,
MCTTree, MCTTree,
ReverseFilter,
bottombarTemplate, bottombarTemplate,
actionButtonTemplate, actionButtonTemplate,
inputFilterTemplate, inputFilterTemplate,
@ -146,7 +148,8 @@ define([
"depends": [ "depends": [
"stylesheets[]", "stylesheets[]",
"$document", "$document",
"THEME" "THEME",
"ASSETS_PATH"
] ]
}, },
{ {
@ -158,7 +161,7 @@ define([
], ],
"filters": [ "filters": [
{ {
"implementation": "filters/ReverseFilter.js", "implementation": ReverseFilter,
"key": "reverse" "key": "reverse"
} }
], ],
@ -405,6 +408,11 @@ define([
"key": "THEME", "key": "THEME",
"value": "unspecified", "value": "unspecified",
"priority": "fallback" "priority": "fallback"
},
{
"key": "ASSETS_PATH",
"value": ".",
"priority": "fallback"
} }
], ],
"containers": [ "containers": [

View File

@ -38,7 +38,7 @@ define(
* @param $document Angular's jqLite-wrapped document element * @param $document Angular's jqLite-wrapped document element
* @param {string} activeTheme the theme in use * @param {string} activeTheme the theme in use
*/ */
function StyleSheetLoader(stylesheets, $document, activeTheme) { function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
var head = $document.find('head'), var head = $document.find('head'),
document = $document[0]; document = $document[0];
@ -47,6 +47,7 @@ define(
// Create a link element, and construct full path // Create a link element, and construct full path
var link = document.createElement('link'), var link = document.createElement('link'),
path = [ path = [
assetPath,
stylesheet.bundle.path, stylesheet.bundle.path,
stylesheet.bundle.resources, stylesheet.bundle.resources,
stylesheet.stylesheetUrl stylesheet.stylesheetUrl

View File

@ -42,11 +42,19 @@ define(
function addWorker(worker) { function addWorker(worker) {
var key = worker.key; var key = worker.key;
if (!workerUrls[key]) { if (!workerUrls[key]) {
workerUrls[key] = [ if (worker.scriptUrl) {
worker.bundle.path, workerUrls[key] = [
worker.bundle.sources, worker.bundle.path,
worker.scriptUrl worker.bundle.sources,
].join("/"); worker.scriptUrl
].join("/");
} else if (worker.scriptText) {
var blob = new Blob(
[worker.scriptText],
{type: 'application/javascript'}
);
workerUrls[key] = URL.createObjectURL(blob);
}
sharedWorkers[key] = worker.shared; sharedWorkers[key] = worker.shared;
} }
} }

View File

@ -27,6 +27,9 @@ define([
"./src/controllers/TableOptionsController", "./src/controllers/TableOptionsController",
'../../commonUI/regions/src/Region', '../../commonUI/regions/src/Region',
'../../commonUI/browse/src/InspectorRegion', '../../commonUI/browse/src/InspectorRegion',
"text!./res/templates/table-options-edit.html",
"text!./res/templates/rt-table.html",
"text!./res/templates/historical-table.html",
"legacyRegistry" "legacyRegistry"
], function ( ], function (
MCTTable, MCTTable,
@ -35,6 +38,9 @@ define([
TableOptionsController, TableOptionsController,
Region, Region,
InspectorRegion, InspectorRegion,
tableOptionsEditTemplate,
rtTableTemplate,
historicalTableTemplate,
legacyRegistry legacyRegistry
) { ) {
/** /**
@ -127,8 +133,8 @@ define([
{ {
"name": "Historical Table", "name": "Historical Table",
"key": "table", "key": "table",
"template": historicalTableTemplate,
"cssclass": "icon-tabular", "cssclass": "icon-tabular",
"templateUrl": "templates/historical-table.html",
"needs": [ "needs": [
"telemetry" "telemetry"
], ],
@ -139,7 +145,7 @@ define([
"name": "Real-time Table", "name": "Real-time Table",
"key": "rt-table", "key": "rt-table",
"cssclass": "icon-tabular-realtime", "cssclass": "icon-tabular-realtime",
"templateUrl": "templates/rt-table.html", "templateUrl": rtTableTemplate,
"needs": [ "needs": [
"telemetry" "telemetry"
], ],
@ -157,7 +163,7 @@ define([
"representations": [ "representations": [
{ {
"key": "table-options-edit", "key": "table-options-edit",
"templateUrl": "templates/table-options-edit.html" "template": tableOptionsEditTemplate
} }
], ],
"stylesheets": [ "stylesheets": [

View File

@ -72,7 +72,7 @@ define(
// Assemble all gestures into a map, for easy look up // Assemble all gestures into a map, for easy look up
gestures.forEach(function (gesture) { gestures.forEach(function (gesture) {
gestureMap[gesture.key] = gesture; gestureMap[gesture.key] = gestureMap[gesture.key] || gesture;
}); });
this.gestureMap = gestureMap; this.gestureMap = gestureMap;

View File

@ -28,6 +28,7 @@ define([
"text!./res/templates/search-item.html", "text!./res/templates/search-item.html",
"text!./res/templates/search.html", "text!./res/templates/search.html",
"text!./res/templates/search-menu.html", "text!./res/templates/search-menu.html",
"text!./src/services/GenericSearchWorker.js",
'legacyRegistry' 'legacyRegistry'
], function ( ], function (
SearchController, SearchController,
@ -37,6 +38,7 @@ define([
searchItemTemplate, searchItemTemplate,
searchTemplate, searchTemplate,
searchMenuTemplate, searchMenuTemplate,
searchWorkerText,
legacyRegistry legacyRegistry
) { ) {
@ -114,7 +116,7 @@ define([
"workers": [ "workers": [
{ {
"key": "genericSearchWorker", "key": "genericSearchWorker",
"scriptUrl": "services/GenericSearchWorker.js" "scriptText": searchWorkerText
} }
] ]
} }