Skip to content

Commit

Permalink
refactor(create-robot-forms): 🎉 update launch robot forms with sub co…
Browse files Browse the repository at this point in the history
…mponents
  • Loading branch information
gokhangunduz committed Aug 7, 2023
1 parent 2e35596 commit bdec227
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 56 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "0.9.4",
"version": "0.9.5",
"private": true,
"dependencies": {
"@emotion/css": "^11.10.6",
Expand Down
27 changes: 5 additions & 22 deletions src/components/BuildManagerStepsTable/BuildManagerStepsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function BuildManagerStepsTable({
workspace: step?.workspace,
command: step?.command,
log: step?.buildLog,
state: responseBuildManager?.robotClusters,
state: step?.buildStatus,
};
}),
[responseBuildManager]
Expand Down Expand Up @@ -59,29 +59,12 @@ export default function BuildManagerStepsTable({
key: "state",
header: "State",
align: "left",
body: () => {
body: (rowData: any) => {
return (
<div className="flex flex-col gap-2">
{responseBuildManager?.robotClusters?.[0]?.buildManagerStatus && (
<div className="flex gap-2">
<span className="text-xs">CI:</span>
<StateCell
state={
responseBuildManager?.robotClusters?.[0]
?.buildManagerStatus
}
/>
</div>
)}
{responseBuildManager?.robotClusters?.[1]?.buildManagerStatus && (
{rowData?.state && (
<div className="flex gap-2">
<span className="text-xs">P I:</span>
<StateCell
state={
responseBuildManager?.robotClusters?.[1]
?.buildManagerStatus
}
/>
<StateCell state={rowData?.state} />
</div>
)}
</div>
Expand All @@ -98,7 +81,7 @@ export default function BuildManagerStepsTable({
},
},
],
[responseBuildManager?.robotClusters, url?.instanceName]
[url?.instanceName]
);

return (
Expand Down
1 change: 1 addition & 0 deletions src/components/Cells/StateCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function StateCell({ state, isRobolaunchState }: IStateCell) {
{state === "running" ||
state === "Ready" ||
state === "Connected" ||
state === "Completed" ||
state === "Running" ||
state === "EnvironmentReady" ? (
<div className="w-2.5 h-2.5 bg-green-500 rounded-full" />
Expand Down
16 changes: 6 additions & 10 deletions src/components/CreateForms/CreateRobotFormStep4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ export default function CreateRobotFormStep4({
robotDataLaunchIndex ? robotDataLaunchIndex : 0
],
validationSchema: Yup.object({
name: Yup.string().required("Required"),
workspace: Yup.string().required("Required"),
entryPointCmd: Yup.string().required("Required"),
instancesName: Yup.array().min(1, "Required"),
name: Yup.string().required("Launch manager name is required"),
workspace: Yup.string().required("Workspace is required"),
entryPointCmd: Yup.string().required("Code is required"),
instancesName: Yup.array().min(1, "Instance scope is required"),
robotLmEnvs: Yup.array().of(
Yup.object().shape({
name: Yup.string().required("Required"),
value: Yup.string().required("Required"),
name: Yup.string().required("Environment name is required"),
value: Yup.string().required("Environment value is required"),
})
),
}),
Expand Down Expand Up @@ -102,10 +102,6 @@ export default function CreateRobotFormStep4({
},
});

useEffect(() => {
console.log(formik?.values);
}, [formik?.values]);

useEffect(
() => {
if (!responseBuildManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,15 @@ export default function CreateRobotFormBuildStepItem({
: `Build Step #${buildStepIndex + 1}`}
</span>
<div className="flex items-center gap-2 text-xs">
{Array.isArray(stepState) && stepState?.[0] && (
{buildStep?.buildStatus && (
<div className="flex gap-1.5">
<span
title={`Launch State of Cloud Instance`}
className="font-medium"
>
CI:
Status:
</span>
<StateCell state={stepState?.[0]} />
</div>
)}
{Array.isArray(stepState) && stepState?.[1] && (
<div className="flex gap-1.5">
<span
title={`Launch State of Physical Instance`}
className="font-medium"
>
PI:
</span>
<StateCell state={stepState?.[1]} />
<StateCell state={buildStep?.buildStatus} />
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Terminal/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function Terminal({ value, ref }: ITerminal): ReactElement {
<TerminalContextProvider>
<ReactTerminal
ref={ref}
prompt={">>>"}
prompt={">"}
theme={"material-dark"}
welcomeMessage={
<Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export default function UpdateRobotLaunchsForm(): ReactElement {
entryPointCmd: "",
instancesName: [],
robotLmEnvs: [
{
name: "",
value: "",
},
// {
// name: "",
// value: "",
// },
],
},
],
Expand Down
8 changes: 4 additions & 4 deletions src/contexts/RobotContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ export default ({ children }: any) => {
entryPointCmd: "",
instancesName: [],
robotLmEnvs: [
{
name: "",
value: "",
},
// {
// name: "",
// value: "",
// },
],
},
],
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/robotInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export interface IRobotBuildStep {
instancesName: any[];
robotClusters?: any;
buildLog?: string;
buildStatus?: string;
}

export interface IRobotLaunchSteps {
Expand Down
1 change: 1 addition & 0 deletions src/modals/LogsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function LogsModal({
<Dialog
header="Logs"
visible={true}
draggable={false}
className="w-[50vw]"
onHide={() => handleCloseModal()}
>
Expand Down

0 comments on commit bdec227

Please sign in to comment.