diff --git a/src/WebSocketApp.tsx b/src/WebSocketApp.tsx index fb638362..dc0f035a 100644 --- a/src/WebSocketApp.tsx +++ b/src/WebSocketApp.tsx @@ -86,7 +86,12 @@ export type StompSessionProviderType = ( */ export const WebSocketWrapper: React.FC<{ Provider?: StompSessionProviderType; -}> = ({ children, Provider = StompSessionProvider }) => { + loadDispatchers?: boolean; +}> = ({ + children, + Provider = StompSessionProvider, + loadDispatchers = true, +}) => { const [securityToken, setSecurityToken] = useState(""); useEffect(() => { @@ -115,7 +120,7 @@ export const WebSocketWrapper: React.FC<{ console.warn("Unhandled STOMP receipt", receipt) } > - {registerDispatchers()} + {loadDispatchers && registerDispatchers()} {children} ); diff --git a/src/__tests__/environment/Environment.tsx b/src/__tests__/environment/Environment.tsx index 9b53af7c..e8c6301f 100644 --- a/src/__tests__/environment/Environment.tsx +++ b/src/__tests__/environment/Environment.tsx @@ -7,7 +7,7 @@ import { Provider } from "react-redux"; import configureMockStore from "redux-mock-store"; import thunk from "redux-thunk"; import TermItState from "../../model/TermItState"; -import { mock as stompMock } from "react-stomp-hooks"; +import { mock as stompMock, StompSessionProvider } from "react-stomp-hooks"; // @ts-ignore import TimeAgo from "javascript-time-ago"; import IntlData from "../../model/IntlData"; @@ -91,3 +91,7 @@ export function withWebSocket(node: ReactElement) { ); } + +export const webSocketProviderWrappingComponentOptions = { + wrappingComponent: StompSessionProvider, +}; diff --git a/src/action/ActionType.ts b/src/action/ActionType.ts index f270544c..91fdd726 100644 --- a/src/action/ActionType.ts +++ b/src/action/ActionType.ts @@ -246,6 +246,7 @@ enum ActionType { REMOVE_CRUMB = "REMOVE_CRUMB", DOES_USERNAME_EXISTS = "DOES_USERNAME_EXISTS", + LONG_RUNNING_TASKS_UPDATE = "LONG_RUNNING_TASKS_UPDATE", } export default ActionType; diff --git a/src/action/AsyncActions.ts b/src/action/AsyncActions.ts index 0bb05cf5..17623ddc 100644 --- a/src/action/AsyncActions.ts +++ b/src/action/AsyncActions.ts @@ -708,17 +708,7 @@ export function executeFileTextAnalysis(fileIri: IRI, vocabularyIri: string) { params(reqParams) ) .then(() => { - dispatch(asyncActionSuccess(action)); - return dispatch( - publishMessage( - new Message( - { - messageId: "file.text-analysis.finished.message", - }, - MessageType.SUCCESS - ) - ) - ); + return dispatch(asyncActionSuccess(action)); }) .catch((error: ErrorData) => { dispatch(asyncActionFailure(action, error)); diff --git a/src/action/__tests__/AsyncActions.test.ts b/src/action/__tests__/AsyncActions.test.ts index 64ef3d7b..c62a062c 100644 --- a/src/action/__tests__/AsyncActions.test.ts +++ b/src/action/__tests__/AsyncActions.test.ts @@ -608,25 +608,6 @@ describe("Async actions", () => { expect((found as MessageAction).message.type).toBe(MessageType.ERROR); }); }); - - it("publishes message on success", () => { - Ajax.put = jest.fn().mockImplementation(() => Promise.resolve("Success")); - return Promise.resolve( - (store.dispatch as ThunkDispatch)( - executeFileTextAnalysis( - VocabularyUtils.create(file.iri), - Generator.generateUri() - ) - ) - ).then(() => { - const actions: Action[] = store.getActions(); - const found = actions.find( - (a) => a.type === ActionType.PUBLISH_MESSAGE - ); - expect(found).toBeDefined(); - expect((found as MessageAction).message.type).toBe(MessageType.SUCCESS); - }); - }); }); describe("load terms", () => { diff --git a/src/component/MainView.tsx b/src/component/MainView.tsx index 15e75358..61bc9f2a 100644 --- a/src/component/MainView.tsx +++ b/src/component/MainView.tsx @@ -30,6 +30,7 @@ import Routing from "src/util/Routing"; import { Configuration, DEFAULT_CONFIGURATION } from "../model/Configuration"; import Breadcrumbs from "./breadcrumb/Breadcrumbs"; import { loadTermStates } from "../action/AsyncActions"; +import { LongRunningTasksStatus } from "./main/LongRunningTasksStatus"; const AdministrationRoute = React.lazy( () => import("./administration/AdministrationRoute") @@ -142,8 +143,11 @@ export class MainView extends React.Component { -