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

fix: 修复体验问题 #45

Merged
merged 1 commit into from
May 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
</bk-loading>
</bk-form> -->

<bk-alert
theme="warning"
title="allow_origins 与 allow_origins_by_regex 不能同时为空"
v-show="typeId === 1"
/>

<!-- 免用户认证应用白名单策略 -->
<div v-if="formStyle === 'raw'">
<div class="white-list">
Expand All @@ -57,6 +63,7 @@
:schema="formConfig.schema"
:layout="formConfig.layout"
:rules="formConfig.rules"
:label-width="180"
ref="formRef">
</BkSchemaForm>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard-front/src/views/permission/app/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

<!-- 主动授权sideslider -->
<bk-sideslider
ext-cls="auth-sideslider" :title="authSliderConf.title" :width="800"
class="auth-sideslider" :title="authSliderConf.title" :width="800"
v-model:isShow="authSliderConf.isShow" quick-close :before-close="handleBeforeClose" @hidden="handleHidden">
<template #default>
<p class="ag-span-title"> {{ t('你将对指定的蓝鲸应用添加访问资源的权限') }} </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ const rules = {
message: t('版本号须符合 Semver 规范'),
trigger: 'change',
validator: (value: any) => {
if (value?.indexOf('v') !== -1) {
return false;
}
if (semver.valid(value) === null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,23 @@
header-icon="right-shape"
class="bk-collapse-source"
>
<bk-collapse-panel :name="1" style="margin-bottom: 12px;">
<span><span class="log-name">{{ $t("版本日志") }}</span></span>
<!-- <template #header>
<div class="bk-collapse-header">
<right-shape v-show="!activeIndex.includes(1)" />
<angle-up-fill v-show="activeIndex.includes(1)" />
<span class="log-name">版本日志</span>
</div>
</template> -->
<bk-collapse-panel :name="1" class="mb12">
<span class="log-name">{{ $t("版本日志") }}</span>
<template #content>
<div style="padding-left: 32px">
<p>{{ info.comment }}</p>
</div>
</template>
</bk-collapse-panel>
<bk-collapse-panel :name="2">
<bk-collapse-panel
v-for="(source, index) in info?.resources"
:key="source?.name"
:name="index + 2"
:class="`source-${source.name}`"
class="mb12">
<span>
<bk-tag :theme="getMethodsTheme(currentSource.method)">{{ currentSource.method }}</bk-tag>
<span class="log-name">{{ currentSource.name }}</span>
<bk-tag :theme="getMethodsTheme(source.method)">{{ source.method }}</bk-tag>
<span class="log-name">{{ source.name }}</span>
</span>
<template #content>
<div class="sideslider-rg-content">
Expand All @@ -90,7 +88,7 @@
<bk-col :span="10">
<div class="ag-value">
<bk-tag theme="success">
{{ currentSource.name }}
{{ source.name }}
</bk-tag>
</div>
</bk-col>
Expand All @@ -101,7 +99,7 @@
<label class="ag-key">{{ $t("资源地址") }}:</label>
</bk-col>
<bk-col :span="10">
<div class="ag-value">{{ currentSource.path }}</div>
<div class="ag-value">{{ source.path }}</div>
</bk-col>
</bk-row>

Expand All @@ -110,7 +108,7 @@
<label class="ag-key">{{ $t("描述") }}:</label>
</bk-col>
<bk-col :span="10">
<div class="ag-value">{{ currentSource.description }}</div>
<div class="ag-value">{{ source.description }}</div>
</bk-col>
</bk-row>

Expand All @@ -120,10 +118,10 @@
</bk-col>
<bk-col :span="10">
<div class="ag-value">
<template v-if="currentSource.gateway_label_ids?.length">
<template v-if="source.gateway_label_ids?.length">
<bk-tag
v-for="tag in labels?.filter((label) => {
if (currentSource.gateway_label_ids?.includes(label.id))
if (source.gateway_label_ids?.includes(label.id))
return true;
})"
:key="tag.id"
Expand All @@ -145,7 +143,7 @@
<div class="ag-value">
{{
getResourceAuth(
currentSource?.contexts?.resource_auth?.config
source?.contexts?.resource_auth?.config
)
}}</div>
</bk-col>
Expand All @@ -159,7 +157,7 @@
<div class="ag-value">
{{
getPermRequired(
currentSource?.contexts?.resource_auth?.config
source?.contexts?.resource_auth?.config
)
}}
</div>
Expand All @@ -172,9 +170,9 @@
</bk-col>
<bk-col :span="10">
<div class="ag-value">
{{ currentSource?.is_public ? $t("是") : $t("否") }}
{{ source?.is_public ? $t("是") : $t("否") }}
{{
currentSource?.allow_apply_permission
source?.allow_apply_permission
? `(${ $t("允许申请权限") })`
: `(${ $t("不允许申请权限") })`
}}
Expand All @@ -195,8 +193,8 @@
</bk-col>
<bk-col :span="10">
<div class="ag-value">
<bk-tag :theme="getMethodsTheme(currentSource.method)">
{{ currentSource.method }}
<bk-tag :theme="getMethodsTheme(source.method)">
{{ source.method }}
</bk-tag>
</div>
</bk-col>
Expand All @@ -207,7 +205,7 @@
<label class="ag-key">{{ $t("请求路径") }}:</label>
</bk-col>
<bk-col :span="10">
<div class="ag-value">{{ currentSource.path }}</div>
<div class="ag-value">{{ source.path }}</div>
</bk-col>
</bk-row>
</bk-container>
Expand All @@ -226,7 +224,7 @@
<bk-col :span="10">
<div class="ag-value">
{{
currentSource?.proxy?.backend?.name
source?.proxy?.backend?.name
}}
</div>
</bk-col>
Expand All @@ -238,9 +236,9 @@
</bk-col>
<bk-col :span="10">
<div class="ag-value">
<bk-tag :theme="getMethodsTheme(currentSource?.proxy?.config?.method)">
<bk-tag :theme="getMethodsTheme(source?.proxy?.config?.method)">
{{
currentSource?.proxy?.config?.method
source?.proxy?.config?.method
}}
</bk-tag>
</div>
Expand All @@ -254,7 +252,7 @@
<bk-col :span="10">
<div class="ag-value">
{{
currentSource?.proxy?.config?.timeout
source?.proxy?.config?.timeout
}}
</div>
</bk-col>
Expand All @@ -267,7 +265,7 @@
<bk-col :span="10">
<div class="ag-value">
{{
currentSource?.proxy?.config?.path
source?.proxy?.config?.path
}}
</div>
</bk-col>
Expand All @@ -288,18 +286,18 @@
<bk-col :span="10">
<div class="ag-value">
<template v-if="localLanguage === 'en'">
{{ currentSource?.doc_updated_time?.en || "--" }}
{{ source?.doc_updated_time?.en || "--" }}
</template>
<template v-else>
{{ currentSource?.doc_updated_time?.zh || "--" }}
{{ source?.doc_updated_time?.zh || "--" }}
</template>
</div>
</bk-col>
</bk-row>
</bk-container>

<template v-if="info.schema_version === '2.0'">
<template v-for="plugin in currentSource.plugins" :key="plugin.id">
<template v-for="plugin in source.plugins" :key="plugin.id">
<p
class="title mt15"
>
Expand Down Expand Up @@ -354,7 +352,7 @@ const props = defineProps<{

const emits = defineEmits<(event: 'hidden') => void>();

const activeIndex = ref([1, 2]);
const activeIndex = ref([1]);
const info = ref<any>({});
const currentSource = ref<any>({});

Expand All @@ -366,13 +364,19 @@ const getInfo = async () => {
const res = await getResourceVersionsInfo(apigwId.value, props.id);
info.value = res;
currentSource.value = res.resources[0] || {};
if (currentSource.value?.proxy?.config) {
if (typeof currentSource.value?.proxy?.config === 'string') {
currentSource.value.proxy.config = JSON.parse(currentSource.value?.proxy?.config);
} else {
// currentSource.value.proxy.config = {};

activeIndex.value = [1];
res?.resources?.forEach((item: any, index: number) => {
activeIndex.value?.push(index + 2);

if (item?.proxy?.config) {
if (typeof item?.proxy?.config === 'string') {
item.proxy.config = JSON.parse(item?.proxy?.config);
} else {
// item.proxy.config = {};
}
}
}
});
} catch (e) {
console.log(e);
}
Expand Down Expand Up @@ -419,13 +423,12 @@ getLabels();
// 切换资源
const changeCurrentSource = (source: any) => {
currentSource.value = source;
if (currentSource.value?.proxy?.config) {
if (typeof currentSource.value?.proxy?.config === 'string') {
currentSource.value.proxy.config = JSON.parse(currentSource.value?.proxy?.config);
} else {
// currentSource.value.proxy.config = {};
}
}

const el = document.querySelector(`.source-${source.name}`);
el.scrollIntoView({
behavior: 'smooth', // 平滑滚动
block: 'start', // 元素顶部与视口顶部对齐
});
};

const exceptionType = ref('empty');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
{{ t('变量名由字母、数字、下划线(_) 组成,首字符必须是字母,长度小于50个字符') }}
</div> -->

<div class="footer-btn">
<div class="footer-btn" v-show="tableIsEdit">
<bk-button
theme="primary"
@click.stop="handleSave"
Expand Down