diff --git a/src/i18n/cn.js b/src/i18n/cn.js
index 92aa5af4..ca9dc609 100644
--- a/src/i18n/cn.js
+++ b/src/i18n/cn.js
@@ -166,7 +166,8 @@ export default {
config: '配置管理',
plugin: '插件',
system: '系统设置',
- trigger: '触发器'
+ trigger: '触发器',
+ git: 'Git 设置',
},
common: {
diff --git a/src/i18n/en.js b/src/i18n/en.js
index 8b606e9a..8ef902a9 100644
--- a/src/i18n/en.js
+++ b/src/i18n/en.js
@@ -167,6 +167,7 @@ export default {
config: 'Configs',
plugin: 'Plugins',
system: 'System',
+ git: 'Git',
trigger: 'Triggers'
},
diff --git a/src/router/index.js b/src/router/index.js
index 63030d03..ec5c4661 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -40,6 +40,10 @@ import SettingsTriggerHome from '@/view/Settings/Trigger/Index'
import SettingsTriggerNew from '@/view/Settings/Trigger/New'
import SettingsTriggerEdit from '@/view/Settings/Trigger/Edit'
+import SettingsGitHome from '@/view/Settings/Git/Index'
+import SettingsGitNew from '@/view/Settings/Git/New'
+import SettingsGitEdit from '@/view/Settings/Git/Edit'
+
import SettingsSystemHome from '@/view/Settings/System/Index'
Vue.use(Router)
@@ -215,6 +219,24 @@ export default new Router({
props: true
},
+ // git settings
+ {
+ path: 'git',
+ name: 'SettingsGitHome',
+ component: SettingsGitHome
+ },
+ {
+ path: 'git/new',
+ name: 'SettingsGitNew',
+ component: SettingsGitNew
+ },
+ {
+ path: 'git/edit',
+ name: 'SettingsGitEdit',
+ component: SettingsGitEdit,
+ props: true
+ },
+
// system settings
{
path: 'system',
diff --git a/src/store/actions.js b/src/store/actions.js
index 597be591..321f943d 100644
--- a/src/store/actions.js
+++ b/src/store/actions.js
@@ -156,5 +156,11 @@ export default {
settings: {
get: 'settings/get',
save: 'settings/save'
+ },
+
+ git: {
+ list: 'git/list',
+ save: 'git/save',
+ delete: 'git/delete'
}
}
diff --git a/src/store/index.js b/src/store/index.js
index 19f7d4a1..f82dbe76 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -18,6 +18,7 @@ import { Store as ConfigStore } from './module/configs'
import { Store as TtyStore } from './module/tty'
import { Store as SettingStore } from './module/settings'
import { Store as TriggerStore } from './module/triggers'
+import { Store as GitStore } from './module/git'
Vue.use(Vuex)
@@ -39,7 +40,8 @@ const store = new Vuex.Store({
'configs': ConfigStore,
'tty': TtyStore,
'settings': SettingStore,
- 'triggers': TriggerStore
+ 'triggers': TriggerStore,
+ 'git': GitStore
}
})
diff --git a/src/store/module/git.js b/src/store/module/git.js
new file mode 100644
index 00000000..a701101a
--- /dev/null
+++ b/src/store/module/git.js
@@ -0,0 +1,52 @@
+import http from '../http'
+
+const state = {
+ items: [],
+ loaded: {}
+}
+
+const mutations = {
+ list(state, items) {
+ state.items = items
+ },
+
+ add(state, git) {
+ state.items.push(git)
+ },
+
+ delete(state, source) {
+ for (let i = 0; i < state.items.length; i++) {
+ if (state.items[i].source === source) {
+ state.items.splice(i, 1)
+ return
+ }
+ }
+ }
+}
+
+const actions = {
+ async list({commit}) {
+ await http.get(`gitconfig`, (items) => {
+ commit('list', items)
+ })
+ },
+
+ async save({commit}, payload) {
+ await http.post(`gitconfig`, (item) => {
+ commit('add', item)
+ }, payload)
+ },
+
+ async delete({commit}, source) {
+ await http.delete(`gitconfig/${source}`, () => {
+ commit('delete', source)
+ })
+ }
+}
+
+export const Store = {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
\ No newline at end of file
diff --git a/src/util/git.js b/src/util/git.js
new file mode 100644
index 00000000..34201d8e
--- /dev/null
+++ b/src/util/git.js
@@ -0,0 +1,36 @@
+export const GIT_SOURCE_GITLAB = "GITLAB"
+export const GIT_SOURCE_GITHUB = "GITHUB"
+export const GIT_SOURCE_GOGS = "GOGS"
+export const GIT_SOURCE_GITEE = "GITEE"
+export const GIT_SOURCE_GERRIT = "GERRIT"
+
+export const GitSourceSelection = [
+ {name: 'GitHub', value: GIT_SOURCE_GITHUB, icon: 'mdi-github'},
+ {name: 'GitLab', value: GIT_SOURCE_GITLAB, icon: 'mdi-gitlab'},
+ {name: 'Gogs', value: GIT_SOURCE_GOGS, icon: 'mdi-git'},
+ {name: 'Gitee', value: GIT_SOURCE_GITEE, icon: 'mdi-git'},
+ {name: 'Gerrit', value: GIT_SOURCE_GERRIT, icon: 'mdi-git'}
+]
+
+export const GitSources = {
+ [GIT_SOURCE_GITHUB]: {
+ name: 'GitHub',
+ icon: 'mdi-github'
+ },
+ [GIT_SOURCE_GITLAB]: {
+ name: 'GitLab',
+ icon: 'mdi-gitlab'
+ },
+ [GIT_SOURCE_GOGS]: {
+ name: 'Gogs',
+ icon: 'mdi-git'
+ },
+ [GIT_SOURCE_GITEE]: {
+ name: 'Gitee',
+ icon: 'mdi-git'
+ },
+ [GIT_SOURCE_GERRIT]: {
+ name: 'Gerrit',
+ icon: 'mdi-git'
+ }
+}
\ No newline at end of file
diff --git a/src/view/Settings/Config/Index.vue b/src/view/Settings/Config/Index.vue
index 7897a8d9..a6ed86a6 100644
--- a/src/view/Settings/Config/Index.vue
+++ b/src/view/Settings/Config/Index.vue
@@ -12,8 +12,8 @@