Skip to content

Commit

Permalink
fix(*): fixed while creating robot fleet bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Aug 17, 2023
1 parent 680348d commit 06bb405
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<img src="https://img.shields.io/badge/nodejs-18.15.0-dgreen" alt="node">
</a>
<a href="https://github.com/robolaunch/ui/releases">
<img src="https://img.shields.io/badge/release-v0.13.0-red" alt="release">
<img src="https://img.shields.io/badge/release-v0.13.1-red" alt="release">
</a>
<a href="#">
<img src="https://img.shields.io/badge/language-typescript-blue" alt="language">
Expand Down
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.13.0",
"version": "0.13.1",
"private": true,
"dependencies": {
"@emotion/css": "^11.10.6",
Expand Down
11 changes: 4 additions & 7 deletions src/components/CreateForms/CreateRobotFormStep2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function CreateRobotFormStep2({
? CreateEnvironmentFormStep2Validations
: CreateRobotFormStep2Validations,
initialValues: robotData?.step2,
onSubmit: async (values: any) => {
onSubmit: (values: any) => {
formik.setSubmitting(true);

if (envOnPremiseRobot) {
Expand All @@ -70,7 +70,7 @@ export default function CreateRobotFormStep2({
await handleSubmit();
});
} else {
await dispatch(
dispatch(
createRobot({
organizationId: selectedState?.organization?.organizationId,
roboticsCloudName: selectedState?.roboticsCloud?.name,
Expand Down Expand Up @@ -233,11 +233,8 @@ export default function CreateRobotFormStep2({
}, [formik]);

useEffect(() => {
console.log(
responseFleet?.fleetStatus !== "Ready" ||
responseFleet?.namespaceStatus !== "Active"
);
}, [responseFleet]);
console.log(formik);
}, [formik]);

return (
<CreateRobotFormLoader
Expand Down
5 changes: 4 additions & 1 deletion src/components/SidebarLists/SidebarListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export default function SidebarListItem({
}
break;
case "fleet":
if (data?.fleetStatus === "Ready") {
if (
data?.fleetStatus === "Ready" ||
data?.namespaceStatus === "Active"
) {
setSelectedState({ ...selectedState, fleet: data });
setSidebarState({ ...sidebarState, isOpen: false });
navigate(url);
Expand Down
25 changes: 23 additions & 2 deletions src/pages/DashboardsPage/FleetDashboardPage/FleetDashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import useFunctions from "../../../hooks/useFunctions";
import DashboardLayout from "../../../layouts/DashboardLayout";
import CountWidget from "../../../components/CountWidget/CountWidget";
import RegionsWidget from "../../../components/RegionsWidget/RegionsWidget";
import { envOnPremiseRobot } from "../../../helpers/envProvider";
import {
envOnPremiseFleet,
envOnPremiseRobot,
} from "../../../helpers/envProvider";
import EnvironmentActionCells from "../../../components/ActionCells/EnvironmentActionCells";

export default function FleetDashboardPage(): ReactElement {
Expand All @@ -27,6 +30,7 @@ export default function FleetDashboardPage(): ReactElement {
getRoboticsCloud,
getInstance,
getFleet,
getNamespace,
getRobots,
getEnvironments,
} = useFunctions();
Expand All @@ -42,7 +46,7 @@ export default function FleetDashboardPage(): ReactElement {
} else if (pagesState?.instance?.name !== url?.instanceName) {
handleGetInstance();
} else if (pagesState?.fleet?.name !== url?.fleetName) {
handleGetFleet();
envOnPremiseFleet ? handleGetNamespace() : handleGetFleet();
} else {
envOnPremiseRobot ? handleGetEnvironments() : handleGetRobots();
}
Expand Down Expand Up @@ -280,6 +284,23 @@ export default function FleetDashboardPage(): ReactElement {
);
}

function handleGetNamespace() {
getNamespace(
{
organizationId: selectedState?.organization?.organizationId,
roboticsCloudName: selectedState?.roboticsCloud?.name,
instanceId: selectedState?.instance?.instanceId,
region: selectedState?.instance?.region,
namespaceName: url?.fleetName as string,
},
{
isSetState: true,
ifErrorNavigateTo404: !responseRobots,
setPages: true,
}
);
}

function handleGetRobots() {
getRobots(
{
Expand Down

0 comments on commit 06bb405

Please sign in to comment.