Skip to content

Commit

Permalink
feat: add group descriptions to models (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juiced66 committed Mar 21, 2024
1 parent 05c426f commit de00fb7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
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

0 comments on commit de00fb7

Please sign in to comment.