Skip to content

Commit 6b5102b

Browse files
authored
Merge pull request #685 from Dative-GPI/features/groupings-v2
Features/groupings v2
2 parents a9b44d2 + ff57268 commit 6b5102b

38 files changed

+1527
-87
lines changed

dev/storybook/src/mocks/deviceOrganisations.mock.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { MANUFACTURERS } from "./manufacturers.mock";
55
import { MODELSTATUSES } from "./modelStatuses.mock";
66
import { ARTICLES } from "./articles.mock";
77
import { MODELS } from "./models.mock";
8+
import { SUBGROUPINGS } from "./subgroupings.mock";
89

910
const ONLINE_PROCESSED = new Date();
1011
const ONLINE_ENQUEUED = new Date(ONLINE_PROCESSED.getTime() - (5 * 60 * 1000));
@@ -240,7 +241,8 @@ export const DEVICEORGANISATIONS: DeviceOrganisationDetailsDTO[] = [{
240241
latitude: null,
241242
longitude: null,
242243
locationLatitude: null,
243-
locationLongitude: null
244+
locationLongitude: null,
245+
subgroupings: SUBGROUPINGS
244246
}, {
245247
id: "2",
246248
deviceId: "2",
@@ -261,7 +263,7 @@ export const DEVICEORGANISATIONS: DeviceOrganisationDetailsDTO[] = [{
261263
groupId: null,
262264
groupLabel: null,
263265
groupIcon: null,
264-
label: "Device 2 with a very very very very long name",
266+
label: "Device 2 with a very very very very long name Device 2 with a very very very very long name Device 2 with a very very very very long name Device 2 with a very very very very long name",
265267
code: "980002",
266268
imageId: "1",
267269
tags: [],
@@ -282,7 +284,8 @@ export const DEVICEORGANISATIONS: DeviceOrganisationDetailsDTO[] = [{
282284
latitude: null,
283285
longitude: null,
284286
locationLatitude: null,
285-
locationLongitude: null
287+
locationLongitude: null,
288+
subgroupings: []
286289
}, {
287290
id: "3",
288291
deviceId: "3",
@@ -324,7 +327,8 @@ export const DEVICEORGANISATIONS: DeviceOrganisationDetailsDTO[] = [{
324327
latitude: null,
325328
longitude: null,
326329
locationLatitude: null,
327-
locationLongitude: null
330+
locationLongitude: null,
331+
subgroupings: []
328332
}, {
329333
id: "4",
330334
deviceId: "4",
@@ -366,5 +370,6 @@ export const DEVICEORGANISATIONS: DeviceOrganisationDetailsDTO[] = [{
366370
latitude: null,
367371
longitude: null,
368372
locationLatitude: null,
369-
locationLongitude: null
373+
locationLongitude: null,
374+
subgroupings: [SUBGROUPINGS[0], SUBGROUPINGS[1]]
370375
}];

dev/storybook/src/mocks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export * from "./roleOrganisationTypes.mock";
3232
export * from "./serviceAccountOrganisations.mock";
3333
export * from "./scenarioOrganisations.mock";
3434
export * from "./scenarioOrganisationTypes.mock";
35+
export * from "./subgroupings.mock";
3536
export * from "./timeZones.mock";
3637
export * from './translations.mock';
3738
export * from "./userOrganisations.mock";
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import type { SubgroupingInfosDTO } from "@dative-gpi/foundation-core-domain/models";
2+
3+
export const SUBGROUPINGS: SubgroupingInfosDTO[] = [
4+
{
5+
id: "subgrouping1",
6+
label: "Neige",
7+
code: "neige",
8+
groupingColor: "#FF9800",
9+
groupingIcon: "mdi-flash",
10+
groupingId: "grouping1",
11+
groupingLabel: "Usage énergétique",
12+
icon: "mdi-snowflake",
13+
deviceOrganisationsCount: 5
14+
},
15+
{
16+
id: "subgrouping2",
17+
label: "Remontées mécaniques",
18+
code: "remontees-mecaniques",
19+
groupingColor: "#FF9800",
20+
groupingIcon: "mdi-flash",
21+
groupingId: "grouping1",
22+
groupingLabel: "Usage énergétique",
23+
icon: "mdi-gondola",
24+
deviceOrganisationsCount: 3
25+
},
26+
{
27+
id: "subgrouping3",
28+
label: "Bâtiment",
29+
code: "batiment",
30+
groupingColor: "#FF9800",
31+
groupingIcon: "mdi-flash",
32+
groupingId: "grouping1",
33+
groupingLabel: "Usage énergétique",
34+
icon: "mdi-office-building",
35+
deviceOrganisationsCount: 8
36+
},
37+
{
38+
id: "subgrouping4",
39+
label: "Neige",
40+
code: "neige-prod",
41+
groupingColor: "#4CAF50",
42+
groupingIcon: "mdi-factory",
43+
groupingId: "grouping2",
44+
groupingLabel: "Usage production",
45+
icon: "mdi-snowflake",
46+
},
47+
{
48+
id: "subgrouping5",
49+
label: "Electricité",
50+
code: "electricite",
51+
groupingColor: "#4CAF50",
52+
groupingIcon: "mdi-factory",
53+
groupingId: "grouping2",
54+
groupingLabel: "Usage production",
55+
icon: "mdi-flash-outline",
56+
},
57+
{
58+
id: "subgrouping6",
59+
label: "Gare motrice",
60+
code: "gare-motrice",
61+
groupingColor: "#2196F3",
62+
groupingIcon: "mdi-ski",
63+
groupingId: "grouping3",
64+
groupingLabel: "Usage remontées mécaniques",
65+
icon: "mdi-engine",
66+
},
67+
{
68+
id: "subgrouping7",
69+
label: "Gare retour",
70+
code: "gare-retour",
71+
groupingColor: "#2196F3",
72+
groupingIcon: "mdi-ski",
73+
groupingId: "grouping3",
74+
groupingLabel: "Usage remontées mécaniques",
75+
icon: "mdi-undo",
76+
},
77+
{
78+
id: "subgrouping8",
79+
label: "Ligne & pylônes",
80+
code: "ligne-pylones",
81+
groupingColor: "#2196F3",
82+
groupingIcon: "mdi-ski",
83+
groupingId: "grouping3",
84+
groupingLabel: "Usage remontées mécaniques",
85+
icon: "mdi-transmission-tower",
86+
},
87+
{
88+
id: "subgrouping9",
89+
label: "Motorisation principale",
90+
code: "motorisation-principale",
91+
groupingColor: "#2196F3",
92+
groupingIcon: "mdi-ski",
93+
groupingId: "grouping3",
94+
groupingLabel: "Usage remontées mécaniques",
95+
icon: "mdi-cog",
96+
},
97+
{
98+
id: "subgrouping10",
99+
label: "Sécurité & contrôle",
100+
code: "securite-controle",
101+
groupingColor: "#2196F3",
102+
groupingIcon: "mdi-ski",
103+
groupingId: "grouping3",
104+
groupingLabel: "Usage remontées mécaniques",
105+
icon: "mdi-shield-check",
106+
},
107+
{
108+
id: "subgrouping11",
109+
label: "Services auxiliaires",
110+
code: "services-auxiliaires",
111+
groupingColor: "#2196F3",
112+
groupingIcon: "mdi-ski",
113+
groupingId: "grouping3",
114+
groupingLabel: "Usage remontées mécaniques",
115+
icon: "mdi-wrench",
116+
}
117+
];

dev/storybook/src/mocks/userOrganisationTables.mock.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ export const USERORGANISATIONTABLES: UserOrganisationTableInfosDTO[] = [
144144
hidden: false,
145145
sortable: false,
146146
filterable: true
147+
}, {
148+
columnId: "6",
149+
text: "Subgroupings",
150+
value: "subgroupings",
151+
index: 4,
152+
hidden: false,
153+
sortable: false,
154+
filterable: true
147155
}],
148156
sortByKey: null,
149157
sortByOrder: null
@@ -958,5 +966,33 @@ export const USERORGANISATIONTABLES: UserOrganisationTableInfosDTO[] = [
958966
],
959967
sortByKey: null,
960968
sortByOrder: null
969+
},
970+
{
971+
id: "21",
972+
code: "subgroupings1",
973+
mode: "table",
974+
rowsPerPage: -1,
975+
columns: [
976+
{
977+
columnId: "sub1",
978+
text: "Subgrouping label",
979+
value: "label",
980+
sortable: true,
981+
filterable: false,
982+
index: 0,
983+
hidden: false
984+
},
985+
{
986+
columnId: "sub2",
987+
text: "Devices count",
988+
value: "deviceOrganisationsCount",
989+
sortable: true,
990+
filterable: false,
991+
index: 1,
992+
hidden: false
993+
},
994+
],
995+
sortByKey: null,
996+
sortByOrder: null
961997
}
962998
];

dev/storybook/src/plugins/axiosmock.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MockAdapter from 'axios-mock-adapter';
22

33
import { ServiceFactory } from '@dative-gpi/bones-ui';
44

5-
import { AUTHTOKENS, CUSTOMPROPERTIES, CONNECTIVITYSCENARIOS, PLAYLISTS, SCENARIOORGANISATIONS, SCENARIOORGANISATIONTYPES, CUSTOMPROPERTYVALUES, DASHBOARDORGANISATIONS, DASHBOARDORGANISATIONTYPES, DASHBOARDSHALLOWS, DEVICEEXPLORERELEMENTS, DEVICEORGANISATIONS, FOLDERS, GROUPINGS, GROUPS, IMAGES, LANGUAGES, USERORGANISATIONTABLES, TIMEZONES, TRANSLATIONS, ORGANISATIONS, ROLEORGANISATIONS, ROLEORGANISATIONTYPES, LOCATIONS, MANUFACTURERS, USERORGANISATIONS, ORGANISATIONTYPES, MODELS, DATACATEGORIES, DATADEFINITIONS, ALERTS, COMMENTS, CHARTORGANISATIONS, CHARTORGANISATIONTYPES, SERVICEACCOUNTORGANISATIONS, CURRENT_USERORGANISATION, LEGAL_INFORMATIONS } from '@/mocks';
5+
import { AUTHTOKENS, CUSTOMPROPERTIES, CONNECTIVITYSCENARIOS, PLAYLISTS, SCENARIOORGANISATIONS, SCENARIOORGANISATIONTYPES, CUSTOMPROPERTYVALUES, DASHBOARDORGANISATIONS, DASHBOARDORGANISATIONTYPES, DASHBOARDSHALLOWS, DEVICEEXPLORERELEMENTS, DEVICEORGANISATIONS, FOLDERS, GROUPINGS, GROUPS, IMAGES, LANGUAGES, USERORGANISATIONTABLES, TIMEZONES, TRANSLATIONS, ORGANISATIONS, ROLEORGANISATIONS, ROLEORGANISATIONTYPES, LOCATIONS, MANUFACTURERS, USERORGANISATIONS, ORGANISATIONTYPES, MODELS, DATACATEGORIES, DATADEFINITIONS, ALERTS, COMMENTS, CHARTORGANISATIONS, CHARTORGANISATIONTYPES, SERVICEACCOUNTORGANISATIONS, CURRENT_USERORGANISATION, LEGAL_INFORMATIONS, SUBGROUPINGS } from '@/mocks';
66

77
const mock = new MockAdapter((ServiceFactory.http as any), { delayResponse: 200 });
88

@@ -52,6 +52,7 @@ export function mockApp() {
5252
onGetWithRegex("/api/foundation/core/v1/organisations/dative/groupings", GROUPINGS);
5353
onGetWithRegex("/api/foundation/core/v1/organisations/dative/groupings/1", GROUPINGS[0]);
5454
onGetWithRegex("/api/foundation/core/v1/organisations/dative/groupings/2", GROUPINGS[1]);
55+
onGetWithRegex("/api/foundation/core/v1/organisations/dative/subgroupings", SUBGROUPINGS);
5556
onGetWithRegex("/api/foundation/core/v1/organisations/dative/locations/1", LOCATIONS[0]);
5657
onGetWithRegex("/api/foundation/core/v1/organisations/dative/locations/2", LOCATIONS[1]);
5758
onGetWithRegex("/api/foundation/core/v1/organisations/dative/locations/3", LOCATIONS[2]);
@@ -85,6 +86,7 @@ export function mockApp() {
8586

8687
onGetWithRegex("/api/foundation/core/v1/organisations/dative/user-organisation-tables/devicesExplorer1", USERORGANISATIONTABLES[18]);
8788
onGetWithRegex("/api/foundation/core/v1/organisations/dative/user-organisation-tables/foldersExplorer1", USERORGANISATIONTABLES[19]);
89+
onGetWithRegex("/api/foundation/core/v1/organisations/dative/user-organisation-tables/subgroupings1", USERORGANISATIONTABLES[20]);
8890

8991

9092
onGetWithRegex("/api/foundation/core/v1/organisations/dative/custom-properties", CUSTOMPROPERTIES);

dev/storybook/src/stories/core/lists/SelectEntitiesList.stories.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,70 @@ export const DialogDashboards: Story = {
158158
selecteds: [],
159159
},
160160
};
161+
162+
export const Groupings: Story = {
163+
render: (args) => ({
164+
components: { FSSelectEntitiesList },
165+
setup() {
166+
return { args };
167+
},
168+
template: `
169+
<FSSelectEntitiesList
170+
:entityType="args.entityType"
171+
:showRemove="true"
172+
v-model="args.modelValue"
173+
/>
174+
`,
175+
}),
176+
args: {
177+
entityType: EntityType.Grouping,
178+
modelValue: []
179+
},
180+
};
181+
182+
export const Subgroupings: Story = {
183+
render: (args) => ({
184+
components: { FSSelectEntitiesList },
185+
setup() {
186+
return { args };
187+
},
188+
template: `
189+
<FSSelectEntitiesList
190+
:entityType="args.entityType"
191+
:showRemove="true"
192+
v-model="args.modelValue"
193+
/>
194+
`,
195+
}),
196+
args: {
197+
entityType: EntityType.Subgrouping,
198+
modelValue: []
199+
},
200+
};
201+
202+
export const DialogSubgroupings: Story = {
203+
render: (args) => ({
204+
components: { FSDialogSelectEntities, FSButton },
205+
setup() {
206+
return { args };
207+
},
208+
template: `
209+
<FSDialogSelectEntities
210+
:entityType="args.entityType"
211+
v-model:selecteds="args.selecteds"
212+
v-model:modelValue="args.modelValue"
213+
@update:selecteds="args['onUpdate:selecteds']"
214+
@update:modelValue="args['onUpdate:modelValue']"
215+
/>
216+
<FSButton
217+
@click="args.modelValue = true"
218+
label="Open Dialog"
219+
/>
220+
`,
221+
}),
222+
args: {
223+
entityType: EntityType.Subgrouping,
224+
selecteds: [],
225+
modelValue: false
226+
},
227+
};

0 commit comments

Comments
 (0)