,
- title: component.id,
- variant: 'tertiary',
- fullWidth: true,
- }}
- inputProps={{
- icon:
,
- value: idInputValue,
- onBlur: (event) => saveComponentUpdate(event.target.value),
- label: t('ux_editor.modal_properties_component_change_id'),
- size: 'small',
- error: errorMessage,
- }}
customValidation={(value) => {
return validateId(value);
}}
+ error={errorMessage}
+ key={component.id}
+ label={t('ux_editor.modal_properties_component_change_id')}
+ layoutSchema={layoutSchema}
+ onBlur={(event) => saveComponentUpdate(event.target.value)}
+ onError={handleValidationError}
onIsViewMode={setIsViewMode}
+ propertyPath='definitions/component/properties/id'
+ relatedSchemas={[expressionSchema, numberFormatSchema]}
+ title={component.id}
+ value={component.id}
/>
{!isViewMode && (
diff --git a/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx b/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx
index de05ced479d..74674655c7a 100644
--- a/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx
+++ b/frontend/packages/ux-editor/src/components/Properties/PropertiesHeader/PropertiesHeader.test.tsx
@@ -65,7 +65,7 @@ describe('PropertiesHeader', () => {
renderPropertiesHeader();
const editComponentIdButton = screen.getByRole('button', {
- name: textMock('ux_editor.id_identifier'),
+ name: component1Mock.id,
});
await user.click(editComponentIdButton);
@@ -83,7 +83,7 @@ describe('PropertiesHeader', () => {
renderPropertiesHeader();
const editComponentIdButton = screen.getByRole('button', {
- name: textMock('ux_editor.id_identifier'),
+ name: component1Mock.id,
});
await user.click(editComponentIdButton);
diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/EditImage.test.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/EditImage.test.tsx
index c628bcb4fb3..eba48c3105f 100644
--- a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/EditImage.test.tsx
+++ b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/EditImage.test.tsx
@@ -6,6 +6,7 @@ import { ComponentType } from 'app-shared/types/ComponentType';
import { componentMocks } from '../../../../testing/componentMocks';
import { textMock } from '@studio/testing/mocks/i18nMock';
import { renderWithProviders } from '../../../../testing/mocks';
+import type { UserEvent } from '@testing-library/user-event';
import userEvent from '@testing-library/user-event';
import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext';
import { queriesMock } from 'app-shared/mocks/queriesMock';
@@ -186,7 +187,7 @@ const getTabs = (): { addImageTab: HTMLElement; pasteUrlTab: HTMLElement } => {
};
};
-const goToExternalUrlTab = async (user) => {
+const goToExternalUrlTab = async (user: UserEvent) => {
await user.click(
screen.getByRole('tab', {
name: textMock('ux_editor.properties_panel.images.enter_external_url_tab_title'),
@@ -194,15 +195,14 @@ const goToExternalUrlTab = async (user) => {
);
};
-const clickExistingUrlButton = async (user, existingExternalUrl: string) => {
+const clickExistingUrlButton = async (user: UserEvent, existingExternalUrl: string) => {
const existingUrlButton = screen.getByRole('button', {
- name:
- textMock('ux_editor.properties_panel.images.enter_external_url') + ' ' + existingExternalUrl,
+ name: existingExternalUrl,
});
await user.click(existingUrlButton);
};
-const enterUrlInField = async (user, url: string | undefined) => {
+const enterUrlInField = async (user: UserEvent, url: string | undefined) => {
const enterUrlField = screen.getByRole('textbox', {
name: textMock('ux_editor.properties_panel.images.enter_external_url'),
});
diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.module.css b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.module.css
index 5fa067d03b6..4a0b85b0d44 100644
--- a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.module.css
+++ b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.module.css
@@ -1,7 +1,3 @@
-.missingUrl {
- font-style: italic;
-}
-
.alertContainer {
padding: 0 var(--fds-spacing-3);
}
diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.test.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.test.tsx
index 212282cf99a..c6ee29f68cc 100644
--- a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.test.tsx
+++ b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.test.tsx
@@ -9,6 +9,7 @@ import { QueryKey } from 'app-shared/types/QueryKey';
import { app, org } from '@studio/testing/testids';
import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext';
import { queriesMock } from 'app-shared/mocks/queriesMock';
+import type { UserEvent } from '@testing-library/user-event';
import userEvent from '@testing-library/user-event';
import type { ExternalImageUrlValidationResponse } from 'app-shared/types/api/ExternalImageUrlValidationResponse';
@@ -223,23 +224,17 @@ const getInvalidUrlErrorMessage = () =>
const getNotAnImageErrorMessage = () =>
screen.getByText(textMock('ux_editor.properties_panel.images.invalid_external_url_not_an_image'));
-const getExistingUrlButton = (url: string) =>
- screen.getByRole('button', {
- name: textMock('ux_editor.properties_panel.images.enter_external_url') + ' ' + url,
- });
+const getExistingUrlButton = (url: string) => screen.getByRole('button', { name: url });
const getEnterUrlWithPlaceholderButton = () =>
screen.getByRole('button', {
- name:
- textMock('ux_editor.properties_panel.images.enter_external_url') +
- ' ' +
- textMock('ux_editor.properties_panel.images.external_url_not_added'),
+ name: textMock('ux_editor.properties_panel.images.external_url_not_added'),
});
-const inputUrlInField = async (user, url: string) => {
+const inputUrlInField = async (user: UserEvent, url: string) => {
const inputUrlField = getInputUrlField();
+ await user.clear(inputUrlField);
if (url) await user.type(inputUrlField, url);
- else await user.clear(inputUrlField);
await waitFor(() => inputUrlField.blur());
};
diff --git a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.tsx b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.tsx
index 1e413c8f286..bab2fd9b87b 100644
--- a/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.tsx
+++ b/frontend/packages/ux-editor/src/components/config/editModal/EditImage/ExternalImage/ExternalImage.tsx
@@ -1,7 +1,6 @@
-import type { ChangeEvent } from 'react';
import React, { useEffect, useState } from 'react';
import { LinkIcon } from '@studio/icons';
-import { StudioToggleableTextfield } from '@studio/components';
+import { StudioIconTextfield, StudioToggleableTextfield } from '@studio/components';
import { useTranslation } from 'react-i18next';
import classes from './ExternalImage.module.css';
import { useValidateImageExternalUrlQuery } from 'app-shared/hooks/queries/useValidateImageExternalUrlQuery';
@@ -22,7 +21,6 @@ export const ExternalImage = ({
onUrlDelete,
imageOriginsFromLibrary,
}: ExternalImageProps) => {
- const { t } = useTranslation();
const { org, app } = useStudioEnvironmentParams();
const [url, setUrl] = useState(existingImageUrl);
const { data: validationResult, status: validationStatus } = useValidateImageExternalUrlQuery(
@@ -38,39 +36,18 @@ export const ExternalImage = ({
}, [validationResult, validationStatus, onUrlChange, url, existingImageUrl]);
const handleBlur = async (newUrl: string) => {
- if (isBLurInitialWithEmptyInput(url, newUrl)) return;
- if (newUrl === '') {
+ if (newUrl === '' && !isBLurInitialWithEmptyInput(url, newUrl)) {
onUrlDelete();
- setUrl(undefined);
- return;
}
setUrl(newUrl);
};
return (
<>
-
- {t('ux_editor.properties_panel.images.external_url_not_added')}
-
- ),
- label: t('ux_editor.properties_panel.images.enter_external_url'),
- title: url,
- variant: 'tertiary',
- fullWidth: true,
- icon: ,
- }}
- inputProps={{
- icon: ,
- value: existingImageUrl,
- onBlur: ({ target }: ChangeEvent) => handleBlur(target.value),
- label: t('ux_editor.properties_panel.images.enter_external_url'),
- size: 'small',
- }}
- setViewModeByDefault={!!existingImageUrl}
- autoFocus={false}
+ handleBlur(event.target.value)}
/>
{!!url && (
) => void;
+};
+
+const EditUrl = ({ url, existingImageUrl, onBlur }: EditUrlProps): React.ReactElement => {
+ const { t } = useTranslation();
+ const [isViewMode, setIsViewMode] = useState(false);
+
+ const noUrlProvided = url === undefined && !existingImageUrl;
+ const label = t('ux_editor.properties_panel.images.enter_external_url');
+ const noUrlText = t('ux_editor.properties_panel.images.external_url_not_added');
+ const currentUrl = !url ? noUrlText : url;
+ const showValue = currentUrl !== noUrlText || isViewMode;
+ const value = showValue ? currentUrl : undefined;
+
+ return noUrlProvided ? (
+
+ ) : (
+
+ );
+};
+
const isBLurInitialWithEmptyInput = (existingUrl: string, newUrl: string) =>
newUrl === '' && existingUrl === undefined;
diff --git a/frontend/packages/ux-editor/src/containers/DesignView/AddItem/ItemInfo/ItemInfo.tsx b/frontend/packages/ux-editor/src/containers/DesignView/AddItem/ItemInfo/ItemInfo.tsx
index f8a333fc05f..42f8372ae90 100644
--- a/frontend/packages/ux-editor/src/containers/DesignView/AddItem/ItemInfo/ItemInfo.tsx
+++ b/frontend/packages/ux-editor/src/containers/DesignView/AddItem/ItemInfo/ItemInfo.tsx
@@ -55,7 +55,7 @@ export const ItemInfo = ({ item, onAddItem, onCancel, setItem }: ItemInfoProps)
description={t('ux_editor.add_item.component_info_generated_id_description')}
>
}
+ Icon={PencilIcon}
label={t('Komponent ID')}
value={item.componentId}
onChange={(event: any) => {
diff --git a/frontend/testing/playwright/pages/ProcessEditorPage/ProcessEditorPage.ts b/frontend/testing/playwright/pages/ProcessEditorPage/ProcessEditorPage.ts
index 10caad4cbf7..f2a4318c9a2 100644
--- a/frontend/testing/playwright/pages/ProcessEditorPage/ProcessEditorPage.ts
+++ b/frontend/testing/playwright/pages/ProcessEditorPage/ProcessEditorPage.ts
@@ -86,7 +86,7 @@ export class ProcessEditorPage extends BasePage {
public async waitForEditIdInputFieldToBeVisible(): Promise {
const inputField = this.page.getByRole('textbox', {
- name: this.textMock('process_editor.configuration_panel_change_task_id'),
+ name: this.textMock('process_editor.configuration_panel_change_task_id_label'),
});
await expect(inputField).toBeVisible();
}
@@ -94,7 +94,7 @@ export class ProcessEditorPage extends BasePage {
public async emptyIdTextfield(): Promise {
await this.page
.getByRole('textbox', {
- name: this.textMock('process_editor.configuration_panel_change_task_id'),
+ name: this.textMock('process_editor.configuration_panel_change_task_id_label'),
})
.clear();
}
@@ -102,14 +102,14 @@ export class ProcessEditorPage extends BasePage {
public async writeNewId(id: string): Promise {
await this.page
.getByRole('textbox', {
- name: this.textMock('process_editor.configuration_panel_change_task_id'),
+ name: this.textMock('process_editor.configuration_panel_change_task_id_label'),
})
.fill(id);
}
public async waitForTextBoxToHaveValue(id: string): Promise {
const textBox = this.page.getByRole('textbox', {
- name: this.textMock('process_editor.configuration_panel_change_task_id'),
+ name: this.textMock('process_editor.configuration_panel_change_task_id_label'),
});
await expect(textBox).toHaveValue(id);
}
@@ -117,7 +117,7 @@ export class ProcessEditorPage extends BasePage {
public async saveNewId(): Promise {
await this.page
.getByRole('textbox', {
- name: this.textMock('process_editor.configuration_panel_change_task_id'),
+ name: this.textMock('process_editor.configuration_panel_change_task_id_label'),
})
.blur();
}