Skip to content

Commit

Permalink
feat(metadata): add option field readOnly to prevent editing (#358)
Browse files Browse the repository at this point in the history
* feat(metadata): add option field readOnly to prevent editing

* doc(metadata): update doc concerning metadataDetails
  • Loading branch information
cyrng authored and sebtiz13 committed Aug 9, 2024
1 parent febf3a6 commit e0641b4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions doc/2/controllers/models/update-asset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Method: PUT
description: string;
};
};
readOnly?: boolean;
};
*/
},
Expand Down
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 @@ -49,6 +49,7 @@ Method: POST
description: string;
};
};
readOnly?: boolean;
};
*/
},
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 @@ -48,6 +48,7 @@ Method: POST
description: string;
};
};
readOnly?: boolean;
};
*/
},
Expand Down
37 changes: 20 additions & 17 deletions lib/modules/model/types/ModelContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface MetadataDetails {
locales: {
[locale: string]: LocaleDetails;
};
readOnly?: boolean;
};
}

Expand Down Expand Up @@ -148,14 +149,15 @@ export interface AssetModelContent extends KDocumentContent {
* "extTemp": {
* "group": "buildingEnv",
* "locales": {
* "en": {
* "friendlyName": "External temperature",
* "description": "Building external temperature"
* },
* "fr": {
* "friendlyName": "Température extérieure",
* "description": "Température à l'exterieur du bâtiment"
* },
* "en": {
* "friendlyName": "External temperature",
* "description": "Building external temperature"
* },
* "fr": {
* "friendlyName": "Température extérieure",
* "description": "Température à l'exterieur du bâtiment"
* },
* "readOnly": true,
* }
*/
metadataDetails?: MetadataDetails;
Expand Down Expand Up @@ -278,14 +280,15 @@ export interface DeviceModelContent extends KDocumentContent {
* "sensorVersion": {
* "group": "sensorSpecs",
* "locales": {
* "en": {
* "friendlyName": "Sensor version",
* "description": "Firmware version of the sensor"
* },
* "fr": {
* "friendlyName": "Version du capteur",
* "description": "Version du micrologiciel du capteur"
* },
* "en": {
* "friendlyName": "Sensor version",
* "description": "Firmware version of the sensor"
* },
* "fr": {
* "friendlyName": "Version du capteur",
* "description": "Version du micrologiciel du capteur"
* },
* "readOnly": true,
* }
*/
metadataDetails?: MetadataDetails;
Expand All @@ -302,7 +305,7 @@ export interface DeviceModelContent extends KDocumentContent {
* "fr": {
* "groupFriendlyName": "Spécifications techniques",
* "description": "Toutes les spécifications techniques"
* }
* },
* }
* }
* }
Expand Down
6 changes: 4 additions & 2 deletions lib/modules/model/types/ModelDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import {
* "friendlyName": "Température externe",
* "description": "Température externe du conteneur"
* }
* }
* },
* "readOnly": true,
* }
* },
* metadataGroups: {
Expand Down Expand Up @@ -153,7 +154,8 @@ export type AssetModelDefinition = {
* friendlyName: "Type de traceur",
* description: "Type du traceur"
* }
* }
* },
* readOnly: true,
* }
* },
* metadataGroups: {
Expand Down
1 change: 1 addition & 0 deletions tests/scenario/migrated/model-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ describe("features/Model/Controller", () => {
description: "L'entreprise qui a fabriqué l'avion",
},
},
readOnly: true,
},
},
metadataGroups: {
Expand Down

0 comments on commit e0641b4

Please sign in to comment.