@beinformed/ui 1.54.2 → 1.55.0
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/CHANGELOG.md +17 -0
- package/esm/hooks/useModelCatalog.js +1 -1
- package/esm/hooks/useModelCatalog.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +7 -0
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +7 -0
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +7 -0
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/index.js +1 -0
- package/esm/models/index.js.map +1 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js +8 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCategoryCollection.js +16 -0
- package/esm/models/modelcatalog/ModelCategoryCollection.js.map +1 -0
- package/esm/models/modelcatalog/ModelCategoryModel.js +53 -0
- package/esm/models/modelcatalog/ModelCategoryModel.js.map +1 -0
- package/esm/redux/_modularui/ModularUIConnector.js +11 -6
- package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/lib/hooks/useModelCatalog.js +1 -1
- package/lib/hooks/useModelCatalog.js.flow +8 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +7 -0
- package/lib/models/concepts/ConceptDetailModel.js.flow +7 -0
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +7 -0
- package/lib/models/concepts/ConceptIndexModel.js.flow +7 -0
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +7 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +7 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/index.js +7 -0
- package/lib/models/index.js.flow +1 -0
- package/lib/models/index.js.map +1 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js +8 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.flow +11 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCategoryCollection.js +24 -0
- package/lib/models/modelcatalog/ModelCategoryCollection.js.flow +22 -0
- package/lib/models/modelcatalog/ModelCategoryCollection.js.map +1 -0
- package/lib/models/modelcatalog/ModelCategoryModel.js +60 -0
- package/lib/models/modelcatalog/ModelCategoryModel.js.flow +63 -0
- package/lib/models/modelcatalog/ModelCategoryModel.js.map +1 -0
- package/lib/models/modelcatalog/__tests__/ModelCatalogModel.spec.js.flow +22 -0
- package/lib/redux/_modularui/ModularUIConnector.js +11 -6
- package/lib/redux/_modularui/ModularUIConnector.js.flow +12 -6
- package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useModelCatalog.js +8 -1
- package/src/models/concepts/ConceptDetailModel.js +7 -0
- package/src/models/concepts/ConceptIndexModel.js +7 -0
- package/src/models/concepts/ConceptTypeDetailModel.js +7 -0
- package/src/models/index.js +1 -0
- package/src/models/modelcatalog/ModelCatalogModel.js +11 -1
- package/src/models/modelcatalog/ModelCategoryCollection.js +22 -0
- package/src/models/modelcatalog/ModelCategoryModel.js +63 -0
- package/src/models/modelcatalog/__mock__/data.json +19 -1
- package/src/models/modelcatalog/__tests__/ModelCatalogModel.spec.js +22 -0
- package/src/redux/_modularui/ModularUIConnector.js +12 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelCatalogModel.js","names":["_ResourceModel","_interopRequireDefault","require","_exceptions","ModelCatalogModel","ResourceModel","type","modelName","isApplicableModel","data","contributions","resourcetype","label","locale","conceptIndexLink","link","links","getLinkByKey","IllegalStateException","contentIndexLink","exports","default"],"sources":["../../../src/models/modelcatalog/ModelCatalogModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport
|
|
1
|
+
{"version":3,"file":"ModelCatalogModel.js","names":["_ResourceModel","_interopRequireDefault","require","_ModelCategoryCollection","_exceptions","ModelCatalogModel","ResourceModel","type","modelName","isApplicableModel","data","contributions","resourcetype","label","locale","conceptIndexLink","link","links","getLinkByKey","IllegalStateException","contentIndexLink","modelcategories","ModelCategoryCollection","exports","default"],"sources":["../../../src/models/modelcatalog/ModelCatalogModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\n\nimport ModelCategoryCollection from \"./ModelCategoryCollection\";\n\nimport { IllegalStateException } from \"../../exceptions\";\n\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * The Application model\n */\nexport default class ModelCatalogModel extends ResourceModel {\n /**\n */\n get type(): string {\n return \"ModelCatalog\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ModelCatalogModel\";\n }\n\n /**\n */\n static isApplicableModel(data: Object): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ModelCatalog\"\n );\n }\n\n /**\n */\n get label(): string {\n return this.locale === \"nl\" ? \"Model catalogus\" : \"Model catalog\";\n }\n\n /**\n * Retrieve link to Concept Index model\n */\n get conceptIndexLink(): LinkModel {\n const link = this.links.getLinkByKey(\"concepts\");\n if (!link) {\n throw new IllegalStateException(\n \"Missing concepts index link in model catalog\",\n );\n }\n return link;\n }\n\n /**\n * Retrieve link to Content Index model\n */\n get contentIndexLink(): LinkModel {\n const link = this.links.getLinkByKey(\"content\");\n if (!link) {\n throw new IllegalStateException(\n \"Missing content index link in model catalog\",\n );\n }\n return link;\n }\n\n /**\n * Retrieve model categories as a collection\n */\n get modelcategories(): ModelCategoryCollection {\n return new ModelCategoryCollection(this.data.modelcategories);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACe,MAAMG,iBAAiB,SAASC,sBAAa,CAAC;EAC3D;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,cAAc;EACvB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,mBAAmB;EAC5B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAY,EAAW;IAC9C,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,cAAc;EAEtD;;EAEA;AACF;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACC,MAAM,KAAK,IAAI,GAAG,iBAAiB,GAAG,eAAe;EACnE;;EAEA;AACF;AACA;EACE,IAAIC,gBAAgBA,CAAA,EAAc;IAChC,MAAMC,IAAI,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,UAAU,CAAC;IAChD,IAAI,CAACF,IAAI,EAAE;MACT,MAAM,IAAIG,iCAAqB,CAC7B,8CACF,CAAC;IACH;IACA,OAAOH,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAII,gBAAgBA,CAAA,EAAc;IAChC,MAAMJ,IAAI,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,SAAS,CAAC;IAC/C,IAAI,CAACF,IAAI,EAAE;MACT,MAAM,IAAIG,iCAAqB,CAC7B,6CACF,CAAC;IACH;IACA,OAAOH,IAAI;EACb;;EAEA;AACF;AACA;EACE,IAAIK,eAAeA,CAAA,EAA4B;IAC7C,OAAO,IAAIC,gCAAuB,CAAC,IAAI,CAACZ,IAAI,CAACW,eAAe,CAAC;EAC/D;AACF;AAACE,OAAA,CAAAC,OAAA,GAAAnB,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
9
|
+
var _BaseCollection = _interopRequireDefault(require("../base/BaseCollection"));
|
|
10
|
+
var _ModelCategoryModel = _interopRequireDefault(require("./ModelCategoryModel"));
|
|
11
|
+
/**
|
|
12
|
+
* Model category collection
|
|
13
|
+
*/
|
|
14
|
+
class SourceReferenceCollection extends _BaseCollection.default {
|
|
15
|
+
/**
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
let modelCategories = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
19
|
+
super();
|
|
20
|
+
this.collection = modelCategories ? (0, _map.default)(modelCategories).call(modelCategories, modelCategory => new _ModelCategoryModel.default(modelCategory)) : [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = SourceReferenceCollection;
|
|
24
|
+
//# sourceMappingURL=ModelCategoryCollection.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import BaseCollection from "../base/BaseCollection";
|
|
3
|
+
import ModelCategoryModel from "./ModelCategoryModel";
|
|
4
|
+
|
|
5
|
+
import type { ModelCategory } from "./ModelCategoryModel";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Model category collection
|
|
9
|
+
*/
|
|
10
|
+
export default class SourceReferenceCollection extends BaseCollection<ModelCategoryModel> {
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
constructor(modelCategories: Array<ModelCategory> = []) {
|
|
14
|
+
super();
|
|
15
|
+
|
|
16
|
+
this.collection = modelCategories
|
|
17
|
+
? modelCategories.map(
|
|
18
|
+
(modelCategory) => new ModelCategoryModel(modelCategory),
|
|
19
|
+
)
|
|
20
|
+
: [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelCategoryCollection.js","names":["_BaseCollection","_interopRequireDefault","require","_ModelCategoryModel","SourceReferenceCollection","BaseCollection","constructor","modelCategories","arguments","length","undefined","collection","_map","default","call","modelCategory","ModelCategoryModel","exports"],"sources":["../../../src/models/modelcatalog/ModelCategoryCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ModelCategoryModel from \"./ModelCategoryModel\";\n\nimport type { ModelCategory } from \"./ModelCategoryModel\";\n\n/**\n * Model category collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<ModelCategoryModel> {\n /**\n */\n constructor(modelCategories: Array<ModelCategory> = []) {\n super();\n\n this.collection = modelCategories\n ? modelCategories.map(\n (modelCategory) => new ModelCategoryModel(modelCategory),\n )\n : [];\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAIA;AACA;AACA;AACe,MAAME,yBAAyB,SAASC,uBAAc,CAAqB;EACxF;AACF;EACEC,WAAWA,CAAA,EAA6C;IAAA,IAA5CC,eAAqC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;IACpD,KAAK,CAAC,CAAC;IAEP,IAAI,CAACG,UAAU,GAAGJ,eAAe,GAC7B,IAAAK,IAAA,CAAAC,OAAA,EAAAN,eAAe,EAAAO,IAAA,CAAfP,eAAe,EACZQ,aAAa,IAAK,IAAIC,2BAAkB,CAACD,aAAa,CACzD,CAAC,GACD,EAAE;EACR;AACF;AAACE,OAAA,CAAAJ,OAAA,GAAAT,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
9
|
+
/**
|
|
10
|
+
*/
|
|
11
|
+
class ModelCategoryModel {
|
|
12
|
+
constructor(modelCategory) {
|
|
13
|
+
(0, _defineProperty2.default)(this, "_modelCategory", void 0);
|
|
14
|
+
this._modelCategory = modelCategory;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Id of the category
|
|
19
|
+
*/
|
|
20
|
+
get key() {
|
|
21
|
+
return this._modelCategory._id;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Label of the category
|
|
26
|
+
*/
|
|
27
|
+
get label() {
|
|
28
|
+
return this._modelCategory.label;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Description of the category
|
|
33
|
+
*/
|
|
34
|
+
get description() {
|
|
35
|
+
return this._modelCategory.description;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Small icon of the category
|
|
40
|
+
*/
|
|
41
|
+
get iconSmall() {
|
|
42
|
+
return this._modelCategory.iconSmall;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Medium icon of the category
|
|
47
|
+
*/
|
|
48
|
+
get iconMedium() {
|
|
49
|
+
return this._modelCategory.iconMedium;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Large icon of the category
|
|
54
|
+
*/
|
|
55
|
+
get iconLarge() {
|
|
56
|
+
return this._modelCategory.iconLarge;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
var _default = exports.default = ModelCategoryModel;
|
|
60
|
+
//# sourceMappingURL=ModelCategoryModel.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
export type ModelCategory = {
|
|
3
|
+
_id: string,
|
|
4
|
+
label: string,
|
|
5
|
+
description: string,
|
|
6
|
+
iconSmall: string,
|
|
7
|
+
iconMedium: string,
|
|
8
|
+
iconLarge: string,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
class ModelCategoryModel {
|
|
14
|
+
_modelCategory: ModelCategory;
|
|
15
|
+
|
|
16
|
+
constructor(modelCategory: ModelCategory) {
|
|
17
|
+
this._modelCategory = modelCategory;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Id of the category
|
|
22
|
+
*/
|
|
23
|
+
get key(): string {
|
|
24
|
+
return this._modelCategory._id;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Label of the category
|
|
29
|
+
*/
|
|
30
|
+
get label(): string {
|
|
31
|
+
return this._modelCategory.label;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Description of the category
|
|
36
|
+
*/
|
|
37
|
+
get description(): string {
|
|
38
|
+
return this._modelCategory.description;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Small icon of the category
|
|
43
|
+
*/
|
|
44
|
+
get iconSmall(): string {
|
|
45
|
+
return this._modelCategory.iconSmall;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Medium icon of the category
|
|
50
|
+
*/
|
|
51
|
+
get iconMedium(): string {
|
|
52
|
+
return this._modelCategory.iconMedium;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Large icon of the category
|
|
57
|
+
*/
|
|
58
|
+
get iconLarge(): string {
|
|
59
|
+
return this._modelCategory.iconLarge;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default ModelCategoryModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelCategoryModel.js","names":["ModelCategoryModel","constructor","modelCategory","_defineProperty2","default","_modelCategory","key","_id","label","description","iconSmall","iconMedium","iconLarge","_default","exports"],"sources":["../../../src/models/modelcatalog/ModelCategoryModel.js"],"sourcesContent":["// @flow\nexport type ModelCategory = {\n _id: string,\n label: string,\n description: string,\n iconSmall: string,\n iconMedium: string,\n iconLarge: string,\n};\n\n/**\n */\nclass ModelCategoryModel {\n _modelCategory: ModelCategory;\n\n constructor(modelCategory: ModelCategory) {\n this._modelCategory = modelCategory;\n }\n\n /**\n * Id of the category\n */\n get key(): string {\n return this._modelCategory._id;\n }\n\n /**\n * Label of the category\n */\n get label(): string {\n return this._modelCategory.label;\n }\n\n /**\n * Description of the category\n */\n get description(): string {\n return this._modelCategory.description;\n }\n\n /**\n * Small icon of the category\n */\n get iconSmall(): string {\n return this._modelCategory.iconSmall;\n }\n\n /**\n * Medium icon of the category\n */\n get iconMedium(): string {\n return this._modelCategory.iconMedium;\n }\n\n /**\n * Large icon of the category\n */\n get iconLarge(): string {\n return this._modelCategory.iconLarge;\n }\n}\n\nexport default ModelCategoryModel;\n"],"mappings":";;;;;;;;AAUA;AACA;AACA,MAAMA,kBAAkB,CAAC;EAGvBC,WAAWA,CAACC,aAA4B,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IACxC,IAAI,CAACC,cAAc,GAAGH,aAAa;EACrC;;EAEA;AACF;AACA;EACE,IAAII,GAAGA,CAAA,EAAW;IAChB,OAAO,IAAI,CAACD,cAAc,CAACE,GAAG;EAChC;;EAEA;AACF;AACA;EACE,IAAIC,KAAKA,CAAA,EAAW;IAClB,OAAO,IAAI,CAACH,cAAc,CAACG,KAAK;EAClC;;EAEA;AACF;AACA;EACE,IAAIC,WAAWA,CAAA,EAAW;IACxB,OAAO,IAAI,CAACJ,cAAc,CAACI,WAAW;EACxC;;EAEA;AACF;AACA;EACE,IAAIC,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAACL,cAAc,CAACK,SAAS;EACtC;;EAEA;AACF;AACA;EACE,IAAIC,UAAUA,CAAA,EAAW;IACvB,OAAO,IAAI,CAACN,cAAc,CAACM,UAAU;EACvC;;EAEA;AACF;AACA;EACE,IAAIC,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAACP,cAAc,CAACO,SAAS;EACtC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEcJ,kBAAkB","ignoreList":[]}
|
|
@@ -12,6 +12,8 @@ describe("modelCatalogModel", () => {
|
|
|
12
12
|
expect(modelcatalog.type).toBe("ModelCatalog");
|
|
13
13
|
expect(modelcatalog.label).toBe("Model catalog");
|
|
14
14
|
|
|
15
|
+
expect(modelcatalog.modelcategories.isEmpty).toBe(true);
|
|
16
|
+
|
|
15
17
|
expect(() => {
|
|
16
18
|
modelcatalog.conceptIndexLink;
|
|
17
19
|
}).toThrow(IllegalStateException);
|
|
@@ -24,4 +26,24 @@ describe("modelCatalogModel", () => {
|
|
|
24
26
|
expect(modelCatalogModel.conceptIndexLink).toBeInstanceOf(LinkModel);
|
|
25
27
|
expect(modelCatalogModel.contentIndexLink).toBeInstanceOf(LinkModel);
|
|
26
28
|
});
|
|
29
|
+
|
|
30
|
+
it("has model categories", () => {
|
|
31
|
+
expect(modelCatalogModel.modelcategories.size).toBe(2);
|
|
32
|
+
expect(modelCatalogModel.modelcategories.first.key).toBe("BusinessDesign");
|
|
33
|
+
expect(modelCatalogModel.modelcategories.first.label).toBe(
|
|
34
|
+
"Business design",
|
|
35
|
+
);
|
|
36
|
+
expect(modelCatalogModel.modelcategories.first.description).toBe(
|
|
37
|
+
"The business design includes the 'what' of the solution",
|
|
38
|
+
);
|
|
39
|
+
expect(modelCatalogModel.modelcategories.first.iconSmall).toBe(
|
|
40
|
+
"/resource/Library/General/Icons/business_design_16x16.png",
|
|
41
|
+
);
|
|
42
|
+
expect(modelCatalogModel.modelcategories.first.iconMedium).toBe(
|
|
43
|
+
"/resource/Library/General/Icons/business_design_24x24.png",
|
|
44
|
+
);
|
|
45
|
+
expect(modelCatalogModel.modelcategories.first.iconLarge).toBe(
|
|
46
|
+
"/resource/Library/General/Icons/business_design_48x48.png",
|
|
47
|
+
);
|
|
48
|
+
});
|
|
27
49
|
});
|
|
@@ -48,6 +48,8 @@ const modularUIConnector = function (name, resource) {
|
|
|
48
48
|
} = options;
|
|
49
49
|
return Component => {
|
|
50
50
|
const WrappedComponent = props => {
|
|
51
|
+
// explicit property for removeOnMount overwrite the setting
|
|
52
|
+
const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;
|
|
51
53
|
const dispatch = (0, _reactRedux.useDispatch)();
|
|
52
54
|
const location = (0, _reactRouter.useLocation)();
|
|
53
55
|
const url = (0, _ModularUIUtils.useUrl)(resource, {
|
|
@@ -57,7 +59,10 @@ const modularUIConnector = function (name, resource) {
|
|
|
57
59
|
const displayName = (0, _utils.getDisplayName)(Component, name, props.contextId);
|
|
58
60
|
|
|
59
61
|
// Load the model through the useModUI hook
|
|
60
|
-
const modelEntry = (0, _useModularUI.useModularUI)(displayName, url,
|
|
62
|
+
const modelEntry = (0, _useModularUI.useModularUI)(displayName, url, {
|
|
63
|
+
...otherOptions,
|
|
64
|
+
removeOnUnmount: finalRemoveOnUnmount
|
|
65
|
+
});
|
|
61
66
|
const modelKey = modelEntry?.model?.connectKey;
|
|
62
67
|
|
|
63
68
|
// handle manual reload of model
|
|
@@ -86,20 +91,20 @@ const modularUIConnector = function (name, resource) {
|
|
|
86
91
|
// Remove model when hoc unloads
|
|
87
92
|
(0, _react.useEffect)(() => {
|
|
88
93
|
return () => {
|
|
89
|
-
if (
|
|
94
|
+
if (finalRemoveOnUnmount) {
|
|
90
95
|
dispatch((0, _ModularUIActions.removeModelByKey)(modelKey));
|
|
91
96
|
}
|
|
92
97
|
};
|
|
93
|
-
}, [dispatch, modelKey]);
|
|
98
|
+
}, [dispatch, modelKey, finalRemoveOnUnmount]);
|
|
94
99
|
|
|
95
100
|
// Create new properties object to inject modularui properties to own props
|
|
96
101
|
const locale = (0, _useI18n.useLocale)();
|
|
97
102
|
const newProps = {
|
|
98
103
|
modelKey,
|
|
99
|
-
[propName]: modelEntry
|
|
104
|
+
[propName]: modelEntry?.model ?? null,
|
|
100
105
|
location,
|
|
101
|
-
status: modelEntry
|
|
102
|
-
lastModification: modelEntry
|
|
106
|
+
status: modelEntry?.status ?? null,
|
|
107
|
+
lastModification: modelEntry.lastModification ?? null,
|
|
103
108
|
hasModel: Boolean(modelEntry),
|
|
104
109
|
locale,
|
|
105
110
|
fetchModularUI: handleFetch,
|
|
@@ -71,6 +71,9 @@ const modularUIConnector = (
|
|
|
71
71
|
|
|
72
72
|
return (Component: ComponentType<any>) => {
|
|
73
73
|
const WrappedComponent = (props: any) => {
|
|
74
|
+
// explicit property for removeOnMount overwrite the setting
|
|
75
|
+
const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;
|
|
76
|
+
|
|
74
77
|
const dispatch = useDispatch();
|
|
75
78
|
const location = useLocation();
|
|
76
79
|
|
|
@@ -78,7 +81,10 @@ const modularUIConnector = (
|
|
|
78
81
|
const displayName = getDisplayName(Component, name, props.contextId);
|
|
79
82
|
|
|
80
83
|
// Load the model through the useModUI hook
|
|
81
|
-
const modelEntry = useModularUI(displayName, url,
|
|
84
|
+
const modelEntry = useModularUI(displayName, url, {
|
|
85
|
+
...otherOptions,
|
|
86
|
+
removeOnUnmount: finalRemoveOnUnmount,
|
|
87
|
+
});
|
|
82
88
|
const modelKey = modelEntry?.model?.connectKey;
|
|
83
89
|
|
|
84
90
|
// handle manual reload of model
|
|
@@ -114,20 +120,20 @@ const modularUIConnector = (
|
|
|
114
120
|
// Remove model when hoc unloads
|
|
115
121
|
useEffect(() => {
|
|
116
122
|
return () => {
|
|
117
|
-
if (
|
|
123
|
+
if (finalRemoveOnUnmount) {
|
|
118
124
|
dispatch(removeModelByKey(modelKey));
|
|
119
125
|
}
|
|
120
126
|
};
|
|
121
|
-
}, [dispatch, modelKey]);
|
|
127
|
+
}, [dispatch, modelKey, finalRemoveOnUnmount]);
|
|
122
128
|
|
|
123
129
|
// Create new properties object to inject modularui properties to own props
|
|
124
130
|
const locale = useLocale();
|
|
125
131
|
const newProps: InjectedProps = {
|
|
126
132
|
modelKey,
|
|
127
|
-
[propName]: modelEntry
|
|
133
|
+
[propName]: modelEntry?.model ?? null,
|
|
128
134
|
location,
|
|
129
|
-
status: modelEntry
|
|
130
|
-
lastModification: modelEntry
|
|
135
|
+
status: modelEntry?.status ?? null,
|
|
136
|
+
lastModification: modelEntry.lastModification ?? null,
|
|
131
137
|
hasModel: Boolean(modelEntry),
|
|
132
138
|
locale,
|
|
133
139
|
fetchModularUI: handleFetch,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","arguments","length","undefined","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (
|
|
1
|
+
{"version":3,"file":"ModularUIConnector.js","names":["_react","require","_reactRedux","_reactRouter","_ModularUIActions","_Href","_interopRequireDefault","_utils","_ModularUIUtils","_useModularUI","_useI18n","_FormModel","_jsxRuntime","patchUpdateModelOption","oldOptions","updateModel","FormModel","updateHandler","newModel","clonedModel","clone","update","modularUIConnector","name","resource","options","arguments","length","undefined","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","finalRemoveOnUnmount","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useLocale","newProps","status","lastModification","hasModel","Boolean","fetchModularUI","jsx","_default","exports","default"],"sources":["../../../src/redux/_modularui/ModularUIConnector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport {\n loadModularUI,\n reloadModel,\n removeModelByKey,\n} from \"./ModularUIActions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./ModularUIUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\nimport { useLocale } from \"../../hooks/useI18n\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\nimport FormModel from \"../../models/form/FormModel\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\nconst patchUpdateModelOption = (oldOptions: Object) => {\n if (\n \"updateModel\" in oldOptions &&\n oldOptions.updateModel instanceof FormModel\n ) {\n return {\n ...oldOptions,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n // $FLowFixMe\n const clonedModel: FormModel = oldOptions.updateModel.clone();\n clonedModel.update(newModel);\n return clonedModel;\n }\n return newModel;\n },\n };\n }\n\n return oldOptions;\n};\n\n/**\n */\nconst modularUIConnector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false },\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n // explicit property for removeOnMount overwrite the setting\n const finalRemoveOnUnmount = props.removeOnUnmount ?? removeOnUnmount;\n\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, {\n ...otherOptions,\n removeOnUnmount: finalRemoveOnUnmount,\n });\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object,\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(\n loadModularUI(modelKey, href, patchUpdateModelOption(fetchOptions)),\n );\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, {\n ...patchUpdateModelOption(otherOptions),\n isReload: true,\n }),\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (finalRemoveOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey, finalRemoveOnUnmount]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useLocale();\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry?.model ?? null,\n location,\n status: modelEntry?.status ?? null,\n lastModification: modelEntry.lastModification ?? null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name,\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default modularUIConnector;\n"],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ export type SearchFilter = {
|
|
|
19
19
|
index?: string,
|
|
20
20
|
label?: string,
|
|
21
21
|
type?: string | Array<string>,
|
|
22
|
+
modelCategory?: string | Array<string>,
|
|
22
23
|
entryDate?: string,
|
|
23
24
|
};
|
|
24
25
|
|
|
@@ -40,7 +41,13 @@ export const useConceptIndex = (
|
|
|
40
41
|
key?: string = "conceptindex",
|
|
41
42
|
options?: UseModularUIBasicOptions<ConceptIndexModel>,
|
|
42
43
|
): ?ConceptIndexModel => {
|
|
43
|
-
const url = filterParameters(href, [
|
|
44
|
+
const url = filterParameters(href, [
|
|
45
|
+
"entryDate",
|
|
46
|
+
"index",
|
|
47
|
+
"label",
|
|
48
|
+
"modelcategory",
|
|
49
|
+
"type",
|
|
50
|
+
]);
|
|
44
51
|
return useModularUIBasic(key, url, {
|
|
45
52
|
expectedModels: ["ConceptIndex"],
|
|
46
53
|
targetModel: ConceptIndexModel,
|
|
@@ -137,6 +137,13 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
137
137
|
return this.data.conceptLabel;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Get model category of the concept
|
|
142
|
+
*/
|
|
143
|
+
get modelCategory(): string {
|
|
144
|
+
return this.getData("modelCategory", "");
|
|
145
|
+
}
|
|
146
|
+
|
|
140
147
|
/**
|
|
141
148
|
* Get taxonomy type
|
|
142
149
|
*/
|
|
@@ -136,6 +136,13 @@ export default class ConceptIndexModel extends ResourceModel {
|
|
|
136
136
|
return this.filterCollection.getFilterByAttributeKey("label");
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Get model category filter
|
|
141
|
+
*/
|
|
142
|
+
get modelCategoryFilter(): FilterType | null {
|
|
143
|
+
return this.filterCollection.getFilterByAttributeKey("modelCategory");
|
|
144
|
+
}
|
|
145
|
+
|
|
139
146
|
/**
|
|
140
147
|
* Get concept links found by index filter
|
|
141
148
|
*/
|
|
@@ -50,6 +50,13 @@ class ConceptTypeDetailModel extends ResourceModel {
|
|
|
50
50
|
return this.getData("label", "");
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Get model category of the concept type
|
|
55
|
+
*/
|
|
56
|
+
get modelCategory(): string {
|
|
57
|
+
return this.getData("modelCategory", "");
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
/**
|
|
54
61
|
*/
|
|
55
62
|
get isCoreTaxonomy(): boolean {
|
package/src/models/index.js
CHANGED
|
@@ -105,6 +105,7 @@ export { default as LookupOptionsModel } from "./lookup/LookupOptionsModel";
|
|
|
105
105
|
export { default as LookupOptionCollection } from "./lookup/LookupOptionCollection";
|
|
106
106
|
|
|
107
107
|
import { default as ModelCatalogModel } from "./modelcatalog/ModelCatalogModel";
|
|
108
|
+
export { default as ModelCategory } from "./modelcatalog/ModelCategoryModel";
|
|
108
109
|
|
|
109
110
|
export { default as ProcessStatusSettingsModel } from "./process/ProcessStatusSettingsModel";
|
|
110
111
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import ResourceModel from "../base/ResourceModel";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import ModelCategoryCollection from "./ModelCategoryCollection";
|
|
5
|
+
|
|
5
6
|
import { IllegalStateException } from "../../exceptions";
|
|
6
7
|
|
|
8
|
+
import type LinkModel from "../links/LinkModel";
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* The Application model
|
|
9
12
|
*/
|
|
@@ -60,4 +63,11 @@ export default class ModelCatalogModel extends ResourceModel {
|
|
|
60
63
|
}
|
|
61
64
|
return link;
|
|
62
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Retrieve model categories as a collection
|
|
69
|
+
*/
|
|
70
|
+
get modelcategories(): ModelCategoryCollection {
|
|
71
|
+
return new ModelCategoryCollection(this.data.modelcategories);
|
|
72
|
+
}
|
|
63
73
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import BaseCollection from "../base/BaseCollection";
|
|
3
|
+
import ModelCategoryModel from "./ModelCategoryModel";
|
|
4
|
+
|
|
5
|
+
import type { ModelCategory } from "./ModelCategoryModel";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Model category collection
|
|
9
|
+
*/
|
|
10
|
+
export default class SourceReferenceCollection extends BaseCollection<ModelCategoryModel> {
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
constructor(modelCategories: Array<ModelCategory> = []) {
|
|
14
|
+
super();
|
|
15
|
+
|
|
16
|
+
this.collection = modelCategories
|
|
17
|
+
? modelCategories.map(
|
|
18
|
+
(modelCategory) => new ModelCategoryModel(modelCategory),
|
|
19
|
+
)
|
|
20
|
+
: [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
export type ModelCategory = {
|
|
3
|
+
_id: string,
|
|
4
|
+
label: string,
|
|
5
|
+
description: string,
|
|
6
|
+
iconSmall: string,
|
|
7
|
+
iconMedium: string,
|
|
8
|
+
iconLarge: string,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
class ModelCategoryModel {
|
|
14
|
+
_modelCategory: ModelCategory;
|
|
15
|
+
|
|
16
|
+
constructor(modelCategory: ModelCategory) {
|
|
17
|
+
this._modelCategory = modelCategory;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Id of the category
|
|
22
|
+
*/
|
|
23
|
+
get key(): string {
|
|
24
|
+
return this._modelCategory._id;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Label of the category
|
|
29
|
+
*/
|
|
30
|
+
get label(): string {
|
|
31
|
+
return this._modelCategory.label;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Description of the category
|
|
36
|
+
*/
|
|
37
|
+
get description(): string {
|
|
38
|
+
return this._modelCategory.description;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Small icon of the category
|
|
43
|
+
*/
|
|
44
|
+
get iconSmall(): string {
|
|
45
|
+
return this._modelCategory.iconSmall;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Medium icon of the category
|
|
50
|
+
*/
|
|
51
|
+
get iconMedium(): string {
|
|
52
|
+
return this._modelCategory.iconMedium;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Large icon of the category
|
|
57
|
+
*/
|
|
58
|
+
get iconLarge(): string {
|
|
59
|
+
return this._modelCategory.iconLarge;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default ModelCategoryModel;
|
|
@@ -6,6 +6,24 @@
|
|
|
6
6
|
"contributions": { "href": "/contributions/modelcatalog" },
|
|
7
7
|
"concepts": { "href": "/concepts" },
|
|
8
8
|
"content": { "href": "/content" }
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"modelcategories": [
|
|
11
|
+
{
|
|
12
|
+
"_id": "BusinessDesign",
|
|
13
|
+
"label": "Business design",
|
|
14
|
+
"iconSmall": "/resource/Library/General/Icons/business_design_16x16.png",
|
|
15
|
+
"iconMedium": "/resource/Library/General/Icons/business_design_24x24.png",
|
|
16
|
+
"iconLarge": "/resource/Library/General/Icons/business_design_48x48.png",
|
|
17
|
+
"description": "The business design includes the 'what' of the solution"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"_id": "Requirements",
|
|
21
|
+
"label": "Requirements",
|
|
22
|
+
"iconSmall": "/resource/Library/General/Icons/requirements_16x16.png",
|
|
23
|
+
"iconMedium": "/resource/Library/General/Icons/requirements_24x24.png",
|
|
24
|
+
"iconLarge": "/resource/Library/General/Icons/requirements_48x48.png",
|
|
25
|
+
"description": "Requirements describe what functions to provide"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
10
28
|
}
|
|
11
29
|
}
|
|
@@ -12,6 +12,8 @@ describe("modelCatalogModel", () => {
|
|
|
12
12
|
expect(modelcatalog.type).toBe("ModelCatalog");
|
|
13
13
|
expect(modelcatalog.label).toBe("Model catalog");
|
|
14
14
|
|
|
15
|
+
expect(modelcatalog.modelcategories.isEmpty).toBe(true);
|
|
16
|
+
|
|
15
17
|
expect(() => {
|
|
16
18
|
modelcatalog.conceptIndexLink;
|
|
17
19
|
}).toThrow(IllegalStateException);
|
|
@@ -24,4 +26,24 @@ describe("modelCatalogModel", () => {
|
|
|
24
26
|
expect(modelCatalogModel.conceptIndexLink).toBeInstanceOf(LinkModel);
|
|
25
27
|
expect(modelCatalogModel.contentIndexLink).toBeInstanceOf(LinkModel);
|
|
26
28
|
});
|
|
29
|
+
|
|
30
|
+
it("has model categories", () => {
|
|
31
|
+
expect(modelCatalogModel.modelcategories.size).toBe(2);
|
|
32
|
+
expect(modelCatalogModel.modelcategories.first.key).toBe("BusinessDesign");
|
|
33
|
+
expect(modelCatalogModel.modelcategories.first.label).toBe(
|
|
34
|
+
"Business design",
|
|
35
|
+
);
|
|
36
|
+
expect(modelCatalogModel.modelcategories.first.description).toBe(
|
|
37
|
+
"The business design includes the 'what' of the solution",
|
|
38
|
+
);
|
|
39
|
+
expect(modelCatalogModel.modelcategories.first.iconSmall).toBe(
|
|
40
|
+
"/resource/Library/General/Icons/business_design_16x16.png",
|
|
41
|
+
);
|
|
42
|
+
expect(modelCatalogModel.modelcategories.first.iconMedium).toBe(
|
|
43
|
+
"/resource/Library/General/Icons/business_design_24x24.png",
|
|
44
|
+
);
|
|
45
|
+
expect(modelCatalogModel.modelcategories.first.iconLarge).toBe(
|
|
46
|
+
"/resource/Library/General/Icons/business_design_48x48.png",
|
|
47
|
+
);
|
|
48
|
+
});
|
|
27
49
|
});
|