diff --git a/src/dashboard-front-new/index.html b/src/dashboard-front-new/index.html index 384175dae..3bd4f48c6 100644 --- a/src/dashboard-front-new/index.html +++ b/src/dashboard-front-new/index.html @@ -14,7 +14,7 @@ var BK_NODE_ENV = '<%= process.env.NODE_ENV %>' var BK_STATIC_URL = '<%= process.env.BK_STATIC_URL %>' - + var BK_API_RESOURCE_URL_TMPL = '<%= process.env.BK_API_RESOURCE_URL_TMPL %>' var BK_APP_VERSION = '<%= process.env.BK_APP_VERSION %>' var BK_LOGIN_URL = '<%= process.env.BK_LOGIN_URL %>' var BK_PAAS_APP_ID = '<%= process.env.BK_PAAS_APP_ID %>' diff --git a/src/dashboard-front-new/src/components/log-details/index.vue b/src/dashboard-front-new/src/components/log-details/index.vue index 24f6f1cbc..797f2d88f 100644 --- a/src/dashboard-front-new/src/components/log-details/index.vue +++ b/src/dashboard-front-new/src/components/log-details/index.vue @@ -75,15 +75,15 @@ let timeId: any = null; // 改变当前选中值 const handleTimelineChange = (data: any) => { const { tag } = data; - let detail: any = {}; + let detail = ''; for (let i = 0; i < state.objectSteps?.length; i++) { const item = state.objectSteps[i]; if (item?.tag === tag) { - detail = item?.detail || {}; + detail = item?.detail; break; } } - logBody.value = JSON.stringify(detail || {}); + logBody.value = detail || ''; }; // 获取日志列表 @@ -98,10 +98,11 @@ const getLogsList = async () => { // 整理步骤 const steps: any = []; state.totalDuration = 0; + const subStep = res?.events[res?.events?.length - 1]?.step || 0; res?.events_template?.forEach((item: any, index: number) => { item.size = 'large'; - const subStep = res?.events[res?.events?.length - 1]?.step || 0; + if (item?.step < subStep) { item.color = 'green'; item.filled = true; @@ -134,12 +135,17 @@ const getLogsList = async () => { const duration = date2.diff(date1, 's', true); state.totalDuration += duration; + const itemLogs: string[] = []; + children?.forEach((c: any) => { + itemLogs?.push(`${c.created_time} ${c.name} ${c.status}`); + }); + steps[index].children = children; steps[index].content = `${duration} s`; - steps[index].detail = children[children.length - 1]?.detail; + steps[index].detail = itemLogs.join('\n'); }); state.objectSteps = steps; - logBody.value = JSON.stringify(steps[steps.length - 1]?.detail || {}); + logBody.value = steps[subStep]?.detail || ''; } catch (e) { clearInterval(timeId); console.log(e); diff --git a/src/dashboard-front-new/src/components/stage-top-bar.vue b/src/dashboard-front-new/src/components/stage-top-bar.vue index 224ffa745..4b11c370c 100644 --- a/src/dashboard-front-new/src/components/stage-top-bar.vue +++ b/src/dashboard-front-new/src/components/stage-top-bar.vue @@ -24,9 +24,21 @@ :class="{ active: curStage.name === item.name }" @click="handleChangeStage(item.name)" > + + {{ item.name }} + + + + + @@ -34,12 +46,16 @@ import { computed, ref, onBeforeMount, onMounted } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import { getStageList, getStageDetail } from '@/http'; -import { useStage } from '@/store'; +import { useStage, useCommon } from '@/store'; import { useI18n } from 'vue-i18n'; import mitt from '@/common/event-bus'; +import { Spinner, Plus } from 'bkui-vue/lib/icon'; +import editStageSideslider from '@/views/stage/overview/comps/edit-stage-sideslider.vue'; + const router = useRouter(); const route = useRoute(); const stageStore = useStage(); +const common = useCommon(); const { t } = useI18n(); const modelTypes = ref([ @@ -56,7 +72,13 @@ const modelTypes = ref([ ]); // 获取环境列表 -const apigwId = +route.params.id; +const apigwId = computed(() => common.apigwId); + +// 新建环境 +const stageSidesliderRef = ref(null); +const handleAddStage = () => { + stageSidesliderRef.value.handleShowSideslider('add'); +}; // 当前环境 const curStage = ref(stageStore.curStageData || stageStore.defaultStage); @@ -64,7 +86,7 @@ const curStage = ref(stageStore.curStageData || stageStore.defaultStage); const init = async (isUpdate?: Boolean, isDelete?: Boolean) => { stageStore.setStageMainLoading(true); try { - const data = await getStageList(apigwId); + const data = await getStageList(apigwId.value); stageStore.setStageList(data); // 更新停留当前环境 @@ -95,7 +117,7 @@ const curActive = ref(isDetailMode.value ? 'detail' : 'abbreviation'); // 获取环境详情 const getStageDetailFun = (id: number) => { stageStore.setStageMainLoading(true); - getStageDetail(apigwId, id).then((data) => { + getStageDetail(apigwId.value, id).then((data) => { stageStore.curStageData = data; curStage.value = data; stageStore.curStageId = data.id; @@ -127,7 +149,7 @@ const switchModelType = (key: string, routeName: string, stageName?: string) => }; // 切换环境 -const handleChangeStage = async (name: string, isDelete: Boolean) => { +const handleChangeStage = async (name: string, isDelete?: Boolean) => { // 获取切换环境的名字 const data = stageStore.stageList.find(item => item.name === name); if (!isDelete) { @@ -216,22 +238,45 @@ defineExpose({ height: 100%; display: flex; .stage-item { - width: 80px; + cursor: pointer; + width: 100px; height: 100%; + box-sizing: border-box; font-size: 14px; color: #63656e; display: flex; align-items: center; + justify-content: center; span { text-align: center; - width: 80px; - padding: 0 3px; + padding-left: 6px; display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .dot { + width: 8px; + height: 8px; + border-radius: 50%; + + &.success { + border: 1px solid #3FC06D; + background: #E5F6EA; + } + + &.unreleased { + border: 1px solid #C4C6CC; + background: #F0F1F5; + } + + &.failure { + border: 1px solid #EA3636; + background: #FFE6E6; + } + } + &:hover { background-color: #f0f5ff; } diff --git a/src/dashboard-front-new/src/store/common.ts b/src/dashboard-front-new/src/store/common.ts index d62996024..2c4d32615 100644 --- a/src/dashboard-front-new/src/store/common.ts +++ b/src/dashboard-front-new/src/store/common.ts @@ -2,9 +2,10 @@ import { defineStore } from 'pinia'; export const useCommon = defineStore('common', { state: () => ({ + // 网关id apigwId: 0, - // 网关名 - apigwName: '', + // 网关对象 + apigwName: {}, methodList: [ { id: 'GET', @@ -46,7 +47,7 @@ export const useCommon = defineStore('common', { setApigwId(apigwId: number) { this.apigwId = apigwId; }, - setApigwName(name: string) { + setApigwName(name: any) { this.apigwName = name; }, setCurApigwData(data: any) { diff --git a/src/dashboard-front-new/src/views/stage/overview/comps/edit-stage-sideslider.vue b/src/dashboard-front-new/src/views/stage/overview/comps/edit-stage-sideslider.vue index 700d125f2..118c77db7 100644 --- a/src/dashboard-front-new/src/views/stage/overview/comps/edit-stage-sideslider.vue +++ b/src/dashboard-front-new/src/views/stage/overview/comps/edit-stage-sideslider.vue @@ -3,7 +3,7 @@

-

+
{{ t('后端服务配置') }}
@@ -110,7 +111,7 @@ >
@@ -152,7 +153,11 @@
@@ -168,9 +173,8 @@