Skip to content

Commit

Permalink
Added export library for custom_view
Browse files Browse the repository at this point in the history
  • Loading branch information
hinashi committed Dec 11, 2024
1 parent 11e7566 commit d6a21b1
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 46 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/entity/EntityHistoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import React, { FC } from "react";

import { PaginationFooter } from "components/common/PaginationFooter";
import { EntityHistoryList as ConstEntityHistoryList } from "services/Constants";
import { EntityHistoryListParam } from "services/Constants";
import { formatDateTime } from "services/DateUtil";

const Operations = {
Expand Down Expand Up @@ -130,7 +130,7 @@ export const EntityHistoryList: FC<Props> = ({

<PaginationFooter
count={histories.count ?? 0}
maxRowCount={ConstEntityHistoryList.MAX_ROW_COUNT}
maxRowCount={EntityHistoryListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/entity/EntityList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EntityListCard } from "./EntityListCard";
import { PaginationFooter } from "components/common/PaginationFooter";
import { SearchBox } from "components/common/SearchBox";
import { newEntityPath } from "routes/Routes";
import { EntityList as ConstEntityList } from "services/Constants";
import { EntityListParam } from "services/Constants";
import { normalizeToMatch } from "services/StringUtil";

interface Props {
Expand Down Expand Up @@ -69,7 +69,7 @@ export const EntityList: FC<Props> = ({
</Grid>
<PaginationFooter
count={entities.count ?? 0}
maxRowCount={ConstEntityList.MAX_ROW_COUNT}
maxRowCount={EntityListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/entry/EntryHistoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Confirmable } from "components/common/Confirmable";
import { PaginationFooter } from "components/common/PaginationFooter";
import { aironeApiClient } from "repository/AironeApiClient";
import { showEntryHistoryPath, topPath } from "routes/Routes";
import { EntryHistoryList as ConstEntryHistoryList } from "services/Constants";
import { EntryHistoryListParam } from "services/Constants";
import { formatDateTime } from "services/DateUtil";

const HeaderTableRow = styled(TableRow)(({}) => ({
Expand Down Expand Up @@ -133,7 +133,7 @@ export const EntryHistoryList: FC<Props> = ({

<PaginationFooter
count={histories.count ?? 0}
maxRowCount={ConstEntryHistoryList.MAX_ROW_COUNT}
maxRowCount={EntryHistoryListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/entry/EntryList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AddIcon from "@mui/icons-material/Add";
import { Box, Button, Grid } from "@mui/material";
import React, { FC, useState } from "react";
import { Link, useNavigate, useLocation } from "react-router-dom";
import { Link, useLocation, useNavigate } from "react-router-dom";

import { EntryListCard } from "./EntryListCard";

Expand All @@ -12,7 +12,7 @@ import { useAsyncWithThrow } from "hooks/useAsyncWithThrow";
import { usePage } from "hooks/usePage";
import { aironeApiClient } from "repository/AironeApiClient";
import { newEntryPath } from "routes/Routes";
import { EntryList as ConstEntryList } from "services/Constants";
import { EntryListParam } from "services/Constants";
import { normalizeToMatch } from "services/StringUtil";

interface Props {
Expand Down Expand Up @@ -96,7 +96,7 @@ export const EntryList: FC<Props> = ({ entityId, canCreateEntry = true }) => {
)}
<PaginationFooter
count={entries.value?.count ?? 0}
maxRowCount={ConstEntryList.MAX_ROW_COUNT}
maxRowCount={EntryListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/entry/RestorableEntryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { styled } from "@mui/material/styles";
import { useSnackbar } from "notistack";
import React, { FC, useState } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import { useLocation, useNavigate } from "react-router-dom";

import { EntryAttributes } from "./EntryAttributes";

Expand All @@ -32,7 +32,7 @@ import { useAsyncWithThrow } from "hooks/useAsyncWithThrow";
import { usePage } from "hooks/usePage";
import { aironeApiClient } from "repository/AironeApiClient";
import { restoreEntryPath, topPath } from "routes/Routes";
import { EntryList as ConstEntryList } from "services/Constants";
import { EntryListParam } from "services/Constants";
import { formatDateTime } from "services/DateUtil";
import { normalizeToMatch } from "services/StringUtil";

Expand Down Expand Up @@ -215,7 +215,7 @@ export const RestorableEntryList: FC<Props> = ({ entityId }) => {
)}
<PaginationFooter
count={entries.value?.count ?? 0}
maxRowCount={ConstEntryList.MAX_ROW_COUNT}
maxRowCount={EntryListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/entry/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { SearchResultsTableHead } from "./SearchResultsTableHead";
import { PaginationFooter } from "components/common/PaginationFooter";
import { AttributeValue } from "components/entry/AttributeValue";
import { entryDetailsPath } from "routes/Routes";
import { AdvancedSerarchResultList } from "services/Constants";
import { AdvancedSerarchResultListParam } from "services/Constants";
import { AttrsFilter } from "services/entry/AdvancedSearch";

const StyledBox = styled(Box)({
Expand Down Expand Up @@ -186,7 +186,7 @@ export const SearchResults: FC<Props> = ({
{!disablePaginationFooter && (
<PaginationFooter
count={results.count}
maxRowCount={AdvancedSerarchResultList.MAX_ROW_COUNT}
maxRowCount={AdvancedSerarchResultListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/entry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export * from "./EntryAttributes";
export * from "./EntryBreadcrumbs";
export * from "./EntryControlMenu";
export * from "./EntryImportModal";
export * from "./EntryList";
export * from "./EntryListCard";
export * from "./EntryReferral";
export * from "./SearchResults";

export * from "./entryForm/EntryFormSchema";
export * from "./entryForm/AttributeValueField";
export * from "./entryForm/EntryFormSchema";
1 change: 1 addition & 0 deletions frontend/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./acl";
export * from "./common";
export * from "./entity";
export * from "./entry";
export * from "./job";
1 change: 1 addition & 0 deletions frontend/src/components/job/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./JobList";
6 changes: 3 additions & 3 deletions frontend/src/components/user/UserList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "@mui/material";
import { styled } from "@mui/material/styles";
import React, { FC, useMemo, useState } from "react";
import { Link, useNavigate, useLocation } from "react-router-dom";
import { Link, useLocation, useNavigate } from "react-router-dom";

import { UserControlMenu } from "./UserControlMenu";

Expand All @@ -25,7 +25,7 @@ import { useAsyncWithThrow } from "hooks/useAsyncWithThrow";
import { usePage } from "hooks/usePage";
import { aironeApiClient } from "repository/AironeApiClient";
import { newUserPath, userPath } from "routes/Routes";
import { UserList as ConstUserList } from "services/Constants";
import { UserListParam } from "services/Constants";
import { ServerContext } from "services/ServerContext";
import { normalizeToMatch } from "services/StringUtil";

Expand Down Expand Up @@ -160,7 +160,7 @@ export const UserList: FC = ({}) => {

<PaginationFooter
count={users.value?.count ?? 0}
maxRowCount={ConstUserList.MAX_ROW_COUNT}
maxRowCount={UserListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/AdvancedSearchResultsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { SearchResults } from "components/entry/SearchResults";
import { usePage } from "hooks/usePage";
import { aironeApiClient } from "repository/AironeApiClient";
import { advancedSearchPath, topPath } from "routes/Routes";
import { AdvancedSerarchResultList } from "services/Constants";
import { AdvancedSerarchResultListParam } from "services/Constants";
import { extractAdvancedSearchParams } from "services/entry/AdvancedSearch";

export const getIsFiltered = (filterKey?: number, keyword?: string) => {
Expand Down Expand Up @@ -106,7 +106,7 @@ export const AdvancedSearchResultsPage: FC = () => {
referralName,
searchAllEntities,
page,
AdvancedSerarchResultList.MAX_ROW_COUNT
AdvancedSerarchResultListParam.MAX_ROW_COUNT
);
};

Expand Down Expand Up @@ -338,7 +338,7 @@ export const AdvancedSearchResultsPage: FC = () => {
<ArrowDropDownIcon />
</IconButton>
<Typography>
{page * AdvancedSerarchResultList.MAX_ROW_COUNT} /{" "}
{page * AdvancedSerarchResultListParam.MAX_ROW_COUNT} /{" "}
{searchResults.totalCount}
</Typography>
</CenterAlignedBox>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/JobListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { JobList } from "components/job/JobList";
import { usePage } from "hooks/usePage";
import { aironeApiClient } from "repository/AironeApiClient";
import { topPath } from "routes/Routes";
import { JobList as ConstJobList } from "services/Constants";
import { JobListParam } from "services/Constants";

export const JobListPage: FC = () => {
const location = useLocation();
Expand Down Expand Up @@ -60,7 +60,7 @@ export const JobListPage: FC = () => {
<JobList jobs={jobs.value?.results ?? []} />
<PaginationFooter
count={jobs.value?.count ?? 0}
maxRowCount={ConstJobList.MAX_ROW_COUNT}
maxRowCount={JobListParam.MAX_ROW_COUNT}
page={page}
changePage={changePage}
/>
Expand Down
30 changes: 15 additions & 15 deletions frontend/src/repository/AironeApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ import Cookies from "js-cookie";
import fileDownload from "js-file-download";

import {
AdvancedSerarchResultList,
EntityList as ConstEntityList,
EntityHistoryList,
EntryHistoryList,
AdvancedSerarchResultListParam,
EntityHistoryListParam,
EntityListParam,
EntryHistoryListParam,
EntryReferralList,
JobList,
JobListParam,
} from "services/Constants";

export type GroupTree = Pick<_GroupTree, "id" | "name"> & {
Expand Down Expand Up @@ -209,8 +209,8 @@ class AironeApiClient {
): Promise<PaginatedEntityListList> {
const params: EntityApiV2ListRequest = page
? {
offset: (page - 1) * ConstEntityList.MAX_ROW_COUNT,
limit: ConstEntityList.MAX_ROW_COUNT,
offset: (page - 1) * EntityListParam.MAX_ROW_COUNT,
limit: EntityListParam.MAX_ROW_COUNT,
search: search,
isToplevel: isToplevel,
}
Expand Down Expand Up @@ -300,8 +300,8 @@ class AironeApiClient {
): Promise<PaginatedEntityHistoryList> {
return await this.entity.entityApiV2HistoriesList({
entityId: id,
offset: (page - 1) * EntityHistoryList.MAX_ROW_COUNT,
limit: EntityHistoryList.MAX_ROW_COUNT,
offset: (page - 1) * EntityHistoryListParam.MAX_ROW_COUNT,
limit: EntityHistoryListParam.MAX_ROW_COUNT,
});
}

Expand Down Expand Up @@ -445,8 +445,8 @@ class AironeApiClient {
): Promise<PaginatedEntryHistoryAttributeValueList> {
return await this.entry.entryApiV2HistoriesList({
id: id,
offset: (page - 1) * EntryHistoryList.MAX_ROW_COUNT,
limit: EntryHistoryList.MAX_ROW_COUNT,
offset: (page - 1) * EntryHistoryListParam.MAX_ROW_COUNT,
limit: EntryHistoryListParam.MAX_ROW_COUNT,
});
}

Expand Down Expand Up @@ -677,7 +677,7 @@ class AironeApiClient {
referralName = "",
searchAllEntities = false,
page: number,
limit: number = AdvancedSerarchResultList.MAX_ROW_COUNT,
limit: number = AdvancedSerarchResultListParam.MAX_ROW_COUNT,
offset: number = 0
): Promise<AdvancedSearchResult> {
return await this.entry.entryApiV2AdvancedSearchCreate(
Expand Down Expand Up @@ -917,8 +917,8 @@ class AironeApiClient {
limit?: number
): Promise<PaginatedJobSerializersList> {
return await this.job.jobApiV2JobsList({
offset: (page - 1) * JobList.MAX_ROW_COUNT,
limit: limit ?? JobList.MAX_ROW_COUNT,
offset: (page - 1) * JobListParam.MAX_ROW_COUNT,
limit: limit ?? JobListParam.MAX_ROW_COUNT,
targetId,
});
}
Expand All @@ -930,7 +930,7 @@ class AironeApiClient {

const resp = await this.job.jobApiV2JobsList({
offset: 0,
limit: JobList.MAX_ROW_COUNT,
limit: JobListParam.MAX_ROW_COUNT,
createdAfter: createdAfter,
});
return resp.results ?? [];
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/services/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ export const EntityStatus = {
EDITING: 1 << 2,
};

export const EntityList = {
export const EntityListParam = {
MAX_ROW_COUNT: 30,
};

export const EntryList = {
export const EntryListParam = {
MAX_ROW_COUNT: 30,
};

export const UserList = {
export const UserListParam = {
MAX_ROW_COUNT: 30,
};

export const JobList = {
export const JobListParam = {
MAX_ROW_COUNT: 30,
};

export const EntryHistoryList = {
export const EntryHistoryListParam = {
MAX_ROW_COUNT: 30,
};

export const EntityHistoryList = {
export const EntityHistoryListParam = {
MAX_ROW_COUNT: 30,
};

export const AdvancedSerarchResultList = {
export const AdvancedSerarchResultListParam = {
MAX_ROW_COUNT: 100,
};

Expand Down
3 changes: 3 additions & 0 deletions frontend/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ export * from "./JobUtil";
export * from "./ServerContext";
export * from "./StringUtil";
export * from "./ZodSchemaUtil";

export * from "./entry/AdvancedSearch";
export * from "./entry/Edit";
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dmm-com/pagoda-core",
"version": "1.0.1",
"version": "1.0.2",
"description": "[![CircleCI](https://circleci.com/gh/dmm-com/airone.svg?style=svg&circle-token=2e12c068b0ed1bab9d0c2d72529d5ee1da9b53b4)](https://circleci.com/gh/dmm-com/airone)",
"main": "frontend/dist/pagoda-core.js",
"types": "frontend/dist/index.d.ts",
Expand Down

0 comments on commit d6a21b1

Please sign in to comment.