Local media server bugfixes.
This commit is contained in:
@@ -15,6 +15,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
|||||||
import { CreateExplorerLinkForJob } from "../../utils/localmedia";
|
import { CreateExplorerLinkForJob } from "../../utils/localmedia";
|
||||||
import DocumentsLocalUploadComponent from "../documents-local-upload/documents-local-upload.component";
|
import DocumentsLocalUploadComponent from "../documents-local-upload/documents-local-upload.component";
|
||||||
import JobsDocumentsLocalGalleryReassign from "./jobs-documents-local-gallery.reassign.component";
|
import JobsDocumentsLocalGalleryReassign from "./jobs-documents-local-gallery.reassign.component";
|
||||||
|
import JobsDocumentsLocalGallerySelectAllComponent from "./jobs-documents-local-gallery.selectall.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -76,6 +77,7 @@ export function JobsDocumentsLocalGallery({
|
|||||||
<Button>{t("documents.labels.openinexplorer")}</Button>
|
<Button>{t("documents.labels.openinexplorer")}</Button>
|
||||||
</a>
|
</a>
|
||||||
<JobsDocumentsLocalGalleryReassign jobid={job.id} />
|
<JobsDocumentsLocalGalleryReassign jobid={job.id} />
|
||||||
|
<JobsDocumentsLocalGallerySelectAllComponent jobid={job.id} />
|
||||||
</Space>
|
</Space>
|
||||||
<Card>
|
<Card>
|
||||||
<DocumentsLocalUploadComponent
|
<DocumentsLocalUploadComponent
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { Button, Space } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import {
|
||||||
|
selectAllmediaForJob,
|
||||||
|
deselectAllMediaForJob,
|
||||||
|
} from "../../redux/media/media.actions";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
selectAllmediaForJob: (jobid) => dispatch(selectAllmediaForJob(jobid)),
|
||||||
|
deselectAllmediaForJob: (jobid) => dispatch(deselectAllMediaForJob(jobid)),
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(JobsDocumentsLocalGallerySelectAllComponent);
|
||||||
|
|
||||||
|
export function JobsDocumentsLocalGallerySelectAllComponent({
|
||||||
|
jobid,
|
||||||
|
selectAllmediaForJob,
|
||||||
|
deselectAllmediaForJob,
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
// onSelectImage={(index, image) => {
|
||||||
|
// toggleMediaSelected({ jobid: job.id, filename: image.filename });
|
||||||
|
// }}
|
||||||
|
|
||||||
|
const handleSelectAll = () => {
|
||||||
|
selectAllmediaForJob({ jobid });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeselectAll = () => {
|
||||||
|
deselectAllmediaForJob({ jobid });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Space wrap>
|
||||||
|
<Button onClick={handleSelectAll}>
|
||||||
|
{t("general.actions.selectall")}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button onClick={handleDeselectAll}>
|
||||||
|
{t("general.actions.deselectall")}
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,15 +6,20 @@ import React from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { useHistory, useLocation } from "react-router-dom";
|
import { useHistory, useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
import { GET_JOB_BY_PK } from "../../graphql/jobs.queries";
|
import { GET_JOB_BY_PK } from "../../graphql/jobs.queries";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import JobLinesContainer from "../job-detail-lines/job-lines.container";
|
import JobLinesContainer from "../job-detail-lines/job-lines.container";
|
||||||
import JobsDetailHeader from "../jobs-detail-header/jobs-detail-header.component";
|
import JobsDetailHeader from "../jobs-detail-header/jobs-detail-header.component";
|
||||||
import JobsDocumentsGalleryContainer from "../jobs-documents-gallery/jobs-documents-gallery.container";
|
import JobsDocumentsGalleryContainer from "../jobs-documents-gallery/jobs-documents-gallery.container";
|
||||||
|
import JobsDocumentsLocalGallery from "../jobs-documents-local-gallery/jobs-documents-local-gallery.container";
|
||||||
import JobNotesContainer from "../jobs-notes/jobs-notes.container";
|
import JobNotesContainer from "../jobs-notes/jobs-notes.container";
|
||||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop });
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPrintCenterContext: (context) =>
|
setPrintCenterContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "printCenter" })),
|
dispatch(setModalContext({ context: context, modal: "printCenter" })),
|
||||||
@@ -29,7 +34,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
// },
|
// },
|
||||||
// };
|
// };
|
||||||
|
|
||||||
export function JobDetailCards({ setPrintCenterContext }) {
|
export function TechLookupJobsDrawer({ bodyshop, setPrintCenterContext }) {
|
||||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||||
.filter((screen) => !!screen[1])
|
.filter((screen) => !!screen[1])
|
||||||
.slice(-1)[0];
|
.slice(-1)[0];
|
||||||
@@ -110,7 +115,13 @@ export function JobDetailCards({ setPrintCenterContext }) {
|
|||||||
/>
|
/>
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane key="documents" tab={t("jobs.labels.documents")}>
|
<Tabs.TabPane key="documents" tab={t("jobs.labels.documents")}>
|
||||||
<JobsDocumentsGalleryContainer jobId={searchParams.selected} />
|
{bodyshop.uselocalmediaserver ? (
|
||||||
|
<JobsDocumentsLocalGallery
|
||||||
|
job={data ? data.jobs_by_pk : null}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<JobsDocumentsGalleryContainer jobId={searchParams.selected} />
|
||||||
|
)}
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane key="notes" tab={t("jobs.labels.notes")}>
|
<Tabs.TabPane key="notes" tab={t("jobs.labels.notes")}>
|
||||||
<JobNotesContainer jobId={searchParams.selected} />
|
<JobNotesContainer jobId={searchParams.selected} />
|
||||||
@@ -121,4 +132,7 @@ export function JobDetailCards({ setPrintCenterContext }) {
|
|||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(null, mapDispatchToProps)(JobDetailCards);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(TechLookupJobsDrawer);
|
||||||
|
|||||||
@@ -32,3 +32,13 @@ export const toggleMediaSelected = ({ jobid, filename }) => ({
|
|||||||
type: MediaActionTypes.TOGGLE_MEDIA_SELECTED,
|
type: MediaActionTypes.TOGGLE_MEDIA_SELECTED,
|
||||||
payload: { jobid, filename },
|
payload: { jobid, filename },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const deselectAllMediaForJob = ({ jobid }) => ({
|
||||||
|
type: MediaActionTypes.DESELECT_ALL_MEDIA_FOR_JOB,
|
||||||
|
payload: { jobid },
|
||||||
|
});
|
||||||
|
|
||||||
|
export const selectAllmediaForJob = ({ jobid }) => ({
|
||||||
|
type: MediaActionTypes.SELECT_ALL_MEDIA_FOR_JOB,
|
||||||
|
payload: { jobid },
|
||||||
|
});
|
||||||
|
|||||||
@@ -26,6 +26,23 @@ const mediaReducer = (state = INITIAL_STATE, action) => {
|
|||||||
return p;
|
return p;
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
case MediaActionTypes.SELECT_ALL_MEDIA_FOR_JOB:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
[action.payload.jobid]: state[action.payload.jobid].map((p) => {
|
||||||
|
p.isSelected = true;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
case MediaActionTypes.DESELECT_ALL_MEDIA_FOR_JOB:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
[action.payload.jobid]: state[action.payload.jobid].map((p) => {
|
||||||
|
p.isSelected = false;
|
||||||
|
return p;
|
||||||
|
}),
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ const MediaActionTypes = {
|
|||||||
GET_MEDIA_FOR_JOB_ERROR: "GET_MEDIA_FOR_JOB_ERROR",
|
GET_MEDIA_FOR_JOB_ERROR: "GET_MEDIA_FOR_JOB_ERROR",
|
||||||
ADD_MEDIA_FOR_JOB: "ADD_MEDIA_FOR_JOB",
|
ADD_MEDIA_FOR_JOB: "ADD_MEDIA_FOR_JOB",
|
||||||
TOGGLE_MEDIA_SELECTED: "TOGGLE_MEDIA_SELECTED",
|
TOGGLE_MEDIA_SELECTED: "TOGGLE_MEDIA_SELECTED",
|
||||||
POST_MEDIA_FOR_JOB: "POST_MEDIA_FOR_JOB",
|
|
||||||
POST_MEDIA_FOR_JOB_SUCCESS: "POST_MEDIA_FOR_JOB_SUCCESS",
|
|
||||||
POST_MEDIA_FOR_JOB_ERROR: "POST_MEDIA_FOR_JOB_ERROR",
|
|
||||||
GET_MEDIA_FOR_BILL: "GET_MEDIA_FOR_BILL",
|
GET_MEDIA_FOR_BILL: "GET_MEDIA_FOR_BILL",
|
||||||
|
SELECT_ALL_MEDIA_FOR_JOB: "SELECT_ALL_MEDIA_FOR_JOB",
|
||||||
|
DESELECT_ALL_MEDIA_FOR_JOB: "DESELECT_ALL_MEDIA_FOR_JOB",
|
||||||
};
|
};
|
||||||
export default MediaActionTypes;
|
export default MediaActionTypes;
|
||||||
|
|||||||
Reference in New Issue
Block a user