Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove use navigate #589

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading