Skip to content

Commit

Permalink
🫥 remove use navigate (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-cvit authored Sep 24, 2024
1 parent dcbde24 commit 0a59a6e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
5 changes: 1 addition & 4 deletions cyclops-ui/src/components/pages/EditModule/EditModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Typography,
} from "antd";
import axios from "axios";
import { useNavigate } from "react-router";
import { LockFilled, UnlockFilled } from "@ant-design/icons";

import { useParams } from "react-router-dom";
Expand Down Expand Up @@ -101,8 +100,6 @@ const EditModule = () => {
const [loadValues, setLoadValues] = useState(false);
const [loadTemplate, setLoadTemplate] = useState(false);

const history = useNavigate();

let { moduleName } = useParams();

const mapsToArray = useCallback((fields: any[], values: any): any => {
Expand Down Expand Up @@ -410,7 +407,7 @@ const EditModule = () => {
</Button>{" "}
<Button
htmlType="button"
onClick={() => history("/modules/" + moduleName)}
onClick={() => (window.location.href = "/modules/" + moduleName)}
disabled={!loadTemplate}
>
Back
Expand Down
4 changes: 1 addition & 3 deletions cyclops-ui/src/components/pages/History.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { Button, Col, Modal, Row, Table, Typography } from "antd";
import { useNavigate } from "react-router";
import axios from "axios";
import { useParams } from "react-router-dom";
import ReactDiffViewer from "react-diff-viewer";
Expand All @@ -15,7 +14,6 @@ require(`ace-builds/src-noconflict/snippets/sass`);
require(`ace-builds/src-noconflict/theme-github`);

const ModuleHistory = () => {
const history = useNavigate();
const [error, setError] = useState({
message: "",
description: "",
Expand Down Expand Up @@ -266,7 +264,7 @@ const ModuleHistory = () => {
<Button
style={{ float: "right" }}
htmlType="button"
onClick={() => history("/modules/" + moduleName)}
onClick={() => (window.location.href = "/modules/" + moduleName)}
>
Back
</Button>
Expand Down
4 changes: 1 addition & 3 deletions cyclops-ui/src/components/pages/Modules/Modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Popover,
Checkbox,
} from "antd";
import { useNavigate } from "react-router";

import axios from "axios";

Expand All @@ -26,7 +25,6 @@ import { mapResponseError } from "../../../utils/api/errors";
const { Title } = Typography;

const Modules = () => {
const history = useNavigate();
const [allData, setAllData] = useState([]);
const [filteredData, setFilteredData] = useState([]);
const [loadingModules, setLoadingModules] = useState(false);
Expand Down Expand Up @@ -83,7 +81,7 @@ const Modules = () => {
}, [moduleHealthFilter, allData, searchInputFilter]);

const handleClick = () => {
history("/modules/new");
window.location.href = "/modules/new";
};
const handleSelectItem = (selectedItems: any[]) => {
setModuleHealthFilter(selectedItems);
Expand Down
5 changes: 1 addition & 4 deletions cyclops-ui/src/components/pages/NewModule/NewModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
notification,
} from "antd";
import axios from "axios";
import { useNavigate } from "react-router";
import { findMaps, flattenObjectKeys } from "../../../utils/form";
import "./custom.css";
import defaultTemplate from "../../../static/img/default-template-icon.png";
Expand Down Expand Up @@ -90,8 +89,6 @@ const NewModule = () => {

const [namespaces, setNamespaces] = useState<string[]>([]);

const history = useNavigate();

const [notificationApi, contextHolder] = notification.useNotification();
const openNotification = (errors: FeedbackError[]) => {
notificationApi.error({
Expand Down Expand Up @@ -702,7 +699,7 @@ const NewModule = () => {
</Button>{" "}
<Button
htmlType="button"
onClick={() => history("/")}
onClick={() => (window.location.href = "/")}
disabled={loadingTemplate || loadingTemplateInitialValues}
>
Back
Expand Down

0 comments on commit 0a59a6e

Please sign in to comment.