-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (40 loc) · 1.09 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { resolveDtmi } from './resolve.js'
export default {
data: () => ({
// tryExpanded: false,
// dtmi: 'dtmi:test:schemas;1',
// repoBaseUrl: './test',
tryExpanded: true,
dtmi: 'dtmi:com:example:TemperatureController;1', // 'dtmi:test:schemas;1',
repoBaseUrl: 'https://devicemodels.azure.com', // './test',
loaded: false,
model: [],
errInfo: ''
}),
created () {
this.tryExpanded = this.repoBaseUrl === 'https://devicemodels.azure.com'
},
methods: {
async search () {
try {
this.loaded = false
this.errInfo = null
this.model.splice(0, this.model.length)
this.model = await resolveDtmi(this.dtmi, this.tryExpanded, this.repoBaseUrl)
} catch (e) {
this.errInfo = e
}
this.loaded = true
},
changeSelection (event) {
this.dtmi = event.target.id
this.model = []
},
changRepo (event) {
console.log('changerepo')
this.repoBaseUrl = event.target.id
this.tryExpanded = this.repoBaseUrl === 'https://devicemodels.azure.com'
this.model = []
}
}
}