mirror of
https://github.com/nasa/openmct.git
synced 2025-05-28 05:04:18 +00:00
[API] Remove bundles.json
...and make its usage optional.
This commit is contained in:
parent
1443ab61e3
commit
72c721b605
34
app.js
34
app.js
@ -40,20 +40,26 @@
|
||||
}
|
||||
|
||||
// Override bundles.json for HTTP requests
|
||||
app.use('/' + BUNDLE_FILE, function (req, res) {
|
||||
var bundles = JSON.parse(fs.readFileSync(BUNDLE_FILE, 'utf8'));
|
||||
|
||||
// Handle command line inclusions/exclusions
|
||||
bundles = bundles.concat(options.include);
|
||||
bundles = bundles.filter(function (bundle) {
|
||||
return options.exclude.indexOf(bundle) === -1;
|
||||
});
|
||||
bundles = bundles.filter(function (bundle, index) { // Uniquify
|
||||
return bundles.indexOf(bundle) === index;
|
||||
});
|
||||
|
||||
res.send(JSON.stringify(bundles));
|
||||
});
|
||||
//app.use('/' + BUNDLE_FILE, function (req, res) {
|
||||
// var bundles;
|
||||
//
|
||||
// try {
|
||||
// bundles = JSON.parse(fs.readFileSync(BUNDLE_FILE, 'utf8'));
|
||||
// } catch (e) {
|
||||
// bundles = [];
|
||||
// }
|
||||
//
|
||||
// // Handle command line inclusions/exclusions
|
||||
// bundles = bundles.concat(options.include);
|
||||
// bundles = bundles.filter(function (bundle) {
|
||||
// return options.exclude.indexOf(bundle) === -1;
|
||||
// });
|
||||
// bundles = bundles.filter(function (bundle, index) { // Uniquify
|
||||
// return bundles.indexOf(bundle) === index;
|
||||
// });
|
||||
//
|
||||
// res.send(JSON.stringify(bundles));
|
||||
//});
|
||||
|
||||
// Expose everything else as static files
|
||||
app.use(express['static']('.'));
|
||||
|
38
bundles.json
38
bundles.json
@ -1,38 +0,0 @@
|
||||
[
|
||||
"platform/framework",
|
||||
"platform/core",
|
||||
"platform/representation",
|
||||
"platform/commonUI/about",
|
||||
"platform/commonUI/edit",
|
||||
"platform/commonUI/dialog",
|
||||
"platform/commonUI/formats",
|
||||
"platform/commonUI/general",
|
||||
"platform/commonUI/inspect",
|
||||
"platform/commonUI/mobile",
|
||||
"platform/commonUI/themes/espresso",
|
||||
"platform/commonUI/notification",
|
||||
"platform/containment",
|
||||
"platform/execution",
|
||||
"platform/telemetry",
|
||||
"platform/features/clock",
|
||||
"platform/features/events",
|
||||
"platform/features/imagery",
|
||||
"platform/features/layout",
|
||||
"platform/features/pages",
|
||||
"platform/features/plot",
|
||||
"platform/features/scrolling",
|
||||
"platform/features/timeline",
|
||||
"platform/forms",
|
||||
"platform/identity",
|
||||
"platform/persistence/aggregator",
|
||||
"platform/persistence/local",
|
||||
"platform/persistence/queue",
|
||||
"platform/policy",
|
||||
"platform/entanglement",
|
||||
"platform/search",
|
||||
"platform/status",
|
||||
|
||||
"example/imagery",
|
||||
"example/eventGenerator",
|
||||
"example/generator"
|
||||
]
|
@ -130,7 +130,20 @@ define(
|
||||
// Load all bundles named in the referenced file. The file is
|
||||
// presumed to be a JSON file
|
||||
function loadBundlesFromFile(listFile) {
|
||||
return getJSON(listFile).then(loadBundlesFromArray);
|
||||
function handleError(err) {
|
||||
$log.info([
|
||||
"No external bundles loaded;",
|
||||
"could not load bundle listing in",
|
||||
listFile,
|
||||
"due to error",
|
||||
err.status,
|
||||
err.statusText
|
||||
].join(' '));
|
||||
return loadBundlesFromArray([]);
|
||||
}
|
||||
|
||||
return getJSON(listFile)
|
||||
.then(loadBundlesFromArray, handleError);
|
||||
}
|
||||
|
||||
return Array.isArray(bundles) ? loadBundlesFromArray(bundles) :
|
||||
|
Loading…
x
Reference in New Issue
Block a user