Skip to content

Commit

Permalink
apply eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
akageun committed Aug 6, 2024
1 parent a19bc42 commit 80a3988
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
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,
keyspaceGeneralNames,
keyspaceSystemNames,
} = useKeyspace();


useEffect(() => {
//show component
setClusterId(routeParams.clusterId);
doGetKeyspaceNames(routeParams.clusterId, false);

return () => {
//hide component
};
}, [clusterId]);
}, [routeParams.clusterId, doGetKeyspaceNames]);

return (
<div className="container-fluid h-100">
Expand All @@ -36,21 +33,21 @@ const ClusterLayout = ({}) => {
<li className="nav-item">
<Link
className={`nav-link d-flex align-items-center gap-2 link-body-emphasis text-decoration-none`}
to={`/cluster/${clusterId}`}>
to={`/cluster/${routeParams.clusterId}`}>
<i className="bi bi-house"></i> Dashboard
</Link>
</li>
<li className="nav-item">
<Link
className={`nav-link d-flex align-items-center gap-2 link-body-emphasis text-decoration-none`}
to={`/cluster/${clusterId}/query`}>
to={`/cluster/${routeParams.clusterId}/query`}>
<i className="bi bi-journal-code"></i> Query Editor
</Link>
</li>
<li className="nav-item">
<Link
className={`nav-link d-flex align-items-center gap-2 link-body-emphasis text-decoration-none`}
to={`/cluster/${clusterId}/monitoring/nodes`}>
to={`/cluster/${routeParams.clusterId}/monitoring/nodes`}>
<i className="bi bi-eye"></i> Monitoring
</Link>
</li>
Expand All @@ -73,9 +70,11 @@ const ClusterLayout = ({}) => {

<h6 className="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-body-secondary ">
<span>Keyspace</span>
<a className="link-danger"
role={"button"}
onClick={e => doGetKeyspaceNames(routeParams.clusterId, true)}>
<Link className="link-danger"
role={"button"}
onClick={e => doGetKeyspaceNames(routeParams.clusterId, true)}
to="{() => false}"
>

<OverlayTrigger placement="top" overlay={
<Tooltip id="tooltip">
Expand All @@ -84,9 +83,7 @@ const ClusterLayout = ({}) => {
}>
<i className="bi bi-arrow-clockwise fs-5"></i>
</OverlayTrigger>


</a>
</Link>
</h6>
<ul className="nav flex-column">
{
Expand All @@ -100,7 +97,7 @@ const ClusterLayout = ({}) => {
return (
<li className="nav-item" key={`sidebarKeyspace${infoIndex}`}>
<Link
to={`/cluster/${clusterId}/keyspace/${info.keyspaceName}`}
to={`/cluster/${routeParams.clusterId}/keyspace/${info.keyspaceName}`}
className={`nav-link d-flex align-items-center link-body-emphasis text-decoration-none gap-2`}>
<i className="bi bi-database"></i> {info.keyspaceName}
</Link>
Expand Down Expand Up @@ -130,7 +127,7 @@ const ClusterLayout = ({}) => {
return (
<li className="nav-item" key={`sidebarKeyspace${infoIndex}`}>
<Link
to={`/cluster/${clusterId}/keyspace/${info.keyspaceName}`}
to={`/cluster/${routeParams.clusterId}/keyspace/${info.keyspaceName}`}
className={`nav-link d-flex align-items-center link-body-emphasis text-decoration-none gap-2`}>
<i className="bi bi-database"></i> {info.keyspaceName}
</Link>
Expand Down
46 changes: 19 additions & 27 deletions cassdio-web/src/main/webapp/src/components/cluster/cluster-list.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import React, {useEffect, useState} from "react";
import React, {useEffect} from "react";
import {Link} from "react-router-dom";

import Spinner from "components/common/spinner";
import useCluster from "hooks/useCluster";

const ClusterList = () => {

const {doGetClusterList, removeClusterId, clusters, clustersLoading} = useCluster();

const [showClusterModal, setShowClusterModal] = useState(false);
const [detailClusterId, setDetailClusterId] = useState(null);

const closeClusterModal = () => {
setShowClusterModal(false)
setDetailClusterId(null);
}
const {doGetClusterList, clusters, clustersLoading} = useCluster();

useEffect(() => {
//show component
Expand All @@ -24,7 +16,7 @@ const ClusterList = () => {
return () => {
//hide component
};
}, []);
}, [doGetClusterList]);

return (
<>
Expand All @@ -48,25 +40,25 @@ const ClusterList = () => {
<div className={"col-md-4 col-sm-12"} key={`clusters${infoIndex}`}>
<div className="card">
<div className="card-body">
<h4 className="card-title">
<Link
className={"text-decoration-none link-body-emphasis"}
to={`/cluster/${info.clusterId}`}>
{info.clusterName}
</Link>
</h4>
<h6 className="card-subtitle mb-2 text-body-secondary">Cluster Id
: {info.clusterId}</h6>
<p className="card-text text-truncate">{info.memo}</p>
<h4 className="card-title">
<Link
className={"text-decoration-none link-body-emphasis"}
to={`/cluster/${info.clusterId}`}>
{info.clusterName}
</Link>
</h4>
<h6 className="card-subtitle mb-2 text-body-secondary">Cluster Id
: {info.clusterId}</h6>
<p className="card-text text-truncate">{info.memo}</p>

<Link to={`/cluster/${info.clusterId}`}
className="btn btn-primary btn-sm">
Go To
</Link>
<Link to={`/cluster/${info.clusterId}`}
className="btn btn-primary btn-sm">
Go To
</Link>
</div>
</div>
</div>
</div>
)
)
}) :
<div className={"col"}>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -60,7 +61,10 @@ export default function DataRowItem(props) {
{data}
</Tooltip>
}>
<a role={"button"} onClick={e => handleCopyClipBoard(data)}>{renderData}</a>
<Link to="{() => false}" role={"button"}
onClick={e => handleCopyClipBoard(data)}>
{renderData}
</Link>
</OverlayTrigger>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ const KeyspaceTableList = ({clusterId, keyspaceName, tableList}) => {
{info.comment}
</div>
<div className={"btn-group btn-group-sm"}>
<a className={"btn btn-sm btn-outline-primary"} role={"button"}
onClick={() => {
setTableName(info.table_name);
setShowDetail(true);
}}>
<button
className={"btn btn-sm btn-outline-primary"}
onClick={() => {
setTableName(info.table_name);
setShowDetail(true);
}}>
Detail
</a>
</button>
</div>
</li>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,7 +24,7 @@ const ClusterManageModal = ({show, handleClose, clusterId, readonly = false}) =>
return () => {
//hide component
};
}, []);
}, [clusterId, doGetCluster]);

return (
<Modal show={show} size={"xl"} onHide={handleClose}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ const TableRowDetailModal = ({show, handleClose, rowDetailView, convertedRowHead
{rowDetailView[info.column_name]}
</td>
<td>
<a className={"btn btn-sm btn-outline-secondary"} onClick={e => handleCopyClipBoard(rowDetailView[info.column_name])}>COPY</a>
<button
className={"btn btn-sm btn-outline-secondary"}
onClick={e => handleCopyClipBoard(rowDetailView[info.column_name])}>
<i className="bi bi-clipboard"></i>
</button>
</td>
</tr>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 <div className={"min-vh-100"}>
<CassdioHeader/>
Expand Down
17 changes: 7 additions & 10 deletions cassdio-web/src/main/webapp/src/pages/admin/admin-cluster-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -50,7 +47,7 @@ const AdminClusterPage = () => {
return () => {
//hide component
};
}, []);
}, [doGetClusterList]);

return (
<>
Expand Down Expand Up @@ -96,14 +93,14 @@ const AdminClusterPage = () => {
<tr key={infoIndex}>
<td className={"text-center"}>
<div className={"btn-group btn-group-sm"}>
<a className={"btn btn-sm btn-outline-info"}
<button className={"btn btn-sm btn-outline-info"}
onClick={e => {
setDetailClusterId(info.clusterId);
setShowClusterModal(true);
}}>
<i className="bi bi-pencil-fill"></i>
</a>
<a className={"btn btn-sm btn-outline-info"} role={"button"}
</button>
<button className={"btn btn-sm btn-outline-info"}
onClick={e => {
sessionOneReset(info.clusterId)
}}>
Expand All @@ -114,13 +111,13 @@ const AdminClusterPage = () => {
}>
<i className="bi bi-x-octagon-fill"></i>
</OverlayTrigger>
</a>
<a className={"btn btn-sm btn-outline-info"}
</button>
<button className={"btn btn-sm btn-outline-info"}
onClick={e => {
removeClusterId(info.clusterId);
}}>
<i className="bi bi-trash"></i>
</a>
</button>
</div>
</td>
<td className={"text-center"}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ClusterClientPage = () => {

return () => {
};
}, [routeParams.clusterId]);
}, [routeParams.clusterId, pageInit]);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -28,15 +28,12 @@ const ClusterDashboardPage = ({}) => {

useEffect(() => {
//show component
setClusterId(routeParams.clusterId);
setKeyspaceLoading(true)

getKeyspaceList();

return () => {
//hide component
};
}, [clusterId]);
}, [routeParams.clusterId, getKeyspaceList]);

return (
<>
Expand Down
Loading

0 comments on commit 80a3988

Please sign in to comment.