@fleetbase/ember-core 0.2.16 → 0.2.18
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/addon/services/current-user.js +106 -183
- package/addon/services/session.js +42 -57
- package/addon/services/theme.js +2 -2
- package/addon/services/universe.js +521 -111
- package/addon/utils/get-model-save-permission.js +7 -0
- package/addon/utils/is-empty-object.js +7 -1
- package/addon/utils/serialize/normalize-relations-with-hash.js +0 -5
- package/app/utils/get-model-save-permission.js +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { isBlank } from '@ember/utils';
|
|
2
|
+
|
|
1
3
|
export default function isEmptyObject(obj) {
|
|
2
|
-
|
|
4
|
+
if (isBlank(obj)) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return obj.constructor === Object && Object.keys(obj).length === 0;
|
|
3
9
|
}
|
|
@@ -8,17 +8,12 @@ export default function serializeNormalizeRelationsWithinHash(hash, primaryKey =
|
|
|
8
8
|
|
|
9
9
|
for (let attr in hash) {
|
|
10
10
|
if (typeof attr === 'string' && attr.includes('_uuid')) {
|
|
11
|
-
// console.log(attr, hash[attr]);
|
|
12
11
|
if (typeof hash[attr] === 'object' && !isBlank(hash[attr])) {
|
|
13
12
|
// the relation has loaded back into `_uuid` - change this to the proper `uuid` string value and set the relationship
|
|
14
13
|
const relation = hash[attr];
|
|
15
14
|
const id = get(relation, primaryKey);
|
|
16
15
|
const relationAttr = attr.replace('_uuid', '');
|
|
17
16
|
|
|
18
|
-
// console.log(`normalizing relation ${relationAttr} from ${attr}`);
|
|
19
|
-
// console.log(relationAttr, relation);
|
|
20
|
-
// console.log(attr, id);
|
|
21
|
-
|
|
22
17
|
setProperties(hash, {
|
|
23
18
|
[relationAttr]: relation,
|
|
24
19
|
[attr]: id,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/ember-core/utils/get-model-save-permission';
|
package/package.json
CHANGED