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

Commit

Permalink
fix: clone resource preview action
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Mar 5, 2024
1 parent 909e453 commit 8f22705
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/assets/style/variable.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ body {

// result view color
--color-result-tip: var(--color-text-2);
--color-result-tip-bg: var(--color-fill-1);
--color-result-tip-bg: var(--color-fill-3);

// avatar icon color
--color-avatar-icon: rgb(var(--arcoblue-5));
Expand Down
8 changes: 3 additions & 5 deletions src/components/highlight-block/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="high-light-wrapper" :class="{ dark: appStore.isDark }">
<hljsVuePlugin.component :language="langType" :code="code" />
<hljsVuePlugin.component :language="lang" :code="code" />
<slot></slot>
</div>
</template>
Expand All @@ -18,7 +18,7 @@
return '';
}
},
langType: {
lang: {
type: String,
default() {
return 'json';
Expand All @@ -31,9 +31,7 @@
<style lang="less" scoped>
.high-light-wrapper {
text-align: left;
// padding: 10px;
// white-space: pre;
// border: 1px solid var(--seal-border-gray-2);
:deep(.hljs) {
background-color: var(--color-white);
}
Expand Down
3 changes: 2 additions & 1 deletion src/views/application-management/services/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ export const cloneServices = (data: {
projectID: string;
environmentID: string;
draft: boolean;
preview: boolean;
items: Record<string, any>[];
}) => {
return axios.post(
`/projects/${data.projectID}/environments/${data.environmentID}${SERVICE_API}/_/batch`,
{ items: data.items, draft: data.draft }
{ items: data.items, draft: data.draft, preview: data.preview }
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@
v-if="basicData.status?.summaryStatus === RevisionStatus.Planning"
dot
style="padding-top: 20px"
:tip="$t('resource.revisons.components.planning')"
/>
>
<template #tip>
<span style="padding-left: 15px">{{
$t('resource.revisons.components.planning')
}}</span>
</template>
</a-spin>
<runComponents
v-else
:run-data="basicData"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
return {
...serviceInfo.value,
attributes: {
...props.runData.attributes
..._.cloneDeep(props.runData.computedAttributes)
}
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
return props.fullscreen ? 'calc(100vh - 310px)' : '310px';
});
// watch(
// () => props.runData,
// () => {
// console.log('props.runData=============', props.runData);
// },
// {
// immediate: true,
// deep: true
// }
// );
const renderStaticLogs = () => {
if (props.runData?.status?.summaryStatus === RevisionStatus.Running) {
return null;
Expand Down
18 changes: 11 additions & 7 deletions src/views/application-management/services/pages/clone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
trigger="hover"
position="br"
:loading="submitLoading"
:actions="actionList"
:actions="SaveActions"
@select="handleSelect"
>
</GroupButtonMenu>
Expand Down Expand Up @@ -175,6 +175,7 @@
let copyFormData: any = {};
const formData = reactive({
draft: false,
preview: false,
environmentID: '',
environmentIDs: [],
items: []
Expand Down Expand Up @@ -254,6 +255,7 @@
projectID: route.params.projectId as string,
...formData
});
console.log('formData====', formData);
succeedList.value.add(environmentID);
failedList.value.delete(environmentID);
errorMap.value.delete(environmentID);
Expand Down Expand Up @@ -284,13 +286,12 @@
console.log(error);
}
};
const handleOk = async (draft: boolean) => {
const handleOk = async () => {
const res = await formref.value?.validate();
if (!res) {
trigger.value = true;
try {
submitLoading.value = true;
formData.draft = draft;
await handleCloneServices();
await batchCloneQueue();
copyFormData = _.cloneDeep(formData);
Expand All @@ -309,11 +310,14 @@
};
const handleSelect = (value) => {
if (value === 'deploy') {
handleOk(false);
} else if (value === 'draft') {
handleOk(true);
formData.preview = false;
formData.draft = false;
if (value === 'draft') {
formData.draft = true;
} else if (value === 'preview') {
formData.preview = true;
}
handleOk();
};
const handleCancel = () => {
Expand Down

0 comments on commit 8f22705

Please sign in to comment.