Skip to content

Commit ddc62d3

Browse files
committed
delete account instructions
1 parent d2795bf commit ddc62d3

File tree

3 files changed

+65
-28
lines changed

3 files changed

+65
-28
lines changed

app/(dashboard)/cloud-accounts/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ import { deleteResourceInstance } from "src/api/resourceInstance";
3535
import { getResourceInstanceStatusStylesAndLabel } from "src/constants/statusChipStyles/resourceInstanceStatus";
3636
import { getCloudAccountsRoute } from "src/utils/routes";
3737
import { ACCOUNT_CREATION_METHODS } from "src/utils/constants/accountConfig";
38-
import { getGcpBootstrapShellCommand } from "src/utils/accountConfig/accountConfig";
38+
import {
39+
getGcpBootstrapShellCommand,
40+
getGcpShellScriptOffboardCommand,
41+
} from "src/utils/accountConfig/accountConfig";
3942

4043
const columnHelper = createColumnHelper<ResourceInstance>();
4144

@@ -317,7 +320,7 @@ const CloudAccountsPage = () => {
317320

318321
const deleteAccountInstructionDetails = useMemo(() => {
319322
const result_params: any = selectedInstance?.result_params;
320-
let details = {};
323+
let details: any = {};
321324
if (result_params?.aws_account_id) {
322325
details = {
323326
awsAccountID: result_params?.aws_account_id,
@@ -327,6 +330,11 @@ const CloudAccountsPage = () => {
327330
gcpProjectID: result_params?.gcp_project_id,
328331
gcpProjectNumber: result_params?.gcp_project_number,
329332
};
333+
if (result_params?.cloud_provider_account_config_id) {
334+
details.gcpOffboardCommand = getGcpShellScriptOffboardCommand(
335+
result_params?.cloud_provider_account_config_id
336+
);
337+
}
330338
}
331339
return details;
332340
}, [selectedInstance]);

src/components/DeleteAccountConfigConfirmationDialog/DeleteAccountConfigConfirmationDialog.jsx

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const StyledLink = styled(Link)({
5151
textDecoration: "underline",
5252
color: "#7F56D9",
5353
fontWeight: 700,
54-
fontStyle: "italic",
54+
// fontStyle: "italic",
5555
});
5656

5757
const List = styled(Box)({
@@ -148,35 +148,54 @@ const DeleteInstructions = ({ accountInstructionDetails }) => {
148148
configuration below to remove all artifacts created by Omnistrate.
149149
</Text>
150150
</ListItem>
151-
{/* <ListItem>
152-
<ListItemIcon>
153-
<ArrowBullet />
154-
</ListItemIcon>
151+
{accountInstructionDetails?.awsAccountID && (
152+
<ListItem>
153+
<ListItemIcon>
154+
<ArrowBullet />
155+
</ListItemIcon>
155156

156-
<Text size="medium" weight="regular" color="#374151">
157-
<b>Terraform Users:</b> If you set up your account using Terraform,
158-
execute terraform destroy to revoke our access.{" "}
159-
</Text>
160-
</ListItem> */}
157+
<Text size="medium" weight="regular" color="#374151">
158+
Follow the provided steps{" "}
159+
<StyledLink
160+
target="_blank"
161+
rel="noopener noreferrer"
162+
href="https://docs.omnistrate.com/getting-started/account-offboarding/"
163+
>
164+
here
165+
</StyledLink>{" "}
166+
to complete the off-boarding process and revoke our access.
167+
</Text>
168+
</ListItem>
169+
)}
161170

162-
<ListItem>
163-
<ListItemIcon>
164-
<ArrowBullet />
165-
</ListItemIcon>
171+
{accountInstructionDetails?.gcpProjectID && (
172+
<ListItem>
173+
<ListItemIcon>
174+
<ArrowBullet />
175+
</ListItemIcon>
166176

167-
<Text size="medium" weight="regular" color="#374151">
168-
Follow the provided steps{" "}
169-
<StyledLink
170-
target="_blank"
171-
rel="noopener noreferrer"
172-
href="https://docs.omnistrate.com/getting-started/account-offboarding/"
173-
>
174-
here
175-
</StyledLink>{" "}
176-
to complete the off-boarding process and revoke our access.
177-
</Text>
178-
</ListItem>
177+
<Text size="medium" weight="regular" color="#374151">
178+
Open the Google Cloud Shell environment using the following link{" "}
179+
<StyledLink
180+
target="_blank"
181+
rel="noopener noreferrer"
182+
href="https://shell.cloud.google.com/?cloudshell_ephemeral=true&show=terminal"
183+
>
184+
Google Cloud Shell
185+
</StyledLink>{" "}
186+
.Once the terminal is open, execute the following command to
187+
complete the off-boarding process and revoke our access.
188+
</Text>
189+
</ListItem>
190+
)}
179191
</List>
192+
193+
{accountInstructionDetails?.gcpProjectID &&
194+
accountInstructionDetails?.gcpOffboardCommand && (
195+
<TextContainerToCopy
196+
text={accountInstructionDetails?.gcpOffboardCommand}
197+
/>
198+
)}
180199
</Box>
181200
);
182201
};

src/utils/accountConfig/accountConfig.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ export const getGcpBootstrapShellCommand = (accountId) => {
2626
accountId
2727
);
2828
};
29+
30+
export const GCP_SHELL_SCRIPT_OFFBOARD_COMMAND =
31+
'bash -c "$(curl -fsSL <BASE_URL>/account-setup/gcp-offboard.sh?account_config_id=<ACCOUNT_CONFIG_ID>)"';
32+
33+
export const getGcpShellScriptOffboardCommand = (accountId) => {
34+
return GCP_BOOTSTRAP_SHELL_COMMAND.replace("<BASE_URL>", baseURL).replace(
35+
"<ACCOUNT_CONFIG_ID>",
36+
accountId
37+
);
38+
};

0 commit comments

Comments
 (0)