-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tooltip model by asset model (#341)
* add tooltip models * fix delete asset model * feat: unit fields for metadata & measures tooltip models * remove unnecessary comments * add doc & tests * review comments * fix tests * fix tests * fix tests * delete test models * Feat tooltipModels add locales, static & suffix * rebase on 2-dev * fix delete asset model * feat: unit fields for metadata & measures tooltip models * remove unnecessary comments * add doc & tests * review comments * fix tests * fix tests * fix tests * rebase on 2-dev * Feat tooltipModels add locales, static & suffix * rebase on 2-dev * add update conflicts check * doc for updateAsset model function * review comments * fix tests * fix tests * fix tests * rebase on 2-dev * add update conflicts check * doc for updateAsset model function * merge conflicts * changed from put to patch
- Loading branch information
Showing
14 changed files
with
712 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
--- | ||
code: true | ||
type: page | ||
title: updateAsset | ||
description: Update an asset model | ||
--- | ||
|
||
# updateAsset | ||
|
||
Update an existing asset model. | ||
|
||
## Query Syntax | ||
|
||
### HTTP | ||
|
||
```http | ||
URL: http://kuzzle:7512/_/device-manager/models/assets/:model?engineGroup=<engine group> | ||
Method: PUT | ||
``` | ||
|
||
### Other protocols | ||
|
||
```js | ||
{ | ||
"controller": "device-manager/assets", | ||
"action": "updateAsset", | ||
"engineGroup": "<engine group>", | ||
"model": "<asset model>", | ||
|
||
"body": { | ||
|
||
// Optional | ||
|
||
"metadataMappings": { | ||
// Metadata mappings | ||
}, | ||
"defaultValues": { | ||
// Default values for metadata | ||
}, | ||
"metadataDetails": { | ||
/* | ||
Metadata details including translations and group. | ||
[name: string]: { | ||
group?: string; | ||
locales: { | ||
[locale: string]: { | ||
friendlyName: string; | ||
description: string; | ||
}; | ||
}; | ||
}; | ||
*/ | ||
}, | ||
"metadataGroups": { | ||
/* | ||
Metadata groups list and details. | ||
{ | ||
[groupName: string]: { | ||
locales: { | ||
[locale: string]: { | ||
groupFriendlyName: string; | ||
description: string; | ||
}; | ||
}; | ||
}; | ||
}; | ||
*/ | ||
}, | ||
"tooltipModels": { | ||
/* | ||
Tooltip models for an asset model. | ||
[key: string]: { | ||
tooltipLabel: string; | ||
content: [ | ||
{ | ||
category: "metadata"; | ||
label?: { | ||
locales: { | ||
[locale: string]: { | ||
friendlyName: string; | ||
description: string; | ||
}; | ||
}; | ||
}; | ||
metadataPath: string; | ||
suffix?: string; | ||
}, | ||
{ | ||
category: "measure"; | ||
label?: { | ||
locales: { | ||
[locale: string]: { | ||
friendlyName: string; | ||
description: string; | ||
}; | ||
}; | ||
}; | ||
measureSlot: string; | ||
measureValuePath: string; | ||
suffix?: string; | ||
}, | ||
{ | ||
category: "static"; | ||
label?: { | ||
locales: { | ||
[locale: string]: { | ||
friendlyName: string; | ||
description: string; | ||
}; | ||
}; | ||
}; | ||
type: "link" | "image" | "text" | "title" | "separator"; | ||
value: string; | ||
} | ||
]; | ||
}; | ||
*/ | ||
}, | ||
"measures": [ | ||
// Array of measure definition with type and name | ||
] | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## Arguments | ||
|
||
- `engineGroup`: Name of the engine group | ||
- `model`: Asset model name | ||
|
||
--- | ||
|
||
## Body properties | ||
|
||
- `metadataMappings`: Mappings of the metadata in Elasticsearch format | ||
- `defaultValues`: Default values for the metadata | ||
- `metadataDetails`: Metadata group and translations | ||
- `metadataGroups`: Groups list with translations for group name | ||
- `tooltipModels`: Tooltip model list, containing each labels and tooltip content to display | ||
- `measures`: Array of measure definition. Each item defines `type` and `name` properties for the measure. | ||
|
||
--- | ||
|
||
## Response | ||
|
||
```js | ||
{ | ||
"status": 200, | ||
"error": null, | ||
"controller": "device-manager/models", | ||
"action": "updateAsset", | ||
"requestId": "<unique request identifier>", | ||
"result": { | ||
"_id": "<modelId>", | ||
"_source": { | ||
// Updated asset model content | ||
}, | ||
} | ||
} | ||
``` | ||
|
||
## Errors | ||
|
||
Updating an asset with metadata mappings can cause conflicts, in this case a [ MappingsConflictsError ](../../../errors/mappings-conflicts/index.md) will be thrown with the HTTP code **409**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.