@@ -98,5 +98,7 @@ StoreListingWidget.propTypes = {
StoreType: PropTypes.string
};
-
-export {LocalURLSection, CapabilitiesSection, StoreNameSection, StoreListingWidget};
+export {LocalURLSection,
+ CapabilitiesSection,
+ StoreNameSection,
+ StoreListingWidget};
diff --git a/src/main/webui/src/app/components/content/CommonPageWidget.test.js b/src/main/webui/src/app/components/content/common/CommonPageWidget.test.js
similarity index 72%
rename from src/main/webui/src/app/components/content/CommonPageWidget.test.js
rename to src/main/webui/src/app/components/content/common/CommonPageWidget.test.js
index 0b33d2b..dc508da 100644
--- a/src/main/webui/src/app/components/content/CommonPageWidget.test.js
+++ b/src/main/webui/src/app/components/content/common/CommonPageWidget.test.js
@@ -15,13 +15,11 @@
*/
import React from "react";
+import {MemoryRouter} from 'react-router-dom';
import {render, screen, cleanup} from '@testing-library/react';
import '@testing-library/jest-dom';
-import {LocalURLSection,
- CapabilitiesSection} from "./CommonPageWidget.jsx";
-import {hostedOptionLegend} from '../ComponentConstants.js';
-
-// const mockData = {};
+import {LocalURLSection, CapabilitiesSection, StoreNameSection} from "./CommonPageWidget.jsx";
+import {hostedOptionLegend} from '../../ComponentConstants.js';
afterEach(() => {
cleanup();
@@ -43,4 +41,14 @@ describe('CommonPageWidget tests', () => {
expect(screen.getByText(/\s*R\s*/u)).toBeInTheDocument();
expect(screen.getByText(/\s*D\s*/u)).toBeInTheDocument();
});
+
+ it("StoreNameSection", ()=>{
+ // As is in , needs to use a Router to wrap it
+ render(
+
+ );
+ expect(screen.getByText(/maven-central/u)).toBeInTheDocument();
+ });
});
diff --git a/src/main/webui/src/app/components/content/Debugger.jsx b/src/main/webui/src/app/components/content/common/Debugger.jsx
similarity index 100%
rename from src/main/webui/src/app/components/content/Debugger.jsx
rename to src/main/webui/src/app/components/content/common/Debugger.jsx
diff --git a/src/main/webui/src/app/components/content/Hints.jsx b/src/main/webui/src/app/components/content/common/Hints.jsx
similarity index 100%
rename from src/main/webui/src/app/components/content/Hints.jsx
rename to src/main/webui/src/app/components/content/common/Hints.jsx
diff --git a/src/main/webui/src/app/components/content/ListControl.jsx b/src/main/webui/src/app/components/content/common/ListControl.jsx
similarity index 100%
rename from src/main/webui/src/app/components/content/ListControl.jsx
rename to src/main/webui/src/app/components/content/common/ListControl.jsx
diff --git a/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx b/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx
new file mode 100644
index 0000000..903eb91
--- /dev/null
+++ b/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx
@@ -0,0 +1,57 @@
+/**
+ * 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 {PropTypes} from 'prop-types';
+import {jsonRest} from '../../RestClient.js';
+
+const PackageTypeSelect = ({pkgType,vauleChangeHandler}) =>{
+ const [state, setState] = useState({
+ pkgTypes: []
+ });
+
+ (function() {
+ const typeUrl = '/api/stats/package-type/keys';
+ useEffect(()=>{
+ const fetchPkgTypes = async () =>{
+ const response = await jsonRest.get(typeUrl);
+ if (response.ok){
+ const pkgTypes = await response.json();
+ setState({pkgTypes});
+ }
+ };
+ fetchPkgTypes();
+ }, []);
+ }());
+
+ return
+
+ ;
+};
+
+PackageTypeSelect.propTypes = {
+ pkgType: PropTypes.strings,
+ vauleChangeHandler: PropTypes.func
+};
diff --git a/src/main/webui/src/app/components/content/StoreControlPanels.jsx b/src/main/webui/src/app/components/content/common/StoreControlPanels.jsx
similarity index 94%
rename from src/main/webui/src/app/components/content/StoreControlPanels.jsx
rename to src/main/webui/src/app/components/content/common/StoreControlPanels.jsx
index 9ad221a..74acd0d 100644
--- a/src/main/webui/src/app/components/content/StoreControlPanels.jsx
+++ b/src/main/webui/src/app/components/content/common/StoreControlPanels.jsx
@@ -17,8 +17,8 @@
import React from 'react';
import {useNavigate} from 'react-router-dom';
import {PropTypes} from 'prop-types';
-import {Utils} from '../CompUtils';
-import {http} from '../../RestClient';
+import {Utils} from '../../CompUtils';
+import {http} from '../../../RestClient';
const StoreEditControlPanel = ({handleSave, handleCancel, handleRemove}) =>
{' '}
@@ -71,9 +71,6 @@ const StoreViewControlPanel = function({enabled, storeObj, handleDisable, handle
StoreViewControlPanel.propTypes={
enabled: PropTypes.bool,
storeObj: PropTypes.object,
- // storeType: PropTypes.string,
- // pkgType: PropTypes.string,
- // storeName: PropTypes.string,
handleDisable: PropTypes.func,
handleEnable: PropTypes.func
};
diff --git a/src/main/webui/src/app/components/content/common/StoreListingWidget.jsx b/src/main/webui/src/app/components/content/common/StoreListingWidget.jsx
new file mode 100644
index 0000000..668a728
--- /dev/null
+++ b/src/main/webui/src/app/components/content/common/StoreListingWidget.jsx
@@ -0,0 +1,65 @@
+/**
+ * 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, {Fragment} from 'react';
+import {PropTypes} from 'prop-types';
+import {Utils} from '../../CompUtils.js';
+import {LocalURLSection,StoreNameSection,CapabilitiesSection} from './CommonPageWidget.jsx';
+
+export const StoreListingWidget = ({StoreList, DisMap, StoreType}) => {
+ const listing = StoreList;
+ const disMap = DisMap;
+ if(listing && listing.length >0){
+ return (
+