Skip to content

Commit

Permalink
feat: 认证源接口联调
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri0528 committed Nov 21, 2023
1 parent 8a08716 commit cc1609b
Show file tree
Hide file tree
Showing 20 changed files with 2,792 additions and 537 deletions.
9 changes: 5 additions & 4 deletions src/pages/src/components/layouts/MainBreadcrumbsDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</template>

<script setup lang="ts">
import { computed, defineProps } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { computed, defineEmits, defineProps } from 'vue';
import { useRoute } from 'vue-router';
import { useMainViewStore } from '@/store/mainView';
Expand All @@ -33,9 +33,10 @@ defineProps({
},
});
const emit = defineEmits(['toBack']);
const store = useMainViewStore();
const route = useRoute();
const router = useRouter();
store.customBreadcrumbs = true;
/**
* 当前面包屑展示文案
Expand All @@ -45,7 +46,7 @@ const current = computed(() => store.breadCrumbsTitle || route.meta.navName);
* back control
*/
const handleBack = () => {
router.push({ name: 'dataSource' });
emit('toBack');
};
</script>

Expand Down
7 changes: 7 additions & 0 deletions src/pages/src/hooks/use-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -83,5 +89,6 @@ export default () => {
fieldsName,
serverBaseUrl,
apiPath,
sourceField,
};
};
36 changes: 36 additions & 0 deletions src/pages/src/http/authSourceFiles.ts
Original file line number Diff line number Diff line change
@@ -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);
39 changes: 39 additions & 0 deletions src/pages/src/http/types/authSourceFiles.ts
Original file line number Diff line number Diff line change
@@ -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,
}[],
}[],
}
1 change: 1 addition & 0 deletions src/pages/src/images/wecom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 32 additions & 7 deletions src/pages/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/src/views/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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' }];
Expand Down
Loading

0 comments on commit cc1609b

Please sign in to comment.