Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit c03697e

Browse files
committed
chore: user provider advanced options
1 parent f0be49d commit c03697e

File tree

18 files changed

+128
-20
lines changed

18 files changed

+128
-20
lines changed

components.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ declare module 'vue' {
1010
ABreadcrumb: typeof import('@arco-design/web-vue')['Breadcrumb'];
1111
ABreadcrumbItem: typeof import('@arco-design/web-vue')['BreadcrumbItem'];
1212
AButton: typeof import('@arco-design/web-vue')['Button'];
13+
AButtton: typeof import('@arco-design/web-vue')['Buttton'];
1314
ACard: typeof import('@arco-design/web-vue')['Card'];
1415
ACascader: typeof import('@arco-design/web-vue')['Cascader'];
1516
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox'];

src/locale/en-US/common.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,6 @@ export default {
172172
'common.code.hide.tips': '... Hide {rows} lines, click to expand ...',
173173
'common.nodata.created': 'No {type} has been created yet',
174174
'common.nodata.added': 'No {type} has been added yet',
175-
'common.status.edited': 'Edited'
175+
'common.status.edited': 'Edited',
176+
'common.table.user': '用户'
176177
};

src/locale/en-US/settings.ts

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default {
2929
'10 gradient colors generated according to the theme color',
3030
'settings.user.nickName': 'Nickname',
3131
'settings.user.email': 'Email',
32+
'settings.user.group': 'Group',
3233
'settings.user.avatar': 'Avatar',
3334
'settings.user.setting': 'User Settings'
3435
};

src/locale/zh-CN/common.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ export default {
168168
'common.code.hide.tips': '... 隐藏 {rows} 行,点击展开 ...',
169169
'common.nodata.created': '尚未创建{type}',
170170
'common.nodata.added': '尚未添加{type}',
171-
'common.status.edited': '已编辑'
171+
'common.status.edited': '已编辑',
172+
'common.table.user': '用户'
172173
};

src/locale/zh-CN/settings.ts

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
'根据主题颜色生成的 10 个梯度色(将配置复制到项目中,主题色才能对亮色 / 暗黑模式同时生效)',
3131
'settings.user.nickName': '昵称',
3232
'settings.user.email': '邮箱',
33+
'settings.user.group': '分组',
3334
'settings.user.avatar': '头像',
3435
'settings.user.setting': '用户设置'
3536
};

src/views/exception/403/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<a-result
88
class="result"
99
status="403"
10-
:subtitle="$t('exception.result.403.description')"
10+
:subtitle="route.err || $t('exception.result.403.description')"
1111
/>
1212
<div class="operation-row">
1313
<a-button key="back" type="primary" @click="handleBack">

src/views/exception/404/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<a-result
66
class="result"
77
status="404"
8-
:subtitle="$t('exception.result.404.description')"
8+
:subtitle="route.err || $t('exception.result.404.description')"
99
>
1010
</a-result>
1111
<div class="operation-row">

src/views/exception/500/index.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<a-result
66
class="result"
77
status="500"
8-
:subtitle="$t('exception.result.500.description')"
8+
:subtitle="route.err || $t('exception.result.500.description')"
99
/>
1010
<a-button key="back" type="primary" @click="handleBack">
1111
{{ $t('exception.result.500.back') }}
@@ -18,7 +18,7 @@
1818
import useCallCommon from '@/hooks/use-call-common';
1919
2020
const { router, route } = useCallCommon();
21-
21+
console.log('router-------', route.query);
2222
const handleBack = () => {
2323
if (route.query.back) {
2424
router.replace({ name: route.query.back as string });

src/views/exception/redirect.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
const { router } = useCallCommon();
1010
const redirectPage = () => {
1111
const query = router.currentRoute.value;
12-
const { code, ...othersQuery } = router.currentRoute.value.params;
12+
const { code, ...othersQuery } = query;
1313
const toPage = code ? `Page${code}` : 'Page500';
14+
console.log('query========', query, othersQuery, code);
1415
router.replace({
1516
name: toPage,
1617
query: {

src/views/login/api/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface LoginData {
2121
}
2222

2323
interface SetPassword {
24-
oldPassword: string;
24+
originalPassword: string;
2525
password: string;
2626
name?: string;
2727
}

src/views/login/components/modify-password.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
const userStore = useUserStore();
133133
const emits = defineEmits(['updatePassword']);
134134
const props = defineProps({
135-
oldPassword: {
135+
originalPassword: {
136136
type: String,
137137
default() {
138138
return '';
@@ -152,7 +152,7 @@
152152
}
153153
});
154154
const formData = reactive({
155-
'oldPassword': props.oldPassword,
155+
'originalPassword': props.originalPassword,
156156
'newPassword': '',
157157
'confirmPassword': '',
158158
'serve-url': window.location.origin,
@@ -193,7 +193,7 @@
193193
const handleSubmit = async ({ errors }) => {
194194
if (!errors) {
195195
const data = {
196-
oldPassword: props.oldPassword,
196+
originalPassword: props.originalPassword,
197197
password: formData.newPassword,
198198
name: props.userName
199199
};

src/views/login/components/password-form.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<!-- modify password box -->
7878
<modifyPassword
7979
v-show="showModify"
80-
:old-password="userInfo.password || tempPassword"
80+
:original-password="userInfo.password || tempPassword"
8181
:user-name="userInfo.username"
8282
:settings-info="settingsInfo"
8383
@updatePassword="handleModifyDefaultPassword"

src/views/login/index.vue

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
121121
// small window: fullscreen=no,scrollbars=yes,left=300,top=0,toolbar=no,height=800, width=700
122122
window.open(ssoLogin(params), '_self');
123+
loading.value = true;
123124
} catch (error) {
124125
// ignore
125126
}

src/views/profile/pages/modify-password.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
<a-form-item
5151
hide-asterisk
5252
hide-label
53-
field="oldPassword"
53+
field="originalPassword"
5454
:trigger="['change', 'blur']"
5555
:rules="[
5656
{ required: true, message: $t('user.password.rules.oldpassword') }
5757
]"
5858
>
5959
<seal-input-password
60-
v-model="formData.oldPassword"
60+
v-model="formData.originalPassword"
6161
:style="{ width: `${InputWidth.LARGE}px` }"
6262
:required="true"
6363
allow-clear
@@ -147,7 +147,7 @@
147147
displayName: '',
148148
email: '',
149149
password: '',
150-
oldPassword: '',
150+
originalPassword: '',
151151
confirmPassword: ''
152152
});
153153
const handleCancel = () => {

src/views/subject-providers/components/create-subject-provider.vue

+52-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import SealInputPassword from '@/components/seal-form/components/seal-input-password.vue';
1616
import SealInput from '@/components/seal-form/components/seal-input.vue';
1717
import SealSwitch from '@/components/seal-form/components/seal-switch.vue';
18+
import ModuleWrapper from '@/components/module-wrapper/index.vue';
1819
import {
1920
GlobalNamespace,
2021
createSubjectProvider,
@@ -55,6 +56,8 @@
5556
const { t } = i18n.global;
5657
const submitLoading = ref(false);
5758
const formref = ref();
59+
const showAdavanced = ref(false);
60+
const configOptions = ref([]);
5861
const formData = ref<FormData>({
5962
apiVersion,
6063
kind: ResourceKinds.SubjectProvider,
@@ -202,10 +205,11 @@
202205
);
203206
};
204207
205-
const renderProviderConfig = () => {
206-
const configList =
207-
ProviderSpecConfig[formData.value.spec.type || 'GitHub'];
208-
return _.map(configList, (item, index) => {
208+
const renderOptions = (options) => {
209+
if (!options || options.length === 0) {
210+
return null;
211+
}
212+
return _.map(options, (item, index) => {
209213
let Component: any = null;
210214
if (item.type === FieldType.boolean) {
211215
Component = SealSwitch;
@@ -266,6 +270,49 @@
266270
);
267271
});
268272
};
273+
const renderAdvancedOptions = () => {
274+
const advancedOptions = _.filter(configOptions.value, (item) => {
275+
return item.key === 'AdvancedOptions';
276+
});
277+
return (
278+
<>
279+
{advancedOptions.length > 0 && (
280+
<div title="Advanced Options">
281+
<a-button
282+
class="size-14"
283+
type="text"
284+
style={{
285+
padding: '0 2px',
286+
marginBottom: '12px',
287+
fontSize: 'var(--font-size-large)'
288+
}}
289+
onClick={() => {
290+
showAdavanced.value = !showAdavanced.value;
291+
}}
292+
v-slots={{
293+
icon: () => {
294+
return <icon-settings />;
295+
}
296+
}}
297+
>
298+
Advanced Options
299+
</a-button>
300+
{showAdavanced.value &&
301+
renderOptions(advancedOptions?.[0]?.options)}
302+
</div>
303+
)}
304+
</>
305+
);
306+
};
307+
const renderProviderConfig = () => {
308+
configOptions.value =
309+
ProviderSpecConfig[formData.value.spec.type || 'GitHub'];
310+
const basicOptions = _.filter(configOptions.value, (item) => {
311+
return item.key !== 'AdvancedOptions';
312+
});
313+
314+
return <>{renderOptions(basicOptions)}</>;
315+
};
269316
return () => (
270317
<a-modal
271318
top="5%"
@@ -389,6 +436,7 @@
389436
</seal-select>
390437
</a-form-item>
391438
{renderProviderConfig()}
439+
{renderAdvancedOptions()}
392440
<a-form-item label={t('common.table.description')} hide-label>
393441
<seal-textarea
394442
v-model={formData.value.spec.description}

src/views/subject-providers/components/providers.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
tooltip
5252
:cell-style="{ minWidth: '40px' }"
5353
data-index="metadata.name"
54-
:title="$t('profile.account.type.user')"
54+
:title="$t('common.table.user')"
5555
>
5656
</a-table-column>
5757
<a-table-column
@@ -78,6 +78,7 @@
7878
:title="$t('settings.user.nickName')"
7979
>
8080
</a-table-column>
81+
8182
<a-table-column
8283
ellipsis
8384
tooltip

src/views/subject-providers/config/index.ts

+36
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,37 @@ const specConfig_1 = [
5757
default: ''
5858
}
5959
];
60+
61+
const AdvancedOptions = [
62+
{
63+
key: 'claimMapping.nameKey',
64+
label: 'Name',
65+
required: false,
66+
type: FieldType.string,
67+
default: 'Name'
68+
},
69+
{
70+
key: 'claimMapping.displayNameKey',
71+
label: 'Nickname',
72+
required: false,
73+
type: FieldType.string,
74+
default: ''
75+
},
76+
{
77+
key: 'claimMapping.emailKey',
78+
label: 'Email',
79+
required: false,
80+
type: FieldType.string,
81+
default: ''
82+
},
83+
{
84+
key: 'claimMapping.groupsKey',
85+
label: 'Groups',
86+
required: false,
87+
type: FieldType.string,
88+
default: ''
89+
}
90+
];
6091
const specConfig_2 = [
6192
{
6293
key: 'issuer',
@@ -85,6 +116,11 @@ const specConfig_2 = [
85116
required: true,
86117
type: FieldType.password,
87118
default: ''
119+
},
120+
{
121+
key: 'AdvancedOptions',
122+
label: 'Claim Mapping',
123+
options: AdvancedOptions
88124
}
89125
];
90126
export const ProviderSpecConfig = {

src/views/system/pages/users.vue

+16
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@
6262
:title="$t('settings.user.nickName')"
6363
>
6464
</a-table-column>
65+
<a-table-column
66+
ellipsis
67+
tooltip
68+
:cell-style="{ minWidth: '40px' }"
69+
data-index="spec.email"
70+
:title="$t('settings.user.email')"
71+
>
72+
</a-table-column>
73+
<!-- <a-table-column
74+
ellipsis
75+
tooltip
76+
:cell-style="{ minWidth: '40px' }"
77+
data-index="spec.role"
78+
:title="$t('settings.user.group')"
79+
>
80+
</a-table-column> -->
6581
<a-table-column
6682
ellipsis
6783
tooltip

0 commit comments

Comments
 (0)