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: 可见范围鉴权前端调整 #1251

Open
wants to merge 2 commits into
base: v1.7.x
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions front/src/store/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ export const useAccountStore = defineStore({
* @param {number} id
* @return {*}
*/
async accountDelete(id: number) {
async accountDelete(id: string) {
return http.delete(`${BK_HCM_AJAX_URL_PREFIX}/api/v1/cloud/accounts/${id}`);
},
/**
* @description: 删除前校验
* @param {number} id
* @return {*}
*/
async accountDeleteValidate(id: number) {
async accountDeleteValidate(id: string) {
return http.post(`${BK_HCM_AJAX_URL_PREFIX}/api/v1/cloud/accounts/${id}/delete/validate`);
},
/**
Expand Down Expand Up @@ -187,12 +187,10 @@ export const useAccountStore = defineStore({
},

async updateAccountList(data: any) {
console.log('data', data);
this.accountList = data?.map(({ id, name }: { id: string; name: string }) => ({
id,
name,
}));
console.log('this.accountList', this.accountList);
},

/**
Expand Down
64 changes: 30 additions & 34 deletions front/src/views/resource/accountmanage/account-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@ export default defineComponent({
...initProjectModel,
});

const {
curExtension,
isValidateLoading,
handleValidate,
isValidateDiasbled,
extensionPayload,
} = useSecretExtension(projectModel, true);
const { curExtension, isValidateLoading, handleValidate, isValidateDiasbled, extensionPayload } =
useSecretExtension(projectModel, true);

const secretModel = reactive<SecretModel>({
...initSecretModel,
Expand Down Expand Up @@ -362,7 +357,6 @@ export default defineComponent({
};

const check = (val: any): boolean => {
console.log('check', check);
return /^[a-z][a-z-z0-9_-]*$/.test(val);
};

Expand Down Expand Up @@ -397,8 +391,6 @@ export default defineComponent({
message: t('更新成功'),
theme: 'success',
});
} catch (error) {
console.log(error);
} finally {
isOrganizationDetail.value = true; // 改为详情展示态
getDetail(); // 请求数据
Expand Down Expand Up @@ -451,8 +443,6 @@ export default defineComponent({
});
projectModel.extension = extension;
onClosed();
} catch (error) {
console.log(error);
} finally {
buttonLoading.value = false;
}
Expand Down Expand Up @@ -684,26 +674,17 @@ export default defineComponent({
},
]);

// const dialogForm = reactive([
// {
// label: 'Secret ID',
// required: true,
// property: 'secretId',
// component: () => <Input class="w450" placeholder={t('请输入')} v-model={secretModel.secretId} />,
// },
// {
// label: 'Secret Key',
// required: true,
// property: 'secretKey',
// component: () => <Input class="w450" placeholder={t('请输入')} v-model={secretModel.secretKey} />,
// },
// ]);

// const test = () => {
// console.log('1111333');
// };

// console.log('formBaseInfo', formBaseInfo);
const isSyncLoading = ref(false);
const handleSync = async () => {
isSyncLoading.value = true;
try {
await accountStore.accountSync(projectModel.id);
Message({ message: t('本次同步任务触发成功。如需再次同步,请在20分钟后重试'), theme: 'success' });
} catch (error) {
} finally {
isSyncLoading.value = false;
}
};

return () =>
isLoading.value ? (
Expand All @@ -713,8 +694,23 @@ export default defineComponent({
{!route.path.includes('resource/resource/account/detail') && (
<>
<DetailHeader>
<span class='header-title-prefix'>账号详情</span>
<span class='header-title-content'>&nbsp;- ID {projectModel.id}</span>
{{
default: () => (
<>
<span class='header-title-prefix'>{t('账号详情')}</span>
<span class='header-title-content'>&nbsp;- ID {projectModel.id}</span>
</>
),
right:
projectModel.type === 'resource' ? (
<bk-pop-confirm
content={t('同步该账号下的资源,点击确定后,立即触发同步任务')}
trigger='click'
onConfirm={handleSync}>
<bk-button loading={isSyncLoading.value}>{t('同步')}</bk-button>
</bk-pop-confirm>
) : undefined,
}}
</DetailHeader>
<div class='h16'></div>
</>
Expand Down
Loading