@fleetbase/ember-core 0.2.0 → 0.2.1

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.
@@ -546,16 +546,24 @@ export default class FetchService extends Service {
546
546
  .then((response) => response.json())
547
547
  .catch((error) => {
548
548
  this.notifications.serverError(error, 'File upload failed.');
549
+
550
+ if (typeof errorCallback === 'function') {
551
+ errorCallback(error);
552
+ }
549
553
  });
550
554
 
551
- const model = this.store.push(this.store.normalize('file', upload.file));
552
- set(file, 'model', model);
555
+ if (upload) {
556
+ const model = this.store.push(this.store.normalize('file', upload.file));
557
+ set(file, 'model', model);
558
+
559
+ if (typeof callback === 'function') {
560
+ callback(model);
561
+ }
553
562
 
554
- if (typeof callback === 'function') {
555
- callback(model);
563
+ return model;
556
564
  }
557
565
 
558
- return model;
566
+ return null;
559
567
  } catch (error) {
560
568
  queue.remove(file);
561
569
  this.notifications.serverError(error, 'File upload failed.');
@@ -16,7 +16,11 @@ export default class NotificationsService extends EmberNotificationsService {
16
16
  return this.error(errorMessage, options);
17
17
  }
18
18
 
19
- return this.error(error ?? fallbackMessage, options);
19
+ if (typeof error === 'string') {
20
+ return this.error(error, options);
21
+ }
22
+
23
+ return this.error(fallbackMessage, options);
20
24
  }
21
25
 
22
26
  invoke(type, message, ...params) {
@@ -759,6 +759,12 @@ export default class UniverseService extends Service.extend(Evented) {
759
759
  const index = this._getOption(options, 'index', 0);
760
760
  const onClick = this._getOption(options, 'onClick', null);
761
761
  const section = this._getOption(options, 'section', null);
762
+ const iconSize = this._getOption(options, 'iconSize', null);
763
+ const iconClass = this._getOption(options, 'iconClass', null);
764
+ const itemClass = this._getOption(options, 'class', null);
765
+ const inlineClass = this._getOption(options, 'inlineClass', null);
766
+ const wrapperClass = this._getOption(options, 'wrapperClass', null);
767
+ const overwriteWrapperClass = this._getOption(options, 'overwriteWrapperClass', false);
762
768
 
763
769
  // dasherize route segments
764
770
  if (typeof route === 'string') {
@@ -784,6 +790,12 @@ export default class UniverseService extends Service.extend(Evented) {
784
790
  index,
785
791
  section,
786
792
  onClick,
793
+ iconSize,
794
+ iconClass,
795
+ class: itemClass,
796
+ inlineClass,
797
+ wrapperClass,
798
+ overwriteWrapperClass,
787
799
  };
788
800
 
789
801
  return menuItem;
@@ -1,10 +1,16 @@
1
- export default function getResourceNameFromTransition(transition) {
1
+ import humanize from './humanize';
2
+
3
+ export default function getResourceNameFromTransition(transition, options = {}) {
2
4
  const { to } = transition;
3
5
 
4
6
  if (typeof to.name === 'string') {
5
7
  let routePathSegments = to.name.split('.');
6
8
  let resourceName = routePathSegments[3];
7
9
 
10
+ if (options.humanize === true) {
11
+ return humanize(resourceName);
12
+ }
13
+
8
14
  return resourceName;
9
15
  }
10
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/ember-core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Provides all the core services, decorators and utilities for building a Fleetbase extension for the Console.",
5
5
  "keywords": [
6
6
  "fleetbase-core",