| "yup": "^0.32.9" | "yup": "^0.32.9" | ||||
| }, | }, | ||||
| "scripts": { | "scripts": { | ||||
| "start": "react-scripts start", | |||||
| "start": "react-scripts --openssl-legacy-provider start", | |||||
| "build": "react-scripts build", | "build": "react-scripts build", | ||||
| "test": "react-scripts test", | "test": "react-scripts test", | ||||
| "eject": "react-scripts eject", | "eject": "react-scripts eject", |
| .pg-viewer-wrapper .document-container{ | .pg-viewer-wrapper .document-container{ | ||||
| margin:0 !important; | margin:0 !important; | ||||
| } | |||||
| .page-navigation-buttons { | |||||
| display: flex; | |||||
| margin-top: 12px; | |||||
| } | |||||
| .page-navigation-buttons > button { | |||||
| margin: 0 !important; | |||||
| margin-right: 12px !important; | |||||
| } | } |
| /* istanbul ignore file */ | /* istanbul ignore file */ | ||||
| export const PAGE_SIZE_CANDIDATES = 12; | export const PAGE_SIZE_CANDIDATES = 12; | ||||
| export const PAGE_SIZE_FILES = 3; |
| import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors"; | import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors"; | ||||
| import { FETCH_FILES_LOADING } from "../../store/actions/files/fileActionConstants"; | import { FETCH_FILES_LOADING } from "../../store/actions/files/fileActionConstants"; | ||||
| import { useHistory, useParams } from "react-router"; | import { useHistory, useParams } from "react-router"; | ||||
| import { PAGE_SIZE_FILES } from "../../constants/keyCodeConstants"; | |||||
| const FileTable = ({ trigger }) => { | const FileTable = ({ trigger }) => { | ||||
| const [file, setFile] = useState(null); | const [file, setFile] = useState(null); | ||||
| dispatch( | dispatch( | ||||
| getFilesReq({ | getFilesReq({ | ||||
| payload: { | payload: { | ||||
| pageSize: 3, | |||||
| pageSize: PAGE_SIZE_FILES, | |||||
| currentPage: page, | currentPage: page, | ||||
| categoryId: id, | categoryId: id, | ||||
| extensions: [], | extensions: [], | ||||
| dispatch( | dispatch( | ||||
| getFilesReq({ | getFilesReq({ | ||||
| payload: { | payload: { | ||||
| pageSize: 3, | |||||
| pageSize: PAGE_SIZE_FILES, | |||||
| currentPage: value, | currentPage: value, | ||||
| categoryId: id, | categoryId: id, | ||||
| extensions: extFilters, | extensions: extFilters, | ||||
| dispatch( | dispatch( | ||||
| getFilesReq({ | getFilesReq({ | ||||
| payload: { | payload: { | ||||
| pageSize: 3, | |||||
| pageSize: PAGE_SIZE_FILES, | |||||
| currentPage: page, | currentPage: page, | ||||
| categoryId: id, | categoryId: id, | ||||
| extensions: extFilters, | extensions: extFilters, | ||||
| display: "flex", | display: "flex", | ||||
| justifyContent: "space-between", | justifyContent: "space-between", | ||||
| position: "relative", | position: "relative", | ||||
| width: "100%", | |||||
| width: "calc(100% - 144px)", | |||||
| }} | }} | ||||
| > | > | ||||
| <div> | <div> | ||||
| }} | }} | ||||
| > | > | ||||
| <div className="table-cont"> | <div className="table-cont"> | ||||
| <div style={{ display: "flex", height: "300px" }}> | |||||
| <div style={{ display: "flex", height: "300px", width: "calc(100% - 144px)" }}> | |||||
| <table | <table | ||||
| className={"usersTable-users mini"} | className={"usersTable-users mini"} | ||||
| style={{ | style={{ | ||||
| <Pagination | <Pagination | ||||
| size={"small"} | size={"small"} | ||||
| count={ | count={ | ||||
| parseInt(data.total) <= 6 | |||||
| parseInt(data.total) <= PAGE_SIZE_FILES | |||||
| ? 1 | ? 1 | ||||
| : Math.ceil(parseInt(data.total) / 6) | |||||
| : Math.ceil(parseInt(data.total) / PAGE_SIZE_FILES) | |||||
| } | } | ||||
| color="primary" | color="primary" | ||||
| className="candidates-pagination" | className="candidates-pagination" |
| import { useSelector, useDispatch } from "react-redux"; | import { useSelector, useDispatch } from "react-redux"; | ||||
| import IconButton from "../../components/IconButton/IconButton"; | import IconButton from "../../components/IconButton/IconButton"; | ||||
| import { setCategoriesReq } from "../../store/actions/categories/categoriesAction"; | import { setCategoriesReq } from "../../store/actions/categories/categoriesAction"; | ||||
| import { selectCategories } from "../../store/selectors/categoriesSelector"; | |||||
| import { | |||||
| selectCategories, | |||||
| selectChildParentRelations, | |||||
| } from "../../store/selectors/categoriesSelector"; | |||||
| import table from "../../assets/images/table.png"; | import table from "../../assets/images/table.png"; | ||||
| import { FILES_PAGE } from "../../constants/pages"; | import { FILES_PAGE } from "../../constants/pages"; | ||||
| import FileTable from "./FileTable"; | import FileTable from "./FileTable"; | ||||
| const FilesPage = ({ history }) => { | const FilesPage = ({ history }) => { | ||||
| const categories = useSelector(selectCategories); | const categories = useSelector(selectCategories); | ||||
| const childParentRelations = useSelector(selectChildParentRelations); | |||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const [trigger, setTrigger] = useState(0); | const [trigger, setTrigger] = useState(0); | ||||
| let { id } = useParams(); | let { id } = useParams(); | ||||
| <div style={{ marginBottom: "50px" }}> | <div style={{ marginBottom: "50px" }}> | ||||
| <div style={{ marginBottom: "30px" }}> | <div style={{ marginBottom: "30px" }}> | ||||
| <h1 className="page-heading">Folderi</h1> | <h1 className="page-heading">Folderi</h1> | ||||
| <div className="page-navigation-buttons"> | |||||
| <IconButton | |||||
| className="c-btn c-btn--primary-outlined files-view-page-delete-btn" | |||||
| onClick={() => history.push({ pathname: FILES_PAGE })} | |||||
| > | |||||
| <p>Root</p> | |||||
| </IconButton> | |||||
| {childParentRelations.map((relation) => ( | |||||
| <IconButton | |||||
| className="c-btn c-btn--primary-outlined files-view-page-delete-btn" | |||||
| key={relation.id} | |||||
| onClick={() => history.push({ pathname: relation.id })} | |||||
| > | |||||
| <p>{relation.name}</p> | |||||
| </IconButton> | |||||
| ))} | |||||
| </div> | |||||
| </div> | </div> | ||||
| <div className="files-page-categories"> | <div className="files-page-categories"> | ||||
| {categories && | {categories && |
| const initialState = { | const initialState = { | ||||
| categories: [], | categories: [], | ||||
| childParentRelations: [], | |||||
| isCategoriesChecked: [], | isCategoriesChecked: [], | ||||
| changedCategories: [], | changedCategories: [], | ||||
| errorMessage: "", | errorMessage: "", | ||||
| function setStateCategories(state, action) { | function setStateCategories(state, action) { | ||||
| return { | return { | ||||
| ...state, | ...state, | ||||
| categories: action.payload, | |||||
| categories: action.payload.categories, | |||||
| childParentRelations: action.payload.childParentRelations | |||||
| }; | }; | ||||
| } | } | ||||
| } else { | } else { | ||||
| result = yield call(getRootCategories2, payload.parentCategoryId); | result = yield call(getRootCategories2, payload.parentCategoryId); | ||||
| } | } | ||||
| console.log("Result:", result); | |||||
| yield put(setCategories(result.data)); | |||||
| yield put(setCategories({categories: result.data.categories, childParentRelations: result.data.childParentRelations})); | |||||
| } catch (error) { | } catch (error) { | ||||
| const errorMessage = yield call(rejectErrorCodeHelper, error); | const errorMessage = yield call(rejectErrorCodeHelper, error); | ||||
| yield put(setCategoriesError(errorMessage)); | yield put(setCategoriesError(errorMessage)); |
| (state) => state.categories | (state) => state.categories | ||||
| ); | ); | ||||
| export const selectChildParentRelations = createSelector( | |||||
| categoriesSelector, | |||||
| (state) => state.childParentRelations | |||||
| ); | |||||
| export const selectCategoriesError = createSelector( | export const selectCategoriesError = createSelector( | ||||
| categoriesSelector, | categoriesSelector, | ||||
| (state) => state.errorMessage | (state) => state.errorMessage |