Skip to content

Commit

Permalink
Merge pull request #102 from arnaugiralt/feat/LITE-28300-LITE-28301-c…
Browse files Browse the repository at this point in the history
…reate-abort-and-retry-actions

LITE-283000 LITE-28301: create Abort and Retry actions for deployment requests
  • Loading branch information
arnaugiralt authored Sep 14, 2023
2 parents c67a6e5 + 4896e6c commit 0a0b51d
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 14 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion connect_ext_ppr/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>Index</title>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.5fdf03c1a578e43267e6.js"></script><link href="index.7f54bf0dcbb9dc626487.css" rel="stylesheet"></head>
<script defer src="vendors.3c43b45d3e9e7cbf9863.js"></script><script defer src="index.36fb1b65206989e793c7.js"></script><link href="index.7f54bf0dcbb9dc626487.css" rel="stylesheet"></head>

<body>
<div id="app"></div>
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ui/src/components/CheckboxTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default {
notResizable: true,
text: '',
value: 'radio',
width: 80,
width: 24,
},
],
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/RadioTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {
notResizable: true,
text: '',
value: 'radio',
width: 80,
width: 24,
},
],
},
Expand Down
22 changes: 19 additions & 3 deletions ui/src/components/RequestTasksTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ import {
readableTimeDiff,
} from '~helpers';
import sync from '~mixins/sync';
export default {
mixins: [sync([{ prop: 'updating', local: 'localUpdating' }])],
components: {
cButton,
cDataTable,
Expand All @@ -109,13 +113,15 @@ export default {
},
props: {
updating: Boolean,
requestId: {
type: String,
required: true,
},
},
data: () => ({
localUpdating: false,
loading: true,
tasks: [],
Expand Down Expand Up @@ -184,17 +190,27 @@ export default {
this.currentError = item.errorMessage;
this.isErrorDialogOpen = true;
},
async loadTasks() {
this.loading = true;
this.tasks = await getDeploymentRequestTasks(this.requestId);
this.loading = false;
this.localUpdating = false;
},
},
watch: {
isInfoDialogOpen(v) {
if (!v) this.currentItem = null;
},
localUpdating(v) {
if (v) this.loadTasks();
},
},
async created() {
this.tasks = await getDeploymentRequestTasks(this.requestId);
this.loading = false;
created() {
this.loadTasks();
},
};
Expand Down
55 changes: 54 additions & 1 deletion ui/src/pages/RequestDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ c-view.request-details(
:current-tab.sync="currentTab",
:loading="loading"
)
template(
#actions="",
v-if="isAnyActionVisible",
)
actions-menu(outline)
c-button.list-item(
v-if="canAbort",
:icon="icons.googleCancelBaseline",
:loading="isAbortingRequest",
:upper-case="false",
color="red",
label="Abort",
@click="abortRequest",
)
c-button.list-item(
v-if="canRetry",
:icon="icons.googleRefreshBaseline",
:loading="isRetryingRequest",
:upper-case="false",
label="Retry",
@click="retryRequest",
)

.info-container
.info-column
grid-item(
Expand Down Expand Up @@ -76,18 +99,25 @@ c-view.request-details(
request-marketplaces-tab(:request-id="requestId")

template(#tasks="")
request-tasks-tab(:request-id="requestId")
request-tasks-tab(
:request-id="requestId",
:updating.sync="areTasksUpdating",
)

</template>

<script>
import {
googleCancelBaseline,
googleCheckCircleBaseline,
googleDescriptionBaseline,
googleRefreshBaseline,
googleRemoveCircleBaseline,
googleSyncBaseline,
} from '@cloudblueconnect/material-svg/baseline';
import ActionsMenu from '~components/ActionsMenu.vue';
import cButton from '~components/cButton.vue';
import cIcon from '~components/cIcon.vue';
import cStatus from '~components/cStatus.vue';
import cTabs from '~components/cTabs.vue';
Expand All @@ -99,8 +129,10 @@ import RequestMarketplacesTab from '~components/RequestMarketplacesTab.vue';
import RequestTasksTab from '~components/RequestTasksTab.vue';
import {
abortDeploymentRequest,
getDeploymentsRequest,
getPPR,
retryDeploymentRequest,
} from '@/utils';
import {
Expand All @@ -110,6 +142,8 @@ import {
export default {
components: {
ActionsMenu,
cButton,
cIcon,
cStatus,
cTabs,
Expand All @@ -125,12 +159,17 @@ export default {
currentTab: null,
loading: true,
request: null,
isAbortingRequest: false,
isRetryingRequest: false,
areTasksUpdating: false,
}),
computed: {
icons: () => ({
googleCancelBaseline,
googleCheckCircleBaseline,
googleDescriptionBaseline,
googleRefreshBaseline,
googleRemoveCircleBaseline,
googleSyncBaseline,
}),
Expand All @@ -141,6 +180,10 @@ export default {
{ label: 'Marketplaces', value: 'marketplaces' },
{ label: 'Tasks', value: 'tasks' },
],
canAbort: vm => ['pending', 'processing'].includes(vm.request?.status),
canRetry: vm => vm.request?.status === 'error',
isAnyActionVisible: vm => vm.canAbort || vm.canRetry,
},
methods: {
Expand All @@ -156,6 +199,16 @@ export default {
downloadPPR() {
downloader({ url: this.pprFileUrl });
},
async abortRequest() {
this.request = await abortDeploymentRequest(this.requestId);
this.areTasksUpdating = true;
},
async retryRequest() {
this.request = await retryDeploymentRequest(this.requestId);
this.areTasksUpdating = true;
},
},
async created() {
Expand Down
4 changes: 4 additions & 0 deletions ui/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ export const getDeploymentRequestMarketplaces = (requestId) => rest.get(`/api/de
export const getDeploymentRequestTasks = (requestId) => rest.get(`/api/deployments/requests/${requestId}/tasks`);

export const createDeploymentRequest = (body) => rest.post('/api/deployments/requests', body);

export const abortDeploymentRequest = (id) => rest.post(`/api/deployments/requests/${id}/abort`);

export const retryDeploymentRequest = (id) => rest.post(`/api/deployments/requests/${id}/retry`);

0 comments on commit 0a0b51d

Please sign in to comment.