diff --git a/src/main/webui/src/app/components/content/GroupEdit.jsx b/src/main/webui/src/app/components/content/GroupEdit.jsx new file mode 100644 index 0000000..c8ad006 --- /dev/null +++ b/src/main/webui/src/app/components/content/GroupEdit.jsx @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2023 Red Hat, Inc. (https://github.com/Commonjava/indy-ui-service) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, {useState, useEffect} from 'react'; +import {useLocation, useNavigate, useParams} from 'react-router-dom'; +import {PropTypes} from 'prop-types'; +import {StoreEditControlPanel as EditControlPanel} from './StoreControlPanels.jsx'; +import {DisableTimeoutHint, DurationHint, PrefetchHint, Hint} from './Hints.jsx'; +import {PackageTypeSelect} from './CommonPageWidget.jsx'; +// import ViewJsonDebugger from './Debugger.jsx'; +import {Utils} from '../CompUtils.js'; +// import Filters from '../Filters.js'; +import {TimeUtils} from '../../TimeUtils.js'; +import {jsonRest} from '../../RestClient.js'; + + +export default function GroupEdit() { + const [state, setState] = useState({ + store: {}, + storeView: {} + }); + + return
This is not implemented yet!
; +} diff --git a/src/main/webui/src/app/components/content/GroupList.jsx b/src/main/webui/src/app/components/content/GroupList.jsx index 6bfbe34..85375ab 100644 --- a/src/main/webui/src/app/components/content/GroupList.jsx +++ b/src/main/webui/src/app/components/content/GroupList.jsx @@ -22,130 +22,11 @@ import ListControl from "./ListControl.jsx"; import {ListJsonDebugger} from './Debugger.jsx'; import {LocalURLSection, StoreNameSection} from './CommonPageWidget.jsx'; -const init = function (state, setState){ - useEffect(()=>{ - Utils.getStores(state, setState, "group"); - }, [state.listing]); -}; - - -const createNew = () => { - // mock -}; - -const hideAll = () => { - // mock -}; - -const handleSearch = (event, rawList, setState) => { - setState({ - listing: Utils.searchByKeyForNewStores(event.target.value, rawList) - }); -}; - -const handleDebug = (event, setState) => { - setState({ - enableDebug: event.target.checked - }); -}; - -const GroupListItem = ({store, storeClass, disableMap}) => { - const [hideCons, setHideCons] = useState(true); - let constituents = store.constituents ? Utils.reConstituents(store) : undefined; - return ( -
- -
-
- -
-
- {store.constituents && store.constituents.length} Constituent(s) [ - - { - hideCons ? - { - event.preventDefault(); - setHideCons(false); - }}>+ : - { - event.preventDefault(); - setHideCons(true); - }}>- - } - - ] -
- { - !hideCons && constituents && -
    - { - constituents.map(item => { - let itemStoreClass = Utils.isDisabled(item.key, disableMap)? "disabled-store":"enabled-store"; - return ( -
  1. - - {item.key} - - { - item.type==='remote' && -
    - (Remote URL: {Utils.storeHref(item.key)}) -
    - } -
  2. - ); - }) - } -
- } -
-
-
{store.description}
-
-
- ); -}; - -GroupListItem.propTypes={ - store: PropTypes.object.isRequired, - storeClass: PropTypes.string, - disableMap: PropTypes.object -}; - -export default function GroupList() { +export default function GruopList() { const [state, setState] = useState({ - listing: [], - rawListing: [], - disabledMap: {}, - enableDebug: false, + store: {}, + raw: {}, message: '' }); - init(state, setState); - let listing = state.listing; - let disMap = state.disabledMap; - - return ( -
- -
-
- { - listing.map(store => { - let storeClass = Utils.isDisabled(store.key, disMap)? "disabled-store":"enabled-store"; - return ( - - ); - }) - } -
-
- - -
- ); + return
This is not implemented yet!
; } diff --git a/src/main/webui/src/app/components/content/GroupView.jsx b/src/main/webui/src/app/components/content/GroupView.jsx index 6b468b1..1149ecd 100644 --- a/src/main/webui/src/app/components/content/GroupView.jsx +++ b/src/main/webui/src/app/components/content/GroupView.jsx @@ -24,187 +24,11 @@ import {Filters} from '../Filters.js'; import {TimeUtils} from '../../TimeUtils.js'; import {jsonGet} from '../../RestClient.js'; -const getDisTimeouts = (store, state, setState) => { - jsonGet({ - url: '/api/admin/schedule/store/all/disable-timeout', - done: response => { - let newStore = Utils.cloneObj(store); - let disabledMap = Utils.setDisableMap(response, state.listing); - let expiration = disabledMap[store.key]; - if(expiration){ - newStore.disableExpiration = expiration; - } - setState({ - store: newStore, - disabledMap - }); - }, - fail: () => { - Utils.logMessage("disable timeout getting failed"); - setState({ - store - }); - } - }); -}; - -const getStore = (state, setState) => { - const [packageType, name] = useParams(); - let getUrl = `/api/admin/stores/${packageType}/group/${name}`; - jsonGet({ - url: getUrl, - done: response => { - let raw = response; - let store = Utils.cloneObj(raw); - store.disabled = raw.disabled === undefined ? false : raw.disabled; - setState({ - raw - }); - getDisTimeouts(store, state, setState); - }, - fail: errorText => { - setState({ - message: JSON.parse(errorText).error - }); - } - }); -}; - -const init = function (state, setState){ - useEffect(()=>{ - getStore(state, setState); - }, [state.raw]); -}; - - -const handlers = { - handleDisable: () => { - // Mock - }, - - handleEnable: () => { - // Mock - }, - - handleEdit: () => { - // Mock - }, - - handleCreate: () => { - // Mock - }, - - handleRemove: () => { - // Mock - } -}; export default function GroupView() { const [state, setState] = useState({ - raw: {}, store: {}, disableMap: [], message: '' + store: {}, + raw: {}, + message: '' }); - - init(state, setState); - let store = state.store; - - if(!Utils.isEmptyObj(store)) { - return ( -
-
- -
- -
-
Basics
- - -
Description
-
-
-