Skip to content

Commit

Permalink
refactor(robot-context): 🎉 update context and add application assets
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Aug 16, 2023
1 parent 166d88d commit 2d0ea6a
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 40 deletions.
File renamed without changes.
File renamed without changes.
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.12.1",
"version": "0.12.2",
"private": true,
"dependencies": {
"@emotion/css": "^11.10.6",
Expand Down
8 changes: 4 additions & 4 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1567,14 +1567,14 @@ video {
grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-6{
grid-template-columns: repeat(6, minmax(0, 1fr));
}

.grid-cols-3{
grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-6{
grid-template-columns: repeat(6, minmax(0, 1fr));
}

.\!flex-col{
flex-direction: column !important;
}
Expand Down
39 changes: 39 additions & 0 deletions public/svg/general/application/application-gray.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/CreateForms/CreateRobotFormStep2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export default function CreateRobotFormStep2({
JSON.stringify(formik.initialValues) ===
JSON.stringify(formik.values)
}
loading={formik.isSubmitting}
className="w-full !h-11 text-xs"
text={
formik.isSubmitting ? (
Expand Down
6 changes: 5 additions & 1 deletion src/components/RobotHeaderTabs/RobotHeaderTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export default function RobotHeaderTabs({
: "text-layer-light-500"
} `}
>
{!isSettedCookie ? (
{responseRobot &&
Array.isArray(responseRobot?.robotClusters) &&
responseRobot?.robotClusters?.filter(
(robot: any) => robot?.robotStatus !== "EnvironmentReady"
)?.length ? (
<ContentLoader
speed={1}
width={92}
Expand Down
5 changes: 2 additions & 3 deletions src/components/SidebarLists/EnvironmentsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import SidebarListItem from "./SidebarListItem";
import useMain from "../../hooks/useMain";
import StateCell from "../Cells/StateCell";
import SidebarListLoader from "../SidebarListLoader/SidebarListLoader";
import { envOnPremise } from "../../helpers/envProvider";

interface IEnvironmentsList {
reload: boolean;
Expand Down Expand Up @@ -81,12 +80,12 @@ export default function EnvironmentsList({
: !selectedState?.instance
? "Instance"
: "Fleet"
} to view ${envOnPremise ? "applications" : "robots"}.`}
} to view applications.`}
/>
) : !Array.isArray(responseEnvironments) ? (
<SidebarListLoader />
) : responseEnvironments?.length === 0 ? (
<SidebarInfo text={`Create a Robot.`} />
<SidebarInfo text={`Create a Application.`} />
) : (
<Fragment>
{responseEnvironments?.map((environment: any, index: number) => {
Expand Down
6 changes: 5 additions & 1 deletion src/components/SidebarMenuItem/SideBarMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export default function SideBarMenuItem({
<img
draggable="false"
className={`w-9 lg:w-10 animate__animated animate__fadeInLeft`}
src={`/svg/general/${type}/${type}-${colorSwitcher()}.svg`}
src={`/svg/general/${
type === "robot" && envOnPremise ? "application" : type
}/${
type === "robot" && envOnPremise ? "application" : type
}-${colorSwitcher()}.svg`}
alt="robolaunch"
style={{ filter: "drop-shadow(0 0 0.5px #00000035" }}
/>
Expand Down
7 changes: 6 additions & 1 deletion src/contexts/RobotContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export default ({ children }: any) => {
!responseBuildManager &&
!responseLaunchManagers
) {
envOnPremise ? handleGetEnvironment() : handleGetRobot();
if (envOnPremise === true) {
handleGetEnvironment();
} else {
handleGetRobot();
}

!envOnPremise && handleGetBuildManager();
!envOnPremise && handleGetLaunchManagers();
}
Expand Down
2 changes: 0 additions & 2 deletions src/modals/DeleteEnvironmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export default function DeleteEnvironmentModal({
const [isLoading, setIsLoading] = useState<boolean>(false);
const dispatch = useAppDispatch();

console.log(data);

function handleDeleteRobotModal() {
setIsLoading(true);

Expand Down
33 changes: 6 additions & 27 deletions src/toolkit/FleetSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,6 @@ export const getFederatedFleets = createAsyncThunk(
}
);

// export const getFederatedFleetStatus = createAsyncThunk(
// "instance/getFederatedFleetStatus",
// async (values: any) => {
// const response = await kubernetesApi.getFederatedFleetStatus({
// name: values.name,
// organizationId: values?.organizationId,
// roboticsClouds: [
// {
// name: values?.roboticsCloudName,
// cloudInstances: [
// {
// instanceId: values?.instanceId,
// region: values?.region,
// robolaunchFederatedFleets: [{ name: values?.fleetName }],
// },
// ],
// },
// ],
// });
// return response.data;
// }
// );

export const deleteFederatedFleet = createAsyncThunk(
"instance/deleteFederatedFleet",
async (values: any) => {
Expand Down Expand Up @@ -121,12 +98,14 @@ export const FleetSlice = createSlice({
.addCase(createFederatedFleet.rejected, () => {
toast.error("Something went wrong of creating fleet");
})
.addCase(getFederatedFleets.fulfilled, (_, action: any) => {
if (!action?.payload?.success) {
toast.error(action?.payload?.message);
}
})
.addCase(getFederatedFleets.rejected, () => {
toast.error("Something went wrong of getting fleets");
toast.error(`Something went wrong of getting fleets`);
})
// .addCase(getFederatedFleetStatus.rejected, () => {
// toast.error("Something went wrong of getting fleet status");
// })
.addCase(deleteFederatedFleet.fulfilled, (_, action: any) => {
if (!action?.payload?.success) {
toast.error(action?.payload?.message);
Expand Down

0 comments on commit 2d0ea6a

Please sign in to comment.