Skip to content

Commit

Permalink
Change StoreViewControlPanel
Browse files Browse the repository at this point in the history
  Remove useless properties
  • Loading branch information
ligangty committed Nov 15, 2023
1 parent 28c444b commit f3d99a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
13 changes: 1 addition & 12 deletions src/main/webui/src/app/components/content/RemoteView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,7 @@ export default function RemoteView() {
return (
<div className="container-fluid">
<div className="control-panel">
<ControlPanel
enabled={!store.disabled}
storeObj={store}
// storeType="remote"
// pkgType={packageType}
// storeName={name}
// handleEnable={handlers.handleEnable}
// handleDisable={handlers.handleDisable}
// handleEdit={()=>navigate(`/remote/${pkgType}/edit/${storeName}`)}
// handleCreate={handlers.handleCreate}
// handleRemove={handlers.handleRemove}
/>
<ControlPanel store={store} />
</div>

<div className="content-panel">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand All @@ -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};

0 comments on commit f3d99a3

Please sign in to comment.