Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 认证源管理接口联调 #1402

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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