ember-tribe 2.3.1 → 2.3.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Service from '@ember/service';
|
|
2
|
+
import ENV from '<%= dasherizedPackageName %>/config/environment';
|
|
2
3
|
import { service } from '@ember/service';
|
|
3
4
|
import { action } from '@ember/object';
|
|
4
5
|
import { tracked } from '@glimmer/tracking';
|
|
@@ -13,25 +14,27 @@ export default class TypesService extends Service {
|
|
|
13
14
|
|
|
14
15
|
@action
|
|
15
16
|
async fetchAgain() {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
if (ENV.TribeENV.API_URL !== undefined && ENV.TribeENV.API_URL != '') {
|
|
18
|
+
this.json = await this.store.findRecord('webapp', 0, {});
|
|
19
|
+
let owner = getOwner(this);
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
Object.entries(this.json.modules).forEach(([modelName, modelData]) => {
|
|
22
|
+
const modelDynamicName = modelName.replace(/_/g, '-');
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
class DynamicModel extends Model {
|
|
25
|
+
@attr slug;
|
|
26
|
+
@attr modules;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!owner.hasRegistration(`model:${modelDynamicName}`)) {
|
|
30
|
+
owner.register(`model:${modelDynamicName}`, DynamicModel);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.json = await this.store.findRecord('webapp', 0, {
|
|
33
|
-
include: ['total_objects'],
|
|
34
|
-
});
|
|
35
|
-
this.json = this.json;
|
|
34
|
+
this.json = await this.store.findRecord('webapp', 0, {
|
|
35
|
+
include: ['total_objects'],
|
|
36
|
+
});
|
|
37
|
+
this.json = this.json;
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|