From 5c0276dd5d3c744bf2820ab9cc6860c6f963d593 Mon Sep 17 00:00:00 2001 From: Salah Aldeen Al Saleh Date: Wed, 18 Dec 2024 16:30:07 -0800 Subject: [PATCH] prettier --- web/src/Root.tsx | 30 ++++---- web/src/components/apps/AppVersionHistory.tsx | 72 ++++++++++--------- .../hooks/postDeployAppVersion.tsx | 20 +++--- 3 files changed, 65 insertions(+), 57 deletions(-) diff --git a/web/src/Root.tsx b/web/src/Root.tsx index 926db11edb..52abac2844 100644 --- a/web/src/Root.tsx +++ b/web/src/Root.tsx @@ -282,15 +282,13 @@ const Root = () => { if (state.adminConsoleMetadata?.isEC2Install) { url = `${process.env.API_ENDPOINT}/app/${appSlug}/ec2-deploy/status`; } - const res = await fetch(url, - { - headers: { - "Content-Type": "application/json", - }, - credentials: "include", - method: "GET", - } - ); + const res = await fetch(url, { + headers: { + "Content-Type": "application/json", + }, + credentials: "include", + method: "GET", + }); if (!res.ok) { if (res.status === 401) { Utilities.logoutUser(); @@ -307,9 +305,15 @@ const Root = () => { let showModal = false; if (state.adminConsoleMetadata?.isEC2Install) { - showModal = status !== "" && status !== "complete" && response.step !== "app-upgrade-service"; + showModal = + status !== "" && + status !== "complete" && + response.step !== "app-upgrade-service"; } else { - showModal = status === "upgrading-cluster" || status === "upgrading-app" || status === "upgrade-failed"; + showModal = + status === "upgrading-cluster" || + status === "upgrading-app" || + status === "upgrade-failed"; } if (showModal) { setState({ @@ -1210,7 +1214,9 @@ const Root = () => { isOpen={state.showUpgradeStatusModal} onRequestClose={() => { // cannot close the modal while upgrading - const failedStatus = state.adminConsoleMetadata?.isEC2Install ? "failed" : "upgrade-failed"; + const failedStatus = state.adminConsoleMetadata?.isEC2Install + ? "failed" + : "upgrade-failed"; if (state.upgradeStatus === failedStatus) { setState({ showUpgradeStatusModal: false }); } diff --git a/web/src/components/apps/AppVersionHistory.tsx b/web/src/components/apps/AppVersionHistory.tsx index 3913506b8a..93f8fffbc7 100644 --- a/web/src/components/apps/AppVersionHistory.tsx +++ b/web/src/components/apps/AppVersionHistory.tsx @@ -1033,22 +1033,21 @@ class AppVersionHistory extends Component { if (adminConsoleMetadata?.isEC2Install) { url = `${process.env.API_ENDPOINT}/app/${app?.slug}/ec2-deploy/status`; } - fetch( - url, - { - headers: { - "Content-Type": "application/json", - }, - credentials: "include", - method: "GET", - } - ) + fetch(url, { + headers: { + "Content-Type": "application/json", + }, + credentials: "include", + method: "GET", + }) .then(async (res) => { const response = await res.json(); let stopPolling = response.status !== "starting"; if (adminConsoleMetadata?.isEC2Install) { - stopPolling = response.step !== "app-upgrade-service" || (response.status !== "pending" && response.status !== "starting"); + stopPolling = + response.step !== "app-upgrade-service" || + (response.status !== "pending" && response.status !== "starting"); } if (stopPolling) { @@ -1896,7 +1895,7 @@ class AppVersionHistory extends Component { this.handleViewLogs( currentDownstreamVersion, currentDownstreamVersion?.status === - "failed" + "failed" ) } data-tip="View deploy logs" @@ -1957,17 +1956,19 @@ class AppVersionHistory extends Component { )}
{(versionHistory.length === 0 && gitopsIsConnected) || - versionHistory?.length > 0 || - (this.state.availableUpdates && - this.state.availableUpdates?.length > 0) ? ( + versionHistory?.length > 0 || + (this.state.availableUpdates && + this.state.availableUpdates?.length > 0) ? (
{gitopsIsConnected && (
{ ) : (
{checkingForUpdates && - !this.props.outletContext - .isBundleUploading ? ( + !this.props.outletContext + .isBundleUploading ? (
{ )} {(this.state.numOfSkippedVersions > 0 || this.state.numOfRemainingVersions > 0) && ( -

- {this.state.numOfSkippedVersions > 0 - ? `${this.state.numOfSkippedVersions - } version${this.state.numOfSkippedVersions > 1 - ? "s" - : "" - } will be skipped in upgrading to ${versionHistory[0].versionLabel +

+ {this.state.numOfSkippedVersions > 0 + ? `${ + this.state.numOfSkippedVersions + } version${ + this.state.numOfSkippedVersions > 1 + ? "s" + : "" + } will be skipped in upgrading to ${ + versionHistory[0].versionLabel }. ` - : ""} - {this.state.numOfRemainingVersions > 0 - ? "Additional versions are available after you deploy this required version." - : ""} -

- )} + : ""} + {this.state.numOfRemainingVersions > 0 + ? "Additional versions are available after you deploy this required version." + : ""} +

+ )}
)} diff --git a/web/src/components/upgrade_service/hooks/postDeployAppVersion.tsx b/web/src/components/upgrade_service/hooks/postDeployAppVersion.tsx index d710a2c2bd..426cb12895 100644 --- a/web/src/components/upgrade_service/hooks/postDeployAppVersion.tsx +++ b/web/src/components/upgrade_service/hooks/postDeployAppVersion.tsx @@ -13,17 +13,15 @@ async function postDeployAppVersion({ if (isEC2Install) { url = `${process.env.API_ENDPOINT}/upgrade-service/app/${slug}/ec2-deploy`; } - const response = await fetch(url, - { - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - credentials: "include", - method: "POST", - body, - } - ); + const response = await fetch(url, { + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + credentials: "include", + method: "POST", + body, + }); if (!response.ok) { throw new Error(