From 80a39883bd90aa5e73673426b86a130d83348ee8 Mon Sep 17 00:00:00 2001 From: akageun Date: Tue, 6 Aug 2024 11:37:39 +0900 Subject: [PATCH] apply eslint --- .../src/components/cluster/cluster-layout.js | 31 ++++++------- .../src/components/cluster/cluster-list.js | 46 ++++++++----------- .../src/components/cluster/data-row-item.js | 6 ++- .../components/cluster/keyspace-table-list.js | 13 +++--- .../cluster/modal/cluster-manage-modal.js | 5 +- .../cluster/modal/table-row-detail-modal.js | 6 ++- .../layout/cassdio-default-layout.js | 19 ++++---- .../src/pages/admin/admin-cluster-page.js | 17 +++---- .../src/pages/cluster/cluster-client-page.js | 2 +- .../pages/cluster/cluster-dashboard-page.js | 9 ++-- .../cluster-keyspace-comapction-page.js | 5 +- .../pages/cluster/cluster-keyspace-page.js | 3 +- .../cluster-monitoring-dashboard-page.js | 7 +-- .../src/pages/cluster/cluster-nodes-page.js | 3 +- .../src/pages/cluster/cluster-query-page.js | 2 +- .../src/pages/cluster/cluster-table-page.js | 6 +-- .../src/main/webapp/src/utils/axiosUtils.js | 2 +- 17 files changed, 85 insertions(+), 97 deletions(-) diff --git a/cassdio-web/src/main/webapp/src/components/cluster/cluster-layout.js b/cassdio-web/src/main/webapp/src/components/cluster/cluster-layout.js index a0c95ba4..c657c2b7 100644 --- a/cassdio-web/src/main/webapp/src/components/cluster/cluster-layout.js +++ b/cassdio-web/src/main/webapp/src/components/cluster/cluster-layout.js @@ -1,14 +1,13 @@ -import React, {useEffect, useState} from "react"; +import React, {useEffect} from "react"; import {Link, Outlet, useParams} from "react-router-dom"; import {OverlayTrigger, Tooltip} from "react-bootstrap"; import CassdioSidebar from "components/layout/cassdio-sidebar"; import useKeyspace from "hooks/useKeyspace"; -const ClusterLayout = ({}) => { +const ClusterLayout = () => { const routeParams = useParams(); - const [clusterId, setClusterId] = useState(``) const { doGetKeyspaceNames, keyspaceNamesLoading, @@ -16,16 +15,14 @@ const ClusterLayout = ({}) => { keyspaceSystemNames, } = useKeyspace(); - useEffect(() => { //show component - setClusterId(routeParams.clusterId); doGetKeyspaceNames(routeParams.clusterId, false); return () => { //hide component }; - }, [clusterId]); + }, [routeParams.clusterId, doGetKeyspaceNames]); return (
@@ -36,21 +33,21 @@ const ClusterLayout = ({}) => {
  • + to={`/cluster/${routeParams.clusterId}`}> Dashboard
  • + to={`/cluster/${routeParams.clusterId}/query`}> Query Editor
  • + to={`/cluster/${routeParams.clusterId}/monitoring/nodes`}> Monitoring
  • @@ -73,9 +70,11 @@ const ClusterLayout = ({}) => {
    Keyspace - doGetKeyspaceNames(routeParams.clusterId, true)}> + doGetKeyspaceNames(routeParams.clusterId, true)} + to="{() => false}" + > @@ -84,9 +83,7 @@ const ClusterLayout = ({}) => { }> - - - +
    - ) + ) }) :

    diff --git a/cassdio-web/src/main/webapp/src/components/cluster/data-row-item.js b/cassdio-web/src/main/webapp/src/components/cluster/data-row-item.js index e37f1088..a47baed7 100644 --- a/cassdio-web/src/main/webapp/src/components/cluster/data-row-item.js +++ b/cassdio-web/src/main/webapp/src/components/cluster/data-row-item.js @@ -1,6 +1,7 @@ import {useEffect, useState} from "react"; import {OverlayTrigger, Tooltip} from "react-bootstrap"; import {toast} from "react-toastify"; +import {Link} from "react-router-dom"; export default function DataRowItem(props) { const data = props.data; @@ -60,7 +61,10 @@ export default function DataRowItem(props) { {data} }> - handleCopyClipBoard(data)}>{renderData} + handleCopyClipBoard(data)}> + {renderData} + ) } diff --git a/cassdio-web/src/main/webapp/src/components/cluster/keyspace-table-list.js b/cassdio-web/src/main/webapp/src/components/cluster/keyspace-table-list.js index 7ca413f9..409c1e6b 100644 --- a/cassdio-web/src/main/webapp/src/components/cluster/keyspace-table-list.js +++ b/cassdio-web/src/main/webapp/src/components/cluster/keyspace-table-list.js @@ -65,13 +65,14 @@ const KeyspaceTableList = ({clusterId, keyspaceName, tableList}) => { {info.comment}

    - { - setTableName(info.table_name); - setShowDetail(true); - }}> +
    ))} diff --git a/cassdio-web/src/main/webapp/src/components/cluster/modal/cluster-manage-modal.js b/cassdio-web/src/main/webapp/src/components/cluster/modal/cluster-manage-modal.js index 7f7677bc..acd3bffc 100644 --- a/cassdio-web/src/main/webapp/src/components/cluster/modal/cluster-manage-modal.js +++ b/cassdio-web/src/main/webapp/src/components/cluster/modal/cluster-manage-modal.js @@ -6,11 +6,8 @@ import useCluster from "hooks/useCluster"; const ClusterManageModal = ({show, handleClose, clusterId, readonly = false}) => { const { - doGetClusterList, - removeClusterId, doSaveCluster, doGetCluster, - clusters, clusterDetailLoading, clusterInfo, setClusterInfo, @@ -27,7 +24,7 @@ const ClusterManageModal = ({show, handleClose, clusterId, readonly = false}) => return () => { //hide component }; - }, []); + }, [clusterId, doGetCluster]); return ( diff --git a/cassdio-web/src/main/webapp/src/components/cluster/modal/table-row-detail-modal.js b/cassdio-web/src/main/webapp/src/components/cluster/modal/table-row-detail-modal.js index 2a983164..85ab04fd 100644 --- a/cassdio-web/src/main/webapp/src/components/cluster/modal/table-row-detail-modal.js +++ b/cassdio-web/src/main/webapp/src/components/cluster/modal/table-row-detail-modal.js @@ -59,7 +59,11 @@ const TableRowDetailModal = ({show, handleClose, rowDetailView, convertedRowHead {rowDetailView[info.column_name]} - handleCopyClipBoard(rowDetailView[info.column_name])}>COPY + ) diff --git a/cassdio-web/src/main/webapp/src/components/layout/cassdio-default-layout.js b/cassdio-web/src/main/webapp/src/components/layout/cassdio-default-layout.js index 80aa0187..c8fb7b59 100644 --- a/cassdio-web/src/main/webapp/src/components/layout/cassdio-default-layout.js +++ b/cassdio-web/src/main/webapp/src/components/layout/cassdio-default-layout.js @@ -3,9 +3,9 @@ import {Outlet, useLoaderData} from "react-router-dom"; import CassdioHeader from "./cassdio-header"; import CassdioToast from "components/common/cassdio-toast"; import {useEffect} from "react"; -import {useCassdioDispatch, useCassdioState} from "../../context/cassdioContext"; +import {useCassdioDispatch} from "../../context/cassdioContext"; -const CassdioDefaultLayout = ({}) => { +const CassdioDefaultLayout = () => { const dispatch = useCassdioDispatch(); // const { // consistencyLevels, @@ -15,15 +15,18 @@ const CassdioDefaultLayout = ({}) => { useEffect(() => { - dispatch({ - type: "SET_BOOTSTRAP", - consistencyLevels: bootstrap.consistencyLevels, - defaultConsistencyLevel: bootstrap.defaultConsistencyLevel, - }); + if (bootstrap) { + dispatch({ + type: "SET_BOOTSTRAP", + consistencyLevels: bootstrap.consistencyLevels, + defaultConsistencyLevel: bootstrap.defaultConsistencyLevel, + }); + } + return () => { }; - }, []); + }, [bootstrap, dispatch]); return
    diff --git a/cassdio-web/src/main/webapp/src/pages/admin/admin-cluster-page.js b/cassdio-web/src/main/webapp/src/pages/admin/admin-cluster-page.js index d9010731..f3888d1c 100644 --- a/cassdio-web/src/main/webapp/src/pages/admin/admin-cluster-page.js +++ b/cassdio-web/src/main/webapp/src/pages/admin/admin-cluster-page.js @@ -14,14 +14,11 @@ const AdminClusterPage = () => { doSessionClearOne, clusters, clustersLoading, - - sessionClearAllLoading, } = useCluster(); const [showClusterModal, setShowClusterModal] = useState(false); const [detailClusterId, setDetailClusterId] = useState(null); - const closeClusterModal = () => { setShowClusterModal(false) setDetailClusterId(null); @@ -50,7 +47,7 @@ const AdminClusterPage = () => { return () => { //hide component }; - }, []); + }, [doGetClusterList]); return ( <> @@ -96,14 +93,14 @@ const AdminClusterPage = () => {
    - { setDetailClusterId(info.clusterId); setShowClusterModal(true); }}> - - +
    diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-client-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-client-page.js index 4009b96b..3d6a6929 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-client-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-client-page.js @@ -51,7 +51,7 @@ const ClusterClientPage = () => { return () => { }; - }, [routeParams.clusterId]); + }, [routeParams.clusterId, pageInit]); return ( <> diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-dashboard-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-dashboard-page.js index 50e1c88e..84e2e54f 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-dashboard-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-dashboard-page.js @@ -4,15 +4,15 @@ import ClusterKeyspaceBreadcrumb from "components/cluster/cluster-keyspace-bread import Spinner from "components/common/spinner"; import clusterKeyspaceListApi from "remotes/clusterKeyspaceListApi"; -const ClusterDashboardPage = ({}) => { +const ClusterDashboardPage = () => { const routeParams = useParams(); - const [clusterId, setClusterId] = useState(``) const [keyspaceList, setKeyspaceList] = useState([]); const [keyspaceLoading, setKeyspaceLoading] = useState(false); const getKeyspaceList = () => { + setKeyspaceLoading(true) clusterKeyspaceListApi({ clusterId: routeParams.clusterId, }).then((data) => { @@ -28,15 +28,12 @@ const ClusterDashboardPage = ({}) => { useEffect(() => { //show component - setClusterId(routeParams.clusterId); - setKeyspaceLoading(true) - getKeyspaceList(); return () => { //hide component }; - }, [clusterId]); + }, [routeParams.clusterId, getKeyspaceList]); return ( <> diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-comapction-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-comapction-page.js index 49fc7f66..fa96fc46 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-comapction-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-comapction-page.js @@ -13,6 +13,7 @@ const ClusterKeyspaceCompactionPage = () => { const [histories, setHistories] = useState([]); const clusterCompactionHistory = () => { + setLoading(true) clusterCompactionHistoryApi({ clusterId: routeParams.clusterId, keyspaceName: routeParams.keyspaceName, @@ -28,12 +29,12 @@ const ClusterKeyspaceCompactionPage = () => { } useEffect(() => { - setLoading(true) + clusterCompactionHistory(); return () => { }; - }, [routeParams.clusterId, routeParams.keyspaceName]); + }, [routeParams.clusterId, routeParams.keyspaceName, clusterCompactionHistory]); return ( <> diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-page.js index cceb4903..02a59a58 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-keyspace-page.js @@ -43,14 +43,13 @@ const ClusterKeyspacePage = () => { useEffect(() => { //show component - setKeyspaceDescribe(''); getKeyspaceDetail(); return () => { //hide component }; - }, [routeParams.clusterId, routeParams.keyspaceName]); + }, [routeParams.clusterId, routeParams.keyspaceName, getKeyspaceDetail]); return ( diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-monitoring-dashboard-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-monitoring-dashboard-page.js index f63107df..114b260f 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-monitoring-dashboard-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-monitoring-dashboard-page.js @@ -1,12 +1,9 @@ -import ClusterMonitoringNavLink from "../../components/cluster/cluster-monitoring-nav-link"; - -const ClusterMonitoringDashboardPage = ({}) => { - +import ClusterMonitoringNavLink from "components/cluster/cluster-monitoring-nav-link"; +const ClusterMonitoringDashboardPage = () => { return ( <> - Dashboard ) diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-nodes-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-nodes-page.js index 734f8b90..6d1916c6 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-nodes-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-nodes-page.js @@ -8,7 +8,7 @@ import ClusterMonitoringNavLink from "components/cluster/cluster-monitoring-nav- import clusterNodesApi from "remotes/clusterNodesApi"; import {DateUtils} from "utils/timeUtils"; -const ClusterNodesPage = ({}) => { +const ClusterNodesPage = () => { const routeParams = useParams(); @@ -19,7 +19,6 @@ const ClusterNodesPage = ({}) => { useEffect(() => { //show component - setNodeList([]) getNodes(routeParams.clusterId) return () => { //hide component diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-query-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-query-page.js index 2bf86a7f..a7c702f7 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-query-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-query-page.js @@ -1,4 +1,4 @@ -import {Link, useParams} from "react-router-dom"; +import {useParams} from "react-router-dom"; import React, {useEffect, useState} from "react"; import {toast} from "react-toastify"; import QueryEditor from "components/cluster/query-editor"; diff --git a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-table-page.js b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-table-page.js index 97e54525..0013edf1 100644 --- a/cassdio-web/src/main/webapp/src/pages/cluster/cluster-table-page.js +++ b/cassdio-web/src/main/webapp/src/pages/cluster/cluster-table-page.js @@ -1,5 +1,5 @@ import {useEffect, useState} from "react"; -import {useParams} from "react-router-dom"; +import {Link, useParams} from "react-router-dom"; import {OverlayTrigger, Tooltip} from "react-bootstrap"; import useTable from "hooks/useTable"; @@ -105,8 +105,8 @@ const ClusterTablePage = () => {
    diff --git a/cassdio-web/src/main/webapp/src/utils/axiosUtils.js b/cassdio-web/src/main/webapp/src/utils/axiosUtils.js index f9b619a4..e12c19e9 100644 --- a/cassdio-web/src/main/webapp/src/utils/axiosUtils.js +++ b/cassdio-web/src/main/webapp/src/utils/axiosUtils.js @@ -70,7 +70,7 @@ const errorCatch = (error) => { toast.error(`Error ${0}, ${error.toString()}`); } } - +// eslint-disable-next-line export default { axiosInstance, };