|
| 1 | +--- |
| 2 | +code: false |
| 3 | +type: page |
| 4 | +title: Metadata details |
| 5 | +description: structure of metadataDetails |
| 6 | +--- |
| 7 | + |
| 8 | +# Metadata details |
| 9 | + |
| 10 | +Defining metadata details is a way to enhance the user experience by improving the metadata management workflow on an asset or a device. There are multiple features you can use : |
| 11 | + |
| 12 | +- [Translation](#translations-mandatory) (**_mandatory_**) |
| 13 | +- [Group](#group-optional) (**_optional_**) |
| 14 | +- [Editor hint](#editor-hint-optional) (change UI elements) (**_optional_**) |
| 15 | + |
| 16 | +## Translations (_mandatory_) |
| 17 | + |
| 18 | +This property allows to add a localized user-friendly name and description to the metadata. Those will be automatically substitued according to the user's language. |
| 19 | + |
| 20 | +**Example** |
| 21 | + |
| 22 | +```js |
| 23 | +{ |
| 24 | + metadataMappings: { |
| 25 | + company: { type: "keyword" }, |
| 26 | + }, |
| 27 | + metadataDetails: { |
| 28 | + locales: { |
| 29 | + en: { |
| 30 | + friendlyName: "Manufacturer", |
| 31 | + description: "The company that manufactured the plane", |
| 32 | + }, |
| 33 | + fr: { |
| 34 | + friendlyName: "Fabricant", |
| 35 | + description: "L'entreprise qui a fabriqué l'avion", |
| 36 | + }, |
| 37 | + }, |
| 38 | + }, |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +## Group (_optional_) |
| 43 | + |
| 44 | +This property allows to group metadata together. |
| 45 | + |
| 46 | +First, create a `metadataGroups` object at the same level as `metadataDetails`, using the group's name as a key and mapping them to their localization details. Then in the `metadataDetails` object, specify the group of the metadata by using the `group` property. |
| 47 | + |
| 48 | +**Example** |
| 49 | + |
| 50 | +```js |
| 51 | +{ |
| 52 | + metadataMappings: { |
| 53 | + company: { type: "keyword" }, |
| 54 | + }, |
| 55 | + metadataDetails: { |
| 56 | + company: { |
| 57 | + group: "companyInfo", |
| 58 | + }, |
| 59 | + }, |
| 60 | + metadataGroups: { |
| 61 | + companyInfo: { |
| 62 | + locales: { |
| 63 | + en: { |
| 64 | + groupFriendlyName: "Company Information", |
| 65 | + description: "All company related informations", |
| 66 | + }, |
| 67 | + fr: { |
| 68 | + groupFriendlyName: "Informations sur l'entreprise", |
| 69 | + description: "Toutes les informations relatives a l'entreprise", |
| 70 | + }, |
| 71 | + }, |
| 72 | + }, |
| 73 | + }, |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## Editor hint (_optional_) |
| 78 | + |
| 79 | +This property allows to specify the frontend whether it should display a custom widget to edit the metadata, like a dropdown of values, a clock picker or date picker with or without time, make a metadata read-only, and so on. |
| 80 | + |
| 81 | +You have to set the enum type associated to the hint you want and fill the properties with your values. |
| 82 | + |
| 83 | +This is the list of the available hints: |
| 84 | + |
| 85 | +- [Read only](#read-only) |
| 86 | +- [Dropdown of values](#dropdown-of-values) |
| 87 | +- [Date/Datetime/Clock picker](#datedatetimeclock-picker) |
| 88 | + |
| 89 | +<h3 id="read-only" style="color: #e94e77">Read only <a href="#read-only" class="heading-anchor-link">#</a></h3> |
| 90 | + |
| 91 | +The read-only feature allows to prevent users to edit a metadata. |
| 92 | + |
| 93 | +**NOTE:** The readOnly property can be set with **any** Enum type. |
| 94 | + |
| 95 | +Enum type: `BASE` |
| 96 | + |
| 97 | +:warning: Set to BASE if you **only** want the readOnly property. |
| 98 | + |
| 99 | +<table> |
| 100 | + <thead> |
| 101 | + <tr> |
| 102 | + <th style="background-color: #e94e77" colspan="4" align="center">PROPERTIES</th> |
| 103 | + </tr> |
| 104 | + <tr> |
| 105 | + <th>Name</th> |
| 106 | + <th>Type</th> |
| 107 | + <th>Description</th> |
| 108 | + <th>Optional</th> |
| 109 | + </tr> |
| 110 | + </thead> |
| 111 | + <tbody> |
| 112 | + <tr> |
| 113 | + <td>readOnly</td> |
| 114 | + <td><code>boolean</code></td> |
| 115 | + <td>It displays or not the edit button</td> |
| 116 | + <td>Yes</td> |
| 117 | + </tr> |
| 118 | + </tbody> |
| 119 | +</table> |
| 120 | + |
| 121 | +**Example** |
| 122 | + |
| 123 | +```js |
| 124 | +{ |
| 125 | + metadataMappings: { |
| 126 | + network: { type: "keyword" }, |
| 127 | + }, |
| 128 | + metadataDetails: { |
| 129 | + network: { |
| 130 | + editorHint: { |
| 131 | + type: EditorHintEnum.BASE, |
| 132 | + readOnly: true, |
| 133 | + }, |
| 134 | + }, |
| 135 | + } |
| 136 | +}, |
| 137 | +``` |
| 138 | + |
| 139 | +<h3 id="dropdown-of-values" style="color: #e94e77">Dropdown of values <a href="#dropdown-of-values" class="heading-anchor-link">#</a></h3> |
| 140 | + |
| 141 | +The dropdown feature allows to display a list of values to choose in a dropdown. |
| 142 | + |
| 143 | +Enum type: `OPTION_SELECTOR` |
| 144 | + |
| 145 | +<table> |
| 146 | + <thead> |
| 147 | + <tr> |
| 148 | + <th style="background-color: #e94e77" colspan="4" align="center">PROPERTIES</th> |
| 149 | + </tr> |
| 150 | + <tr> |
| 151 | + <th>Name</th> |
| 152 | + <th>Type</th> |
| 153 | + <th>Description</th> |
| 154 | + <th>Optional</th> |
| 155 | + </tr> |
| 156 | + </thead> |
| 157 | + <tbody> |
| 158 | + <tr> |
| 159 | + <td>values</td> |
| 160 | + <td><code>string[] | number[] | boolean[]</code></td> |
| 161 | + <td>A list that represents all the values displayed in a dropdown.</td> |
| 162 | + <td>No</td> |
| 163 | + </tr> |
| 164 | + <tr> |
| 165 | + <td>customValueAllowed</td> |
| 166 | + <td><code>boolean</code></td> |
| 167 | + <td>Allows users to add custom values.</td> |
| 168 | + <td>Yes</td> |
| 169 | + </tr> |
| 170 | + </tbody> |
| 171 | +</table> |
| 172 | + |
| 173 | +**Example** |
| 174 | + |
| 175 | +```js |
| 176 | +{ |
| 177 | + metadataMappings: { |
| 178 | + company: { type: "keyword" }, |
| 179 | + }, |
| 180 | + metadataDetails: { |
| 181 | + company: { |
| 182 | + editorHint: { |
| 183 | + type: EditorHintEnum.OPTION_SELECTOR, |
| 184 | + values: ["red", "blue"], |
| 185 | + customValueAllowed: true, |
| 186 | + }, |
| 187 | + } |
| 188 | + }, |
| 189 | +}, |
| 190 | +``` |
| 191 | + |
| 192 | +**Visual** |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | +<h3 id="datedatetimeclock-picker" style="color: #e94e77">Date/Datetime/Clock picker <a href="#datedatetimeclock-picker" class="heading-anchor-link">#</a></h3> |
| 197 | + |
| 198 | +This feature allows to display either a date picker with or without a time picker, or a clock picker. |
| 199 | + |
| 200 | +Enum type: `DATETIME` |
| 201 | + |
| 202 | +<table> |
| 203 | + <thead> |
| 204 | + <tr> |
| 205 | + <th style="background-color: #e94e77" colspan="4" align="center">PROPERTIES</th> |
| 206 | + </tr> |
| 207 | + <tr> |
| 208 | + <th>Name</th> |
| 209 | + <th>Type</th> |
| 210 | + <th>Description</th> |
| 211 | + <th>Optional</th> |
| 212 | + </tr> |
| 213 | + </thead> |
| 214 | + <tbody> |
| 215 | + <tr> |
| 216 | + <td>date</td> |
| 217 | + <td><code>boolean</code></td> |
| 218 | + <td>If true, displays a date picker, otherwise displays a clock picker.</td> |
| 219 | + <td>No</td> |
| 220 | + </tr> |
| 221 | + <tr> |
| 222 | + <td>time</td> |
| 223 | + <td><code>boolean</code></td> |
| 224 | + <td>If `date` is true, setting this to true will add time picking to the date picker.</td> |
| 225 | + <td>Yes</td> |
| 226 | + </tr> |
| 227 | + </tbody> |
| 228 | +</table> |
| 229 | + |
| 230 | +**Example** |
| 231 | + |
| 232 | +```js |
| 233 | +{ |
| 234 | + metadataMappings: { |
| 235 | + date: { type: "date" }, |
| 236 | + }, |
| 237 | + metadataDetails: { |
| 238 | + date: { |
| 239 | + editorHint: { |
| 240 | + type: EditorHintEnum.DATETIME, |
| 241 | + date: true, |
| 242 | + time: true, |
| 243 | + customTimeZoneAllowed: true, |
| 244 | + }, |
| 245 | + } |
| 246 | + }, |
| 247 | +}, |
| 248 | +``` |
| 249 | + |
| 250 | +**Visual** |
| 251 | + |
| 252 | + |
0 commit comments