Skip to content

Commit

Permalink
Merge pull request #77 from ligangty/2.0-refactor
Browse files Browse the repository at this point in the history
Re-organize all utils into /utils folder
  • Loading branch information
ligangty authored Nov 15, 2023
2 parents 5152b68 + 16f18d6 commit 5f3bb54
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 26 deletions.
5 changes: 1 addition & 4 deletions src/main/webui/src/app/components/ComponentConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ const hostedOptionLegend = [
{icon: 'D', title: 'Deployment allowed'}
];

// TODO: this should be fetched from backend
const PACKAGE_TYPES = ["maven", "generic","npm"];


export {remoteOptionLegend, hostedOptionLegend, PACKAGE_TYPES};
export {remoteOptionLegend, hostedOptionLegend};
12 changes: 5 additions & 7 deletions src/main/webui/src/app/components/content/RemoteEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import {PropTypes} from 'prop-types';
import {StoreEditControlPanel as EditControlPanel} from './common/StoreControlPanels.jsx';
import {DisableTimeoutHint, DurationHint, PrefetchHint, Hint} from './common/Hints.jsx';
// import ViewJsonDebugger from './Debugger.jsx';
import {Utils} from '../CompUtils.js';
// import Filters from '../Filters.js';
import {TimeUtils} from '../../TimeUtils.js';
import {PACKAGE_TYPES} from '../ComponentConstants.js';
import {jsonRest} from '../../RestClient.js';
import {Utils} from '../../utils/AppUtils.js';
import {TimeUtils} from '../../utils/TimeUtils.js';
import {jsonRest} from '../../utils/RestClient.js';

const init = (pkgType, storeName, setState) => {
const getUrl = `/api/admin/stores/${pkgType}/remote/${storeName}`;
Expand Down Expand Up @@ -121,8 +119,8 @@ export default function RemoteEdit() {
// Utils.logMessage(mode);
let storeView = state.storeView;
// let store = state.store;
// TODO this package types should be fetched from backend
let pkgTypes = PACKAGE_TYPES;
// TODO: this package types should be fetched from backend
let pkgTypes = ["maven", "generic-http", "npm"];

const handleCheckChange = (event, field) => {
if (event.target.checked) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/webui/src/app/components/content/RemoteList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import React, {useEffect, useState} from 'react';
import {ListJsonDebugger} from './common/Debugger.jsx';
import ListControl from "./common/ListControl.jsx";
import {remoteOptionLegend as options} from "../ComponentConstants.js";
import {Utils} from '../CompUtils.js';
import {StoreListingWidget} from './common/StoreListingWidget.jsx';
import {jsonRest} from '../../RestClient.js';
import {Utils} from '../../utils/AppUtils.js';
import {jsonRest} from '../../utils/RestClient.js';

const init = (state, setState) => {
useEffect(()=>{
Expand Down
8 changes: 4 additions & 4 deletions src/main/webui/src/app/components/content/RemoteView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {PropTypes} from 'prop-types';
import {StoreViewControlPanel as ControlPanel} from './common/StoreControlPanels.jsx';
import {DisableTimeoutHint, PrefetchHint, Hint, PasswordMask} from './common/Hints.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';
import {Filters} from '../../utils/Filters.js';
import {Utils} from '../../utils/AppUtils.js';
import {TimeUtils} from '../../utils/TimeUtils.js';
import {jsonRest} from '../../utils/RestClient.js';

const init = (pkgType, storeName, setState) => {
const storeUrl = `/api/admin/stores/${pkgType}/remote/${storeName}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import React, {Fragment} from 'react';
import {Link} from 'react-router-dom';
import {PropTypes} from 'prop-types';
import {Utils} from '../../CompUtils.js';
import {Utils} from '../../../utils/AppUtils.js';

const LocalURLSection = ({storeKey}) => <div className="left-half">
<label>Local URL:</label>{' '}
Expand All @@ -28,7 +28,7 @@ LocalURLSection.propTypes = {
storeKey: PropTypes.string
};

// For options, see CompUtils.remoteOptions|hostedOptions
// For options, see AppUtils.remoteOptions|hostedOptions
const CapabilitiesSection = ({options}) => <div className="left-half">
<label>Capabilities:</label>{' '}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React, {useState, useEffect} from 'react';
import {PropTypes} from 'prop-types';
import {jsonRest} from '../../../RestClient.js';
import {jsonRest} from '../../../utils/RestClient.js';

export const PackageTypeSelect = ({pkgType,vauleChangeHandler}) =>{
const [state, setState] = useState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../utils/AppUtils';
import {http} from '../../../utils/RestClient';

const StoreEditControlPanel = ({handleSave, handleCancel, handleRemove}) => <div className="cp-row">
<button name="save" onClick={handleSave} className="cp-button">Save</button>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React, {Fragment} from 'react';
import {PropTypes} from 'prop-types';
import {Utils} from '../../CompUtils.js';
import {Utils} from '../../../utils/AppUtils.js';
import {LocalURLSection,StoreNameSection,CapabilitiesSection} from './CommonPageWidget.jsx';

export const StoreListingWidget = ({StoreList, DisMap, StoreType}) => {
Expand Down
4 changes: 2 additions & 2 deletions src/main/webui/src/app/components/nav/NavFooter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import React, {useEffect, useState} from 'react';
import {jsonRest} from '../../RestClient';
import {Utils} from '../CompUtils';
import {jsonRest} from '../../utils/RestClient';
import {Utils} from '../../utils/AppUtils';

export default function NavFooter() {
const [state, setState] = useState({stats: {}});
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main/webui/src/content-browse/DirectoryListing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import React, {useState, useEffect} from 'react';
import {PropTypes} from 'prop-types';
import {styles} from './style.js';
import {jsonRest} from '../app/RestClient.js';
import {jsonRest} from '../app/utils/RestClient.js';

const replaceUrl = url =>{
if (url.includes("api/browse")){
Expand Down

0 comments on commit 5f3bb54

Please sign in to comment.