- Merge client update into test-beta
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Checkbox, notification, Space, Spin } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import {useMutation} from "@apollo/client";
|
||||
import {Checkbox, notification, Space, Spin} from "antd";
|
||||
import React, {useState} from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {UPDATE_JOB} from "../../graphql/jobs.queries";
|
||||
|
||||
export default function JobRemoveFromPartsQueue({ checked, jobId }) {
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
const { t } = useTranslation();
|
||||
export default function JobRemoveFromPartsQueue({checked, jobId}) {
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
const {t} = useTranslation();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleChange = async (e) => {
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: { jobId: jobId, job: { queued_for_parts: e.target.checked } },
|
||||
});
|
||||
const handleChange = async (e) => {
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: {jobId: jobId, job: {queued_for_parts: e.target.checked}},
|
||||
});
|
||||
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("jobs.successes.save") });
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.saving", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({message: t("jobs.successes.save")});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.saving", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Space>
|
||||
<Checkbox checked={checked} onChange={handleChange} />
|
||||
{loading && <Spin size="small" />}
|
||||
</Space>
|
||||
);
|
||||
return (
|
||||
<Space>
|
||||
<Checkbox checked={checked} onChange={handleChange}/>
|
||||
{loading && <Spin size="small"/>}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user