diff --git a/frontend/language/src/nb.json b/frontend/language/src/nb.json index f513a8507ae..2e2e538e6a5 100644 --- a/frontend/language/src/nb.json +++ b/frontend/language/src/nb.json @@ -657,7 +657,7 @@ "process_editor.not_found_process_error_message": "Det finnes ingen prosess definert innenfor BPMN, Du kan verifisere om prosessen finnes i BPMN-filen.", "process_editor.not_found_process_heading": "Ingen tilgjengelig prosess", "process_editor.save": "Lagre", - "process_editor.too_old_version_helptext_content": "Applikasjonen din har versjon {{ version }} av app-lib-pakken. \nVersjonen er for gammel for å kunne redigere denne modellen.\nDu kan se på prosessen, men vi anbefaler at du oppgraderer til versjon 8 eller nyere.", + "process_editor.too_old_version_helptext_content": "Applikasjonen din har versjon {{ version }} av app-lib-pakken. \nVersjonen er for gammel for å kunne redigere denne modellen.\nDu kan se på prosessen og konfigurere oppsett tilknyttet prosessen, men vi anbefaler at du oppgraderer til versjon 8 eller nyere.", "process_editor.too_old_version_helptext_title": "Du kan ikke redigere prosessen", "process_editor.too_old_version_title": "Du kan ikke redigere denne prosessen", "process_editor.unknown_heading_error_message": "Obs, noe gikk galt!", diff --git a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigSection/ConfigIcon/ConfigIcon.tsx b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigSection/ConfigIcon/ConfigIcon.tsx index 38d8da887e6..ce18e6f2346 100644 --- a/frontend/packages/process-editor/src/components/ConfigPanel/ConfigSection/ConfigIcon/ConfigIcon.tsx +++ b/frontend/packages/process-editor/src/components/ConfigPanel/ConfigSection/ConfigIcon/ConfigIcon.tsx @@ -1,6 +1,6 @@ import React from 'react'; import classes from './ConfigIcon.module.css'; -import { BpmnTaskType } from '../../../types/BpmnTaskType'; +import { BpmnTaskType } from '../../../../types/BpmnTaskType'; import { ConfirmationTask, DataTask, FeedbackTask, SignTask } from '@studio/icons'; export type ConfigIconProps = { diff --git a/frontend/packages/process-editor/src/types/BpmnBusinessObjectViewer.ts b/frontend/packages/process-editor/src/types/BpmnBusinessObjectViewer.ts index 2a5b4eb7308..9d207fb53f9 100644 --- a/frontend/packages/process-editor/src/types/BpmnBusinessObjectViewer.ts +++ b/frontend/packages/process-editor/src/types/BpmnBusinessObjectViewer.ts @@ -5,14 +5,7 @@ export interface BpmnBusinessObjectViewer { $type: BpmnTypeEnum; id: string; name?: string; - extensionElements?: BpmnExtensionElementsViewer; -} - -export interface BpmnExtensionElementsViewer { - values?: Array<{ - $children: Array<{ - $body: BpmnTaskType; - $type: string; - }>; - }>; + $attrs: { + 'altinn:tasktype': BpmnTaskType; + }; } diff --git a/frontend/packages/process-editor/src/utils/configPanelUtils/configPanelUtils.ts b/frontend/packages/process-editor/src/utils/configPanelUtils/configPanelUtils.ts index 693c717cbcc..19772d6622b 100644 --- a/frontend/packages/process-editor/src/utils/configPanelUtils/configPanelUtils.ts +++ b/frontend/packages/process-editor/src/utils/configPanelUtils/configPanelUtils.ts @@ -7,16 +7,7 @@ import { BpmnTaskType } from '../../types/BpmnTaskType'; * */ export const getConfigTitleKey = (taskType: BpmnTaskType) => { - switch (taskType) { - case 'data': - return 'process_editor.configuration_panel_data_task'; - case 'confirmation': - return 'process_editor.configuration_panel_confirmation_task'; - case 'feedback': - return 'process_editor.configuration_panel_feedback_task'; - case 'signing': - return 'process_editor.configuration_panel_signing_task'; - } + return `process_editor.configuration_panel_${taskType}_task`; }; /** @@ -25,14 +16,5 @@ export const getConfigTitleKey = (taskType: BpmnTaskType) => { * @returns the correct helptext key */ export const getConfigTitleHelpTextKey = (taskType: BpmnTaskType) => { - switch (taskType) { - case 'data': - return 'process_editor.configuration_panel_header_help_text_data'; - case 'confirmation': - return 'process_editor.configuration_panel_header_help_text_confirmation'; - case 'feedback': - return 'process_editor.configuration_panel_header_help_text_feedback'; - case 'signing': - return 'process_editor.configuration_panel_header_help_text_signing'; - } + return `process_editor.configuration_panel_header_help_text_${taskType}`; }; diff --git a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts index 1ec47d015b4..9808116d2f7 100644 --- a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts +++ b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.test.ts @@ -1,8 +1,5 @@ import { BpmnTypeEnum } from '../../enum/BpmnTypeEnum'; -import { - BpmnBusinessObjectViewer, - BpmnExtensionElementsViewer, -} from '../../types/BpmnBusinessObjectViewer'; +import { BpmnBusinessObjectViewer } from '../../types/BpmnBusinessObjectViewer'; import { BpmnBusinessObjectEditor, BpmnExtensionElementsEditor, @@ -23,19 +20,13 @@ describe('hookUtils', () => { const mockName: string = 'mockName'; const mockTaskTypeData: BpmnTaskType = 'data'; - const mockBpmnExtensionElements: BpmnExtensionElementsViewer = { - values: [ - { - $children: [{ $body: mockTaskTypeData, $type: 'altinn:taskType' }], - }, - ], - }; - const mockBpmnBusinessObject: BpmnBusinessObjectViewer = { $type: mockTypeTask, id: mockId, name: mockName, - extensionElements: mockBpmnExtensionElements, + $attrs: { + 'altinn:tasktype': mockTaskTypeData, + }, }; it('returns the BpmnDetails with correct values', () => { @@ -47,25 +38,10 @@ describe('hookUtils', () => { expect(bpmnDetails.taskType).toEqual(mockTaskTypeData); }); - it('returns taskType with value "null" when etensionElements are not present', () => { + it('returns taskType with value "null" when $attrs are not present', () => { const bpmnBusinessObject: BpmnBusinessObjectViewer = { ...mockBpmnBusinessObject, - extensionElements: undefined, - }; - const bpmnDetails: BpmnDetails = getBpmnViewerDetailsFromBusinessObject(bpmnBusinessObject); - expect(bpmnDetails.id).toEqual(mockId); - expect(bpmnDetails.name).toEqual(mockName); - expect(bpmnDetails.type).toEqual(mockTypeTask); - expect(bpmnDetails.taskType).toBeNull(); - }); - - it('returns taskType with value "null" when etensionElements.values are not present', () => { - const bpmnBusinessObject: BpmnBusinessObjectViewer = { - ...mockBpmnBusinessObject, - extensionElements: { - ...mockBpmnExtensionElements, - values: undefined, - }, + $attrs: undefined, }; const bpmnDetails: BpmnDetails = getBpmnViewerDetailsFromBusinessObject(bpmnBusinessObject); expect(bpmnDetails.id).toEqual(mockId); diff --git a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts index d6ceda7d4d9..ac8e48853b6 100644 --- a/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts +++ b/frontend/packages/process-editor/src/utils/hookUtils/hookUtils.ts @@ -10,19 +10,17 @@ import type { BpmnBusinessObjectEditor } from '../../types/BpmnBusinessObjectEdi export const getBpmnViewerDetailsFromBusinessObject = ( businessObject: BpmnBusinessObjectViewer, ): BpmnDetails => { + console.log('businessobject', businessObject); const bpmnType = businessObject?.$type; const bpmnId = businessObject?.id; const bpmnName = businessObject?.name; - - const extensionElements = businessObject?.extensionElements; - const values = extensionElements?.values; - const $children = values ? values[0].$children : null; - const $body = $children ? $children[0].$body : null; + const bpmnAttrs = businessObject?.$attrs; + const bpmnTasktype = bpmnAttrs ? bpmnAttrs['altinn:tasktype'] : null; const bpmnDetails: BpmnDetails = { id: bpmnId, name: bpmnName, - taskType: $body, + taskType: bpmnTasktype, type: bpmnType, }; return bpmnDetails;