Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: "Upload codelist" functionality in component config #13763

Merged
merged 43 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4b20b88
Fix link in codelist config.
Konrad-Simso Oct 8, 2024
89a22f2
Upload button added.
Konrad-Simso Oct 10, 2024
f627d58
Edit language and fix typing.
Konrad-Simso Oct 10, 2024
ce088e4
Fix linting, rename variable and allow trailing commas, it gets fixed…
Konrad-Simso Oct 10, 2024
9cc37a3
Rename useValidateFileName.ts to validateFileNameUtils.ts
Konrad-Simso Oct 10, 2024
9a23d27
Add test for useAddOptionMutation.ts
Konrad-Simso Oct 10, 2024
e199eaf
Add tests for EditCodeList.tsx and remove a toast as it's not correct…
Konrad-Simso Oct 10, 2024
73e8b3b
Edit tests and remove unused imports
Konrad-Simso Oct 10, 2024
627433d
Rename hook to use react-hook rules.
Konrad-Simso Oct 10, 2024
1b5bb7a
Edit filename again
Konrad-Simso Oct 10, 2024
da0bb76
Render hook correctly in test file.
Konrad-Simso Oct 10, 2024
d9542a1
Fix whitespaces in backend for linting.
Konrad-Simso Oct 10, 2024
ac92608
Fixing spacing
Konrad-Simso Oct 10, 2024
f230629
Move file out of Utils folder, since it's a React hook and not a util…
Konrad-Simso Oct 10, 2024
efd12b8
Endringer fra review.
Konrad-Simso Oct 11, 2024
541efa4
Refactor useValidateFileName into smaller utils functions and move re…
Konrad-Simso Oct 11, 2024
1fb11bf
- Rename function in validateFileNameUtils.ts
Konrad-Simso Oct 11, 2024
bbc4c79
- Add check for when FormField should be visible.
Konrad-Simso Oct 11, 2024
b24128c
Remove unused import.
Konrad-Simso Oct 11, 2024
6819cfa
- Less generic catch.
Konrad-Simso Oct 11, 2024
3308902
Remove unused imports again
Konrad-Simso Oct 11, 2024
735a0a1
Edit styling
Konrad-Simso Oct 14, 2024
1af9611
Merge branch 'main' into feature/codelist-configuration
Konrad-Simso Oct 14, 2024
155196c
Remove a test and fix 2 tests.
Konrad-Simso Oct 14, 2024
2395cec
Edit test and replace forEach with for of loops for iterator object.
Konrad-Simso Oct 15, 2024
ae5ccbf
Remove unused parameter, extract filename from File
Konrad-Simso Oct 15, 2024
06087e3
Changes from 2nd review:
Konrad-Simso Oct 15, 2024
8640803
fixed typing of props, and changed an error message.
Konrad-Simso Oct 16, 2024
fd06550
Simplify file uploader component
TomasEng Oct 16, 2024
9a603ca
Update file name
TomasEng Oct 16, 2024
2b5218a
Update reference to updated file name
TomasEng Oct 16, 2024
6f2b3a0
Edit import statement
Konrad-Simso Oct 16, 2024
1f7ae0a
Updated `FileUploaderWithValidation.tsx`
Konrad-Simso Oct 16, 2024
9182ce8
Merge branch 'simplify-file-uploader' into feature/codelist-configura…
Konrad-Simso Oct 16, 2024
55609b0
Refactoring
Konrad-Simso Oct 16, 2024
a594d40
Update tests
Konrad-Simso Oct 16, 2024
7ae920d
Merge branch 'main' into feature/codelist-configuration
TomasEng Oct 17, 2024
1a05b9e
Updates from 3rd review
Konrad-Simso Oct 17, 2024
388d011
Update nb.json and edit texts for tests.
Konrad-Simso Oct 17, 2024
34cbb40
Update test
Konrad-Simso Oct 17, 2024
c0fa350
Updates from testing:
Konrad-Simso Oct 22, 2024
4aa4506
Merge branch 'main' into feature/codelist-configuration
ErlingHauan Oct 22, 2024
a853e5f
Fix type error
ErlingHauan Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions backend/src/Designer/Controllers/OptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,26 @@ public async Task<ActionResult> CreateOrOverwriteOptionsList(string org, string
return Ok(newOptionsList);
}

/// <summary>
/// Create new options list.
/// </summary>
/// <param name="org">Unique identifier of the organisation responsible for the app.</param>
/// <param name="repo">Application identifier which is unique within an organisation.</param>
/// <param name="file">File being uploaded.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/> that observes if operation is cancelled.</param>
[HttpPost]
[Route("upload")]
public async Task<IActionResult> UploadFile(string org, string repo, [FromForm] IFormFile file, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext);
string fileName = file.FileName.Replace(".json", "");

List<Option> newOptionsList = await _optionsService.UploadNewOption(org, repo, developer, fileName, file, cancellationToken);

return Ok(newOptionsList);
}

/// <summary>
/// Deletes an option list.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,15 @@ public async Task<string> GetOptionsList(string optionsListId, CancellationToken
/// <param name="payload">The contents of the new options list as a string</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that observes if operation is cancelled.</param>
/// <returns>The new options list as a string.</returns>
public async Task<string> CreateOrOverwriteOptionsList(string optionsListId, string payload, CancellationToken cancellationToken = default)
public async Task<string> CreateOrOverwriteOptionsList(string optionsListId, List<Option> payload, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();

var serialiseOptions = new JsonSerializerOptions { WriteIndented = true };
string payloadString = JsonSerializer.Serialize(payload, serialiseOptions);

string optionsFilePath = Path.Combine(OptionsFolderPath, $"{optionsListId}.json");
await WriteTextByRelativePathAsync(optionsFilePath, payload, true, cancellationToken);
await WriteTextByRelativePathAsync(optionsFilePath, payloadString, true, cancellationToken);
string fileContent = await ReadTextByRelativePathAsync(optionsFilePath, cancellationToken);

return fileContent;
Expand Down
18 changes: 16 additions & 2 deletions backend/src/Designer/Services/Implementation/OptionsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Altinn.Studio.Designer.Models;
using Altinn.Studio.Designer.Services.Interfaces;
using LibGit2Sharp;
using Microsoft.AspNetCore.Http;

namespace Altinn.Studio.Designer.Services.Implementation;

Expand Down Expand Up @@ -57,13 +58,26 @@ public async Task<List<Option>> CreateOrOverwriteOptionsList(string org, string
cancellationToken.ThrowIfCancellationRequested();
var altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(org, repo, developer);

string payloadString = JsonSerializer.Serialize(payload, new JsonSerializerOptions() { WriteIndented = true });
string updatedOptionsString = await altinnAppGitRepository.CreateOrOverwriteOptionsList(optionsListId, payloadString, cancellationToken);
string updatedOptionsString = await altinnAppGitRepository.CreateOrOverwriteOptionsList(optionsListId, payload, cancellationToken);
var updatedOptions = JsonSerializer.Deserialize<List<Option>>(updatedOptionsString);

return updatedOptions;
}

/// <inheritdoc />
public async Task<List<Option>> UploadNewOption(string org, string repo, string developer, string optionsListId, IFormFile payload, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();

List<Option> deserializedOptions = JsonSerializer.Deserialize<List<Option>>(payload.OpenReadStream(),
new JsonSerializerOptions { WriteIndented = true, AllowTrailingCommas = true });

var altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(org, repo, developer);
await altinnAppGitRepository.CreateOrOverwriteOptionsList(optionsListId, deserializedOptions, cancellationToken);

return deserializedOptions;
}

/// <inheritdoc />
public void DeleteOptionsList(string org, string repo, string developer, string optionsListId)
{
Expand Down
13 changes: 13 additions & 0 deletions backend/src/Designer/Services/Interfaces/IOptionsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading;
using System.Threading.Tasks;
using Altinn.Studio.Designer.Models;
using Microsoft.AspNetCore.Http;

namespace Altinn.Studio.Designer.Services.Interfaces;

Expand Down Expand Up @@ -42,6 +43,18 @@ public interface IOptionsService
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that observes if operation is cancelled.</param>
public Task<List<Option>> CreateOrOverwriteOptionsList(string org, string repo, string developer, string optionsListId, List<Option> payload, CancellationToken cancellationToken = default);

/// <summary>
/// Adds a new option to the option list.
/// If the file already exists, it will be overwritten.
/// </summary>
/// <param name="org">Orginisation</param>
/// <param name="repo">Repository</param>
/// <param name="developer">Username of developer</param>
/// <param name="optionsListId">Name of the new options list</param>
/// <param name="payload">The options list contents</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that observes if operation is cancelled.</param>
public Task<List<Option>> UploadNewOption(string org, string repo, string developer, string optionsListId, IFormFile payload, CancellationToken cancellationToken = default);

/// <summary>
/// Deletes an options list from the app repository.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public async Task CreateOrOverwriteOptions_WithAppThatHasNoOptionLists_ShouldCre
string newOptionsListString = JsonSerializer.Serialize(newOptionsList, jsonOptions);

// Act
string savedOptionsList = await altinnAppGitRepository.CreateOrOverwriteOptionsList(newOptionName, newOptionsListString);
string savedOptionsList = await altinnAppGitRepository.CreateOrOverwriteOptionsList(newOptionName, newOptionsList);

// Assert
Assert.Equal(newOptionsListString, savedOptionsList);
Expand Down Expand Up @@ -372,7 +372,7 @@ public async Task CreateOrOverwriteOptions_WithAppThatHasOptionLists_ShouldOverw
string newOptionsListString = JsonSerializer.Serialize(newOptionsList, jsonOptions);

// Act
string savedOptionsList = await altinnAppGitRepository.CreateOrOverwriteOptionsList(newOptionName, newOptionsListString);
string savedOptionsList = await altinnAppGitRepository.CreateOrOverwriteOptionsList(newOptionName, newOptionsList);

// Assert
Assert.Equal(newOptionsListString, savedOptionsList);
Expand Down
3 changes: 3 additions & 0 deletions frontend/language/src/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,9 @@
"ux_editor.modal_properties_code_list_read_more": "<0 href=\"{{optionsDocs}}\" >Les mer om kodelister</0>",
"ux_editor.modal_properties_code_list_read_more_dynamic": "<0 href=\"{{optionsDocs}}\" >Les mer om dynamiske kodelister</0>",
"ux_editor.modal_properties_code_list_read_more_static": "<0 href=\"{{optionsDocs}}\" >Les mer om statiske kodelister</0>",
"ux_editor.modal_properties_code_list_upload": "Last opp din egen kodeliste",
"ux_editor.modal_properties_code_list_upload_duplicate_error": "Opplastning feilet, du prøvde å laste opp en fil som finnes fra før.",
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
"ux_editor.modal_properties_code_list_upload_success": "Filen ble lastet opp.",
"ux_editor.modal_properties_component_change_id": "Komponent-ID",
"ux_editor.modal_properties_component_change_id_information": "Ved redigering av komponent ID vil Studio automatisk oppdatere IDen der den er brukt som referanse, men det er ikke garantert at alle eksemplarer er oppdatert.",
"ux_editor.modal_properties_component_id_not_unique_error": "Komponenten må ha en unik ID",
Expand Down
2 changes: 2 additions & 0 deletions frontend/packages/shared/src/api/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
altinn2DelegationsMigrationPath,
imagePath,
addImagePath,
optionListPath,
} from 'app-shared/api/paths';
import type { AddLanguagePayload } from 'app-shared/types/api/AddLanguagePayload';
import type { AddRepoParams } from 'app-shared/types/api';
Expand Down Expand Up @@ -113,6 +114,7 @@ export const updateAppPolicy = (org: string, app: string, payload: Policy) => pu
export const updateAppMetadata = (org: string, app: string, payload: ApplicationMetadata) => put(appMetadataPath(org, app), payload);
export const updateAppConfig = (org: string, app: string, payload: AppConfig) => post(serviceConfigPath(org, app), payload);
export const uploadDataModel = (org: string, app: string, form: FormData) => post<void, FormData>(dataModelsUploadPath(org, app), form, { headers: { 'Content-Type': 'multipart/form-data' } });
export const uploadOption = (org: string, app: string, payload: FormData) => post<void, FormData>(optionListPath(org, app), payload, { headers: { 'Content-Type': 'multipart/form-data' } });
export const upsertTextResources = (org: string, app: string, language: string, payload: ITextResourcesObjectFormat) => put<ITextResourcesObjectFormat>(textResourcesPath(org, app, language), payload);

// Resourceadm
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/shared/src/api/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const dataModelAddXsdFromRepoPath = (org, app, filePath) => `${basePath}/
export const ruleHandlerPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/rule-handler?${s({ layoutSetName })}`; // Get, Post
export const widgetSettingsPath = (org, app) => `${basePath}/${org}/${app}/app-development/widget-settings`; // Get
export const optionListsPath = (org, app) => `${basePath}/${org}/${app}/options/option-lists`; // Get
export const optionListPath = (org, app) => `${basePath}/${org}/${app}/options/upload/`; // Post
export const optionListIdsPath = (org, app) => `${basePath}/${org}/${app}/app-development/option-list-ids`; // Get
export const ruleConfigPath = (org, app, layoutSetName) => `${basePath}/${org}/${app}/app-development/rule-config?${s({ layoutSetName })}`; // Get, Post
export const appMetadataModelIdsPath = (org, app, onlyUnReferenced) => `${basePath}/${org}/${app}/app-development/model-ids?${s({ onlyUnReferenced })}`; // Get
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/shared/src/mocks/queriesMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export const queriesMock: ServicesContextProps = {
updateAppMetadata: jest.fn().mockImplementation(() => Promise.resolve()),
updateAppConfig: jest.fn().mockImplementation(() => Promise.resolve()),
uploadDataModel: jest.fn().mockImplementation(() => Promise.resolve<JsonSchema>({})),
uploadOption: jest.fn().mockImplementation(() => Promise.resolve()),
upsertTextResources: jest
.fn()
.mockImplementation(() => Promise.resolve<ITextResourcesObjectFormat>({})),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.studioFileUploader {
padding-top: var(--fds-spacing-4);
}

.linkStaticCodeLists {
margin-bottom: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import userEvent from '@testing-library/user-event';
import { textMock } from '@studio/testing/mocks/i18nMock';
import { createQueryClientMock } from 'app-shared/mocks/queryClientMock';
import type { FormComponent } from '../../../../../types/FormComponent';
import { fileSelectorInputId } from '@studio/testing/testids';

const mockComponent: FormComponent<ComponentType.Dropdown> = {
id: 'c24d0812-0c34-4582-8f31-ff4ce9795e96',
Expand Down Expand Up @@ -130,6 +131,54 @@ describe('EditCodeList', () => {
await screen.findByText(textMock('ux_editor.modal_properties_error_message')),
).toBeInTheDocument();
});

it('should render success toast if file upload is successful', async () => {
const user = userEvent.setup();
const file = new File(['hello'], 'hello.json', { type: 'text/json' });
await render({
queries: {
getOptionListIds: jest
.fn()
.mockImplementation(() => Promise.resolve<string[]>(optionListIdsMock)),
},
});

const btn = screen.getByText(textMock('ux_editor.modal_properties_code_list_upload'));
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
await user.click(btn);

const fileInput = screen.getByTestId(fileSelectorInputId);

await user.upload(fileInput, file);

expect(await screen.findByRole('alert')).toHaveTextContent(
textMock('ux_editor.modal_properties_code_list_upload_success'),
);
});

it('should render error toast if file already exists', async () => {
const user = userEvent.setup();
const file = new File([optionListIdsMock[0]], optionListIdsMock[0] + '.json', {
type: 'text/json',
});
await render({
queries: {
getOptionListIds: jest
.fn()
.mockImplementation(() => Promise.resolve<string[]>(optionListIdsMock)),
},
});

const btn = screen.getByText(textMock('ux_editor.modal_properties_code_list_upload'));
await user.click(btn);

const fileInput = screen.getByTestId(fileSelectorInputId);

await user.upload(fileInput, file);

expect(await screen.findByRole('alert')).toHaveTextContent(
textMock('ux_editor.modal_properties_code_list_upload_duplicate_error'),
);
});
});

const render = async ({
Expand Down
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@ import React from 'react';
import { Alert, ErrorMessage } from '@digdir/designsystemet-react';
import type { IGenericEditComponent } from '../../../componentConfig';
import { useOptionListIdsQuery } from '../../../../../hooks/queries/useOptionListIdsQuery';
import { useAddOptionMutation } from '../../../../../hooks/mutations/useAddOptionMutation';
import { useTranslation, Trans } from 'react-i18next';
import { StudioNativeSelect, StudioSpinner } from '@studio/components';

import { StudioFileUploader, StudioNativeSelect, StudioSpinner } from '@studio/components';
import { altinnDocsUrl } from 'app-shared/ext-urls';
import { FormField } from '../../../../FormField';
import { useStudioEnvironmentParams } from 'app-shared/hooks/useStudioEnvironmentParams';
import { ManualCodelistUploadSteps } from './ManualCodelistUploadSteps';
import type { SelectionComponentType } from '../../../../../types/FormComponent';
import { fileSelectorInputId } from '@studio/testing/testids';
import { removeExtension } from 'app-shared/utils/filenameUtils';
import { useValidateFileName } from './useValidateFileName';
import { toast } from 'react-toastify';
import classes from './EditCodeList.module.css';

export function EditCodeList<T extends SelectionComponentType>({
component,
handleComponentChange,
}: IGenericEditComponent<T>) {
const { t } = useTranslation();
const { org, app } = useStudioEnvironmentParams();

const { data: optionListIds, isPending, isError, error } = useOptionListIdsQuery(org, app);
const { mutate: uploadOption } = useAddOptionMutation(org, app);
TomasEng marked this conversation as resolved.
Show resolved Hide resolved

const handleOptionsIdChange = (optionsId: string) => {
if (component.options) {
Expand All @@ -31,6 +36,25 @@ export function EditCodeList<T extends SelectionComponentType>({
});
};

const { validateFileName, getDuplicatedOptionIds } = useValidateFileName(optionListIds);

const handleInvalidFileName = (file?: FormData, fileName?: string) => {
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
const fileNameWithoutExtension = removeExtension(fileName);
if (getDuplicatedOptionIds(optionListIds, fileNameWithoutExtension)) {
toast.error(t('ux_editor.modal_properties_code_list_upload_duplicate_error'));
}
};

const handleUpload = (file: FormData) => {
uploadOption(file, {
onSuccess: () => {
toast.success(t('ux_editor.modal_properties_code_list_upload_success'));
},
});
};

const fileInputRef = React.useRef<HTMLInputElement>(null);
TomasEng marked this conversation as resolved.
Show resolved Hide resolved

return (
<div>
{isPending ? (
Expand Down Expand Up @@ -74,10 +98,25 @@ export function EditCodeList<T extends SelectionComponentType>({
)}
/>
)}
<p style={{ marginBottom: 0 }}>
<div className={classes.studioFileUploader}>
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
<StudioFileUploader
onUploadFile={handleUpload}
accept='.json'
variant={'tertiary'}
uploaderButtonText={t('ux_editor.modal_properties_code_list_upload')}
ref={fileInputRef}
customFileValidation={{
validateFileName: validateFileName,
onInvalidFileName: handleInvalidFileName,
}}
dataTestId={fileSelectorInputId}
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>

<p className={classes.linkStaticCodeLists}>
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
<Trans i18nKey={'ux_editor.modal_properties_code_list_read_more_static'}>
<a
href={altinnDocsUrl('altinn-studio/guides/options/static-codelists/')}
href={altinnDocsUrl('altinn-studio/reference/data/options/static-codelists/')}
target='_newTab'
rel='noopener noreferrer'
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useValidateFileName } from './useValidateFileName';
import { renderHook } from '@testing-library/react';

const optionIdOne = 'one';
const optionIdTwo = 'two';
const options: string[] = [optionIdOne];
TomasEng marked this conversation as resolved.
Show resolved Hide resolved
const result = renderHook(() => useValidateFileName(options)).result.current;

describe('validateFileNameUtils', () => {
it('should return true for valid filename', () => {
expect(result.validateFileName(optionIdTwo + '.json')).toBe(true);
});

it('should return false for invalid filename', () => {
jest.spyOn(window, 'alert').mockImplementation(() => {});
expect(result.validateFileName('_test.json')).toBe(false);
expect(window.alert).toHaveBeenCalled();
});

it('should return true for duplicate found', () => {
expect(result.getDuplicatedOptionIds(options, optionIdOne)).toBe(true);
});

it('should return false for new value', () => {
expect(result.getDuplicatedOptionIds(options, optionIdTwo)).toBe(false);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { removeExtension } from 'app-shared/utils/filenameUtils';
import { useTranslation } from 'react-i18next';

export const useValidateFileName = (optionListIds: string[]) => {
const { t } = useTranslation();

const fileNameRegEx: RegExp = /^[a-zA-Z][a-zA-Z0-9_.\-æÆøØåÅ ]*$/;
const validateFileName = (fileName: string): boolean => {
const fileNameWithoutExtension = removeExtension(fileName);
const nameFollowsRegexRules = Boolean(fileName.match(fileNameRegEx));

if (!nameFollowsRegexRules) {
alert(t('app_data_modelling.upload_xsd_invalid_name_error'));
return false;
}
return !Boolean(optionListIds.find((option) => option === fileNameWithoutExtension));
};
TomasEng marked this conversation as resolved.
Show resolved Hide resolved

const getDuplicatedOptionIds = (
optionListIds: string[],
fileNameWithoutExtension: string,
): boolean => {
return Boolean(optionListIds.find((option) => option === fileNameWithoutExtension));
};
TomasEng marked this conversation as resolved.
Show resolved Hide resolved

return {
validateFileName,
getDuplicatedOptionIds,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
padding: var(--fds-spacing-5) 0;
}

.codelistTabContent {
padding: var(--fds-spacing-4);
}

.optionsHeading {
padding-left: var(--fds-spacing-5);
}
Loading
Loading