🏗️ Wired up job queue control methods
This commit is contained in:
@@ -21,7 +21,7 @@ interface IProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the average of two numbers.
|
* Component to facilitate comics.
|
||||||
*
|
*
|
||||||
* @remarks
|
* @remarks
|
||||||
* This method is part of the {@link core-library#Statistics | Statistics subsystem}.
|
* This method is part of the {@link core-library#Statistics | Statistics subsystem}.
|
||||||
@@ -75,22 +75,24 @@ export const Import = (props: IProps): ReactElement => {
|
|||||||
// LS_IMPORT_QUEUE_DRAINED event
|
// LS_IMPORT_QUEUE_DRAINED event
|
||||||
socketIOInstance.on("LS_IMPORT_QUEUE_DRAINED", (data) => {
|
socketIOInstance.on("LS_IMPORT_QUEUE_DRAINED", (data) => {
|
||||||
localStorage.removeItem("sessionId");
|
localStorage.removeItem("sessionId");
|
||||||
|
importJobQueue.setStatus("drained");
|
||||||
});
|
});
|
||||||
const toggleQueue = useCallback(
|
const toggleQueue = (queueAction: string, queueStatus: string) => {
|
||||||
(queueAction: string, queueStatus: string) => {
|
socketIOInstance.emit(
|
||||||
// dispatch(setQueueControl(queueAction, queueStatus));
|
"call",
|
||||||
socketIOInstance.emit("call", "socket.setQueueStatus", {
|
"socket.setQueueStatus",
|
||||||
|
{
|
||||||
queueAction,
|
queueAction,
|
||||||
queueStatus,
|
queueStatus,
|
||||||
});
|
|
||||||
},
|
},
|
||||||
[],
|
(data) => console.log(data),
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// dispatch(getImportJobResultStatistics());
|
// dispatch(getImportJobResultStatistics());
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const libraryQueueImportStatus = undefined;
|
|
||||||
const renderQueueControls = (status: string): ReactElement | null => {
|
const renderQueueControls = (status: string): ReactElement | null => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "running":
|
case "running":
|
||||||
@@ -98,7 +100,10 @@ export const Import = (props: IProps): ReactElement => {
|
|||||||
<div className="control">
|
<div className="control">
|
||||||
<button
|
<button
|
||||||
className="button is-warning is-light"
|
className="button is-warning is-light"
|
||||||
onClick={() => toggleQueue("pause", "paused")}
|
onClick={() => {
|
||||||
|
toggleQueue("pause", "paused");
|
||||||
|
importJobQueue.setStatus("paused");
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-pause mr-2"></i> Pause
|
<i className="fa-solid fa-pause mr-2"></i> Pause
|
||||||
</button>
|
</button>
|
||||||
@@ -109,7 +114,10 @@ export const Import = (props: IProps): ReactElement => {
|
|||||||
<div className="control">
|
<div className="control">
|
||||||
<button
|
<button
|
||||||
className="button is-success is-light"
|
className="button is-success is-light"
|
||||||
onClick={() => toggleQueue("resume", "running")}
|
onClick={() => {
|
||||||
|
toggleQueue("resume", "running");
|
||||||
|
importJobQueue.setStatus("running");
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<i className="fa-solid fa-play mr-2"></i> Resume
|
<i className="fa-solid fa-play mr-2"></i> Resume
|
||||||
</button>
|
</button>
|
||||||
@@ -148,12 +156,15 @@ export const Import = (props: IProps): ReactElement => {
|
|||||||
<p className="buttons">
|
<p className="buttons">
|
||||||
<button
|
<button
|
||||||
className={
|
className={
|
||||||
libraryQueueImportStatus === "drained" ||
|
importJobQueue.status === "drained" ||
|
||||||
libraryQueueImportStatus === undefined
|
importJobQueue.status === undefined
|
||||||
? "button is-medium"
|
? "button is-medium"
|
||||||
: "button is-loading is-medium"
|
: "button is-loading is-medium"
|
||||||
}
|
}
|
||||||
onClick={() => initiateImport()}
|
onClick={() => {
|
||||||
|
initiateImport();
|
||||||
|
importJobQueue.setStatus("running");
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span className="icon">
|
<span className="icon">
|
||||||
<i className="fas fa-file-import"></i>
|
<i className="fas fa-file-import"></i>
|
||||||
@@ -194,14 +205,14 @@ export const Import = (props: IProps): ReactElement => {
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{/* <td>{renderQueueControls(libraryQueueImportStatus)}</td>
|
<td>{renderQueueControls(importJobQueue.status)}</td>
|
||||||
<td>
|
<td>
|
||||||
{libraryQueueImportStatus !== undefined ? (
|
{importJobQueue.status !== undefined ? (
|
||||||
<span className="tag is-warning">
|
<span className="tag is-warning">
|
||||||
{libraryQueueImportStatus}
|
{importJobQueue.status}
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</td> */}
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ export const useStore = create((set, get) => ({
|
|||||||
importJobQueue: {
|
importJobQueue: {
|
||||||
successfulJobCount: 0,
|
successfulJobCount: 0,
|
||||||
failedJobCount: 0,
|
failedJobCount: 0,
|
||||||
|
status: undefined,
|
||||||
|
setStatus: (status: string) =>
|
||||||
|
set(
|
||||||
|
produce((state) => {
|
||||||
|
state.importJobQueue.status = status;
|
||||||
|
}),
|
||||||
|
),
|
||||||
setJobCount: (jobType: string, count: Number) => {
|
setJobCount: (jobType: string, count: Number) => {
|
||||||
switch (jobType) {
|
switch (jobType) {
|
||||||
case "successful":
|
case "successful":
|
||||||
|
|||||||
Reference in New Issue
Block a user