diff --git a/src/main/webui/src/app/components/content/RemoteEdit.jsx b/src/main/webui/src/app/components/content/RemoteEdit.jsx index e959ef2..a915ac3 100644 --- a/src/main/webui/src/app/components/content/RemoteEdit.jsx +++ b/src/main/webui/src/app/components/content/RemoteEdit.jsx @@ -15,10 +15,11 @@ */ import React, {useState, useEffect} from 'react'; -import {useLocation, useNavigate, useParams} from 'react-router-dom'; +import {useLocation, useParams} from 'react-router-dom'; import {PropTypes} from 'prop-types'; import {StoreEditControlPanel as EditControlPanel} from './common/StoreControlPanels.jsx'; import {DisableTimeoutHint, DurationHint, PrefetchHint, Hint} from './common/Hints.jsx'; +import {PackageTypeSelect} from './common/PackageTypeSelect.jsx'; // import ViewJsonDebugger from './Debugger.jsx'; import {Utils} from '../../utils/AppUtils.js'; import {TimeUtils} from '../../utils/TimeUtils.js'; @@ -29,11 +30,10 @@ const init = (pkgType, storeName, setState) => { useEffect(()=>{ const fetchStore = async () =>{ // get Store data - let isError = false; const response = await jsonRest.get(getUrl); if (response.ok){ - let raw = await response.json(); - let storeView = Utils.cloneObj(raw); + const raw = await response.json(); + const storeView = Utils.cloneObj(raw); storeView.disabled = raw.disabled === undefined ? false : raw.disabled; storeView.useX509 = raw.server_certificate_pem || raw.key_certificate_pem; storeView.useProxy = raw.proxy_host && true; @@ -43,7 +43,7 @@ const init = (pkgType, storeName, setState) => { // get Store disablement data const timeoutUrl = `/api/admin/schedule/store/${storeView.packageType}/${storeView.type}/${storeView.name}/disable-timeout`; const timeoutResponse = await jsonRest.get(timeoutUrl); - let cloned = Utils.cloneObj(storeView); + const cloned = Utils.cloneObj(storeView); if (timeoutResponse.ok){ const timeout = await timeoutResponse.json(); cloned.disableExpiration = timeout.expiration; @@ -57,6 +57,7 @@ const init = (pkgType, storeName, setState) => { store: raw }); }else{ + // TODO: find another way to do error handling response.text().then(error=>setState({ message: error })); @@ -67,35 +68,42 @@ const init = (pkgType, storeName, setState) => { }, []); }; -const saveStore = store => { - const getUrl = `/api/admin/stores/${store.packageType}/remote/${store.name}`; - const postStore = async () =>{ - // get Store data - let isError = false; - const response = await jsonRest.post(getUrl, store); - if (!response.ok){ - response.text().then(error=>Utils.logMessage(error)); - } - const navigate = useNavigate(); - if(!isError && (response.status >= 200 || response.status < 300)){ - navigate(`/remote/${store.packageType}/view/${store.name}`); - } - }; - postStore(); -}; - -const handlers = { - handleSave: () => { - // TODO need to implement save logic - }, - - handleCancel: () => { - // TODO need to implement cancel logic - }, +const CertificateSection = ({store, handleValueChange}) =>