Unverified Commit bcfd0ce3 authored by Shawna Monero's avatar Shawna Monero Committed by GitHub
Browse files

FE: add support for location notes in delete pod (#2206)

parent a89a85b1
Showing with 8 additions and 12 deletions
+8 -12
......@@ -8,22 +8,21 @@ import {
FeatureOff,
FeatureOn,
MetadataTable,
NotePanel,
Resolver,
SimpleFeatureFlag,
useWizardContext,
} from "@clutch-sh/core";
import { useDataLayout } from "@clutch-sh/data-layout";
import type { WizardChild } from "@clutch-sh/wizard";
import { Wizard, WizardStep } from "@clutch-sh/wizard";
import _ from "lodash";
import type { ConfirmChild, ResolverChild, WorkflowProps } from ".";
import type { ConfirmChild, ResolverChild, VerifyChild, WorkflowProps } from ".";
const PodIdentifier: React.FC<ResolverChild> = ({ resolverType, notes = [] }) => {
const { onSubmit } = useWizardContext();
const resolvedResourceData = useDataLayout("resourceData");
const resolverInput = useDataLayout("resolverInput");
const onResolve = ({ results, input }) => {
// Decide how to process results.
resolvedResourceData.assign(results[0]);
......@@ -34,14 +33,16 @@ const PodIdentifier: React.FC<ResolverChild> = ({ resolverType, notes = [] }) =>
return <Resolver type={resolverType} searchLimit={1} onResolve={onResolve} notes={notes} />;
};
const PodDetails: React.FC<WizardChild> = () => {
const PodDetails: React.FC<VerifyChild> = ({ notes = [] }) => {
const { onSubmit, onBack } = useWizardContext();
const resourceData = useDataLayout("resourceData");
const instance = resourceData.displayValue() as IClutch.k8s.v1.Pod;
const locationNotes = notes.filter(note => note.location === "verify");
return (
<WizardStep error={resourceData.error} isLoading={resourceData.isLoading}>
<strong>Pod Details</strong>
<NotePanel notes={locationNotes} />
<MetadataTable
data={[
{ name: "Name", value: instance.name },
......@@ -67,12 +68,6 @@ const PodDetails: React.FC<WizardChild> = () => {
);
};
/*
TODO: Need information boxes for
These changes are not permanent, and will be overwritten on your next deploy. Adjust your manifest.yaml to persist changes across deploys.
and
Note: the HPA should take just a few minutes to scale in either direction.
*/
const Confirm: React.FC<ConfirmChild> = () => {
const deletionData = useDataLayout("deletionData");
const podData = useDataLayout("resourceData");
......@@ -112,7 +107,7 @@ const DeletePod: React.FC<WorkflowProps> = ({ heading, resolverType, notes = []
return (
<Wizard dataLayout={dataLayout} heading={heading}>
<PodIdentifier name="Lookup" resolverType={resolverType} notes={notes} />
<PodDetails name="Verify" />
<PodDetails name="Verify" notes={notes} />
<Confirm name="Confirmation" />
</Wizard>
);
......
......@@ -17,6 +17,7 @@ interface ConfirmConfigProps {
export interface WorkflowProps extends BaseWorkflowProps, ResolverConfigProps, ConfirmConfigProps {}
export interface ResolverChild extends WizardChild, ResolverConfigProps {}
export interface VerifyChild extends WizardChild, ConfirmConfigProps {}
export interface ConfirmChild extends WizardChild, ConfirmConfigProps {}
const register = (): WorkflowConfiguration => {
......
......@@ -3,7 +3,7 @@
exports[`Terminate Instance workflow renders correctly 1`] = `
"<Wizard dataLayout={{...}} heading={[undefined]}>
<PodIdentifier name=\\"Lookup\\" resolverType=\\"clutch.k8s.v1.Pod\\" notes={{...}} />
<PodDetails name=\\"Verify\\" />
<PodDetails name=\\"Verify\\" notes={{...}} />
<Confirm name=\\"Confirmation\\" />
</Wizard>"
`;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment