File tree Expand file tree Collapse file tree 1 file changed +30
-9
lines changed
src/components/ShaclForm/Editor Expand file tree Collapse file tree 1 file changed +30
-9
lines changed Original file line number Diff line number Diff line change 88 - select -
99 </option >
1010 <option
11- v-for =" option in createOptions() "
12- :key =" option. key"
13- :value =" option. key"
11+ v-for =" key in keys "
12+ :key =" key"
13+ :value =" key"
1414 >
15- {{ option.value }}
15+ {{ values[key] }}
1616 </option >
1717 </select >
1818</template >
@@ -21,6 +21,8 @@ import * as $rdf from 'rdflib'
2121import _ from ' lodash'
2222import { Component , Prop , Vue } from ' vue-property-decorator'
2323import rdfUtils from ' @/rdf/utils'
24+ import api from ' @/api'
25+ import { SHACL } from ' @/rdf/namespaces'
2426
2527@Component ({})
2628export default class EnumSelectEditor extends Vue {
@@ -30,11 +32,30 @@ export default class EnumSelectEditor extends Vue {
3032 @Prop ({ required: true })
3133 readonly value: any
3234
33- createOptions() {
34- return _ .get (this .field , ' in' , []).map ((val ) => ({
35- key: val ,
36- value: rdfUtils .pathTerm (val ),
37- }))
35+ keys : any
36+
37+ values : any
38+
39+ created(): void {
40+ this .keys = []
41+ this .values = {}
42+
43+ _ .get (this .field , ' in' , []).forEach ((key ) => {
44+ this .keys .push (key )
45+ this .values [key ] = rdfUtils .pathTerm (key )
46+
47+ if (this .field .nodeKind === SHACL (' IRI' ).value ) {
48+ this .resolveValue (key )
49+ }
50+ })
51+ }
52+
53+ async resolveValue(key : string ): Promise <void > {
54+ try {
55+ this .values [key ] = await api .label .getLabel (key )
56+ } catch {
57+ // nothing could be fetched, keep default label
58+ }
3859 }
3960
4061 onInput(e ) {
You can’t perform that action at this time.
0 commit comments