Skip to content

Commit

Permalink
Use nodejs path alias to shrink the utils path for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ligangty committed Nov 16, 2023
1 parent 067dfd8 commit 208c7d1
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 18 deletions.
3 changes: 3 additions & 0 deletions src/main/webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"description": "Indy Repository Manager UI",
"repository": "https://github.com/Commonjava/indy-ui-service",
"license": "ASLv2",
"imports": {
"#utils/*": "./src/app/utils/*"
},
"dependencies": {
"bootstrap": "^5.3.2",
"prop-types": "^15.8.1",
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 '../../../utils/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,9 +17,9 @@
import React from 'react';
import {PropTypes} from 'prop-types';
import {DisableTimeoutHint, PrefetchHint, Hint} from './Hints.jsx';
import {Filters} from '../../../utils/Filters.js';
import {Utils} from '../../../utils/AppUtils.js';
import {TimeUtils} from '../../../utils/TimeUtils.js';
import {Filters} from '#utils/Filters.js';
import {Utils} from '#utils/AppUtils.js';
import {TimeUtils} from '#utils/TimeUtils.js';

export const StoreViewBasicSection = ({store})=>{
let authoritativeIndexHints = "Make the content index authoritative to this repository";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React from "react";
import {render, screen, cleanup} from '@testing-library/react';
import '@testing-library/jest-dom';
import {StoreViewBasicSection} from "./StoreBasicSections.jsx";
import {Utils} from "../../../utils/AppUtils.js";
import {Utils} from "#utils/AppUtils.js";

afterEach(() => {
cleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React from 'react';
import {PropTypes} from 'prop-types';
import {Filters} from '../../../utils/Filters.js';
import {Filters} from '#utils/Filters.js';

export const StoreViewCapabilitiesSection = ({store}) => (store.type==="remote"|| store.type==="hosted") &&
<React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React from "react";
import {render, screen, cleanup, within} from '@testing-library/react';
import '@testing-library/jest-dom';
import {StoreViewCapabilitiesSection} from "./StoreCapabilitiesSections.jsx";
import {Filters} from "../../../utils/Filters.js";
import {Filters} from "#utils/Filters.js";

afterEach(() => {
cleanup();
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 '../../../utils/AppUtils';
import {jsonRest,http} from '../../../utils/RestClient';
import {Utils} from '#utils/AppUtils';
import {jsonRest,http} from '#utils/RestClient';

const StoreViewControlPanel = function({store}){
const handleEnable = () =>{
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 '../../../utils/AppUtils.js';
import {Utils} from '#utils/AppUtils.js';

const LocalURLSection = ({storeKey}) => <div className="left-half">
<label>Local URL:</label>{' '}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {MemoryRouter} from 'react-router-dom';
import {render, screen, cleanup} from '@testing-library/react';
import '@testing-library/jest-dom';
import {StoreListingWidget} from "./StoreListingWidget.jsx";
import {Utils} from "../../../utils/AppUtils.js";
import {Utils} from "#utils/AppUtils.js";

afterEach(() => {
cleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {ListJsonDebugger} from '../common/Debugger.jsx';
import ListControl from "../common/ListControl.jsx";
import {remoteOptionLegend as options} from "../../ComponentConstants.js";
import {StoreListingWidget} from '../common/StoreListingWidget.jsx';
import {Utils} from '../../../utils/AppUtils.js';
import {jsonRest} from '../../../utils/RestClient.js';
import {Utils} from '#utils/AppUtils.js';
import {jsonRest} from '#utils/RestClient.js';

const init = (state, setState) => {
useEffect(()=>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {Hint, PasswordMask} from '../common/Hints.jsx';
import {StoreViewBasicSection as BasicSection} from '../common/StoreBasicSections.jsx';
import {StoreViewCapabilitiesSection} from '../common/StoreCapabilitiesSections.jsx';
// import ViewJsonDebugger from './Debugger.jsx';
import {Filters} from '../../../utils/Filters.js';
import {Utils} from '../../../utils/AppUtils.js';
import {TimeUtils} from '../../../utils/TimeUtils.js';
import {jsonRest} from '../../../utils/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
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/utils/RestClient.js';
import {jsonRest} from '#utils/RestClient.js';

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

0 comments on commit 208c7d1

Please sign in to comment.