Skip to content

Commit f33cd5c

Browse files
committed
support to let user to choose store param from list
1 parent ad85fb8 commit f33cd5c

File tree

3 files changed

+85
-74
lines changed

3 files changed

+85
-74
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ console/atest-desktop/atest
2020
console/atest-desktop/atest.exe
2121
console/atest-desktop/coverage
2222
atest-store-git
23+
.db

console/atest-ui/src/views/StoreManager.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ watch(() => storeForm.kind.name, (name) => {
150150
value: '',
151151
defaultValue: p.defaultValue,
152152
description: p.description,
153+
type: p.type,
154+
enum: p.enum
153155
} as Pair)
154156
} else {
155157
pro[index].description = p.description
@@ -318,15 +320,21 @@ const storeExtLink = ref('')
318320
<el-table-column label="Value">
319321
<template #default="scope">
320322
<div style="display: flex; align-items: center">
321-
<el-input v-model="scope.row.value" :placeholder="scope.row.defaultValue">
322-
<template #append v-if="scope.row.description">
323-
<el-tooltip :content="scope.row.description">
323+
<el-select v-model="scope.row.value" v-if="scope.row.enum">
324+
<el-option
325+
v-for="item in scope.row.enum"
326+
:key="item"
327+
:label="item"
328+
:value="item"
329+
/>
330+
</el-select>
331+
<el-input-number v-model="scope.row.value" v-else-if="scope.row.type === 'number'"/>
332+
<el-input v-model="scope.row.value" :placeholder="scope.row.defaultValue" v-else/>
333+
<el-tooltip :content="scope.row.description" v-if="scope.row.description">
324334
<el-icon>
325335
<QuestionFilled/>
326336
</el-icon>
327337
</el-tooltip>
328-
</template>
329-
</el-input>
330338
</div>
331339
</template>
332340
</el-table-column>

console/atest-ui/src/views/store.ts

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -22,80 +22,82 @@ interface Store {
2222
}
2323

2424
const storeExtensions = [
25-
{
26-
name: 'atest-store-git',
27-
params: [{
28-
key: 'insecure'
29-
}, {
30-
key: 'timeout'
31-
}, {
32-
key: 'targetpath'
33-
}, {
34-
key: 'branch'
35-
}, {
36-
key: 'email',
37-
description: 'See also: git config --local user.email [email protected]'
38-
}, {
39-
key: 'name',
40-
description: 'See also: git config --local user.name xxx'
41-
}],
42-
link: 'https://github.com/LinuxSuRen/atest-ext-store-git'
43-
},
44-
{
45-
name: 'atest-store-s3',
46-
params: [{
47-
key: 'accesskeyid'
48-
}, {
49-
key: 'secretaccesskey'
50-
}, {
51-
key: 'sessiontoken'
52-
}, {
53-
key: 'region'
54-
}, {
55-
key: 'disablessl'
56-
}, {
57-
key: 'forcepathstyle'
58-
}, {
59-
key: 'bucket'
60-
}],
61-
link: 'https://github.com/LinuxSuRen/atest-ext-store-s3'
62-
},
63-
{
64-
name: 'atest-store-orm',
65-
params: [{
66-
key: 'driver',
67-
defaultValue: 'mysql',
68-
description: 'Supported: mysql, postgres, sqlite'
69-
}, {
70-
key: 'database',
71-
defaultValue: 'atest'
72-
}, {
73-
key: 'historyLimit',
74-
defaultValue: '',
75-
description: 'Set the limit of the history record count'
76-
}],
77-
link: 'https://github.com/LinuxSuRen/atest-ext-store-orm'
78-
},
79-
{
80-
name: 'atest-store-etcd',
81-
params: [],
82-
link: 'https://github.com/LinuxSuRen/atest-ext-store-etcd'
83-
},
25+
{
26+
name: 'atest-store-git',
27+
params: [{
28+
key: 'insecure'
29+
}, {
30+
key: 'timeout'
31+
}, {
32+
key: 'targetpath'
33+
}, {
34+
key: 'branch'
35+
}, {
36+
key: 'email',
37+
description: 'See also: git config --local user.email [email protected]'
38+
}, {
39+
key: 'name',
40+
description: 'See also: git config --local user.name xxx'
41+
}],
42+
link: 'https://github.com/LinuxSuRen/atest-ext-store-git'
43+
},
44+
{
45+
name: 'atest-store-s3',
46+
params: [{
47+
key: 'accesskeyid'
48+
}, {
49+
key: 'secretaccesskey'
50+
}, {
51+
key: 'sessiontoken'
52+
}, {
53+
key: 'region'
54+
}, {
55+
key: 'disablessl'
56+
}, {
57+
key: 'forcepathstyle'
58+
}, {
59+
key: 'bucket'
60+
}],
61+
link: 'https://github.com/LinuxSuRen/atest-ext-store-s3'
62+
},
63+
{
64+
name: 'atest-store-orm',
65+
params: [{
66+
key: 'driver',
67+
defaultValue: 'mysql',
68+
enum: ['mysql', 'postgres', 'sqlite', 'tdengine'],
69+
description: 'Supported: mysql, postgres, sqlite, tdengine'
70+
}, {
71+
key: 'database',
72+
defaultValue: 'atest'
73+
}, {
74+
key: 'historyLimit',
75+
defaultValue: '',
76+
// type: 'number',
77+
description: 'Set the limit of the history record count'
78+
}],
79+
link: 'https://github.com/LinuxSuRen/atest-ext-store-orm'
80+
},
81+
{
82+
name: 'atest-store-etcd',
83+
params: [],
84+
link: 'https://github.com/LinuxSuRen/atest-ext-store-etcd'
85+
},
8486
{
8587
name: 'atest-store-redis',
8688
params: [],
8789
link: 'https://github.com/LinuxSuRen/atest-ext-store-redis'
8890
},
89-
{
90-
name: 'atest-store-mongodb',
91-
params: [{
92-
key: 'collection'
93-
}, {
94-
key: 'database',
95-
defaultValue: 'atest'
96-
}],
97-
link: 'https://github.com/LinuxSuRen/atest-ext-store-mongodb'
98-
}
91+
{
92+
name: 'atest-store-mongodb',
93+
params: [{
94+
key: 'collection'
95+
}, {
96+
key: 'database',
97+
defaultValue: 'atest'
98+
}],
99+
link: 'https://github.com/LinuxSuRen/atest-ext-store-mongodb'
100+
}
99101
] as Store[]
100102

101103
export function SupportedExtensions() {

0 commit comments

Comments
 (0)