-
Notifications
You must be signed in to change notification settings - Fork 7
/
loader.js
136 lines (124 loc) · 4.74 KB
/
loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
define([
'openmct',
'./src/AMMOSPlugins',
'./src/styles/sass/vista.scss',
'./src/commandEventsView/plugin',
'./src/messagesView/plugin',
'./src/product-status/plugin',
'./about.html',
'./src/metadataAction/plugin',
'./src/clearDataIndicator/plugin',
'./src/dictionaryView/plugin',
'./src/packetSummary/plugin',
'./src/containerView/plugin',
'services/identity/MCWSIdentityProvider',
'./src/persistence/plugin'
], function (
openmct,
AMMOSPlugins,
VistaStyles, /** Do not delete, needed for webpack to compile scss file*/
CommandEventsViewPlugin,
MessagesPlugin,
ProductStatusPlugin,
AboutTemplate,
MetadataActionPlugin,
ClearDataIndicator,
DictionaryViewPlugin,
PacketSummaryPlugin,
ContainerViewPlugin,
IdentityProvider,
MCWSPersistenceProviderPlugin
) {
function loader(config) {
let persistenceLoaded;
const persistenceLoadedPromise = new Promise(resolve => {
persistenceLoaded = resolve;
});
openmct.setAssetPath(config.assetPath);
//Optional Themes
if (config.theme) {
openmct.install(openmct.plugins[config.theme]());
} else {
openmct.install(openmct.plugins.Snow());
}
openmct.install(openmct.plugins.Filters([
'vista.alarmsView',
'telemetry.plot.overlay',
'table',
'vista.chanTableGroup',
'vista.commandEventsView',
'vista.messagesView',
'vista.evrView'
]));
openmct.install(openmct.plugins.ObjectMigration());
openmct.install(openmct.plugins.DisplayLayout({
showAsView: [
'summary-widget', 'vista.packetSummaryEvents', 'vista.dataProducts',
'vista.packets', 'vista.frameSummary', 'vista.frameWatch'
]
}));
openmct.install(openmct.plugins.ClearData([
'table', 'telemetry.plot.overlay', 'telemetry.plot.stacked',
'vista.packetSummaryEvents', 'vista.dataProducts', 'vista.packets',
'vista.frameSummary', 'vista.frameWatch', 'vista.chanTableGroup'
],
{
indicator: false
}
));
openmct.install(ClearDataIndicator.default(config.globalStalenessInterval));
openmct.install(CommandEventsViewPlugin.default(config.tablePerformanceOptions));
openmct.install(MessagesPlugin.default(config.tablePerformanceOptions));
openmct.install(ProductStatusPlugin.default(config.tablePerformanceOptions));
openmct.install(openmct.plugins.UTCTimeSystem())
openmct.install(openmct.plugins.Notebook());
openmct.install(MetadataActionPlugin.default());
openmct.install(DictionaryViewPlugin.default(config.tablePerformanceOptions));
openmct.install(PacketSummaryPlugin.default(config.tablePerformanceOptions));
openmct.install(ContainerViewPlugin.default());
openmct.install(openmct.plugins.Clock(
{ useClockIndicator: false }
));
openmct.install(new AMMOSPlugins(config));
openmct.user.setProvider(new IdentityProvider.default(openmct));
if (config.useDeveloperStorage) {
openmct.install(openmct.plugins.LocalStorage());
openmct.install(openmct.plugins.MyItems());
persistenceLoaded();
} else {
const mcwsPersistenceProvider = MCWSPersistenceProviderPlugin.default(config.namespaces);
openmct.install(async (_openmct) => {
await mcwsPersistenceProvider(_openmct);
persistenceLoaded();
});
}
if (config.plugins) {
if (config.plugins.summaryWidgets) {
openmct.install(openmct.plugins.SummaryWidget());
}
}
openmct.branding({
aboutHtml: insertBuildInfo(AboutTemplate),
});
// do not show telemetry if it falls out of bounds
// even if there is no new telemetry
openmct.telemetry.greedyLAD(false);
persistenceLoadedPromise.then(() => {
openmct.start();
window.openmct = openmct;
});
}
/**
* Replaces placeholders in the HTML with build info provided by webpack.
* Build info is defined in webpack config, and is exposed as global
* JavaScript variables
* @param {*} markup
*/
function insertBuildInfo(markup) {
return markup.replace(/\$\{project\.version\}/g, __VISTA_VERSION__)
.replace(/\$\{timestamp\}/g, __VISTA_BUILD_DATE__)
.replace(/\$\{buildNumber\}/g, __VISTA_REVISION__)
.replace(/\$\{branch\}/g, __VISTA_BUILD_BRANCH__);
}
return loader;
});