Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add group descriptions to models #335

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/2/controllers/models/write-asset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Method: POST
locales: {
[locale: string]: {
groupFriendlyName: string;
description: string;
};
};
};
Expand Down
1 change: 1 addition & 0 deletions doc/2/controllers/models/write-device/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Method: POST
locales: {
[locale: string]: {
groupFriendlyName: string;
description: string;
};
};
};
Expand Down
13 changes: 9 additions & 4 deletions lib/modules/model/types/ModelContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface MetadataDetails {

interface MetadataGroupLocale {
groupFriendlyName: string;
description: string;
}

export interface MetadataGroups {
Expand Down Expand Up @@ -106,10 +107,12 @@ export interface AssetModelContent extends KDocumentContent {
* "buildingEnv": {
* "locales": {
* "en": {
* "groupFriendlyName": "Building environment"
* "groupFriendlyName": "Building environment",
* "description": "The building environment"
* },
* "fr": {
* "groupFriendlyName": "Environnement du bâtiment"
* "groupFriendlyName": "Environnement du bâtiment",
* "description": "L'environnement du bâtiment"
* }
* }
* }
Expand Down Expand Up @@ -187,10 +190,12 @@ export interface DeviceModelContent extends KDocumentContent {
* "sensorSpecs": {
* "locales": {
* "en": {
* "groupFriendlyName": "Sensor specifications"
* "groupFriendlyName": "Sensor specifications",
* "description" : "All sensors specifications"
* },
* "fr": {
* "groupFriendlyName": "Spécifications techniques"
* "groupFriendlyName": "Spécifications techniques",
* "description": "Toutes les spécifications techniques"
* }
* }
* }
Expand Down
45 changes: 24 additions & 21 deletions lib/modules/model/types/ModelDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ import {
* }
* },
* metadataGroups: {
* "buildingEnv": {
* "locales": {
* "en": {
* "groupFriendlyName": "Building environment"
* },
* "fr": {
* "groupFriendlyName": "Environnement du bâtiment"
* }
* buildingEnv: {
* locales: {
* en: {
* groupFriendlyName: "Building environment",
* description: "The building environment"
* },
* fr: {
* groupFriendlyName: "Environnement du bâtiment",
* description: "L'environnement du bâtiment"
* }
* }
* }
* }
Expand Down Expand Up @@ -108,19 +110,20 @@ export type AssetModelDefinition = {
* }
* },
* metadataGroups: {
* sensorSpecs: {
* locales: {
* en: {
* groupFriendlyName: "Sensors specifications"
* },
* fr: {
* groupFriendlyName: "Spécifications des capteurs"
* }
* }
* }
* }
* }
*
* sensorSpecs: {
* locales: {
* en: {
* groupFriendlyName: "Sensor specifications",
* description : "All sensors specifications"
* },
* fr: {
* groupFriendlyName: "Spécifications techniques",
* description: "Toutes les spécifications techniques"
* }
* }
* }
* }
* }
*/
export type DeviceModelDefinition = {
/**
Expand Down
6 changes: 4 additions & 2 deletions tests/application/assets/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ export const containerAssetDefinition: AssetModelDefinition = {
environment: {
locales: {
en: {
groupFriendlyName: "Environmental Measurements"
groupFriendlyName: "Environmental Measurements",
description: "All environmental relative measurments"
},
fr: {
groupFriendlyName: "Mesures environnementales"
groupFriendlyName: "Mesures environnementales",
description: "Toutes les mesures liées a l'environement"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions tests/scenario/migrated/model-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ describe("features/Model/Controller", () => {
metadataGroups: {
companyInfo: {
locales: {
en: { groupFriendlyName: "Company Information" },
fr: { groupFriendlyName: "Informations sur l'entreprise" }
en: { groupFriendlyName: "Company Information", description: "All company related informations" },
fr: { groupFriendlyName: "Informations sur l'entreprise", description: "Toutes les informations relatives a l'entreprise" }
}
}
}
Expand Down
Loading