{new Date((duration ? duration : 0)).toISOString().substr(11, 10)}
diff --git a/src/main/WorkflowConfiguration.tsx b/src/main/WorkflowConfiguration.tsx
index 521f18305..1f67c33de 100644
--- a/src/main/WorkflowConfiguration.tsx
+++ b/src/main/WorkflowConfiguration.tsx
@@ -1,39 +1,17 @@
-import React, { useEffect } from "react";
+import React from "react";
import { css } from "@emotion/react";
import {
- basicButtonStyle,
backOrContinueStyle,
errorBoxStyle,
- spinningStyle,
} from "../cssStyles";
-
-import { LuLoader, LuCheck, LuAlertCircle, LuChevronLeft, LuDatabase, LuMoreHorizontal } from "react-icons/lu";
-
-import { useAppDispatch, useAppSelector } from "../redux/store";
-import {
- selectCustomizedTrackSelection,
- selectSegments,
- selectTracks,
- setHasChanges as videoSetHasChanges,
- selectSelectedWorkflowId,
-} from "../redux/videoSlice";
-import { postVideoInformationWithWorkflow, selectStatus, selectError } from "../redux/workflowPostAndProcessSlice";
-
+import { LuChevronLeft, LuDatabase, LuMoreHorizontal } from "react-icons/lu";
+import { useAppSelector } from "../redux/store";
import { PageButton } from "./Finish";
-import { setEnd } from "../redux/endSlice";
-
import { useTranslation } from "react-i18next";
-import {
- setHasChanges as metadataSetHasChanges,
- selectCatalogs,
-} from "../redux/metadataSlice";
-import {
- selectSubtitles,
- setHasChanges as subtitleSetHasChanges,
-} from "../redux/subtitleSlice";
-import { serializeSubtitle } from "../util/utilityFunctions";
import { useTheme } from "../themes";
+import { selectError, selectStatus } from "../redux/workflowPostSlice";
+import { SaveButton } from "./Save";
/**
* Will eventually display settings based on the selected workflow index
@@ -62,7 +40,11 @@ const WorkflowConfiguration: React.FC = () => {
{t("various.error-text")}
@@ -74,92 +56,4 @@ const WorkflowConfiguration: React.FC = () => {
);
};
-/**
- * Button that sends a post request to save current changes
- * and starts the selected workflow
- */
-export const SaveAndProcessButton: React.FC<{ text: string; }> = ({ text }) => {
-
- // Initialize redux variables
- const dispatch = useAppDispatch();
-
- const selectedWorkflowId = useAppSelector(selectSelectedWorkflowId);
- const segments = useAppSelector(selectSegments);
- const tracks = useAppSelector(selectTracks);
- const customizedTrackSelection = useAppSelector(selectCustomizedTrackSelection);
- const subtitles = useAppSelector(selectSubtitles);
- const metadata = useAppSelector(selectCatalogs);
- const workflowStatus = useAppSelector(selectStatus);
- const theme = useTheme();
-
- // Let users leave the page without warning after a successful save
- useEffect(() => {
- if (workflowStatus === "success") {
- dispatch(setEnd({ hasEnded: true, value: "success" }));
- dispatch(videoSetHasChanges(false));
- dispatch(metadataSetHasChanges(false));
- dispatch(subtitleSetHasChanges(false));
- }
- }, [dispatch, workflowStatus]);
-
- const prepareSubtitles = () => {
- const subtitlesForPosting = [];
-
- for (const identifier in subtitles) {
- subtitlesForPosting.push({
- id: identifier,
- subtitle: serializeSubtitle(subtitles[identifier].cues),
- tags: subtitles[identifier].tags,
- });
- }
- return subtitlesForPosting;
- };
-
- const saveAndProcess = () => {
- dispatch(postVideoInformationWithWorkflow({
- segments: segments,
- tracks: tracks,
- customizedTrackSelection,
- workflow: [{ id: selectedWorkflowId }],
- subtitles: prepareSubtitles(),
- metadata: metadata,
- }));
- };
-
- // Update based on current fetching status
- let Icon = LuDatabase;
- let spin = false;
- if (workflowStatus === "failed") {
- Icon = LuAlertCircle;
- spin = false;
- } else if (workflowStatus === "success") {
- Icon = LuCheck;
- spin = false;
- } else if (workflowStatus === "loading") {
- Icon = LuLoader;
- spin = true;
-
- }
-
- const saveButtonStyle = css({
- padding: "16px",
- boxShadow: `${theme.boxShadow}`,
- background: `${theme.element_bg}`,
- });
-
- return (
-
) => {
- if (event.key === " " || event.key === "Enter") {
- saveAndProcess();
- }
- }}>
-
- {text}
-
- );
-};
-
export default WorkflowConfiguration;
diff --git a/src/main/WorkflowSelection.tsx b/src/main/WorkflowSelection.tsx
index 19b773358..48fb01a92 100644
--- a/src/main/WorkflowSelection.tsx
+++ b/src/main/WorkflowSelection.tsx
@@ -5,12 +5,9 @@ import { backOrContinueStyle, errorBoxStyle } from "../cssStyles";
import { useAppDispatch, useAppSelector } from "../redux/store";
import { selectWorkflows, setSelectedWorkflowIndex } from "../redux/videoSlice";
-import { selectFinishState, selectPageNumber } from "../redux/finishSlice";
import { PageButton } from "./Finish";
-import { LuChevronLeft } from "react-icons/lu";
-import { SaveAndProcessButton } from "./WorkflowConfiguration";
-import { selectStatus, selectError } from "../redux/workflowPostAndProcessSlice";
+import { LuChevronLeft, LuDatabase } from "react-icons/lu";
import { selectStatus as saveSelectStatus, selectError as saveSelectError } from "../redux/workflowPostSlice";
import { httpRequestState, Workflow } from "../types";
import { SaveButton } from "./Save";
@@ -37,18 +34,14 @@ const WorkflowSelection: React.FC = () => {
return (b.displayOrder - a.displayOrder);
});
- const finishState = useAppSelector(selectFinishState);
- const pageNumber = useAppSelector(selectPageNumber);
const theme = useTheme();
- const postAndProcessWorkflowStatus = useAppSelector(selectStatus);
- const postAndProcessError = useAppSelector(selectError);
const saveStatus = useAppSelector(saveSelectStatus);
const saveError = useAppSelector(saveSelectError);
const workflowSelectionStyle = css({
padding: "20px",
- display: (finishState === "Start processing" && pageNumber === 1) ? "flex" : "none",
+ display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
@@ -107,7 +100,7 @@ const WorkflowSelection: React.FC = () => {
{t("various.error-text")}
{errorMessage ?
- t("various.error-details-text", { errorMessage: postAndProcessError }) :
+ t("various.error-details-text", { errorMessage: saveError }) :
t("various.error-text")}
@@ -140,9 +133,13 @@ const WorkflowSelection: React.FC = () => {
This will take some time.
,
false,
-