From f3d99a3c6a6a31e7d2743ace546d6bc0c710772b Mon Sep 17 00:00:00 2001 From: Gang Li Date: Wed, 15 Nov 2023 19:22:37 +0800 Subject: [PATCH] Change StoreViewControlPanel Remove useless properties --- .../src/app/components/content/RemoteView.jsx | 13 +------------ .../content/common/StoreControlPanels.jsx | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/main/webui/src/app/components/content/RemoteView.jsx b/src/main/webui/src/app/components/content/RemoteView.jsx index c2824d2..bc616bc 100644 --- a/src/main/webui/src/app/components/content/RemoteView.jsx +++ b/src/main/webui/src/app/components/content/RemoteView.jsx @@ -86,18 +86,7 @@ export default function RemoteView() { return (
- navigate(`/remote/${pkgType}/edit/${storeName}`)} - // handleCreate={handlers.handleCreate} - // handleRemove={handlers.handleRemove} - /> +
diff --git a/src/main/webui/src/app/components/content/common/StoreControlPanels.jsx b/src/main/webui/src/app/components/content/common/StoreControlPanels.jsx index dd052c6..791b1c9 100644 --- a/src/main/webui/src/app/components/content/common/StoreControlPanels.jsx +++ b/src/main/webui/src/app/components/content/common/StoreControlPanels.jsx @@ -84,11 +84,17 @@ StoreEditControlPanel.propTypes={ store: PropTypes.object }; -const StoreViewControlPanel = function({enabled, storeObj, handleDisable, handleEnable}){ - const [enableText, enableHandler] = enabled?["Disable",handleDisable]:["Enable",handleEnable]; +const StoreViewControlPanel = function({store}){ + const handleEnable = () =>{ + // TODO: need to implement + }; + const handleDisable = () =>{ + // TODO: need to implement + }; + const [enableText, enableHandler] = store.disabled?["Enable",handleEnable]:["Disable",handleDisable]; const navigate = useNavigate(); - const [pkgType, storeType, storeName] = [storeObj.packageType, storeObj.type, storeObj.name]; + const [pkgType, storeType, storeName] = [store.packageType, store.type, store.name]; const storeUrl = `/api/admin/stores/${pkgType}/${storeType}/${storeName}`; const handleRemove = async ()=>{ const response = await http.delete(storeUrl); @@ -100,7 +106,7 @@ const StoreViewControlPanel = function({enabled, storeObj, handleDisable, handle // TODO: Some other way to show deletion success? Utils.logMessage("Store deleted."); } - navigate(`/${storeObj.type}`); + navigate(`/${store.type}`); }; return( @@ -120,10 +126,7 @@ const StoreViewControlPanel = function({enabled, storeObj, handleDisable, handle }; StoreViewControlPanel.propTypes={ - enabled: PropTypes.bool, - storeObj: PropTypes.object, - handleDisable: PropTypes.func, - handleEnable: PropTypes.func + store: PropTypes.object }; export {StoreEditControlPanel, StoreViewControlPanel};