From 6ebebce47d92b59bd8011ec860f1f38c0be3269a Mon Sep 17 00:00:00 2001 From: gokhangunduz Date: Fri, 26 Jan 2024 11:17:24 +0300 Subject: [PATCH] feat(version): release 0.33.1 version --- package.json | 2 +- public/css/style.css | 35 ----- .../CFAddBuildButton/CFAddBuildButton.tsx | 4 +- .../CFDeleteBuildButton.tsx | 4 +- src/components/CFGpuTypes/CFGpuTypes.tsx | 2 +- src/components/CFPortSetter/CFPortSetter.tsx | 2 +- src/components/CreateForms/CFAppStep1.tsx | 2 +- src/components/CreateForms/CFFleet.tsx | 2 +- src/components/CreateForms/CFInstance.tsx | 6 +- src/components/CreateForms/CFNamespace.tsx | 2 +- src/components/CreateForms/CFPhysical.tsx | 6 +- src/components/CreateForms/CFRegion.tsx | 12 +- src/components/CreateForms/CFStep1.tsx | 4 +- src/components/CreateForms/CFStep2.tsx | 8 +- src/components/CreateForms/CFStep3.tsx | 2 +- src/components/CreateForms/CFStep4.tsx | 4 +- .../CreateRobotTypes/CreateRobotTypes.tsx | 2 +- src/components/FilteredTags/FilteredTags.tsx | 2 +- .../HostDirectoriesSearchIframe.tsx | 4 +- .../SidebarLists/CloudInstancesList.tsx | 5 +- .../SidebarLists/EnvironmentsList.tsx | 4 +- src/components/SidebarLists/FleetsList.tsx | 4 +- .../SidebarLists/NamespacesList.tsx | 4 +- .../SidebarLists/OrganizationsList.tsx | 9 +- .../SidebarLists/PhysicalInstancesList.tsx | 14 +- .../SidebarLists/RoboticsCloudsList.tsx | 5 +- src/components/SidebarLists/RobotsList.tsx | 2 +- .../SidebarLists/SidebarListItem.tsx | 8 +- .../TableActionCells/FleetActionCells.tsx | 2 +- .../TableActionCells/NamespaceActionCells.tsx | 2 +- .../OrganizationActionCells.tsx | 2 +- .../UpdateRobotLaunchsForm.tsx | 2 +- src/components/UsagesWidget/UsagesWidget.tsx | 2 +- src/contexts/FunctionsContext.tsx | 123 +++++++----------- src/contexts/RobotContext.tsx | 27 ++-- src/controllers/InstanceTableData.tsx | 23 ++-- src/controllers/MainTableData.tsx | 6 +- src/controllers/NamespaceTableData.tsx | 35 +++-- src/controllers/OrgTableData.tsx | 33 +++-- src/controllers/RegionTableData.tsx | 15 +-- src/handler/organization.handler.ts | 26 ++++ src/interfaces/mainInterfaces.ts | 2 +- ...nterfaces.ts => organization.interface.ts} | 5 + src/interfaces/tableInterface.ts | 2 +- src/modals/DeleteBuildManagerModal.tsx | 4 +- src/modals/DeleteLaunchManagerModal.tsx | 4 +- src/modals/DeleteOrganizationModal.tsx | 6 +- src/pages/DataSciencePage/DataSciencePage.tsx | 2 +- src/toolkit/OrganizationSlice.ts | 24 ++-- tsconfig.json | 4 +- 50 files changed, 224 insertions(+), 287 deletions(-) create mode 100644 src/handler/organization.handler.ts rename src/interfaces/{organizationInterfaces.ts => organization.interface.ts} (88%) diff --git a/package.json b/package.json index dd1b6476..83caf65c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "0.33.0", + "version": "0.33.1", "private": true, "scripts": { "dev": "GENERATE_SOURCEMAP=false react-scripts start", diff --git a/public/css/style.css b/public/css/style.css index 580504e7..b25e8c4a 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1162,36 +1162,10 @@ video { height: 100vh; } -.h-max { - height: -webkit-max-content; - height: max-content; -} - -.h-min { - height: -webkit-min-content; - height: min-content; -} - -.h-auto { - height: auto; -} - .max-h-\[40rem\] { max-height: 40rem; } -.max-h-full { - max-height: 100%; -} - -.\!max-h-full { - max-height: 100% !important; -} - -.\!max-h-\[20rem\] { - max-height: 20rem !important; -} - .min-h-4 { min-height: 1rem; } @@ -1421,11 +1395,6 @@ video { width: max-content; } -.w-min { - width: -webkit-min-content; - width: min-content; -} - .min-w-24 { min-width: 6rem; } @@ -2217,10 +2186,6 @@ video { background-color: rgb(234 179 8 / var(--tw-bg-opacity)); } -.object-cover { - object-fit: cover; -} - .\!p-0 { padding: 0px !important; } diff --git a/src/components/CFAddBuildButton/CFAddBuildButton.tsx b/src/components/CFAddBuildButton/CFAddBuildButton.tsx index 44da7df4..27c88f8e 100644 --- a/src/components/CFAddBuildButton/CFAddBuildButton.tsx +++ b/src/components/CFAddBuildButton/CFAddBuildButton.tsx @@ -11,12 +11,12 @@ interface ICFAddBuildButton { export default function CFAddBuildButton({ formik, }: ICFAddBuildButton): ReactElement { - const { handleAddStepToBuildStep } = useCreateRobot(); + const { handleAddBuildStep } = useCreateRobot(); return (
handleAddStepToBuildStep(formik)} + onClick={() => handleAddBuildStep(formik)} disabled={formik?.isSubmitting} />
diff --git a/src/components/CFDeleteBuildButton/CFDeleteBuildButton.tsx b/src/components/CFDeleteBuildButton/CFDeleteBuildButton.tsx index 397293ac..5fc4b42e 100644 --- a/src/components/CFDeleteBuildButton/CFDeleteBuildButton.tsx +++ b/src/components/CFDeleteBuildButton/CFDeleteBuildButton.tsx @@ -17,13 +17,13 @@ export default function CFDeleteBuildButton({ return ( - {formik.values?.robotBuildSteps?.length > 1 && ( + {formik.values?.steps?.length > 1 && ( { handleRemoveStepFromBuildStep(formik, buildStepIndex); }} text={`Delete ${ - formik.values.robotBuildSteps[buildStepIndex]?.name || "this" + formik.values.steps?.[buildStepIndex]?.name || "this" } Build Step`} disabled={formik?.isSubmitting} /> diff --git a/src/components/CFGpuTypes/CFGpuTypes.tsx b/src/components/CFGpuTypes/CFGpuTypes.tsx index 3eb53e7b..ff474d3d 100644 --- a/src/components/CFGpuTypes/CFGpuTypes.tsx +++ b/src/components/CFGpuTypes/CFGpuTypes.tsx @@ -23,7 +23,7 @@ export default function CFGpuTypes({ function handleGetInstance() { getInstance( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceName: selectedState.instance?.name!, region: selectedState?.roboticsCloud?.region!, diff --git a/src/components/CFPortSetter/CFPortSetter.tsx b/src/components/CFPortSetter/CFPortSetter.tsx index 09b28b10..794492a1 100644 --- a/src/components/CFPortSetter/CFPortSetter.tsx +++ b/src/components/CFPortSetter/CFPortSetter.tsx @@ -26,7 +26,7 @@ export default function CFPortSetter({ try { const result = await dispatch( getFreePort({ - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.roboticsCloud?.region!, roboticsCloudName: selectedState?.roboticsCloud?.name!, diff --git a/src/components/CreateForms/CFAppStep1.tsx b/src/components/CreateForms/CFAppStep1.tsx index 8da6ff15..c9619a83 100644 --- a/src/components/CreateForms/CFAppStep1.tsx +++ b/src/components/CreateForms/CFAppStep1.tsx @@ -75,7 +75,7 @@ export default function CFAppStep1({ function handleGetEnvironment() { getEnvironment( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.roboticsCloud?.region!, diff --git a/src/components/CreateForms/CFFleet.tsx b/src/components/CreateForms/CFFleet.tsx index 3c93bbc4..e5affac2 100644 --- a/src/components/CreateForms/CFFleet.tsx +++ b/src/components/CreateForms/CFFleet.tsx @@ -21,7 +21,7 @@ export default function CreateFleetForm(): ReactElement { dispatch( createFederatedFleet({ robolaunchFederatedFleetsName: values.name, - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, diff --git a/src/components/CreateForms/CFInstance.tsx b/src/components/CreateForms/CFInstance.tsx index 1c4206ee..f24feed5 100644 --- a/src/components/CreateForms/CFInstance.tsx +++ b/src/components/CreateForms/CFInstance.tsx @@ -25,7 +25,7 @@ export default function CFInstance(): ReactElement { formik.setSubmitting(true); dispatch( createCloudInstance({ - organizationId: selectedState.organization!.organizationId!, + organizationId: selectedState.organization!.id!, roboticsCloudName: selectedState.roboticsCloud!.name!, cloudInstanceName: values.cloudInstanceName, instanceType: values.instanceType, @@ -52,7 +52,7 @@ export default function CFInstance(): ReactElement { />
-
+
Types: {type.name}
-
+
{type.resources.cpu} CPU diff --git a/src/components/CreateForms/CFNamespace.tsx b/src/components/CreateForms/CFNamespace.tsx index 5776523d..8867e3f7 100644 --- a/src/components/CreateForms/CFNamespace.tsx +++ b/src/components/CreateForms/CFNamespace.tsx @@ -21,7 +21,7 @@ export default function CreateNamespaceForm(): ReactElement { dispatch( createNamespace({ namespaceName: values.name, - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, diff --git a/src/components/CreateForms/CFPhysical.tsx b/src/components/CreateForms/CFPhysical.tsx index 7eea7e98..8b40e17a 100644 --- a/src/components/CreateForms/CFPhysical.tsx +++ b/src/components/CreateForms/CFPhysical.tsx @@ -27,7 +27,7 @@ export default function CFPhysical(): ReactElement { await keycloak.updateToken(-1); await dispatch( addPhysicalInstance({ - organizationId: selectedState?.organization?.organizationId, + organizationId: selectedState?.organization?.id, roboticsCloudName: selectedState?.roboticsCloud?.name, instanceId: selectedState?.instance?.instanceId, region: selectedState?.instance?.region, @@ -69,7 +69,7 @@ export default function CFPhysical(): ReactElement { }} theme="vs-dark" /> -

+

Copy the code given below and run it on your physical device. After doing this, you can check and manage the status of your device.

@@ -81,7 +81,7 @@ export default function CFPhysical(): ReactElement { /> +
{isOpened && ( setIsOpened(false)} diff --git a/src/components/SidebarLists/CloudInstancesList.tsx b/src/components/SidebarLists/CloudInstancesList.tsx index a80edf28..2869285c 100644 --- a/src/components/SidebarLists/CloudInstancesList.tsx +++ b/src/components/SidebarLists/CloudInstancesList.tsx @@ -47,7 +47,7 @@ export default function CloudInstancesList({ function handleGetCloudInstances() { getInstances( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, region: selectedState?.roboticsCloud?.region!, details: true, @@ -83,8 +83,7 @@ export default function CloudInstancesList({ name={instance?.name} description={} url={`/${organizationNameViewer({ - organizationName: - selectedState?.organization?.organizationName!, + organizationName: selectedState?.organization?.name!, capitalization: false, })}/${selectedState?.roboticsCloud?.name}/${instance?.name}`} data={instance} diff --git a/src/components/SidebarLists/EnvironmentsList.tsx b/src/components/SidebarLists/EnvironmentsList.tsx index efdd1c45..46ad4166 100644 --- a/src/components/SidebarLists/EnvironmentsList.tsx +++ b/src/components/SidebarLists/EnvironmentsList.tsx @@ -1,4 +1,4 @@ -import React, { Fragment, ReactElement, useEffect, useState } from "react"; +import { Fragment, ReactElement, useEffect, useState } from "react"; import SidebarListLoader from "../SidebarListLoader/SidebarListLoader"; import StateCell from "../TableInformationCells/StateCell"; import SidebarInfo from "../SidebarInfo/SidebarInfo"; @@ -51,7 +51,7 @@ export default function EnvironmentsList({ function handleGetEnvironments() { getEnvironments( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, diff --git a/src/components/SidebarLists/FleetsList.tsx b/src/components/SidebarLists/FleetsList.tsx index 219372ff..b397ee39 100644 --- a/src/components/SidebarLists/FleetsList.tsx +++ b/src/components/SidebarLists/FleetsList.tsx @@ -59,7 +59,7 @@ export default function FleetsList({ function handleGetFleets() { getFleets( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.name!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, @@ -101,7 +101,7 @@ export default function FleetsList({ name={fleet?.name} description={} url={`${ - selectedState?.organization?.organizationName?.split("_")[1] + selectedState?.organization?.name?.split("_")[1] }/${selectedState?.roboticsCloud?.name}/${ selectedState?.instance?.name }/${fleet?.name}`} diff --git a/src/components/SidebarLists/NamespacesList.tsx b/src/components/SidebarLists/NamespacesList.tsx index a291d975..7f05e6f9 100644 --- a/src/components/SidebarLists/NamespacesList.tsx +++ b/src/components/SidebarLists/NamespacesList.tsx @@ -59,7 +59,7 @@ export default function NamespacesList({ function handleGetNamespaces() { getNamespaces( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, @@ -122,7 +122,7 @@ export default function NamespacesList({
} url={`${ - selectedState?.organization?.organizationName?.split("_")[1] + selectedState?.organization?.name?.split("_")[1] }/${selectedState?.roboticsCloud?.name}/${ selectedState?.instance?.name }/${fleet?.name}`} diff --git a/src/components/SidebarLists/OrganizationsList.tsx b/src/components/SidebarLists/OrganizationsList.tsx index 262a8d04..fc2e0529 100644 --- a/src/components/SidebarLists/OrganizationsList.tsx +++ b/src/components/SidebarLists/OrganizationsList.tsx @@ -1,5 +1,5 @@ import { organizationNameViewer } from "../../functions/GeneralFunctions"; -import { IOrganization } from "../../interfaces/organizationInterfaces"; +import { IOrganization } from "../../interfaces/organization.interface"; import SidebarListLoader from "../SidebarListLoader/SidebarListLoader"; import { Fragment, ReactElement, useEffect, useState } from "react"; import StateCell from "../TableInformationCells/StateCell"; @@ -53,18 +53,17 @@ export default function OrganizationsList({ key={index} type="organization" name={organizationNameViewer({ - organizationName: organization?.organizationName, + organizationName: organization?.name, capitalization: false, })} description={} url={`/${organizationNameViewer({ - organizationName: organization?.organizationName, + organizationName: organization?.name, capitalization: false, })}`} data={organization} selected={ - organization.organizationName === - selectedState?.organization?.organizationName + organization.name === selectedState?.organization?.name } /> ); diff --git a/src/components/SidebarLists/PhysicalInstancesList.tsx b/src/components/SidebarLists/PhysicalInstancesList.tsx index 7c86ea05..5cab4d97 100644 --- a/src/components/SidebarLists/PhysicalInstancesList.tsx +++ b/src/components/SidebarLists/PhysicalInstancesList.tsx @@ -58,7 +58,7 @@ export default function PhysicalInstancesList({ function handleGetPhysicalInstances() { getPhysicalInstances( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, @@ -82,8 +82,8 @@ export default function PhysicalInstancesList({ !selectedState?.organization ? "Organization" : !selectedState?.roboticsCloud - ? "Robotics Cloud" - : "Cloud Instance" + ? "Robotics Cloud" + : "Cloud Instance" } to view Physical Instances.`} /> ) : !Array.isArray(responsePhysicalInstances) ? ( @@ -105,11 +105,11 @@ export default function PhysicalInstancesList({
} url={`/${organizationNameViewer({ - organizationName: - selectedState?.organization?.organizationName!, + organizationName: selectedState?.organization?.name!, capitalization: false, - })}/${selectedState?.roboticsCloud - ?.name}/${instance?.name}/physical-instances`} + })}/${ + selectedState?.roboticsCloud?.name + }/${instance?.name}/physical-instances`} data={instance} notSelectable /> diff --git a/src/components/SidebarLists/RoboticsCloudsList.tsx b/src/components/SidebarLists/RoboticsCloudsList.tsx index 5b502dd6..b96eb57c 100644 --- a/src/components/SidebarLists/RoboticsCloudsList.tsx +++ b/src/components/SidebarLists/RoboticsCloudsList.tsx @@ -34,7 +34,7 @@ export default function RoboticsCloudsList({ function handleGetRoboticsClouds() { getRoboticsClouds( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, }, { ifErrorNavigateTo404: false, @@ -69,8 +69,7 @@ export default function RoboticsCloudsList({
} url={`/${organizationNameViewer({ - organizationName: - selectedState?.organization?.organizationName!, + organizationName: selectedState?.organization?.name!, capitalization: false, })}/${roboticsCloud?.name}`} data={roboticsCloud} diff --git a/src/components/SidebarLists/RobotsList.tsx b/src/components/SidebarLists/RobotsList.tsx index 276c142e..a9dec398 100644 --- a/src/components/SidebarLists/RobotsList.tsx +++ b/src/components/SidebarLists/RobotsList.tsx @@ -79,7 +79,7 @@ export default function RobotsList({ function handleGetRobots() { getRobots( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, diff --git a/src/components/SidebarLists/SidebarListItem.tsx b/src/components/SidebarLists/SidebarListItem.tsx index 1eab2c97..1f4997fa 100644 --- a/src/components/SidebarLists/SidebarListItem.tsx +++ b/src/components/SidebarLists/SidebarListItem.tsx @@ -38,10 +38,7 @@ export default function SidebarListItem({ const handleSelectItem = () => { switch (type) { case "organization": - if ( - selectedState?.organization?.organizationName === - data?.organizationName - ) { + if (selectedState?.organization?.name === data?.name) { setSelectedState({ ...selectedState, organization: null, @@ -122,8 +119,7 @@ export default function SidebarListItem({ setSidebarState({ ...sidebarState, isOpen: false }); navigate( `/${organizationNameViewer({ - organizationName: selectedState?.organization - ?.organizationName as string, + organizationName: selectedState?.organization?.name as string, capitalization: false, })}/${selectedState?.roboticsCloud?.name}/${ selectedState?.instance?.name diff --git a/src/components/TableActionCells/FleetActionCells.tsx b/src/components/TableActionCells/FleetActionCells.tsx index dd4fc027..69312a04 100644 --- a/src/components/TableActionCells/FleetActionCells.tsx +++ b/src/components/TableActionCells/FleetActionCells.tsx @@ -1,5 +1,5 @@ import TableActionButtons from "../TableActionButtons/TableActionButtons"; -import { IOrganization } from "../../interfaces/organizationInterfaces"; +import { IOrganization } from "../../interfaces/organization.interface"; import DeleteFleetModalModal from "../../modals/DeleteFleetModal"; import { IInstance } from "../../interfaces/instanceInferfaces"; import { IRegion } from "../../interfaces/regionInterfaces"; diff --git a/src/components/TableActionCells/NamespaceActionCells.tsx b/src/components/TableActionCells/NamespaceActionCells.tsx index 7aa790f2..8668eae0 100644 --- a/src/components/TableActionCells/NamespaceActionCells.tsx +++ b/src/components/TableActionCells/NamespaceActionCells.tsx @@ -1,6 +1,6 @@ import DeleteNamespaceModal from "../../modals/DeleteNamespaceModal"; import TableActionButtons from "../TableActionButtons/TableActionButtons"; -import { IOrganization } from "../../interfaces/organizationInterfaces"; +import { IOrganization } from "../../interfaces/organization.interface"; import { IInstance } from "../../interfaces/instanceInferfaces"; import { IRegion } from "../../interfaces/regionInterfaces"; import { Fragment, ReactElement, useState } from "react"; diff --git a/src/components/TableActionCells/OrganizationActionCells.tsx b/src/components/TableActionCells/OrganizationActionCells.tsx index 16594dc5..20952510 100644 --- a/src/components/TableActionCells/OrganizationActionCells.tsx +++ b/src/components/TableActionCells/OrganizationActionCells.tsx @@ -1,6 +1,6 @@ import DeleteOrganizationModal from "../../modals/DeleteOrganizationModal"; import TableActionButtons from "../TableActionButtons/TableActionButtons"; -import { IOrganization } from "../../interfaces/organizationInterfaces"; +import { IOrganization } from "../../interfaces/organization.interface"; import { envCreatableOrganization } from "../../helpers/envProvider"; import { Fragment, ReactElement, useState } from "react"; diff --git a/src/components/UpdateRobotLaunchsForm/UpdateRobotLaunchsForm.tsx b/src/components/UpdateRobotLaunchsForm/UpdateRobotLaunchsForm.tsx index 39ec77a0..049c64c2 100644 --- a/src/components/UpdateRobotLaunchsForm/UpdateRobotLaunchsForm.tsx +++ b/src/components/UpdateRobotLaunchsForm/UpdateRobotLaunchsForm.tsx @@ -30,7 +30,7 @@ export default function UpdateRobotLaunchsForm(): ReactElement { function handleGetLaunchManagers() { getLaunchManagers( { - organizationId: selectedState?.organization!.organizationId, + organizationId: selectedState?.organization!.id, roboticsCloudName: selectedState?.roboticsCloud!.name, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, diff --git a/src/components/UsagesWidget/UsagesWidget.tsx b/src/components/UsagesWidget/UsagesWidget.tsx index 16ca416d..8f33c68e 100644 --- a/src/components/UsagesWidget/UsagesWidget.tsx +++ b/src/components/UsagesWidget/UsagesWidget.tsx @@ -18,7 +18,7 @@ export default function UsagesWidget(): ReactElement { const { getSystemStatus } = useFunctions(); useEffect(() => { - pagesState?.organization?.organizationId && + pagesState?.organization?.id && pagesState?.roboticsCloud?.name && pagesState?.instance?.instanceId && !pagesState?.instance?.systemStatus?.length && diff --git a/src/contexts/FunctionsContext.tsx b/src/contexts/FunctionsContext.tsx index 8967f3bc..099ebae4 100644 --- a/src/contexts/FunctionsContext.tsx +++ b/src/contexts/FunctionsContext.tsx @@ -70,6 +70,7 @@ import { namespacesMapper, } from "../handler/namespace.handler"; import { fleetMapper, fleetsMapper } from "../handler/fleet.handler"; +import { orgMapper, orgsMapper } from "../handler/organization.handler"; export const FunctionsContext: any = createContext(null); @@ -87,25 +88,13 @@ export default ({ children }: any) => { const { robotData, setRobotData } = useCreateRobot(); async function getOrganizations(parameters?: ImultipleGetParameters) { - await dispatch(getAllOrganizations()).then((organizationsResponse: any) => { - if (organizationsResponse?.payload?.data) { - parameters?.setResponse && - parameters?.setResponse(organizationsResponse?.payload?.data || []); + await dispatch(getAllOrganizations()).then((resOrgs: any) => { + const organizations = orgsMapper(resOrgs?.payload?.data); + if (organizations) { + parameters?.setResponse && parameters?.setResponse(organizations); parameters?.setItemCount && - parameters?.setItemCount( - organizationsResponse?.payload?.data?.length || 0, - ); - - if (organizationsResponse?.payload?.data?.length === 1) { - parameters?.setFirstItemforTrial && - parameters?.setFirstItemforTrial( - organizationsResponse?.payload?.data[0], - ); - } else { - parameters?.setFirstItemforTrial && - parameters?.setFirstItemforTrial(null); - } + parameters?.setItemCount(organizations?.length); } else { parameters?.ifErrorNavigateTo404 && navigateTo404(); parameters?.setResponse && parameters?.setResponse([]); @@ -118,52 +107,34 @@ export default ({ children }: any) => { values: IgetOrganization, parameters?: IsingleGetParameters, ) { - await dispatch(getAllOrganizations()).then( - async (organizationsResponse: any) => { - if ( - organizationsResponse?.payload?.data && - organizationsResponse?.payload?.data?.find( - (organization: any) => - organization?.organizationName === - `org_${values?.organizationName}`, - ) - ) { - parameters?.isSetState && - setSelectedState((prevState: any) => { - return { - ...prevState, - organization: organizationsResponse?.payload?.data?.find( - (organization: any) => - organization?.organizationName === - `org_${values?.organizationName}`, - ), - }; - }); - parameters?.setResponse && - (await parameters?.setResponse( - organizationsResponse?.payload?.data?.find( - (organization: any) => - organization?.organizationName === - `org_${values?.organizationName}`, - ), - )); - parameters?.setPages && - setPagesState((prevState: any) => { - return { - ...prevState, - organization: organizationsResponse?.payload?.data?.find( - (organization: any) => - organization?.organizationName === - `org_${values?.organizationName}`, - ), - }; - }); - } else { - parameters?.ifErrorNavigateTo404 && navigateTo404(); - parameters?.setResponse && parameters?.setResponse({}); - } - }, - ); + await dispatch(getAllOrganizations()).then(async (resOrg: any) => { + const organization = orgMapper( + resOrg?.payload?.data, + values?.organizationName, + ); + + if (organization) { + parameters?.isSetState && + setSelectedState((prevState: any) => { + return { + ...prevState, + organization: organization, + }; + }); + parameters?.setResponse && + (await parameters?.setResponse(organization)); + parameters?.setPages && + setPagesState((prevState: any) => { + return { + ...prevState, + organization: organization, + }; + }); + } else { + parameters?.ifErrorNavigateTo404 && navigateTo404(); + parameters?.setResponse && parameters?.setResponse({}); + } + }); } async function getRoboticsClouds( @@ -680,10 +651,8 @@ export default ({ children }: any) => { }, tree: { organization: { - id: selectedState?.organization?.organizationId, - name: orgNameViewer( - selectedState?.organization?.organizationName!, - ), + id: selectedState?.organization?.id, + name: orgNameViewer(selectedState?.organization?.name!), }, region: { name: selectedState?.instance?.region, @@ -1221,10 +1190,8 @@ export default ({ children }: any) => { }, tree: { organization: { - id: selectedState?.organization?.organizationId, - name: orgNameViewer( - selectedState?.organization?.organizationName!, - ), + id: selectedState?.organization?.id, + name: orgNameViewer(selectedState?.organization?.name!), }, region: { name: selectedState?.instance?.region, @@ -1507,7 +1474,7 @@ export default ({ children }: any) => { try { await dispatch( addPhysicalInstanceToFleetDispatch({ - organizationId: selectedState?.organization?.organizationId, + organizationId: selectedState?.organization?.id, roboticsCloudName: selectedState?.roboticsCloud?.name, instanceId: selectedState?.instance?.instanceId, region: selectedState?.roboticsCloud?.region, @@ -1528,7 +1495,7 @@ export default ({ children }: any) => { try { await dispatch( getSystemStatusDispatch({ - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, roboticsCloudName: pagesState?.roboticsCloud?.name!, @@ -1558,7 +1525,7 @@ export default ({ children }: any) => { try { await dispatch( createRobotDispatch({ - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, region: selectedState?.roboticsCloud?.region!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, @@ -1613,7 +1580,7 @@ export default ({ children }: any) => { try { await dispatch( createEnvironmentDispatch({ - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, region: selectedState?.roboticsCloud?.region!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, @@ -1705,7 +1672,7 @@ export default ({ children }: any) => { async function deleteDataScienceApp(values: IdeleteDataScienceAppsRequest) { await dispatch( deleteDataScienceAppDispatch({ - organizationId: selectedState.organization?.organizationId!, + organizationId: selectedState.organization?.id!, roboticsCloudName: selectedState.roboticsCloud?.name!, region: selectedState.instance?.region!, instanceId: selectedState.instance?.instanceId!, @@ -1719,7 +1686,7 @@ export default ({ children }: any) => { async function createDataScienceApp(values: IcreateDataScienceAppsRequest) { await dispatch( createDataScienceAppDispatch({ - organizationId: selectedState.organization?.organizationId!, + organizationId: selectedState.organization?.id!, roboticsCloudName: selectedState.roboticsCloud?.name!, region: selectedState.instance?.region!, instanceId: selectedState.instance?.instanceId!, @@ -1733,7 +1700,7 @@ export default ({ children }: any) => { async function getDataScienceApps(parameters?: ImultipleGetParameters) { await dispatch( getDataScienceAppsDispatch({ - organizationId: selectedState.organization?.organizationId!, + organizationId: selectedState.organization?.id!, roboticsCloudName: selectedState.roboticsCloud?.name!, region: selectedState.instance?.region!, instanceId: selectedState.instance?.instanceId!, diff --git a/src/contexts/RobotContext.tsx b/src/contexts/RobotContext.tsx index 0438833a..06a5aa2c 100644 --- a/src/contexts/RobotContext.tsx +++ b/src/contexts/RobotContext.tsx @@ -89,10 +89,7 @@ export default ({ children }: any) => { // Main Functions useEffect(() => { - if ( - pagesState?.organization?.organizationName !== - `org_${url?.organizationName}` - ) { + if (pagesState?.organization?.name !== `org_${url?.organizationName}`) { return handleGetOrganization(); } else if (pagesState?.roboticsCloud?.name !== url?.roboticsCloudName) { return handleGetRoboticsCloud(); @@ -388,7 +385,7 @@ export default ({ children }: any) => { function handleGetRoboticsCloud() { getRoboticsCloud( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: url?.roboticsCloudName!, }, { @@ -402,7 +399,7 @@ export default ({ children }: any) => { function handleGetInstance() { getInstance( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceName: url?.instanceName!, region: pagesState?.roboticsCloud?.region!, @@ -419,7 +416,7 @@ export default ({ children }: any) => { function handleGetPhysicalInstance() { getPhysicalInstance( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, physicalInstanceName: responseRobot?.physicalInstance, @@ -435,7 +432,7 @@ export default ({ children }: any) => { function handleGetFleet() { getFleet( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, @@ -452,7 +449,7 @@ export default ({ children }: any) => { function handleGetNamespace() { getNamespace( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, @@ -469,11 +466,11 @@ export default ({ children }: any) => { function handleGetRobot() { getRobot( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, - fleetName: pagesState?.fleet?.name, + fleetName: pagesState?.fleet?.name!, robotName: url?.robotName!, }, { @@ -487,11 +484,11 @@ export default ({ children }: any) => { function handleGetEnvironment() { getEnvironment( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, - fleetName: pagesState?.fleet?.name, + fleetName: pagesState?.fleet?.name!, environmentName: url?.robotName!, }, { @@ -513,11 +510,11 @@ export default ({ children }: any) => { function handleGetLaunchManagers() { getLaunchManagers( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, - fleetName: pagesState?.fleet?.name, + fleetName: pagesState?.fleet?.name!, robotName: url?.robotName!, }, { diff --git a/src/controllers/InstanceTableData.tsx b/src/controllers/InstanceTableData.tsx index c1f43f53..6858310a 100644 --- a/src/controllers/InstanceTableData.tsx +++ b/src/controllers/InstanceTableData.tsx @@ -30,10 +30,7 @@ export function InstanceTableData() { const { pagesState, selectedState } = useMain(); useEffect(() => { - if ( - pagesState?.organization?.organizationName !== - `org_${url?.organizationName}` - ) { + if (pagesState?.organization?.name !== `org_${url?.organizationName}`) { handleGetOrganization(); } else if (pagesState?.roboticsCloud?.name !== url?.roboticsCloudName) { handleGetRoboticsCloud(); @@ -75,7 +72,7 @@ export function InstanceTableData() { function handleGetRoboticsCloud() { getRoboticsCloud( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: url?.roboticsCloudName as string, }, { @@ -89,7 +86,7 @@ export function InstanceTableData() { function handleGetInstance() { getInstance( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceName: url?.instanceName as string, region: pagesState?.roboticsCloud?.region!, @@ -106,7 +103,7 @@ export function InstanceTableData() { function handleGetFleets() { getFleets( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, @@ -121,7 +118,7 @@ export function InstanceTableData() { function handleGetNamespaces() { getNamespaces( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, @@ -144,7 +141,7 @@ export function InstanceTableData() { return { key: fleet?.name, name: fleet, - organization: pagesState?.organization?.organizationName, + organization: pagesState?.organization?.name, roboticsCloud: pagesState?.roboticsCloud?.name, instance: pagesState?.instance?.name, state: fleet?.status || fleet?.status, @@ -166,9 +163,9 @@ export function InstanceTableData() { return ( { - return ( - - ); + return ; }, }, { diff --git a/src/controllers/MainTableData.tsx b/src/controllers/MainTableData.tsx index 1a6be669..d848aeb3 100644 --- a/src/controllers/MainTableData.tsx +++ b/src/controllers/MainTableData.tsx @@ -4,7 +4,7 @@ import { } from "../interfaces/tableInterface"; import OrganizationActionCells from "../components/TableActionCells/OrganizationActionCells"; import StateCell from "../components/TableInformationCells/StateCell"; -import { IOrganization } from "../interfaces/organizationInterfaces"; +import { IOrganization } from "../interfaces/organization.interface"; import { useEffect, useMemo, useState } from "react"; import useFunctions from "../hooks/useFunctions"; import { useParams } from "react-router-dom"; @@ -40,8 +40,8 @@ export function MainTableData() { () => responseOrganizations?.map((organization: IOrganization) => { return { - key: organization?.organizationName, - name: organization?.organizationName, + key: organization?.name, + name: organization?.name, status: "Ready", actions: organization, }; diff --git a/src/controllers/NamespaceTableData.tsx b/src/controllers/NamespaceTableData.tsx index 9e182e40..880f1be8 100644 --- a/src/controllers/NamespaceTableData.tsx +++ b/src/controllers/NamespaceTableData.tsx @@ -26,10 +26,7 @@ export function NamespaceTableData() { } = useFunctions(); useEffect(() => { - if ( - pagesState?.organization?.organizationName !== - `org_${url?.organizationName}` - ) { + if (pagesState?.organization?.name !== `org_${url?.organizationName}`) { handleGetOrganization(); } else if (pagesState?.roboticsCloud?.name !== url?.roboticsCloudName) { handleGetRoboticsCloud(); @@ -41,16 +38,16 @@ export function NamespaceTableData() { applicationMode ? handleGetEnvironments() : handleGetRobots(); } - const timer = + const timer = setInterval(() => { selectedState?.organization && selectedState?.roboticsCloud && selectedState?.instance && selectedState?.fleet && - setInterval(() => { - pagesState?.fleet && applicationMode - ? handleGetEnvironments() - : handleGetRobots(); - }, 10000); + pagesState?.fleet && + applicationMode + ? handleGetEnvironments() + : handleGetRobots(); + }, 10000); return () => { clearInterval(timer); @@ -83,7 +80,7 @@ export function NamespaceTableData() { function handleGetRoboticsCloud() { getRoboticsCloud( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: url?.roboticsCloudName!, }, { @@ -97,7 +94,7 @@ export function NamespaceTableData() { function handleGetInstance() { getInstance( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceName: url?.instanceName!, region: pagesState?.roboticsCloud?.region!, @@ -114,7 +111,7 @@ export function NamespaceTableData() { function handleGetFleet() { getFleet( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, @@ -131,7 +128,7 @@ export function NamespaceTableData() { function handleGetNamespace() { getNamespace( { - organizationId: selectedState?.organization?.organizationId!, + organizationId: selectedState?.organization?.id!, roboticsCloudName: selectedState?.roboticsCloud?.name!, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, @@ -148,7 +145,7 @@ export function NamespaceTableData() { function handleGetRobots() { getRobots( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, @@ -164,7 +161,7 @@ export function NamespaceTableData() { function handleGetEnvironments() { getEnvironments( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: pagesState?.roboticsCloud?.name!, instanceId: pagesState?.instance?.instanceId!, region: pagesState?.roboticsCloud?.region!, @@ -184,7 +181,7 @@ export function NamespaceTableData() { key: robot?.name, name: robot, organization: handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, ), roboticsCloud: pagesState?.roboticsCloud?.name!, instance: pagesState?.instance?.name!, @@ -197,7 +194,7 @@ export function NamespaceTableData() { isEnabledVDI: robot?.vdiEnabled, }, actions: { - organizationId: pagesState.organization?.organizationId!, + organizationId: pagesState.organization?.id!, roboticsCloudName: pagesState.roboticsCloud?.name!, instanceId: pagesState.instance?.instanceId!, region: pagesState.instance?.region!, @@ -225,7 +222,7 @@ export function NamespaceTableData() { title={rowData?.name?.name} subtitle={rowData?.name?.fleetName} titleURL={`/${handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, )}/${pagesState.roboticsCloud?.name}/${ pagesState.instance?.name }/${pagesState.fleet?.name}/${rowData?.name?.name}`} diff --git a/src/controllers/OrgTableData.tsx b/src/controllers/OrgTableData.tsx index 068ffa18..c6a9b963 100644 --- a/src/controllers/OrgTableData.tsx +++ b/src/controllers/OrgTableData.tsx @@ -28,10 +28,7 @@ export function OrgTableData() { } useEffect(() => { - if ( - pagesState?.organization?.organizationName !== - `org_${url?.organizationName}` - ) { + if (pagesState?.organization?.name !== `org_${url?.organizationName}`) { handleGetOrganization(); } else { handleGetRegions(); @@ -60,7 +57,7 @@ export function OrgTableData() { function handleGetRegions() { getRoboticsClouds( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, }, { setResponse: setResponseRegions, @@ -77,30 +74,30 @@ export function OrgTableData() { name: { name: r?.name, organization: handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, ), titleURL: `/${handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, )}/${r?.name}`, }, organization: handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, ), region: r?.region, country: r.region === "eu-central-1" ? "Frankfurt (Germany)" : r?.region === "eu-west-2" - ? "London (UK)" - : r?.region === "us-east-1" - ? "N. Virginia (US)" - : r?.region === "us-east-2" - ? "Ohio (US)" - : r?.region === "us-west-1" - ? "N. California (US)" - : r?.region === "ap-northeast-1" - ? "Tokyo (Japan)" - : "", + ? "London (UK)" + : r?.region === "us-east-1" + ? "N. Virginia (US)" + : r?.region === "us-east-2" + ? "Ohio (US)" + : r?.region === "us-west-1" + ? "N. California (US)" + : r?.region === "ap-northeast-1" + ? "Tokyo (Japan)" + : "", state: "Ready", actions: r, }; diff --git a/src/controllers/RegionTableData.tsx b/src/controllers/RegionTableData.tsx index 2201a27f..fa4107bd 100644 --- a/src/controllers/RegionTableData.tsx +++ b/src/controllers/RegionTableData.tsx @@ -29,10 +29,7 @@ export function RegionTableData() { } useEffect(() => { - if ( - pagesState?.organization?.organizationName !== - `org_${url?.organizationName}` - ) { + if (pagesState?.organization?.name !== `org_${url?.organizationName}`) { handleGetOrganization(); } else if (pagesState?.roboticsCloud?.name !== url?.roboticsCloudName) { handleGetRegion(); @@ -74,7 +71,7 @@ export function RegionTableData() { function handleGetRegion() { getRoboticsCloud( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: url?.roboticsCloudName!, }, { @@ -88,7 +85,7 @@ export function RegionTableData() { function handleGetInstances() { getInstances( { - organizationId: pagesState?.organization?.organizationId!, + organizationId: pagesState?.organization?.id!, roboticsCloudName: url?.roboticsCloudName!, region: pagesState?.roboticsCloud?.region!, details: true, @@ -109,11 +106,11 @@ export function RegionTableData() { title: instance?.name, subtitle: instance?.instanceType, titleURL: `/${handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, )}/${pagesState.roboticsCloud?.name}/${instance?.name}`, }, organization: handleSplitOrganizationName( - pagesState?.organization?.organizationName!, + pagesState?.organization?.name!, ), architecture: instance?.cloudInstanceResource?.architecture, OSResources: @@ -303,7 +300,7 @@ export function RegionTableData() { name: rowData?.actions?.name, state: rowData?.providerState, robolaunchState: rowData?.robolaunchState, - organizationId: pagesState?.organization?.organizationId, + organizationId: pagesState?.organization?.id, roboticsCloudName: pagesState.roboticsCloud?.name, instanceId: rowData?.actions?.instanceId, region: rowData?.actions?.region, diff --git a/src/handler/organization.handler.ts b/src/handler/organization.handler.ts new file mode 100644 index 00000000..08cbe810 --- /dev/null +++ b/src/handler/organization.handler.ts @@ -0,0 +1,26 @@ +import { + IOrganization, + IOrganizationBE, +} from "../interfaces/organization.interface"; + +function handleMapper(orgs: IOrganizationBE[]): IOrganization[] { + return ( + orgs?.map((org) => { + return { + id: org.organizationId, + name: org.organizationName, + }; + }) || [] + ); +} + +export function orgsMapper(orgs: IOrganizationBE[]): IOrganization[] { + return handleMapper(orgs); +} + +export function orgMapper( + orgs: IOrganizationBE[], + filter: string, +): null | IOrganization { + return handleMapper(orgs).find((org) => org.name === `org_${filter}`) || null; +} diff --git a/src/interfaces/mainInterfaces.ts b/src/interfaces/mainInterfaces.ts index d47d22de..2483d26a 100644 --- a/src/interfaces/mainInterfaces.ts +++ b/src/interfaces/mainInterfaces.ts @@ -1,4 +1,4 @@ -import { IOrganization } from "./organizationInterfaces"; +import { IOrganization } from "./organization.interface"; import { IInstance } from "./instanceInferfaces"; import { IRegion } from "./regionInterfaces"; import { INamespace } from "./namespace.interface"; diff --git a/src/interfaces/organizationInterfaces.ts b/src/interfaces/organization.interface.ts similarity index 88% rename from src/interfaces/organizationInterfaces.ts rename to src/interfaces/organization.interface.ts index 04936e4a..e52d9cd5 100644 --- a/src/interfaces/organizationInterfaces.ts +++ b/src/interfaces/organization.interface.ts @@ -1,4 +1,9 @@ export interface IOrganization { + id: string; + name: string; +} + +export interface IOrganizationBE { isCurrentMemberUser: boolean; organizationId: string; organizationName: string; diff --git a/src/interfaces/tableInterface.ts b/src/interfaces/tableInterface.ts index f98c40a6..c1211928 100644 --- a/src/interfaces/tableInterface.ts +++ b/src/interfaces/tableInterface.ts @@ -1,5 +1,5 @@ import { ReactElement } from "react"; -import { IOrganization } from "./organizationInterfaces"; +import { IOrganization } from "./organization.interface"; import { IInstance } from "./instanceInferfaces"; export interface IMainDashboardData { diff --git a/src/modals/DeleteBuildManagerModal.tsx b/src/modals/DeleteBuildManagerModal.tsx index fc24803f..d5de2d95 100644 --- a/src/modals/DeleteBuildManagerModal.tsx +++ b/src/modals/DeleteBuildManagerModal.tsx @@ -25,10 +25,10 @@ export default function DeleteBuildManagerModal({ dispatch( deleteBuildManager({ - organizationId: selectedState?.organization!.organizationId, + organizationId: selectedState?.organization!.id, roboticsCloudName: selectedState?.roboticsCloud!.name, instanceId: selectedState?.instance?.instanceId!, - fleetName: selectedState?.fleet?.name, + fleetName: selectedState?.fleet?.name!, robotName: url?.robotName as string, physicalInstanceName: robotData?.step1.tree.physicalInstance.name, region: selectedState?.roboticsCloud!.region, diff --git a/src/modals/DeleteLaunchManagerModal.tsx b/src/modals/DeleteLaunchManagerModal.tsx index b5dc8fd9..80e0e93e 100644 --- a/src/modals/DeleteLaunchManagerModal.tsx +++ b/src/modals/DeleteLaunchManagerModal.tsx @@ -24,12 +24,12 @@ export default function DeleteLaunchManagerModal({ setIsLoading(true); await dispatch( deleteLaunchManager({ - organizationId: selectedState?.organization!.organizationId, + organizationId: selectedState?.organization!.id, roboticsCloudName: selectedState?.roboticsCloud!.name, instanceId: selectedState?.instance?.instanceId!, region: selectedState?.instance?.region!, robotName: robotData?.step1?.details.name, - fleetName: selectedState?.fleet?.name, + fleetName: selectedState?.fleet?.name!, physicalInstanceName: robotData?.step1?.tree.physicalInstance.name, launchManagerName: launchManagerName, }), diff --git a/src/modals/DeleteOrganizationModal.tsx b/src/modals/DeleteOrganizationModal.tsx index ed0df954..7fc2edc6 100644 --- a/src/modals/DeleteOrganizationModal.tsx +++ b/src/modals/DeleteOrganizationModal.tsx @@ -1,7 +1,7 @@ import Button from "../components/Button/Button"; import { ReactElement, useState } from "react"; import { Dialog } from "primereact/dialog"; -import { IOrganization } from "../interfaces/organizationInterfaces"; +import { IOrganization } from "../interfaces/organization.interface"; interface IDeleteOrganizationModal { data: IOrganization; @@ -36,9 +36,7 @@ export default function DeleteOrganizationModal({

Are you sure you want to delete the organization named " - - {data?.organizationName?.split("_")[1]} - + {data?.name?.split("_")[1]} "? This action permanently deletes all objects underneath.

diff --git a/src/pages/DataSciencePage/DataSciencePage.tsx b/src/pages/DataSciencePage/DataSciencePage.tsx index ff8dcf7c..ce16f76e 100644 --- a/src/pages/DataSciencePage/DataSciencePage.tsx +++ b/src/pages/DataSciencePage/DataSciencePage.tsx @@ -9,7 +9,7 @@ export default function DataSciencePage(): ReactElement { function handleSelectController(): boolean { if ( - selectedState.organization?.organizationId && + selectedState.organization?.id && selectedState.roboticsCloud?.name && selectedState.instance?.instanceId ) { diff --git a/src/toolkit/OrganizationSlice.ts b/src/toolkit/OrganizationSlice.ts index 50fcef64..0ed34662 100644 --- a/src/toolkit/OrganizationSlice.ts +++ b/src/toolkit/OrganizationSlice.ts @@ -6,7 +6,7 @@ import { IgetOrganizationAdminsRequest, IgetOrganizationGuestsRequest, IgetOrganizationUsersRequest, -} from "../interfaces/organizationInterfaces"; +} from "../interfaces/organization.interface"; export const createOrganization = createAsyncThunk( "organizations/createOrganization", @@ -15,7 +15,7 @@ export const createOrganization = createAsyncThunk( name: values.name, }); return response.data; - } + }, ); export const getOrganizations = createAsyncThunk( @@ -23,7 +23,7 @@ export const getOrganizations = createAsyncThunk( async () => { const response = await organizationApi.getOrganizations(); return response.data; - } + }, ); export const getOrganizationUsers = createAsyncThunk( @@ -34,7 +34,7 @@ export const getOrganizationUsers = createAsyncThunk( organizationId: values.organizationId, }); return response.data; - } + }, ); export const getOrganizationAdmins = createAsyncThunk( @@ -45,7 +45,7 @@ export const getOrganizationAdmins = createAsyncThunk( organizationId: values.organizationId, }); return response.data; - } + }, ); export const getOrganizationGuests = createAsyncThunk( @@ -56,7 +56,7 @@ export const getOrganizationGuests = createAsyncThunk( organizationId: values.organizationId, }); return response.data; - } + }, ); export const moveAdminAsUserFromOrganization = createAsyncThunk( @@ -68,7 +68,7 @@ export const moveAdminAsUserFromOrganization = createAsyncThunk( invitedUserId: values.invitedUserId, }); return response.data; - } + }, ); export const moveUserAsAdminToOrganization = createAsyncThunk( @@ -80,7 +80,7 @@ export const moveUserAsAdminToOrganization = createAsyncThunk( invitedUserId: values.invitedUserId, }); return response.data; - } + }, ); export const deleteUserFromOrganization = createAsyncThunk( @@ -92,7 +92,7 @@ export const deleteUserFromOrganization = createAsyncThunk( invitedUserId: values.invitedUserId, }); return response.data; - } + }, ); export const deleteAdminFromOrganization = createAsyncThunk( @@ -104,7 +104,7 @@ export const deleteAdminFromOrganization = createAsyncThunk( invitedUserId: values.invitedUserId, }); return response.data; - } + }, ); export const deleteGuestFromOrganization = createAsyncThunk( @@ -116,14 +116,14 @@ export const deleteGuestFromOrganization = createAsyncThunk( invitedUserId: values.invitedUserId, }); return response.data; - } + }, ); export const deleteOrganization = createAsyncThunk( "organizations/deleteOrganization", async (values: { organizationId: string }) => { return undefined; - } + }, ); export const organizationSlice = createSlice({ diff --git a/tsconfig.json b/tsconfig.json index 55c142c2..4c698651 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "moduleResolution": "node", "resolveJsonModule": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", }, - "include": ["src"] + "include": ["src"], }