From 301268e4002125812f16136d7df71a8d49688220 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Tue, 16 Jan 2024 14:21:14 -0800 Subject: [PATCH] Add PreDeployment to details page and fix compile --- .../ExistingDeploymentHeader.vue | 74 +++++++++++++------ .../ExistingDeploymentPage.vue | 8 +- 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/web/src/views/existing-deployment/ExistingDeploymentHeader.vue b/web/src/views/existing-deployment/ExistingDeploymentHeader.vue index 001dafa4b..f6354bead 100644 --- a/web/src/views/existing-deployment/ExistingDeploymentHeader.vue +++ b/web/src/views/existing-deployment/ExistingDeploymentHeader.vue @@ -26,12 +26,22 @@

Deploying to: {{ deployment.serverUrl }}

-

- {{ deployment.id }} -

-

- Last Deployed on {{ formatDateString(deployment.deployedAt) }} -

+ +
View summarized deployment logs @@ -90,7 +101,15 @@ import { ref, watch, PropType, computed } from 'vue'; -import { Account, ConfigurationError, Deployment, useApi } from 'src/api'; +import { + Account, + ConfigurationError, + Deployment, + PreDeployment, + useApi, + isDeployment, + isPreDeployment +} from 'src/api'; import PLink from 'src/components/PLink.vue'; import SelectAccount from 'src/components/SelectAccount.vue'; import PButton from 'src/components/PButton.vue'; @@ -113,7 +132,7 @@ const numSuccessfulDeploys = ref(0); const emit = defineEmits(['deploy']); const props = defineProps({ - deployment: { type: Object as PropType, required: true }, + deployment: { type: Object as PropType, required: true }, configError: { type: Object as PropType, required: false, @@ -125,19 +144,23 @@ const onChange = (account: Account) => { selectedAccount.value = account; }; -const showLogsLink = computed(() => { - return eventStore.doesPublishStatusApply(props.deployment.id); -}); +const progressLink = computed(() => { + if (isPreDeployment(props.deployment)) { + return undefined; + } + + if (eventStore.doesPublishStatusApply(props.deployment.id)) { + return { + name: 'progress', + query: { + name: props.deployment.saveName, + operation: operationStr.value, + id: props.deployment.id, + }, + }; + } -const routerLocation = computed(() => { - return { - name: 'progress', - query: { - name: props.deployment.saveName, - operation: operationStr.value, - id: props.deployment.id, - }, - }; + return undefined; }); const redeployDisableTitle = computed(() => { @@ -181,7 +204,7 @@ const initiateRedeploy = async() => { accountName, props.deployment.saveName, destinationURL, - props.deployment.id, + isDeployment(props.deployment) ? props.deployment.id : undefined, ); deployingLocalId.value = result; } catch (error: unknown) { @@ -235,7 +258,10 @@ watch( // and last publishing run was ours ( eventStore.doesPublishStatusApply(deployingLocalId.value) || - eventStore.doesPublishStatusApply(props.deployment.id) + ( + isDeployment(props.deployment) && + eventStore.doesPublishStatusApply(props.deployment.id) + ) ) && // and it was successful enough to get a content id assigned eventStore.currentPublishStatus.contentId diff --git a/web/src/views/existing-deployment/ExistingDeploymentPage.vue b/web/src/views/existing-deployment/ExistingDeploymentPage.vue index c28b0aed4..284edbc30 100644 --- a/web/src/views/existing-deployment/ExistingDeploymentPage.vue +++ b/web/src/views/existing-deployment/ExistingDeploymentPage.vue @@ -31,7 +31,7 @@ import { ref, computed, watch } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { Configuration, ConfigurationError, isConfigurationError, useApi } from 'src/api'; -import { Deployment, isDeploymentRecordError, isPreDeployment } from 'src/api/types/deployments'; +import { Deployment, PreDeployment, isDeploymentRecordError } from 'src/api/types/deployments'; import { newFatalErrorRouteLocation, } from 'src/util/errors'; @@ -45,7 +45,7 @@ const route = useRoute(); const router = useRouter(); const api = useApi(); -const deployment = ref(); +const deployment = ref(); const configurations = ref>([]); @@ -92,10 +92,6 @@ const getDeployment = async() => { // let the fatal error page handle this deployment error. // we're in a header, they can't fix it here. throw new Error(d.error.msg); - } else if (isPreDeployment(d)) { - // let the fatal error page handle this deployment error. - // we're in a header, they can't fix it here. - throw new Error('This page doesn\'t support pre-deployments yet.'); } else { deployment.value = d; }