Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
bcfd0ce3
Unverified
Commit
bcfd0ce3
authored
3 years ago
by
Shawna Monero
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
FE: add support for location notes in delete pod (#2206)
parent
a89a85b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/workflows/k8s/src/delete-pod.tsx
+6
-11
frontend/workflows/k8s/src/delete-pod.tsx
frontend/workflows/k8s/src/index.tsx
+1
-0
frontend/workflows/k8s/src/index.tsx
frontend/workflows/k8s/src/tests/__snapshots__/delete-pod.test.tsx.snap
+1
-1
...lows/k8s/src/tests/__snapshots__/delete-pod.test.tsx.snap
with
8 additions
and
12 deletions
+8
-12
frontend/workflows/k8s/src/delete-pod.tsx
+
6
-
11
View file @
bcfd0ce3
...
...
@@ -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
<
Wizard
Child
>
=
()
=>
{
const
PodDetails
:
React
.
FC
<
Verify
Child
>
=
(
{
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
>
);
...
...
This diff is collapsed.
Click to expand it.
frontend/workflows/k8s/src/index.tsx
+
1
-
0
View file @
bcfd0ce3
...
...
@@ -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
=>
{
...
...
This diff is collapsed.
Click to expand it.
frontend/workflows/k8s/src/tests/__snapshots__/delete-pod.test.tsx.snap
+
1
-
1
View file @
bcfd0ce3
...
...
@@ -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>"
`;
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment