Skip to content

Commit 02d97c1

Browse files
authored
Merge pull request #141 from FlowCI/feature/1562
Feature/1562
2 parents 5cff61f + 714da83 commit 02d97c1

File tree

7 files changed

+112
-14
lines changed

7 files changed

+112
-14
lines changed

src/components/Common/TextBox.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ export default {
7070
}
7171
},
7272
watch: {
73+
value(val) {
74+
this.adaptor = val
75+
},
76+
7377
adaptor(val) {
7478
this.$emit('input', val)
7579
}

src/i18n/cn.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export default {
163163
agent: 'Agents',
164164
secret: '秘钥管理',
165165
config: '配置管理',
166+
plugin: '插件',
166167
system: '系统设置'
167168
},
168169

src/i18n/en.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@ export default {
160160
settings: {
161161
li: {
162162
profile: 'Profile',
163-
users: 'Users',
163+
users: 'User',
164164
security: 'Security',
165-
agent: 'Agents',
166-
secret: 'Secrets',
165+
agent: 'Agent',
166+
secret: 'Secret',
167167
config: 'Config',
168+
plugin: 'Plugin',
168169
system: 'System'
169170
},
170171

src/router/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import SettingsConfigHome from '@/view/Settings/Config/Index'
3434
import SettingsConfigNew from '@/view/Settings/Config/New'
3535
import SettingsConfigEdit from '@/view/Settings/Config/Edit'
3636

37-
import SystemSettingsHome from '@/view/Settings/System/Index'
37+
import SettingsPluginHome from '@/view/Settings/Plugin/Index'
38+
import SettingsSystemHome from '@/view/Settings/System/Index'
3839

3940
Vue.use(Router)
4041

@@ -183,10 +184,15 @@ export default new Router({
183184
props: true
184185
},
185186

187+
{
188+
path: 'plugins',
189+
name: 'PluginSettingsHome',
190+
component: SettingsPluginHome
191+
},
186192
{
187193
path: 'system',
188194
name: 'SystemSettingsHome',
189-
component: SystemSettingsHome
195+
component: SettingsSystemHome
190196
}
191197
]
192198
}

src/util/plugins.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { timeFormat } from "./time"
2+
13
export const TagNotification = 'notification'
24

35
export class PluginWrapper {
@@ -19,11 +21,11 @@ export class PluginWrapper {
1921
}
2022

2123
get docker() {
22-
return this.plugin.docker
24+
return this.plugin.meta.docker
2325
}
2426

2527
get icon() {
26-
return this.plugin.icon
28+
return this.plugin.meta.icon
2729
}
2830

2931
get version() {
@@ -38,16 +40,12 @@ export class PluginWrapper {
3840
return this.plugin.source
3941
}
4042

41-
get inputs() {
42-
return this.plugin.inputs
43-
}
44-
4543
get isDefaultIcon() {
46-
return !this.plugin.icon
44+
return !this.plugin.meta.icon
4745
}
4846

4947
get isHttpLinkIcon() {
50-
const pathOrLink = this.plugin.icon
48+
const pathOrLink = this.plugin.meta.icon
5149
if (!pathOrLink) {
5250
return false
5351
}
@@ -56,11 +54,22 @@ export class PluginWrapper {
5654
}
5755

5856
get isRepoSrcIcon() {
59-
const pathOrLink = this.plugin.icon
57+
const pathOrLink = this.plugin.meta.icon
6058
if (!pathOrLink) {
6159
return false
6260
}
6361

6462
return !this.isHttpLinkIcon
6563
}
64+
65+
get syncTime() {
66+
if (this.plugin.syncTime) {
67+
return timeFormat(this.plugin.syncTime)
68+
}
69+
return '-'
70+
}
71+
72+
get synced() {
73+
return this.plugin.synced
74+
}
6675
}

src/view/Settings/FunList.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
i18n: 'settings.li.config',
4848
path: 'configs'
4949
},
50+
{
51+
i18n: 'settings.li.plugin',
52+
path: 'plugins'
53+
},
5054
{
5155
i18n: 'settings.li.system',
5256
path: 'system'

src/view/Settings/Plugin/Index.vue

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<template>
2+
<v-data-table
3+
:headers="headers"
4+
:items="pluginList"
5+
>
6+
<template v-slot:item="{item}">
7+
<tr>
8+
<td><a :href="item.source" target="_blank">{{ item.name }}</a></td>
9+
<td>{{ item.version }}</td>
10+
<td>{{ item.desc }}</td>
11+
<td>
12+
<v-icon small color="green" v-if="item.synced">mdi-check-circle</v-icon>
13+
<v-icon small color="red" v-else>mdi-close-circle-outline</v-icon>
14+
</td>
15+
<td>{{ item.syncTime }}</td>
16+
</tr>
17+
</template>
18+
</v-data-table>
19+
</template>
20+
21+
<script>
22+
import actions from "@/store/actions";
23+
import {mapState} from "vuex";
24+
import { PluginWrapper } from '@/util/plugins'
25+
26+
export default {
27+
name: "PluginSettingsHome",
28+
29+
mounted() {
30+
this.$emit('onConfigNav', {
31+
navs: [{text: this.$t('settings.li.plugin')}],
32+
showAddBtn: false
33+
})
34+
35+
this.$store.dispatch(actions.plugins.list).then(() => {
36+
})
37+
},
38+
39+
data() {
40+
return {
41+
loading: false,
42+
pluginList: [],
43+
headers: [
44+
{text: 'Name', sortable: true, value: 'name'},
45+
{text: 'Version', value: 'version'},
46+
{text: 'Description', value: 'description'},
47+
{text: 'Synced', value: 'synced'},
48+
{text: 'Last sync time', value: 'synced'},
49+
]
50+
}
51+
},
52+
53+
computed: {
54+
...mapState({
55+
plugins: state => state.plugins.items,
56+
})
57+
},
58+
59+
watch: {
60+
plugins(val) {
61+
this.pluginList = []
62+
for (let p of val) {
63+
this.pluginList.push(new PluginWrapper(p))
64+
}
65+
},
66+
}
67+
68+
}
69+
</script>
70+
71+
<style scoped>
72+
73+
</style>

0 commit comments

Comments
 (0)