@fleetbase/ember-core 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,16 +94,29 @@ export default class ApplicationAdapter extends RESTAdapter {
94
94
  */
95
95
  getHeaders() {
96
96
  const headers = {};
97
- const isAuthenticated = this.session.isAuthenticated;
98
97
  const userId = this.session.data.authenticated.user;
99
98
  const userOptions = getUserOptions();
100
99
  const isSandbox = get(userOptions, `${userId}:sandbox`) === true;
101
100
  const testKey = get(userOptions, `${userId}:testKey`);
101
+ let isAuthenticated = this.session.isAuthenticated;
102
+ let { token } = this.session.data.authenticated;
103
+
104
+ // If the session data is not yet available, check localStorage
105
+ if (!isAuthenticated) {
106
+ const localStorageSession = JSON.parse(window.localStorage.getItem('ember_simple_auth-session'));
107
+ if (localStorageSession) {
108
+ const { authenticated } = localStorageSession;
109
+ token = authenticated.token;
110
+
111
+ // Check isAuthenticated again
112
+ isAuthenticated = !!token;
113
+ }
114
+ }
102
115
 
103
116
  headers['Content-Type'] = 'application/json';
104
117
 
105
118
  if (isAuthenticated) {
106
- headers['Authorization'] = `Bearer ${this.session.data.authenticated.token}`;
119
+ headers['Authorization'] = `Bearer ${token}`;
107
120
  }
108
121
 
109
122
  if (isAuthenticated && isSandbox) {
@@ -13,6 +13,7 @@ const hostServices = [
13
13
  'crud',
14
14
  'notifications',
15
15
  'fileQueue',
16
+ 'universe',
16
17
  { hostRouter: 'router' },
17
18
  ];
18
19
 
@@ -14,6 +14,7 @@ const services = [
14
14
  'notifications',
15
15
  'hostRouter',
16
16
  'fileQueue',
17
+ 'universe',
17
18
  ];
18
19
 
19
20
  export default services;
@@ -0,0 +1,529 @@
1
+ import Service from '@ember/service';
2
+ import { tracked } from '@glimmer/tracking';
3
+ import { inject as service } from '@ember/service';
4
+ import { computed, action } from '@ember/object';
5
+ import { isBlank } from '@ember/utils';
6
+ import { isArray } from '@ember/array';
7
+ import { dasherize } from '@ember/string';
8
+ import { getOwner } from '@ember/application';
9
+ import { assert } from '@ember/debug';
10
+ import RSVP from 'rsvp';
11
+
12
+ export default class UniverseService extends Service {
13
+ @service router;
14
+ @tracked headerMenuItems = [];
15
+ @tracked organizationMenuItems = [];
16
+ @tracked userMenuItems = [];
17
+ @tracked adminRegistry = {
18
+ menuItems: [],
19
+ menuPanels: [],
20
+ };
21
+ @tracked accountRegistry = {
22
+ menuItems: [],
23
+ menuPanels: [],
24
+ };
25
+ @tracked settingsRegistry = {
26
+ menuItems: [],
27
+ menuPanels: [],
28
+ };
29
+
30
+ /**
31
+ * Computed property that returns all administrative menu items.
32
+ *
33
+ * @computed adminMenuItems
34
+ * @public
35
+ * @readonly
36
+ * @memberof UniverseService
37
+ * @returns {Array} Array of administrative menu items
38
+ */
39
+ @computed('adminRegistry.menuItems.[]') get adminMenuItems() {
40
+ return this.adminRegistry.menuItems;
41
+ }
42
+
43
+ /**
44
+ * Computed property that returns all administrative menu panels.
45
+ *
46
+ * @computed adminMenuPanels
47
+ * @public
48
+ * @readonly
49
+ * @memberof UniverseService
50
+ * @returns {Array} Array of administrative menu panels
51
+ */
52
+ @computed('adminRegistry.menuPanels.[]') get adminMenuPanels() {
53
+ return this.adminRegistry.menuPanels;
54
+ }
55
+
56
+ /**
57
+ * Computed property that returns all settings menu items.
58
+ *
59
+ * @computed settingsMenuItems
60
+ * @public
61
+ * @readonly
62
+ * @memberof UniverseService
63
+ * @returns {Array} Array of administrative menu items
64
+ */
65
+ @computed('settingsRegistry.menuItems.[]') get settingsMenuItems() {
66
+ return this.settingsRegistry.menuItems;
67
+ }
68
+
69
+ /**
70
+ * Computed property that returns all settings menu panels.
71
+ *
72
+ * @computed settingsMenuPanels
73
+ * @public
74
+ * @readonly
75
+ * @memberof UniverseService
76
+ * @returns {Array} Array of administrative menu panels
77
+ */
78
+ @computed('settingsRegistry.menuPanels.[]') get settingsMenuPanels() {
79
+ return this.settingsRegistry.menuPanels;
80
+ }
81
+
82
+ /**
83
+ * Action to transition to a specified route based on the provided menu item.
84
+ *
85
+ * The route transition will include the 'slug' as a dynamic segment, and
86
+ * the 'view' as an optional dynamic segment if it is defined.
87
+ *
88
+ * @action
89
+ * @memberof UniverseService
90
+ * @param {string} route - The target route to transition to.
91
+ * @param {Object} menuItem - The menu item containing the transition parameters.
92
+ * @param {string} menuItem.slug - The 'slug' dynamic segment for the route.
93
+ * @param {string} [menuItem.view] - The 'view' dynamic segment for the route, if applicable.
94
+ *
95
+ * @returns {Transition} Returns a Transition object representing the transition to the route.
96
+ */
97
+ @action transitionMenuItem(route, menuItem) {
98
+ const { slug, view } = menuItem;
99
+
100
+ if (view) {
101
+ return this.router.transitionTo(route, slug, view);
102
+ }
103
+
104
+ return this.router.transitionTo(route, slug, 'index');
105
+ }
106
+
107
+ /**
108
+ * Loads a component from the specified registry based on a given slug and view.
109
+ *
110
+ * @param {string} registryName - The name of the registry where the component is located.
111
+ * @param {string} slug - The slug of the menu item.
112
+ * @param {string} [view=null] - The view of the menu item, if applicable.
113
+ *
114
+ * @returns {Promise} Returns a Promise that resolves with the component if it is found, or null.
115
+ */
116
+ loadComponentFromRegistry(registryName, slug, view = null) {
117
+ const registry = this[`${registryName}Registry`];
118
+
119
+ if (isBlank(registry)) {
120
+ return null;
121
+ }
122
+
123
+ return new Promise((resolve) => {
124
+ let component = null;
125
+
126
+ // check menu items first
127
+ for (let i = 0; i < registry.menuItems.length; i++) {
128
+ const menuItem = registry.menuItems[i];
129
+
130
+ // no view hack
131
+ if (menuItem && menuItem.slug === slug && menuItem.view === null && view === 'index') {
132
+ component = menuItem.component;
133
+ break;
134
+ }
135
+
136
+ if (menuItem && menuItem.slug === slug && menuItem.view === view) {
137
+ component = menuItem.component;
138
+ break;
139
+ }
140
+ }
141
+
142
+ // check menu panels
143
+ for (let i = 0; i < registry.menuPanels.length; i++) {
144
+ const menuPanel = registry.menuPanels[i];
145
+
146
+ if (menuPanel && isArray(menuPanel.items)) {
147
+ for (let j = 0; j < menuPanel.items.length; j++) {
148
+ const menuItem = menuPanel.items[j];
149
+
150
+ // no view hack
151
+ if (menuItem && menuItem.slug === slug && menuItem.view === null && view === 'index') {
152
+ component = menuItem.component;
153
+ break;
154
+ }
155
+
156
+ if (menuItem && menuItem.slug === slug && menuItem.view === view) {
157
+ component = menuItem.component;
158
+ break;
159
+ }
160
+ }
161
+ }
162
+ }
163
+
164
+ resolve(component);
165
+ });
166
+ }
167
+
168
+ /**
169
+ * Looks up a menu item from the specified registry based on a given slug and view.
170
+ *
171
+ * @param {string} registryName - The name of the registry where the menu item is located.
172
+ * @param {string} slug - The slug of the menu item.
173
+ * @param {string} [view=null] - The view of the menu item, if applicable.
174
+ *
175
+ * @returns {Promise} Returns a Promise that resolves with the menu item if it is found, or null.
176
+ */
177
+ lookupMenuItemFromRegistry(registryName, slug, view = null) {
178
+ const registry = this[`${registryName}Registry`];
179
+
180
+ if (isBlank(registry)) {
181
+ return null;
182
+ }
183
+
184
+ return new Promise((resolve) => {
185
+ let foundMenuItem = null;
186
+
187
+ // check menu items first
188
+ for (let i = 0; i < registry.menuItems.length; i++) {
189
+ const menuItem = registry.menuItems[i];
190
+
191
+ // no view hack
192
+ if (menuItem && menuItem.slug === slug && menuItem.view === null && view === 'index') {
193
+ foundMenuItem = menuItem;
194
+ break;
195
+ }
196
+
197
+ if (menuItem && menuItem.slug === slug && menuItem.view === view) {
198
+ foundMenuItem = menuItem;
199
+ break;
200
+ }
201
+ }
202
+
203
+ // check menu panels
204
+ for (let i = 0; i < registry.menuPanels.length; i++) {
205
+ const menuPanel = registry.menuPanels[i];
206
+
207
+ if (menuPanel && isArray(menuPanel.items)) {
208
+ for (let j = 0; j < menuPanel.items.length; j++) {
209
+ const menuItem = menuPanel.items[j];
210
+
211
+ // no view hack
212
+ if (menuItem && menuItem.slug === slug && menuItem.view === null && view === 'index') {
213
+ foundMenuItem = menuItem;
214
+ break;
215
+ }
216
+
217
+ if (menuItem && menuItem.slug === slug && menuItem.view === view) {
218
+ foundMenuItem = menuItem;
219
+ break;
220
+ }
221
+ }
222
+ }
223
+ }
224
+
225
+ resolve(foundMenuItem);
226
+ });
227
+ }
228
+
229
+ /**
230
+ * Registers a new menu panel in a registry.
231
+ *
232
+ * @method registerMenuPanel
233
+ * @public
234
+ * @memberof UniverseService
235
+ * @param {String} registryName The name of the registry to use
236
+ * @param {String} title The title of the panel
237
+ * @param {Array} items The items of the panel
238
+ * @param {Object} options Additional options for the panel
239
+ */
240
+ registerMenuPanel(registryName, title, items = [], options = {}) {
241
+ const open = this._getOption(options, 'open', true);
242
+ const slug = this._getOption(options, 'slug', dasherize(title));
243
+
244
+ this[`${registryName}Registry`].menuPanels.pushObject({
245
+ title,
246
+ open,
247
+ items: items.map(({ title, route, ...options }) => {
248
+ options.slug = slug;
249
+ options.view = dasherize(title);
250
+
251
+ return this._createMenuItem(title, route, options);
252
+ }),
253
+ });
254
+ }
255
+
256
+ /**
257
+ * Registers a new menu item in a registry.
258
+ *
259
+ * @method registerMenuItem
260
+ * @public
261
+ * @memberof UniverseService
262
+ * @param {String} registryName The name of the registry to use
263
+ * @param {String} title The title of the item
264
+ * @param {String} route The route of the item
265
+ * @param {Object} options Additional options for the item
266
+ */
267
+ registerMenuItem(registryName, title, options = {}) {
268
+ const route = this._getOption(options, 'route', `console.${registryName}.virtual`);
269
+ options.slug = this._getOption(options, 'slug', '~');
270
+ options.view = this._getOption(options, 'view', dasherize(title));
271
+
272
+ // not really a fan of assumptions, but will do this for the timebeing till anyone complains
273
+ if (options.slug === options.view) {
274
+ options.view = null;
275
+ }
276
+
277
+ this[`${registryName}Registry`].menuItems.pushObject(this._createMenuItem(title, route, options));
278
+ }
279
+
280
+ /**
281
+ * Registers a new administrative menu panel.
282
+ *
283
+ * @method registerAdminMenuPanel
284
+ * @public
285
+ * @memberof UniverseService
286
+ * @param {String} title The title of the panel
287
+ * @param {Array} items The items of the panel
288
+ * @param {Object} options Additional options for the panel
289
+ */
290
+ registerAdminMenuPanel(title, items = [], options = {}) {
291
+ options.section = this._getOption(options, 'section', 'admin');
292
+ this.registerMenuPanel('admin', title, items, options);
293
+ }
294
+
295
+ /**
296
+ * Registers a new administrative menu item.
297
+ *
298
+ * @method registerAdminMenuItem
299
+ * @public
300
+ * @memberof UniverseService
301
+ * @param {String} title The title of the item
302
+ * @param {Object} options Additional options for the item
303
+ */
304
+ registerAdminMenuItem(title, options = {}) {
305
+ this.registerMenuItem('admin', title, options);
306
+ }
307
+
308
+ /**
309
+ * Registers a new settings menu panel.
310
+ *
311
+ * @method registerSettingsMenuPanel
312
+ * @public
313
+ * @memberof UniverseService
314
+ * @param {String} title The title of the panel
315
+ * @param {Array} items The items of the panel
316
+ * @param {Object} options Additional options for the panel
317
+ */
318
+ registerSettingsMenuPanel(title, items = [], options = {}) {
319
+ this.registerMenuPanel('settings', title, items, options);
320
+ }
321
+
322
+ /**
323
+ * Registers a new settings menu item.
324
+ *
325
+ * @method registerSettingsMenuItem
326
+ * @public
327
+ * @memberof UniverseService
328
+ * @param {String} title The title of the item
329
+ * @param {Object} options Additional options for the item
330
+ */
331
+ registerSettingsMenuItem(title, options = {}) {
332
+ this.registerMenuItem('settings', title, options);
333
+ }
334
+
335
+ /**
336
+ * Registers a new header menu item.
337
+ *
338
+ * @method registerHeaderMenuItem
339
+ * @public
340
+ * @memberof UniverseService
341
+ * @param {String} title The title of the item
342
+ * @param {String} route The route of the item
343
+ * @param {Object} options Additional options for the item
344
+ */
345
+ registerHeaderMenuItem(title, route, options = {}) {
346
+ this.headerMenuItems.pushObject(this._createMenuItem(title, route, options));
347
+ this.headerMenuItems.sort((a, b) => a.priority - b.priority);
348
+ }
349
+
350
+ /**
351
+ * Registers a new organization menu item.
352
+ *
353
+ * @method registerOrganizationMenuItem
354
+ * @public
355
+ * @memberof UniverseService
356
+ * @param {String} title The title of the item
357
+ * @param {String} route The route of the item
358
+ * @param {Object} options Additional options for the item
359
+ */
360
+ registerOrganizationMenuItem(title, options = {}) {
361
+ const route = this._getOption(options, 'route', 'console.virtual');
362
+ options.index = this._getOption(options, 'index', 0);
363
+ options.section = this._getOption(options, 'section', 'settings');
364
+
365
+ this.organizationMenuItems.pushObject(this._createMenuItem(title, route, options));
366
+ }
367
+
368
+ /**
369
+ * Registers a new organization menu item.
370
+ *
371
+ * @method registerOrganizationMenuItem
372
+ * @public
373
+ * @memberof UniverseService
374
+ * @param {String} title The title of the item
375
+ * @param {String} route The route of the item
376
+ * @param {Object} options Additional options for the item
377
+ */
378
+ registerUserMenuItem(title, options = {}) {
379
+ const route = this._getOption(options, 'route', 'console.virtual');
380
+ options.index = this._getOption(options, 'index', 0);
381
+ options.section = this._getOption(options, 'section', 'account');
382
+
383
+ this.userMenuItems.pushObject(this._createMenuItem(title, route, options));
384
+ }
385
+
386
+ /**
387
+ * Returns the value of a given key on a target object, with a default value.
388
+ *
389
+ * @method _getOption
390
+ * @private
391
+ * @memberof UniverseService
392
+ * @param {Object} target The target object
393
+ * @param {String} key The key to get value for
394
+ * @param {*} defaultValue The default value if the key does not exist
395
+ * @returns {*} The value of the key or default value
396
+ */
397
+ _getOption(target, key, defaultValue = null) {
398
+ return target[key] !== undefined ? target[key] : defaultValue;
399
+ }
400
+
401
+ /**
402
+ * Creates a new menu item with the provided information.
403
+ *
404
+ * @method _createMenuItem
405
+ * @private
406
+ * @memberof UniverseService
407
+ * @param {String} title The title of the item
408
+ * @param {String} route The route of the item
409
+ * @param {Object} options Additional options for the item
410
+ * @returns {Object} A new menu item object
411
+ */
412
+ _createMenuItem(title, route, options = {}) {
413
+ const priority = this._getOption(options, 'priority', 9);
414
+ const icon = this._getOption(options, 'icon', 'circle-dot');
415
+ const items = this._getOption(options, 'items');
416
+ const component = this._getOption(options, 'component');
417
+ const componentParams = this._getOption(options, 'componentParams', {});
418
+ const slug = this._getOption(options, 'slug', dasherize(title));
419
+ const view = this._getOption(options, 'view');
420
+ const queryParams = this._getOption(options, 'queryParams', {});
421
+ const index = this._getOption(options, 'index', 0);
422
+ const onClick = this._getOption(options, 'onClick', null);
423
+ const section = this._getOption(options, 'section', null);
424
+
425
+ // todo: create menu item class
426
+ const menuItem = {
427
+ title,
428
+ route,
429
+ icon,
430
+ priority,
431
+ items,
432
+ component,
433
+ componentParams,
434
+ slug,
435
+ queryParams,
436
+ view,
437
+ index,
438
+ section,
439
+ };
440
+
441
+ // send default params into onClick
442
+ if (typeof onClick === 'function') {
443
+ menuItem.onClick = () => {
444
+ return onClick(menuItem);
445
+ };
446
+ }
447
+
448
+ return menuItem;
449
+ }
450
+
451
+ /**
452
+ * Load the specified engine. If it is not loaded yet, it will use assetLoader
453
+ * to load it and then register it to the router.
454
+ *
455
+ * @method loadEngine
456
+ * @public
457
+ * @memberof UniverseService
458
+ * @param {String} name The name of the engine to load
459
+ * @returns {Promise} A promise that resolves with the constructed engine instance
460
+ */
461
+ loadEngine(name) {
462
+ const router = getOwner(this).lookup('router:main');
463
+ const instanceId = 'manual'; // Arbitrary instance id, should be unique per engine
464
+ const mountPoint = null; // No mount point for manually loaded engines
465
+
466
+ if (!router._enginePromises[name]) {
467
+ router._enginePromises[name] = Object.create(null);
468
+ }
469
+
470
+ let enginePromise = router._enginePromises[name][instanceId];
471
+
472
+ // We already have a Promise for this engine instance
473
+ if (enginePromise) {
474
+ return enginePromise;
475
+ }
476
+
477
+ if (router._engineIsLoaded(name)) {
478
+ // The Engine is loaded, but has no Promise
479
+ enginePromise = RSVP.resolve();
480
+ } else {
481
+ // The Engine is not loaded and has no Promise
482
+ enginePromise = router._assetLoader.loadBundle(name).then(
483
+ () => router._registerEngine(name),
484
+ (error) => {
485
+ router._enginePromises[name][instanceId] = undefined;
486
+ throw error;
487
+ }
488
+ );
489
+ }
490
+
491
+ return (router._enginePromises[name][instanceId] = enginePromise.then(() => {
492
+ return this.constructEngineInstance(name, instanceId, mountPoint);
493
+ }));
494
+ }
495
+
496
+ /**
497
+ * Construct an engine instance. If the instance does not exist yet, it will be created.
498
+ *
499
+ * @method constructEngineInstance
500
+ * @public
501
+ * @memberof UniverseService
502
+ * @param {String} name The name of the engine
503
+ * @param {String} instanceId The id of the engine instance
504
+ * @param {String} mountPoint The mount point of the engine
505
+ * @returns {Promise} A promise that resolves with the constructed engine instance
506
+ */
507
+ constructEngineInstance(name, instanceId, mountPoint) {
508
+ const owner = getOwner(this);
509
+
510
+ assert("You attempted to load the engine '" + name + "', but the engine cannot be found.", owner.hasRegistration(`engine:${name}`));
511
+
512
+ let engineInstances = owner.lookup('router:main')._engineInstances;
513
+
514
+ if (!engineInstances[name]) {
515
+ engineInstances[name] = Object.create(null);
516
+ }
517
+
518
+ let engineInstance = owner.buildChildEngineInstance(name, {
519
+ routable: true,
520
+ mountPoint,
521
+ });
522
+
523
+ engineInstances[name][instanceId] = engineInstance;
524
+
525
+ return engineInstance.boot().then(() => {
526
+ return engineInstance;
527
+ });
528
+ }
529
+ }
@@ -1,6 +1,18 @@
1
1
  import { dasherize } from '@ember/string';
2
2
  import hostServices from '../exports/host-services';
3
3
 
4
+ function routeNameFromExtension(extension) {
5
+ const mountName = extension.name.split('/')[1];
6
+ const mountPath = mountName.replace('-engine', '');
7
+ let route = mountPath;
8
+
9
+ if (extension.fleetbase && extension.fleetbase.route) {
10
+ route = extension.fleetbase.route;
11
+ }
12
+
13
+ return dasherize(route);
14
+ }
15
+
4
16
  export default function mapEngines(extensions, withServices = []) {
5
17
  const engines = {};
6
18
  const externalRoutes = {
@@ -10,9 +22,9 @@ export default function mapEngines(extensions, withServices = []) {
10
22
 
11
23
  for (let i = 0; i < extensions.length; i++) {
12
24
  const extension = extensions[i];
13
- const path = dasherize(extension.extension);
25
+ const route = routeNameFromExtension(extension);
14
26
 
15
- externalRoutes[path] = `console.${path}`;
27
+ externalRoutes[route] = `console.${route}`;
16
28
  }
17
29
 
18
30
  for (let i = 0; i < extensions.length; i++) {
@@ -0,0 +1 @@
1
+ export { default } from '@fleetbase/ember-core/services/universe';
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@fleetbase/ember-core",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Provides all the core services, decorators and utilities for building a Fleetbase extension for the Console.",
5
5
  "keywords": [
6
- "fleetbase-extension",
7
6
  "fleetbase-core",
8
7
  "fleetbase-services",
9
8
  "fleetbase",
10
- "ember-addon",
11
- "ember-engine"
9
+ "ember-addon"
12
10
  ],
13
11
  "repository": "https://github.com/fleetbase/ember-core",
14
12
  "license": "MIT",
@@ -1,47 +0,0 @@
1
- import { classify } from '@ember/string';
2
-
3
- export default function getPermissionAction(permissionName) {
4
- const permissionNameParts = permissionName.split(':');
5
- const fullActionName = permissionNameParts.lastObject;
6
- const actions = [
7
- 'create',
8
- 'update',
9
- 'delete',
10
- 'deactivate',
11
- 'get',
12
- 'list',
13
- 'cancel',
14
- 'optimize',
15
- 'roll',
16
- 'export',
17
- 'batch_delete',
18
- 'batch_cancel',
19
- 'notify',
20
- 'assign_vehicle',
21
- 'assign_order_to',
22
- 'dispatch_order_to',
23
- 'dispatch',
24
- 'assign',
25
- 'attach',
26
- 'sub_contract',
27
- 'create_order_for',
28
- ];
29
-
30
- if (permissionName.startsWith('auth')) {
31
- return fullActionName;
32
- }
33
-
34
- if (fullActionName === '*') {
35
- return 'All';
36
- }
37
-
38
- for (let i = 0; i < actions.length; i++) {
39
- const action = actions.objectAt(i);
40
-
41
- if (fullActionName.toLowerCase().startsWith(classify(action).toLowerCase())) {
42
- return classify(action);
43
- }
44
- }
45
-
46
- return 'N/A';
47
- }
@@ -1,16 +0,0 @@
1
- import getPermissionAction from './get-permission-action';
2
- import { classify } from '@ember/string';
3
- import { singularize } from 'ember-inflector';
4
-
5
- export default function getPermissionResource(permissionName = '') {
6
- if (permissionName.startsWith('auth')) {
7
- return 'N/A';
8
- }
9
-
10
- const permissionNameParts = permissionName.split(':');
11
- const fullActionName = permissionNameParts.lastObject;
12
- const actionName = getPermissionAction(permissionName);
13
- const resourceName = fullActionName.replace(actionName, '');
14
-
15
- return singularize(classify(resourceName));
16
- }
@@ -1,21 +0,0 @@
1
- // import { classify } from '@ember/string';
2
-
3
- export default function getServiceName(serviceName) {
4
- if (serviceName.toLowerCase().startsWith('fleet')) {
5
- return 'Fleet Ops';
6
- }
7
-
8
- if (serviceName.toLowerCase().startsWith('iam') || serviceName.toLowerCase().startsWith('identity')) {
9
- return 'IAM';
10
- }
11
-
12
- if (serviceName.toLowerCase().startsWith('auth')) {
13
- return 'Auth';
14
- }
15
-
16
- if (serviceName === 'developers' || serviceName.toLowerCase().startsWith('developers')) {
17
- return 'Developers Console';
18
- }
19
-
20
- return 'N/A';
21
- }
@@ -1 +0,0 @@
1
- export { default } from '@fleetbase/ember-core/utils/get-permission-action';
@@ -1 +0,0 @@
1
- export { default } from '@fleetbase/ember-core/utils/get-permission-resource';
@@ -1 +0,0 @@
1
- export { default } from '@fleetbase/ember-core/utils/get-service-name';