diff --git a/src/pages/src/components/layouts/MainBreadcrumbsDetails.vue b/src/pages/src/components/layouts/MainBreadcrumbsDetails.vue index 029af7230..077b0714a 100644 --- a/src/pages/src/components/layouts/MainBreadcrumbsDetails.vue +++ b/src/pages/src/components/layouts/MainBreadcrumbsDetails.vue @@ -21,8 +21,8 @@ diff --git a/src/pages/src/hooks/use-validate.ts b/src/pages/src/hooks/use-validate.ts index c540b897f..b90cd8252 100644 --- a/src/pages/src/hooks/use-validate.ts +++ b/src/pages/src/hooks/use-validate.ts @@ -72,6 +72,12 @@ export default () => { return len; }; + const sourceField = { + validator: (value: string) => /^[a-zA-Z][a-zA-Z0-9_-]{1,30}[a-zA-Z0-9]$/.test(value), + message: '由3-32位字母、数字、下划线(_)、减号(-)字符组成,以字母开头,字母或数字结尾', + trigger: 'blur', + }; + return { required, name, @@ -83,5 +89,6 @@ export default () => { fieldsName, serverBaseUrl, apiPath, + sourceField, }; }; diff --git a/src/pages/src/http/authSourceFiles.ts b/src/pages/src/http/authSourceFiles.ts new file mode 100644 index 000000000..f1549bf8d --- /dev/null +++ b/src/pages/src/http/authSourceFiles.ts @@ -0,0 +1,36 @@ +import http from './fetch'; +import type { + NewIdpsParams, + PatchIdpsParams, + PutIdpsParams, +} from './types/authSourceFiles'; + +/** + * 认证源列表 + */ +export const getIdps = (keyword: string) => http.get(`/api/v1/web/idps/?keyword=${keyword}`); + +/** + * 认证源插件列表 + */ +export const getIdpsPlugins = () => http.get('/api/v1/web/idps/plugins/'); + +/** + * 新建认证源 + */ +export const postIdps = (params: NewIdpsParams) => http.post('/api/v1/web/idps/', params); + +/** + * 认证源详情 + */ +export const getIdpsDetails = (id: string) => http.get(`/api/v1/web/idps/${id}/`); + +/** + * 更新认证源部分字段(local) + */ +export const patchIdps = (params: PatchIdpsParams) => http.patch(`/api/v1/web/idps/${params.id}/`, params); + +/** + * 更新认证源 + */ +export const putIdps = (params: PutIdpsParams) => http.put(`/api/v1/web/idps/${params.id}/`, params); diff --git a/src/pages/src/http/types/authSourceFiles.ts b/src/pages/src/http/types/authSourceFiles.ts new file mode 100644 index 000000000..401a7eb79 --- /dev/null +++ b/src/pages/src/http/types/authSourceFiles.ts @@ -0,0 +1,39 @@ +/** + * 新建认证源参数 + */ +export interface NewIdpsParams { + name: string, + plugin_id: string, + plugin_config: {}, + data_source_match_rules?: { + data_source_id: number, + field_compare_rules: { + source_field: string, + target_field: string, + }[], + }[], +} + +/** + * 更新本地认证源部分字段参数 + */ +export interface PatchIdpsParams { + id: string, + name: string, +} + +/** + * 更新认证源字段参数 + */ +export interface PutIdpsParams { + id: string, + name: string, + plugin_config: {}, + data_source_match_rules?: { + data_source_id: number, + field_compare_rules: { + source_field: string, + target_field: string, + }[], + }[], +} diff --git a/src/pages/src/images/wecom.svg b/src/pages/src/images/wecom.svg new file mode 100644 index 000000000..02a95b6d3 --- /dev/null +++ b/src/pages/src/images/wecom.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/src/router/index.ts b/src/pages/src/router/index.ts index f9871508e..e92318e3c 100644 --- a/src/pages/src/router/index.ts +++ b/src/pages/src/router/index.ts @@ -118,15 +118,40 @@ export default createRouter({ { path: '/auth-source', name: 'authSource', - component: () => import('@/views/auth-source/index.vue'), - }, - { - path: '/auth-source/new', - name: 'newAuthSource', meta: { - navName: '新建认证源', + navName: '认证源管理', }, - component: () => import('@/views/auth-source/new-data/NewConfig.vue'), + component: () => import('@/views/auth-source/index.vue'), + children: [ + { + path: '', + name: 'authSourceList', + meta: { + routeParentName: 'authSource', + navName: '认证源管理', + }, + component: () => import('@/views/auth-source/List.vue'), + }, + { + path: 'new', + name: 'newAuthSource', + meta: { + routeParentName: 'authSource', + navName: '新建认证源', + }, + component: () => import('@/views/auth-source/new-data/index.vue'), + }, + { + path: 'edit/:type/:id', + name: 'editAuthSource', + meta: { + routeParentName: 'authSource', + navName: '编辑认证源', + showBack: true, + }, + component: () => import('@/views/auth-source/edit-data/index.vue'), + }, + ], }, { path: '/audit', diff --git a/src/pages/src/views/Header.vue b/src/pages/src/views/Header.vue index 76725a7d6..c3eb60d16 100644 --- a/src/pages/src/views/Header.vue +++ b/src/pages/src/views/Header.vue @@ -114,7 +114,7 @@ const userInfo = computed(() => { const baseNav = [ { name: '组织架构', path: 'organization' }, { name: '数据源管理', path: 'dataSource' }, - { name: '认证源管理', path: 'authSource' }, + { name: '认证源管理', path: 'authSourceList' }, ]; if (role === 'super_manager') { headerNav.value = [...baseNav, { name: '租户管理', path: 'tenant' }, { name: '设置', path: 'setting' }]; diff --git a/src/pages/src/views/auth-source/List.vue b/src/pages/src/views/auth-source/List.vue new file mode 100644 index 000000000..1c9e26e4a --- /dev/null +++ b/src/pages/src/views/auth-source/List.vue @@ -0,0 +1,338 @@ + + + + + diff --git a/src/pages/src/views/auth-source/ViewDetails.vue b/src/pages/src/views/auth-source/ViewDetails.vue new file mode 100644 index 000000000..33369571d --- /dev/null +++ b/src/pages/src/views/auth-source/ViewDetails.vue @@ -0,0 +1,380 @@ + + + + + diff --git a/src/pages/src/views/auth-source/edit-data/Local.vue b/src/pages/src/views/auth-source/edit-data/Local.vue new file mode 100644 index 000000000..40e46fb22 --- /dev/null +++ b/src/pages/src/views/auth-source/edit-data/Local.vue @@ -0,0 +1,571 @@ + + + + + diff --git a/src/pages/src/views/auth-source/edit-data/WeCom.vue b/src/pages/src/views/auth-source/edit-data/WeCom.vue new file mode 100644 index 000000000..233dc0fec --- /dev/null +++ b/src/pages/src/views/auth-source/edit-data/WeCom.vue @@ -0,0 +1,363 @@ + + + + + diff --git a/src/pages/src/views/auth-source/edit-data/index.vue b/src/pages/src/views/auth-source/edit-data/index.vue new file mode 100644 index 000000000..8126649fd --- /dev/null +++ b/src/pages/src/views/auth-source/edit-data/index.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/src/pages/src/views/auth-source/index.vue b/src/pages/src/views/auth-source/index.vue index f532b1ecf..98393de41 100644 --- a/src/pages/src/views/auth-source/index.vue +++ b/src/pages/src/views/auth-source/index.vue @@ -1,278 +1,9 @@ diff --git a/src/pages/src/views/auth-source/new-data/NewConfig.vue b/src/pages/src/views/auth-source/new-data/NewConfig.vue deleted file mode 100644 index 34d6ccb54..000000000 --- a/src/pages/src/views/auth-source/new-data/NewConfig.vue +++ /dev/null @@ -1,253 +0,0 @@ - - - - - diff --git a/src/pages/src/views/auth-source/new-data/WeCom.less b/src/pages/src/views/auth-source/new-data/WeCom.less new file mode 100644 index 000000000..5ba2ca5be --- /dev/null +++ b/src/pages/src/views/auth-source/new-data/WeCom.less @@ -0,0 +1,269 @@ +.details-wrapper { + width: 1000px; + margin: 0 auto; + + .details-type { + display: flex; + padding: 10px 16px; + margin: 16px 0; + background: #FFF; + border-radius: 2px; + align-items: center; + + .title { + font-size: 14px; + color: #313238; + } + + .subtitle { + font-size: 12px; + color: #979BA5; + } + } + + .auth-source-form { + .content-item { + background: #fff; + border-radius: 2px; + box-shadow: 0 2px 4px 0 #1919290d; + + .item-title { + padding: 16px 0 16px 24px; + font-size: 14px; + font-weight: 700; + } + + ::v-deep .bk-form-item { + padding-bottom: 24px; + margin-bottom: 0; + margin-left: 64px; + font-size: 14px; + + &:last-child { + margin-bottom: 16px; + } + + .bk-radio-button { + .bk-radio-button-label { + font-size: 14px !important; + } + } + + .bk-radio-label { + font-size: 14px !important; + } + + .error-text { + font-size: 12px; + line-height: 1; + color: #ea3636; + animation: form-error-appear-animation .15s; + } + } + + .data-source-matching { + width: 622px; + margin-left: 59px; + border-radius: 2px; + + .hover-item { + cursor: pointer; + } + + .matching-item { + position: relative; + padding: 16px 16px 16px 24px; + margin-bottom: 16px; + background: #F5F7FA; + + .bk-sq-icon { + position: absolute; + top: -6px; + right: -6px; + font-size: 20px; + color: #EA3636; + } + + .or { + position: absolute; + top: -16px; + left: -22px; + display: inline-block; + width: 19px; + height: 16px; + line-height: 16px; + color: #FE9C00; + text-align: center; + background: #FFF3E1; + border-radius: 2px; + + &::before { + position: absolute; + top: -27px; + left: 10px; + width: 12px; + height: 27px; + border: 1px solid #DCDEE5; + border-right: transparent; + border-bottom: transparent; + border-top-left-radius: 2px; + content: ''; + } + + &::after { + position: absolute; + top: 16px; + left: 10px; + width: 12px; + height: 27px; + border: 1px solid #DCDEE5; + border-top: transparent; + border-right: transparent; + border-bottom-left-radius: 2px; + content: ''; + } + } + + ::v-deep .bk-form-item { + padding-bottom: 24px; + margin-bottom: 0; + margin-left: 0; + font-size: 14px; + + &:last-child { + margin-bottom: 0; + } + } + + .item-flex-header { + display: flex; + align-items: center; + + ::v-deep .bk-form-item { + padding-bottom: 0; + margin-bottom: 0; + margin-left: 0; + font-size: 14px; + + &:last-child { + margin-left: 16px; + } + } + } + + .item-flex { + position: relative; + display: flex; + padding-bottom: 8px; + align-items: center; + + ::v-deep .bk-form-item { + padding-bottom: 0; + margin-bottom: 0; + margin-left: 0; + font-size: 14px; + } + + .auth-source-fields { + margin-left: 16px; + } + + .user-icon { + font-size: 16px; + color: #dcdee5; + + &:hover { + color: #c4c6cc; + } + } + + .icon-plus-fill { + position: absolute; + top: 9px; + right: 35px; + } + + .icon-minus-fill { + position: absolute; + top: 9px; + right: 5px; + } + + .and { + position: absolute; + top: -12px; + left: -24px; + display: inline-block; + width: 24px; + height: 16px; + line-height: 16px; + color: #14A568; + text-align: center; + background: #E4FAF0; + border-radius: 2px; + + &::before { + position: absolute; + top: -12px; + left: 12px; + width: 12px; + height: 12px; + border: 1px solid #DCDEE5; + border-right: transparent; + border-bottom: transparent; + border-top-left-radius: 2px; + content: ''; + } + + &::after { + position: absolute; + top: 16px; + left: 12px; + width: 12px; + height: 12px; + border: 1px solid #DCDEE5; + border-top: transparent; + border-right: transparent; + border-bottom-left-radius: 2px; + content: ''; + } + } + } + } + } + + .add-data-source { + display: flex; + width: 622px; + height: 32px; + margin-left: 59px; + font-size: 14px; + color: #3A84FF; + cursor: pointer; + background: #F0F5FF; + border: 1px dashed #A3C5FD; + border-radius: 2px; + align-items: center; + justify-content: center; + + span { + margin-left: 5px; + } + } + } + } + + .footer-wrapper { + margin: 24px 0; + + .bk-button { + width: 88px; + margin-right: 8px; + } + } +} + +.option-select { + display: flex !important; + justify-content: space-between; +} \ No newline at end of file diff --git a/src/pages/src/views/auth-source/new-data/WeCom.vue b/src/pages/src/views/auth-source/new-data/WeCom.vue new file mode 100644 index 000000000..400abcc60 --- /dev/null +++ b/src/pages/src/views/auth-source/new-data/WeCom.vue @@ -0,0 +1,411 @@ + + + + + + diff --git a/src/pages/src/views/auth-source/new-data/config.vue b/src/pages/src/views/auth-source/new-data/config.vue new file mode 100644 index 000000000..f2dd4ec24 --- /dev/null +++ b/src/pages/src/views/auth-source/new-data/config.vue @@ -0,0 +1,197 @@ + + + + + diff --git a/src/pages/src/views/auth-source/new-data/index.vue b/src/pages/src/views/auth-source/new-data/index.vue new file mode 100644 index 000000000..eb6ea5753 --- /dev/null +++ b/src/pages/src/views/auth-source/new-data/index.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/src/pages/src/views/data-source/local-details/index.vue b/src/pages/src/views/data-source/local-details/index.vue index cce54d76a..67fcf762c 100644 --- a/src/pages/src/views/data-source/local-details/index.vue +++ b/src/pages/src/views/data-source/local-details/index.vue @@ -1,6 +1,6 @@