forked from element-plus/element-plus
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
282 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const gits: LViewGits = { | ||
table: { | ||
columns: { | ||
name: 'Name', | ||
} | ||
}, | ||
navActions: { | ||
new: { | ||
label: 'New Git Repo', | ||
tooltip: 'Create a new git repo' | ||
}, | ||
filter: { | ||
search: { | ||
placeholder: 'Search git repos' | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default gits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const gits: LViewGits = { | ||
table: { | ||
columns: { | ||
name: '名称', | ||
} | ||
}, | ||
navActions: { | ||
new: { | ||
label: '新建 Git 仓库', | ||
tooltip: '添加一个新 Git 仓库' | ||
}, | ||
filter: { | ||
search: { | ||
placeholder: '搜索 Git 仓库' | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default gits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
interface LViewGits { | ||
table: { | ||
columns: { | ||
name: string; | ||
}; | ||
}; | ||
navActions: LNavActions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {RouteRecordRaw} from 'vue-router'; | ||
import {TAB_NAME_OVERVIEW, TAB_NAME_SPIDERS} from '@/constants/tab'; | ||
|
||
const endpoint = 'gits'; | ||
|
||
export default [ | ||
{ | ||
name: 'GitList', | ||
path: endpoint, | ||
component: () => import('@/views/git/list/GitList.vue'), | ||
}, | ||
{ | ||
name: 'GitDetail', | ||
path: `${endpoint}/:id`, | ||
redirect: to => { | ||
return {path: to.path + '/overview'}; | ||
}, | ||
component: () => import('@/views/git/detail/GitDetail.vue'), | ||
children: [ | ||
{ | ||
path: TAB_NAME_OVERVIEW, | ||
component: () => import('@/views/git/detail/tabs/GitDetailTabOverview.vue'), | ||
}, | ||
// { | ||
// path: TAB_NAME_SPIDERS, | ||
// component: () => import('@/views/git/detail/tabs/GitDetailTabSpiders.vue'), | ||
// }, | ||
] | ||
}, | ||
] as Array<RouteRecordRaw>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<cl-detail-layout store-namespace="git"/> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div class="project-detail-tab-overview"> | ||
<cl-git-form/> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script setup lang="ts"> | ||
import useGitList from "@/views/git/list/useGitList"; | ||
const { | ||
actionFunctions, | ||
navActions, | ||
tablePagination, | ||
tableColumns, | ||
tableData, | ||
tableTotal, | ||
} = useGitList(); | ||
</script> | ||
|
||
<template> | ||
<cl-list-layout | ||
class="node-list" | ||
:action-functions="actionFunctions" | ||
:nav-actions="navActions" | ||
:table-pagination="tablePagination" | ||
:table-columns="tableColumns" | ||
:table-data="tableData" | ||
:table-total="tableTotal" | ||
> | ||
<template #extra> | ||
<!-- Dialogs (handled by store) --> | ||
<cl-create-edit-git-dialog/> | ||
<!-- ./Dialogs --> | ||
</template> | ||
</cl-list-layout> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import {computed, h} from 'vue'; | ||
import {useStore} from 'vuex'; | ||
import {useRouter} from "vue-router"; | ||
import { | ||
ACTION_ADD, | ||
ACTION_DELETE, | ||
ACTION_FILTER, | ||
ACTION_FILTER_SEARCH, | ||
ACTION_VIEW, FILTER_OP_CONTAINS, TAB_NAME_SPIDERS, | ||
TABLE_COLUMN_NAME_ACTIONS | ||
} from "@/constants"; | ||
import {sendEvent} from "@/admin/umeng"; | ||
import {useList} from "@/layouts/content"; | ||
import {onListFilterChangeByKey, translate} from "@/utils"; | ||
import NavLink from "@/components/nav/NavLink.vue"; | ||
|
||
const useGitList = () => { | ||
// router | ||
const router = useRouter(); | ||
|
||
// store | ||
const ns = 'git'; | ||
const store = useStore<RootStoreState>(); | ||
const {commit} = store; | ||
|
||
// i18n | ||
const t = translate; | ||
|
||
// use list | ||
const { | ||
actionFunctions, | ||
} = useList<Git>(ns, store); | ||
|
||
// action functions | ||
const { | ||
deleteByIdConfirm, | ||
} = actionFunctions; | ||
|
||
// nav actions | ||
const navActions = computed<ListActionGroup[]>(() => [ | ||
{ | ||
name: 'common', | ||
children: [ | ||
{ | ||
action: ACTION_ADD, | ||
id: 'add-btn', | ||
className: 'add-btn', | ||
buttonType: 'label', | ||
label: t('views.gits.navActions.new.label'), | ||
tooltip: t('views.gits.navActions.new.tooltip'), | ||
icon: ['fa', 'plus'], | ||
type: 'success', | ||
onClick: () => { | ||
commit(`${ns}/showDialog`, 'create'); | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
action: ACTION_FILTER, | ||
name: 'filter', | ||
children: [ | ||
{ | ||
action: ACTION_FILTER_SEARCH, | ||
id: 'filter-search', | ||
className: 'search', | ||
placeholder: t('views.gits.navActions.filter.search.placeholder'), | ||
onChange: onListFilterChangeByKey(store, ns, 'name', FILTER_OP_CONTAINS), | ||
}, | ||
] | ||
}, | ||
]); | ||
|
||
// table columns | ||
const tableColumns = computed<TableColumns<Git>>(() => [ | ||
{ | ||
className: 'name', | ||
key: 'name', | ||
label: t('views.gits.table.columns.name'), | ||
icon: ['fa', 'font'], | ||
width: '150', | ||
value: (row: Git) => h(NavLink, { | ||
path: `/gits/${row._id}`, | ||
label: row.name, | ||
}), | ||
hasSort: true, | ||
hasFilter: true, | ||
allowFilterSearch: true, | ||
}, | ||
{ | ||
key: TABLE_COLUMN_NAME_ACTIONS, | ||
label: t('components.table.columns.actions'), | ||
fixed: 'right', | ||
width: '200', | ||
buttons: [ | ||
{ | ||
className: 'view-btn', | ||
type: 'primary', | ||
icon: ['fa', 'search'], | ||
tooltip: t('common.actions.view'), | ||
onClick: (row: Git) => { | ||
router.push(`/gits/${row._id}`); | ||
|
||
sendEvent('click_git_list_actions_view'); | ||
}, | ||
action: ACTION_VIEW, | ||
}, | ||
{ | ||
className: 'delete-btn', | ||
type: 'danger', | ||
size: 'small', | ||
icon: ['fa', 'trash-alt'], | ||
tooltip: t('common.actions.delete'), | ||
onClick: deleteByIdConfirm, | ||
action: ACTION_DELETE, | ||
}, | ||
], | ||
disableTransfer: true, | ||
} | ||
]); | ||
|
||
// options | ||
const opts = { | ||
navActions, | ||
tableColumns, | ||
} as UseListOptions<Git>; | ||
|
||
return { | ||
...useList<Git>(ns, store, opts), | ||
}; | ||
}; | ||
|
||
export default useGitList; |