Skip to content

Commit 30724f9

Browse files
Merge pull request #1318 from syucream/fix/arrange-directories
Aggregate similar files in the same directories
2 parents 5f04700 + e93aecd commit 30724f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+300
-118
lines changed

frontend/src/App.tsx

+3-23
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
import { ThemeProvider } from "@mui/material/styles";
2-
import React, { FC } from "react";
1+
import React from "react";
32
import { createRoot } from "react-dom/client";
43

5-
import { AironeSnackbarProvider } from "AironeSnackbarProvider";
6-
import { AppRouter } from "AppRouter";
7-
import { CheckTermsService } from "CheckTermsService";
8-
import { ErrorHandler } from "ErrorHandler";
9-
import { theme } from "Theme";
10-
import "i18n/config";
11-
12-
const App: FC = () => {
13-
return (
14-
<ThemeProvider theme={theme}>
15-
<AironeSnackbarProvider>
16-
<ErrorHandler>
17-
<CheckTermsService>
18-
<AppRouter />
19-
</CheckTermsService>
20-
</ErrorHandler>
21-
</AironeSnackbarProvider>
22-
</ThemeProvider>
23-
);
24-
};
4+
import { AppBase } from "AppBase";
255

266
const container = document.getElementById("app");
277
if (container == null) {
288
throw new Error("failed to initializer React app.");
299
}
3010
const root = createRoot(container);
31-
root.render(<App />);
11+
root.render(<AppBase />);

frontend/src/AppBase.tsx

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { ThemeProvider } from "@mui/material/styles";
2+
import React, { FC } from "react";
3+
4+
import { AironeSnackbarProvider } from "AironeSnackbarProvider";
5+
import { ErrorHandler } from "ErrorHandler";
6+
import { theme } from "Theme";
7+
import { CheckTerms } from "components/common/CheckTerms";
8+
import { AppRouter } from "routes/AppRouter";
9+
import "i18n/config";
10+
11+
interface Props {
12+
customRoutes?: {
13+
path: string;
14+
element: React.ReactNode;
15+
}[];
16+
}
17+
18+
export const AppBase: FC<Props> = ({ customRoutes }) => {
19+
return (
20+
<ThemeProvider theme={theme}>
21+
<AironeSnackbarProvider>
22+
<ErrorHandler>
23+
<CheckTerms>
24+
<AppRouter customRoutes={customRoutes} />
25+
</CheckTerms>
26+
</ErrorHandler>
27+
</AironeSnackbarProvider>
28+
</ThemeProvider>
29+
);
30+
};

frontend/src/AppRouter.tsx

+20-20
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ import { NotFoundErrorPage } from "./pages/NotFoundErrorPage";
1616
import { RoleEditPage } from "./pages/RoleEditPage";
1717
import { RoleListPage } from "./pages/RoleListPage";
1818

19+
import { Header } from "components/common/Header";
20+
import { ACLEditPage } from "pages/ACLEditPage";
21+
import { AdvancedSearchPage } from "pages/AdvancedSearchPage";
22+
import { AdvancedSearchResultsPage } from "pages/AdvancedSearchResultsPage";
23+
import { DashboardPage } from "pages/DashboardPage";
24+
import { EntityEditPage } from "pages/EntityEditPage";
25+
import { EntityHistoryPage } from "pages/EntityHistoryPage";
26+
import { EntityListPage } from "pages/EntityListPage";
27+
import { EntryEditPage } from "pages/EntryEditPage";
28+
import { EntryHistoryListPage } from "pages/EntryHistoryListPage";
29+
import { EntryListPage } from "pages/EntryListPage";
30+
import { GroupEditPage } from "pages/GroupEditPage";
31+
import { GroupListPage } from "pages/GroupListPage";
32+
import { JobListPage } from "pages/JobListPage";
33+
import { LoginPage } from "pages/LoginPage";
34+
import { TriggerEditPage } from "pages/TriggerEditPage";
35+
import { TriggerListPage } from "pages/TriggerListPage";
36+
import { UserEditPage } from "pages/UserEditPage";
37+
import { UserListPage } from "pages/UserListPage";
1938
import {
2039
aclHistoryPath,
2140
aclPath,
@@ -47,26 +66,7 @@ import {
4766
triggersPath,
4867
userPath,
4968
usersPath,
50-
} from "Routes";
51-
import { Header } from "components/Header";
52-
import { ACLEditPage } from "pages/ACLEditPage";
53-
import { AdvancedSearchPage } from "pages/AdvancedSearchPage";
54-
import { AdvancedSearchResultsPage } from "pages/AdvancedSearchResultsPage";
55-
import { DashboardPage } from "pages/DashboardPage";
56-
import { EntityEditPage } from "pages/EntityEditPage";
57-
import { EntityHistoryPage } from "pages/EntityHistoryPage";
58-
import { EntityListPage } from "pages/EntityListPage";
59-
import { EntryEditPage } from "pages/EntryEditPage";
60-
import { EntryHistoryListPage } from "pages/EntryHistoryListPage";
61-
import { EntryListPage } from "pages/EntryListPage";
62-
import { GroupEditPage } from "pages/GroupEditPage";
63-
import { GroupListPage } from "pages/GroupListPage";
64-
import { JobListPage } from "pages/JobListPage";
65-
import { LoginPage } from "pages/LoginPage";
66-
import { TriggerEditPage } from "pages/TriggerEditPage";
67-
import { TriggerListPage } from "pages/TriggerListPage";
68-
import { UserEditPage } from "pages/UserEditPage";
69-
import { UserListPage } from "pages/UserListPage";
69+
} from "routes/Routes";
7070

7171
// re-throw error to be caught by the root error boundary
7272
const ErrorBridge: FC = () => {

frontend/src/ErrorHandler.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
NonTermsServiceAgreement,
2323
} from "./services/Exceptions";
2424

25-
import { topPath } from "Routes";
25+
import { topPath } from "routes/Routes";
2626

2727
const ErrorDescription = styled(Box)(({ theme }) => ({
2828
marginTop: theme.spacing(2),

frontend/src/CheckTermsService.tsx frontend/src/components/common/CheckTerms.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import React, { FC } from "react";
22

3-
import { NonTermsServiceAgreement } from "./services/Exceptions";
4-
3+
import { NonTermsServiceAgreement } from "services/Exceptions";
54
import { ServerContext } from "services/ServerContext";
65

76
function getCookieValue(key: string) {
87
return ((document.cookie + ";").match(key + "=([^¥S;]*)") || [])[1];
98
}
109

11-
export const CheckTermsService: FC<{ children: React.ReactNode }> = ({
12-
children,
13-
}) => {
10+
export const CheckTerms: FC<{ children: React.ReactNode }> = ({ children }) => {
1411
const serverContext = ServerContext.getInstance();
1512

1613
if (

frontend/src/components/Header.tsx frontend/src/components/common/Header.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import React, { FC, MouseEvent, useMemo, useState } from "react";
2323
import { Link } from "react-router-dom";
2424
import { useInterval } from "react-use";
2525

26-
import { useTranslation } from "../hooks/useTranslation";
26+
import { useTranslation } from "../../hooks/useTranslation";
2727

28+
import { SearchBox } from "components/common/SearchBox";
29+
import { useSimpleSearch } from "hooks/useSimpleSearch";
30+
import { aironeApiClient } from "repository/AironeApiClient";
2831
import {
2932
advancedSearchPath,
3033
entitiesPath,
@@ -36,10 +39,7 @@ import {
3639
triggersPath,
3740
userPath,
3841
usersPath,
39-
} from "Routes";
40-
import { SearchBox } from "components/common/SearchBox";
41-
import { useSimpleSearch } from "hooks/useSimpleSearch";
42-
import { aironeApiClient } from "repository/AironeApiClient";
42+
} from "routes/Routes";
4343
import {
4444
JobOperations,
4545
JobRefreshIntervalMilliSec,

frontend/src/components/common/PageHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { styled } from "@mui/material/styles";
44
import React, { FC } from "react";
55
import { Link } from "react-router-dom";
66

7-
import { jobsPath } from "Routes";
7+
import { jobsPath } from "routes/Routes";
88

99
const Frame = styled(Box)({
1010
width: "100%",

frontend/src/components/entity/EntityBreadcrumbs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { Typography } from "@mui/material";
44
import React, { FC } from "react";
55
import { Link } from "react-router-dom";
66

7-
import { topPath, entitiesPath, entityEntriesPath } from "Routes";
87
import { AironeBreadcrumbs } from "components/common/AironeBreadcrumbs";
98
import { FlexBox } from "components/common/FlexBox";
9+
import { topPath, entitiesPath, entityEntriesPath } from "routes/Routes";
1010

1111
interface Props {
1212
entity?: EntityDetail;

frontend/src/components/entity/EntityControlMenu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { Link, useNavigate } from "react-router-dom";
1212

1313
import { RateLimitedClickable } from "../common/RateLimitedClickable";
1414

15+
import { Confirmable } from "components/common/Confirmable";
16+
import { aironeApiClient } from "repository/AironeApiClient";
1517
import {
1618
aclPath,
1719
entityHistoryPath,
@@ -21,9 +23,7 @@ import {
2123
topPath,
2224
entityEntriesPath,
2325
aclHistoryPath,
24-
} from "Routes";
25-
import { Confirmable } from "components/common/Confirmable";
26-
import { aironeApiClient } from "repository/AironeApiClient";
26+
} from "routes/Routes";
2727

2828
type ExportFormatType = "YAML" | "CSV";
2929

frontend/src/components/entity/EntityList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { Link } from "react-router-dom";
66

77
import { EntityListCard } from "./EntityListCard";
88

9-
import { newEntityPath } from "Routes";
109
import { PaginationFooter } from "components/common/PaginationFooter";
1110
import { SearchBox } from "components/common/SearchBox";
11+
import { newEntityPath } from "routes/Routes";
1212
import { EntityList as ConstEntityList } from "services/Constants";
1313
import { normalizeToMatch } from "services/StringUtil";
1414

frontend/src/components/entity/EntityListCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import { Link } from "react-router-dom";
1515

1616
import { EntityControlMenu } from "./EntityControlMenu";
1717

18-
import { entityEntriesPath } from "Routes";
1918
import { ClipboardCopyButton } from "components/common/ClipboardCopyButton";
2019
import { EntryImportModal } from "components/entry/EntryImportModal";
20+
import { entityEntriesPath } from "routes/Routes";
2121

2222
const EntityNote = styled(Typography)(({ theme }) => ({
2323
color: theme.palette.text.secondary,

frontend/src/components/entity/entityForm/AttributeField.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Link } from "react-router-dom";
2525
import { AttributeNoteModal } from "./AttributeNoteModal";
2626
import { Schema } from "./EntityFormSchema";
2727

28-
import { aclPath } from "Routes";
28+
import { aclPath } from "routes/Routes";
2929
import { AttributeTypes } from "services/Constants";
3030

3131
const StyledBox = styled(Box)(({ theme }) => ({

frontend/src/components/entry/AttributeValue.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as React from "react";
1212
import { FC } from "react";
1313
import { Link } from "react-router-dom";
1414

15-
import { groupsPath, rolePath, entryDetailsPath } from "Routes";
15+
import { groupsPath, rolePath, entryDetailsPath } from "routes/Routes";
1616

1717
const StyledBox = styled(Box)(() => ({
1818
display: "flex",

frontend/src/components/entry/EntryBreadcrumbs.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { Typography } from "@mui/material";
44
import React, { FC } from "react";
55
import { Link } from "react-router-dom";
66

7+
import { AironeBreadcrumbs } from "components/common/AironeBreadcrumbs";
8+
import { FlexBox } from "components/common/FlexBox";
79
import {
810
topPath,
911
entitiesPath,
1012
entityEntriesPath,
1113
entryDetailsPath,
12-
} from "Routes";
13-
import { AironeBreadcrumbs } from "components/common/AironeBreadcrumbs";
14-
import { FlexBox } from "components/common/FlexBox";
14+
} from "routes/Routes";
1515

1616
interface Props {
1717
entry?: EntryRetrieve;

frontend/src/components/entry/EntryControlMenu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { useSnackbar } from "notistack";
1111
import React, { FC } from "react";
1212
import { Link, useNavigate } from "react-router-dom";
1313

14+
import { Confirmable } from "components/common/Confirmable";
15+
import { aironeApiClient } from "repository/AironeApiClient";
1416
import {
1517
entryEditPath,
1618
aclPath,
@@ -20,9 +22,7 @@ import {
2022
topPath,
2123
entryDetailsPath,
2224
aclHistoryPath,
23-
} from "Routes";
24-
import { Confirmable } from "components/common/Confirmable";
25-
import { aironeApiClient } from "repository/AironeApiClient";
25+
} from "routes/Routes";
2626

2727
interface EntryControlProps {
2828
entityId: number;

frontend/src/components/entry/EntryHistoryList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import { useNavigate } from "react-router-dom";
1616

1717
import { AttributeValue } from "./AttributeValue";
1818

19-
import { showEntryHistoryPath, topPath } from "Routes";
2019
import { Confirmable } from "components/common/Confirmable";
2120
import { PaginationFooter } from "components/common/PaginationFooter";
2221
import { aironeApiClient } from "repository/AironeApiClient";
22+
import { showEntryHistoryPath, topPath } from "routes/Routes";
2323
import { EntryHistoryList as ConstEntryHistoryList } from "services/Constants";
2424
import { formatDateTime } from "services/DateUtil";
2525

frontend/src/components/entry/EntryList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { Link, useNavigate, useLocation } from "react-router-dom";
55

66
import { EntryListCard } from "./EntryListCard";
77

8-
import { newEntryPath } from "Routes";
98
import { Loading } from "components/common/Loading";
109
import { PaginationFooter } from "components/common/PaginationFooter";
1110
import { SearchBox } from "components/common/SearchBox";
1211
import { useAsyncWithThrow } from "hooks/useAsyncWithThrow";
1312
import { usePage } from "hooks/usePage";
1413
import { aironeApiClient } from "repository/AironeApiClient";
14+
import { newEntryPath } from "routes/Routes";
1515
import { EntryList as ConstEntryList } from "services/Constants";
1616
import { normalizeToMatch } from "services/StringUtil";
1717

frontend/src/components/entry/EntryListCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { styled } from "@mui/material/styles";
1212
import React, { FC, useState } from "react";
1313
import { Link } from "react-router-dom";
1414

15-
import { entryDetailsPath } from "Routes";
1615
import { ClipboardCopyButton } from "components/common/ClipboardCopyButton";
1716
import { EntryControlMenu } from "components/entry/EntryControlMenu";
17+
import { entryDetailsPath } from "routes/Routes";
1818

1919
const StyledCard = styled(Card)(({}) => ({
2020
height: "100%",

frontend/src/components/entry/EntryReferral.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { aironeApiClient } from "../../repository/AironeApiClient";
1818
import { EntryReferralList } from "../../services/Constants";
1919
import { normalizeToMatch } from "../../services/StringUtil";
2020

21-
import { entryDetailsPath } from "Routes";
2221
import { SearchBox } from "components/common/SearchBox";
22+
import { entryDetailsPath } from "routes/Routes";
2323

2424
const ReferralCount = styled(Typography)(({}) => ({
2525
fontSize: "16px",

frontend/src/components/entry/RestorableEntryList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ import { useNavigate, useLocation } from "react-router-dom";
2424

2525
import { EntryAttributes } from "./EntryAttributes";
2626

27-
import { restoreEntryPath, topPath } from "Routes";
2827
import { Confirmable } from "components/common/Confirmable";
2928
import { Loading } from "components/common/Loading";
3029
import { PaginationFooter } from "components/common/PaginationFooter";
3130
import { SearchBox } from "components/common/SearchBox";
3231
import { useAsyncWithThrow } from "hooks/useAsyncWithThrow";
3332
import { usePage } from "hooks/usePage";
3433
import { aironeApiClient } from "repository/AironeApiClient";
34+
import { restoreEntryPath, topPath } from "routes/Routes";
3535
import { EntryList as ConstEntryList } from "services/Constants";
3636
import { formatDateTime } from "services/DateUtil";
3737
import { normalizeToMatch } from "services/StringUtil";

frontend/src/components/entry/SearchResults.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { Link } from "react-router-dom";
2121

2222
import { SearchResultsTableHead } from "./SearchResultsTableHead";
2323

24-
import { entryDetailsPath } from "Routes";
2524
import { PaginationFooter } from "components/common/PaginationFooter";
2625
import { AttributeValue } from "components/entry/AttributeValue";
26+
import { entryDetailsPath } from "routes/Routes";
2727
import { AdvancedSerarchResultList } from "services/Constants";
2828
import { AttrsFilter } from "services/entry/AdvancedSearch";
2929

frontend/src/components/group/GroupControlMenu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { useSnackbar } from "notistack";
1111
import React, { FC, useCallback } from "react";
1212
import { Link, useNavigate } from "react-router-dom";
1313

14-
import { groupPath, groupsPath, topPath } from "Routes";
1514
import { Confirmable } from "components/common/Confirmable";
1615
import { aironeApiClient } from "repository/AironeApiClient";
16+
import { groupPath, groupsPath, topPath } from "routes/Routes";
1717

1818
interface Props {
1919
groupId: number;

frontend/src/components/group/GroupTreeItem.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { Checkbox, IconButton, ListItem, Typography } from "@mui/material";
33
import React, { FC } from "react";
44
import { Link } from "react-router-dom";
55

6-
import { groupPath } from "../../Routes";
76
import { GroupTree } from "../../repository/AironeApiClient";
7+
import { groupPath } from "../../routes/Routes";
88
import { ServerContext } from "../../services/ServerContext";
99

1010
const CHILDREN_INDENT_WIDTH = 16;

frontend/src/components/group/GroupTreeRoot.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { styled } from "@mui/material/styles";
1010
import React, { FC } from "react";
1111
import { Link } from "react-router-dom";
1212

13-
import { groupPath } from "../../Routes";
1413
import { GroupTree } from "../../repository/AironeApiClient";
14+
import { groupPath } from "../../routes/Routes";
1515
import { ServerContext } from "../../services/ServerContext";
1616

1717
import { GroupTreeItem } from "./GroupTreeItem";

0 commit comments

Comments
 (0)