@fleetbase/ember-core 0.0.1 → 0.0.2

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.
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # @fleetbase/ember-core
2
2
 
3
- Ember Core Services, Utilities and Framework for building Fleetbase Extensions in the Console
4
-
3
+ Ember Core Services, Utilities and Framework for building Fleetbase Extensions in the Console. To start building with Fleetbase, you need to install `@fleetbase/ember-core`, which is built using Ember, a JavaScript framework for building web applications
5
4
 
6
5
  ## Compatibility
7
6
 
@@ -9,23 +8,17 @@ Ember Core Services, Utilities and Framework for building Fleetbase Extensions i
9
8
  * Ember CLI v3.24 or above
10
9
  * Node.js v14 or above
11
10
 
12
-
13
11
  ## Installation
14
12
 
15
- ```
16
- ember install @fleetbase/ember-core
17
- ```
18
-
19
-
20
- ## Usage
21
-
22
- [Longer description of how to use the addon in apps.]
13
+ To install ember-core, run:
23
14
 
15
+ `ember install @fleetbase/ember-core`
24
16
 
25
17
  ## Contributing
26
18
 
27
- See the [Contributing](CONTRIBUTING.md) guide for details.
19
+ We welcome contributions to Ember-Core from the Fleetbase community!
28
20
 
21
+ If you'd like to contribute, please follow the contributing guidelines.
29
22
 
30
23
  ## License
31
24
 
@@ -1,6 +1,5 @@
1
1
  import Base from 'ember-simple-auth/authenticators/base';
2
2
  import { inject as service } from '@ember/service';
3
- import { get } from '@ember/object';
4
3
 
5
4
  export default class FleetbaseAuthenticator extends Base {
6
5
  /**
@@ -8,7 +8,7 @@ export default function fetchFrom(endpoint, query = {}, options = {}) {
8
8
  assert('The second argument of the @fetchFrom decorator must be an object', typeof query === 'object');
9
9
  assert('The third argument of the @fetchFrom decorator must be an object', typeof options === 'object');
10
10
 
11
- return decoratorWithRequiredParams(function (target, key, desc, params) {
11
+ return decoratorWithRequiredParams(function (target, key) {
12
12
  const symbol = Symbol(`__${key}_fetchFrom`);
13
13
 
14
14
  Object.defineProperty(target, symbol, {
@@ -1,6 +1,5 @@
1
1
  import { decoratorWithRequiredParams } from '@ember-decorators/utils/decorator';
2
2
  import { assert } from '@ember/debug';
3
- import { get } from '@ember/object';
4
3
  import { getOwner } from '@ember/application';
5
4
  import { scheduleOnce } from '@ember/runloop';
6
5
 
@@ -9,7 +8,7 @@ export default function fromStore(modelName, query = {}, options = {}) {
9
8
  assert('The second argument of the @fromStore decorator must be an object', typeof query === 'object');
10
9
  assert('The third argument of the @fromStore decorator must be an object', typeof options === 'object');
11
10
 
12
- return decoratorWithRequiredParams(function (target, key, desc, params) {
11
+ return decoratorWithRequiredParams(function (target, key) {
13
12
  const symbol = Symbol(`__${key}_fromStore`);
14
13
 
15
14
  Object.defineProperty(target, symbol, {
@@ -18,7 +18,7 @@ export default class ApplicationSerializer extends RESTSerializer {
18
18
  *
19
19
  * @var {String}
20
20
  */
21
- keyForPolymorphicType(key, typeClass, method) {
21
+ keyForPolymorphicType(key) {
22
22
  return `${underscore(key)}_type`;
23
23
  }
24
24
 
@@ -77,7 +77,6 @@ export default class ApplicationSerializer extends RESTSerializer {
77
77
  * @param {Array} attributes
78
78
  */
79
79
  serializeAttribute(snapshot, json, key, attributes) {
80
- const { modelName } = snapshot;
81
80
  const excludedKeys = ['name', 'meta', 'options', 'config', 'excluded_addons', 'translations', 'tags'];
82
81
 
83
82
  if (snapshot.record?.get('isNew') || snapshot.changedAttributes()[key] || isArray(snapshot.attr(key)) || excludedKeys.includes(key)) {
@@ -125,7 +125,7 @@ export default class CurrentUserService extends Service.extend(Evented) {
125
125
 
126
126
  resolve(user);
127
127
  })
128
- .catch((error) => {
128
+ .catch(() => {
129
129
  reject(NoUserAuthenticatedError);
130
130
  });
131
131
  } else {
@@ -1,7 +1,7 @@
1
1
  import Service from '@ember/service';
2
2
  import { tracked } from '@glimmer/tracking';
3
3
  import { inject as service } from '@ember/service';
4
- import { get, set, setProperties } from '@ember/object';
4
+ import { get, set } from '@ember/object';
5
5
  import { isBlank } from '@ember/utils';
6
6
  import { dasherize } from '@ember/string';
7
7
  import { isArray } from '@ember/array';
@@ -4,7 +4,6 @@ import { inject as service } from '@ember/service';
4
4
  import { dasherize } from '@ember/string';
5
5
  import { isArray } from '@ember/array';
6
6
  import { getOwner } from '@ember/application';
7
- import closeSidebar from '@fleetbase/ember-ui/utils/close-sidebar';
8
7
 
9
8
  export default class ThemeService extends Service {
10
9
  /**
@@ -108,7 +107,6 @@ export default class ThemeService extends Service {
108
107
  * @void
109
108
  */
110
109
  routeWillChange() {
111
- closeSidebar();
112
110
  this.removeRoutebodyClassNames(this.currentRouteBodyClasses);
113
111
  }
114
112
 
@@ -1,7 +1,7 @@
1
1
  import Model from '@ember-data/model';
2
2
  import { isArray } from '@ember/array';
3
3
  import { get } from '@ember/object';
4
- import { isEmpty, tryInvoke } from '@ember/utils';
4
+ import { isEmpty } from '@ember/utils';
5
5
 
6
6
  const _isEmpty = (value) => {
7
7
  let empty = isEmpty(value);
@@ -148,7 +148,7 @@ export default function download(data, strFileName, strMimeType) {
148
148
 
149
149
  // Blob but not URL support:
150
150
  reader = new FileReader();
151
- reader.onload = function (e) {
151
+ reader.onload = function () {
152
152
  saver(this.result);
153
153
  };
154
154
  reader.readAsDataURL(blob);
@@ -1,14 +1,9 @@
1
1
  import { get } from '@ember/object';
2
2
  import { isArray } from '@ember/array';
3
3
  import { isBlank } from '@ember/utils';
4
- // import { getOwner } from '@ember/application';
5
4
  import config from '@fleetbase/console/config/environment';
6
5
 
7
6
  const isRoutingInCountry = (country, payload, waypoints = []) => {
8
- // const owner = getOwner(this);
9
- // const currentUser = owner.lookup(`service:current-user`);
10
- // const whois = currentUser.getOption('whois');
11
-
12
7
  if (isBlank(payload)) {
13
8
  payload = {};
14
9
  }
@@ -14,6 +14,7 @@ export default function last(arr, n = 1) {
14
14
  }
15
15
 
16
16
  let res = new Array(n);
17
+ let len = arr.length;
17
18
 
18
19
  while (n--) {
19
20
  res[n] = arr[--len];
@@ -1,5 +1,3 @@
1
- /* global L */
2
-
3
1
  /**
4
2
  * Represents an icon to provide when creating a marker.
5
3
  * More information about its possible options [here](https://leafletjs.com/reference-1.7.1.html#icon-option).
@@ -1,6 +1,6 @@
1
1
  import groupBy from './group-by';
2
2
  import { _range } from './range';
3
- import { format, startOfMonth, endOfMonth, startOfDay, sub, addDays } from 'date-fns';
3
+ import { format, startOfMonth, endOfMonth, addDays } from 'date-fns';
4
4
 
5
5
  function randomInt(min, max) {
6
6
  min = Math.ceil(min);
@@ -11,7 +11,7 @@ export default function serializeNormalizePolymorphicTypeWithinHash(hash) {
11
11
  if (typeof attr === 'string' && attr.includes('_type') && encodeURI(hash[attr]).includes('%5C')) {
12
12
  const emberPolymorphicType = normalizePolymorphicType(hash[attr]);
13
13
  const polymorphicRelationType = attr.replace(`_type`, ``);
14
-
14
+
15
15
  hash[attr] = emberPolymorphicType;
16
16
 
17
17
  // set the type of relationship using the polymorphic relation attr
@@ -1,4 +1,3 @@
1
- import isModel from '../is-model';
2
1
  import { get, setProperties } from '@ember/object';
3
2
  import { isBlank } from '@ember/utils';
4
3
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/ember-core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
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-extension",