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

Commit

Permalink
fix: resource id not found
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Mar 5, 2024
1 parent 1be55ba commit 7885278
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 187 deletions.
1 change: 1 addition & 0 deletions src/api/interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ axios.interceptors.request.use(
if (some(NoBaseURLApiList, (api) => url.startsWith(api))) {
config.baseURL = '';
}

return config;
},
(error) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ace-editor/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

.ace_tooltip {
color: var(--color-text-2);
background-color: var(--color-fill-2);
background-color: var(--color-white-3);
border: 1px solid var(--color-border-2);
border-radius: 4px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,10 @@
<a-grid-item
:span="{ xxl: 16, xl: 16, lg: 24, md: 24, sm: 24, xs: 24 }"
>
<ComCard
:title="$t('applications.applications.table.latestRun')"
padding="0 20px 20px"
:header-style="{ padding: '20px', height: 'auto' }"
bordered
style="height: 100%; border-radius: 16px"
>
<template #title>
<div class="flex flex-justify-between flex-align-center">
<span>{{
$t('applications.applications.table.latestRun')
}}</span>
<a-link
v-if="
currentInfo?.status?.summaryStatus !==
ServiceStatus.Undeployed
"
size="small"
class="font-13"
@click="
() => {
latestRunRef?.viewLogs?.();
}
"
>
<i class="size-16 m-r-5 iconfont icon-xiangqing"></i>
{{ $t('common.button.detail') }}</a-link
>
</div>
</template>
<LatestRun
ref="latestRunRef"
:service-info="currentInfo"
></LatestRun>
</ComCard>
<LatestRun
ref="latestRunRef"
:service-info="currentInfo"
></LatestRun>
</a-grid-item>

<a-grid-item
Expand Down Expand Up @@ -149,12 +118,7 @@
@save="handleEditSucceed"
@cancel="handleEditCancel"
></serviceEdit>
<serviceInfo
v-else
ref="serviceInfoRef"
:is-collapsed="isCollapsed"
>
</serviceInfo>
<serviceInfo v-else :detail-info="currentInfo"> </serviceInfo>
</a-tab-pane>
</a-tabs>
</ComCard>
Expand Down Expand Up @@ -263,7 +227,6 @@
const serviceID = route.query.id || '';
const isCollapsed = ref(false);
const currentInfo = ref<ServiceRowData>({} as ServiceRowData);
const serviceInfoRef = ref();
const instanceTabMap = {
tabResource: markRaw(tabResource),
tabOutput: markRaw(tabOutput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
PropType,
watch,
defineComponent,
computed
computed,
onBeforeUnmount
} from 'vue';
import useBasicInfoData from '@/views/application-management/projects/hooks/use-basicInfo-data';
import ComCard from '@/components/page-wrap/com-card.vue';
import { StatusColor } from '@/views/config';
import {
latestRunConfig,
Expand All @@ -32,14 +34,14 @@
revisionDetailId,
revisionData,
showDetailModal,
axiosToken,
initialStatus,
currentServiceInfo,
loading,
handleViewServiceLatestLogs
} = useViewLatestLogs(false);
const basicDataList = useBasicInfoData(latestRunConfig, revisionData);
const runFlag = ref(true);
// logs
provide(ProvideServiceInfoKey, currentServiceInfo);
Expand All @@ -62,10 +64,10 @@
});
watch(
() => props.serviceInfo,
() => props.serviceInfo.id,
(data) => {
if (data.id) {
debounceViewLatestLogs(props.serviceInfo);
if (data) {
handleViewServiceLatestLogs(props.serviceInfo);
}
},
{
Expand All @@ -77,15 +79,15 @@
() => showDetailModal.value,
() => {
if (props.serviceInfo.id && showDetailModal.value) {
handleViewServiceLatestLogs(props.serviceInfo);
// handleViewServiceLatestLogs(props.serviceInfo);
}
},
{
immediate: true
}
);
expose({
viewLogs
onBeforeUnmount(() => {
axiosToken?.cancel?.();
});
const renderNoRunData = () => {
return (
Expand Down Expand Up @@ -146,11 +148,42 @@
);
};
return () => (
<a-spin style={{ width: '100%' }}>
{!_.keys(revisionData.value).length && !loading.value
? renderNoRunData()
: renderLatestRun()}
</a-spin>
<ComCard
title={i18n.global.t('applications.applications.table.latestRun')}
header-style={{ padding: '20px', height: 'auto' }}
style={{ 'height': '100%', 'border-radius': '16px' }}
padding="0 20px 20px"
bordered={true}
v-slots={{
title: () => {
return (
<div class="flex flex-justify-between flex-align-center">
<span>
{i18n.global.t('applications.applications.table.latestRun')}
</span>
{_.keys(revisionData.value).length && !loading.value ? (
<a-link
size="small"
class="font-13"
onClick={() => {
viewLogs();
}}
>
<i class="size-16 m-r-5 iconfont icon-xiangqing"></i>
{i18n.global.t('common.button.detail')}
</a-link>
) : null}
</div>
);
}
}}
>
<a-spin style={{ width: '100%' }}>
{!_.keys(revisionData.value).length && !loading.value
? renderNoRunData()
: renderLatestRun()}
</a-spin>
</ComCard>
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,9 @@
@change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
<!-- <revisionDetail
v-model:show="showDetailModal"
:data-info="revisionData"
:revision-id="revisionDetailId"
:initial-status="initialStatus"
></revisionDetail> -->
<RunDetailModal
v-model:show="showDetailModal"
title="Run Details"
:title="$t('applications.applications.history.detail')"
:data="runData"
></RunDetailModal>
<serviceSpecDiff
Expand Down Expand Up @@ -329,7 +323,7 @@
const projectID = route.params.projectId || '';
const environmentID = route.params.environmentId as string;
const title = ref('');
const serviceId = inject(ProvideServiceIDKey, ref(''));
const serviceId = ref(route.query.id as string);
const revisionDetailId = ref('');
const revisionData = ref({});
const total = ref(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
_.startsWith(item.value, 'http') ||
_.startsWith(item.value, 'https')
);
return [{ label: 1, value: 2 }];
return list;
});
const handleCheckboxChange = (checked, id) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
}
}
});
const emit = defineEmits(['update:show']);
const emit = defineEmits(['update:show', 'close']);
const { t } = useCallCommon();
const loading = ref(false);
const showTimer = ref(true);
Expand Down Expand Up @@ -224,6 +224,7 @@
showTimer.value = false;
fullscreen.value = false;
emit('update:show', false);
emit('close');
};
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script lang="tsx">
import _ from 'lodash';
import { defineComponent, ref, PropType, computed, watch } from 'vue';
import { defineComponent, ref, PropType, computed, watch, inject } from 'vue';
import AceEditor from '@/components/ace-editor/index.vue';
import IconBtnGroup from '@/components/icon-btn-group/index.vue';
import {
yaml2Json,
json2Yaml
} from '@/components/form-create/config/yaml-parse';
import ServiceInfo from '@/views/application-management/services/components/service-info.vue';
import { ProvideServiceInfoKey } from '@/views/application-management/services/config';
export default defineComponent({
name: 'AttributesContent',
Expand Down Expand Up @@ -35,6 +36,14 @@
const activeKey = ref('form');
const yamlAttributes = ref('');
const serviceInfo = inject(ProvideServiceInfoKey, ref<any>({}));
const serviceDetail = computed(() => {
return {
...serviceInfo.value,
attributes: props.runData.attributes
};
});
watch(
() => props.runData?.computedAttributes,
Expand All @@ -55,7 +64,7 @@
></IconBtnGroup>
<div>
{activeKey.value === 'form' ? (
<ServiceInfo></ServiceInfo>
<ServiceInfo detail-info={serviceDetail.value}></ServiceInfo>
) : (
<AceEditor
ref="yaml_editor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
const loading = ref(false);
const getRevisionChange = async () => {
if (!props.runData.id || !props.runData.resource?.id) {
return;
}
try {
loading.value = true;
const { data } = await queryRevisionChange({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import {
onMounted,
nextTick,
toRef,
provide,
ref,
watch,
Expand All @@ -41,14 +42,16 @@
import { ServiceDataType, ProvideServiceInfoKey } from '../config';
const props = defineProps({
isCollapsed: {
type: Boolean,
default: false
detailInfo: {
type: Object,
default() {
return {};
}
}
});
const { route } = useCallCommon();
const serviceInfo = inject(ProvideServiceInfoKey, ref<any>({}));
const serviceInfo = ref(props.detailInfo);
const schema = ref<any>({});
const loaded = ref(false);
const templateList = ref<any[]>([]);
Expand Down Expand Up @@ -177,21 +180,10 @@
await getSchema();
loading.value = false;
};
watch(
() => props.isCollapsed,
(val) => {
if (val) {
getSchema();
}
},
{
immediate: true
}
);
watch(
() => serviceInfo.value,
() => serviceInfo.value.id,
() => {
console.log('serviceInfo.value.id', serviceInfo.value);
if (serviceInfo.value.id && requestFlag.value) {
requestFlag.value = false;
init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@
:data-info="revisionData"
:revision-id="revisionDetailId"
:initial-status="initialStatus"
@close="
() => {
axiosToken?.cancel?.();
}
"
></revisionDetail>
<driftResource
v-model:show="showDriftModal"
Expand Down Expand Up @@ -349,6 +354,7 @@
revisionDetailId,
revisionData,
showDetailModal,
axiosToken,
initialStatus,
currentServiceInfo,
handleViewServiceLatestLogs
Expand Down
8 changes: 4 additions & 4 deletions src/views/application-management/services/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ export const latestRunConfig = [
span: 1
},
{
label: 'common.table.createdBy',
key: 'createdBy',
label: 'applications.applications.history.changes',
key: 'componentChangeSummary',
value: '',
span: 1
},
{
label: 'applications.applications.history.changes',
key: 'componentChangeSummary',
label: 'common.table.createdBy',
key: 'createdBy',
value: '',
span: 1
},
Expand Down
Loading

0 comments on commit 7885278

Please sign in to comment.