From 92394e73a7fede4da31c5f3b7156c6a67cf1923f Mon Sep 17 00:00:00 2001 From: Mirko Sekulic Date: Thu, 7 Dec 2023 15:15:49 +0100 Subject: [PATCH 1/4] Support semantic version for app-lib version endpoint (#11812) * Use semantic version * adding revision version in tests --- .../Controllers/ProcessModelingController.cs | 5 +++-- .../src/Designer/Helpers/PackageVersionHelper.cs | 6 +++--- .../Implementation/AppDevelopmentService.cs | 5 +++-- .../ProcessModeling/ProcessModelingService.cs | 13 +++++++------ .../Services/Interfaces/IAppDevelopmentService.cs | 2 +- .../Services/Interfaces/IProcessModelingService.cs | 8 ++++---- .../Designer/ViewModels/Response/VersionResponse.cs | 3 ++- .../GetVersionOfTheAppLibTests.cs | 1 + .../ProcessModelingController/GetTemplatesTests.cs | 1 + .../SaveProcessDefinitionFromTemplateTests.cs | 1 + .../Helpers/PackageVersionHelperTests.cs | 2 +- .../Services/ProcessModelingServiceTests.cs | 3 ++- 12 files changed, 29 insertions(+), 21 deletions(-) diff --git a/backend/src/Designer/Controllers/ProcessModelingController.cs b/backend/src/Designer/Controllers/ProcessModelingController.cs index 6f5f9a18c93..94361b99ff2 100644 --- a/backend/src/Designer/Controllers/ProcessModelingController.cs +++ b/backend/src/Designer/Controllers/ProcessModelingController.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using NuGet.Versioning; namespace Altinn.Studio.Designer.Controllers { @@ -56,14 +57,14 @@ public async Task SaveProcessDefinition(string org, string repo, } [HttpGet("templates/{appVersion}")] - public IEnumerable GetTemplates(string org, string repo, Version appVersion) + public IEnumerable GetTemplates(string org, string repo, SemanticVersion appVersion) { Guard.AssertArgumentNotNull(appVersion, nameof(appVersion)); return _processModelingService.GetProcessDefinitionTemplates(appVersion); } [HttpPut("templates/{appVersion}/{templateName}")] - public async Task SaveProcessDefinitionFromTemplate(string org, string repo, Version appVersion, string templateName, CancellationToken cancellationToken) + public async Task SaveProcessDefinitionFromTemplate(string org, string repo, SemanticVersion appVersion, string templateName, CancellationToken cancellationToken) { Guard.AssertArgumentNotNull(appVersion, nameof(appVersion)); string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext); diff --git a/backend/src/Designer/Helpers/PackageVersionHelper.cs b/backend/src/Designer/Helpers/PackageVersionHelper.cs index b8eb167b358..ae294de1429 100644 --- a/backend/src/Designer/Helpers/PackageVersionHelper.cs +++ b/backend/src/Designer/Helpers/PackageVersionHelper.cs @@ -1,12 +1,13 @@ using System.Linq; using System.Xml.Linq; using System.Xml.XPath; +using NuGet.Versioning; namespace Altinn.Studio.Designer.Helpers { public static class PackageVersionHelper { - public static bool TryGetPackageVersionFromCsprojFile(string csprojFilePath, string packageName, out System.Version version) + public static bool TryGetPackageVersionFromCsprojFile(string csprojFilePath, string packageName, out SemanticVersion version) { version = null; var doc = XDocument.Load(csprojFilePath); @@ -26,8 +27,7 @@ public static bool TryGetPackageVersionFromCsprojFile(string csprojFilePath, str return false; } - version = System.Version.Parse(versionString); - return true; + return SemanticVersion.TryParse(versionString, out version); } } } diff --git a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs index 805c1963b1c..e7c50f611c5 100644 --- a/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs +++ b/backend/src/Designer/Services/Implementation/AppDevelopmentService.cs @@ -10,6 +10,7 @@ using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Services.Interfaces; using Microsoft.AspNetCore.Http; +using NuGet.Versioning; namespace Altinn.Studio.Designer.Services.Implementation { @@ -218,7 +219,7 @@ public async Task SaveRuleConfig(AltinnRepoEditingContext altinnRepoEditingConte } /// - public Version GetAppLibVersion(AltinnRepoEditingContext altinnRepoEditingContext) + public SemanticVersion GetAppLibVersion(AltinnRepoEditingContext altinnRepoEditingContext) { AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); @@ -226,7 +227,7 @@ public Version GetAppLibVersion(AltinnRepoEditingContext altinnRepoEditingContex foreach (string csprojFile in csprojFiles) { - if (PackageVersionHelper.TryGetPackageVersionFromCsprojFile(csprojFile, "Altinn.App.Api", out Version version)) + if (PackageVersionHelper.TryGetPackageVersionFromCsprojFile(csprojFile, "Altinn.App.Api", out SemanticVersion version)) { return version; } diff --git a/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs b/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs index df29ba7aea6..71dc3035a61 100644 --- a/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs +++ b/backend/src/Designer/Services/Implementation/ProcessModeling/ProcessModelingService.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Collections.Generic; using System.IO; @@ -10,6 +10,7 @@ using Altinn.Studio.Designer.Infrastructure.GitRepository; using Altinn.Studio.Designer.Models; using Altinn.Studio.Designer.Services.Interfaces; +using NuGet.Versioning; namespace Altinn.Studio.Designer.Services.Implementation.ProcessModeling { @@ -21,10 +22,10 @@ public ProcessModelingService(IAltinnGitRepositoryFactory altinnGitRepositoryFac _altinnGitRepositoryFactory = altinnGitRepositoryFactory; } - private string TemplatesFolderIdentifier(Version version) => string.Join(".", nameof(Services), nameof(Implementation), nameof(ProcessModeling), "Templates", $"v{version.Major}"); + private string TemplatesFolderIdentifier(SemanticVersion version) => string.Join(".", nameof(Services), nameof(Implementation), nameof(ProcessModeling), "Templates", $"v{version.Major}"); /// - public IEnumerable GetProcessDefinitionTemplates(Version version) + public IEnumerable GetProcessDefinitionTemplates(SemanticVersion version) { return EnumerateTemplateResources(version) .Select( @@ -32,7 +33,7 @@ public IEnumerable GetProcessDefinitionTemplates(Version version) } /// - public async Task SaveProcessDefinitionFromTemplateAsync(AltinnRepoEditingContext altinnRepoEditingContext, string templateName, Version version, CancellationToken cancellationToken = default) + public async Task SaveProcessDefinitionFromTemplateAsync(AltinnRepoEditingContext altinnRepoEditingContext, string templateName, SemanticVersion version, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); AltinnAppGitRepository altinnAppGitRepository = _altinnGitRepositoryFactory.GetAltinnAppGitRepository(altinnRepoEditingContext.Org, altinnRepoEditingContext.Repo, altinnRepoEditingContext.Developer); @@ -86,13 +87,13 @@ public async Task UpdateProcessTaskNameAsync(AltinnRepoEditingContext al return processStream; } - private IEnumerable EnumerateTemplateResources(Version version) + private IEnumerable EnumerateTemplateResources(SemanticVersion version) { return typeof(ProcessModelingService).Assembly.GetManifestResourceNames() .Where(resourceName => resourceName.Contains(TemplatesFolderIdentifier(version))); } - private Stream GetTemplateStream(Version version, string templateName) + private Stream GetTemplateStream(SemanticVersion version, string templateName) { var templates = EnumerateTemplateResources(version).ToList(); if (!templates.Exists(template => template.EndsWith(templateName))) diff --git a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs index 3d42bd9521c..30dde252729 100644 --- a/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs +++ b/backend/src/Designer/Services/Interfaces/IAppDevelopmentService.cs @@ -133,6 +133,6 @@ public interface IAppDevelopmentService /// /// An . /// A holding the version of the app-lib used in app. - public System.Version GetAppLibVersion(AltinnRepoEditingContext altinnRepoEditingContext); + public NuGet.Versioning.SemanticVersion GetAppLibVersion(AltinnRepoEditingContext altinnRepoEditingContext); } } diff --git a/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs b/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs index db1a533a6b0..cc5e61db789 100644 --- a/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs +++ b/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; using Altinn.Studio.Designer.Models; +using NuGet.Versioning; namespace Altinn.Studio.Designer.Services.Interfaces { @@ -14,7 +14,7 @@ public interface IProcessModelingService /// /// Version of the app-lib /// An IEnumerable containing supported templates for given version. - IEnumerable GetProcessDefinitionTemplates(Version version); + IEnumerable GetProcessDefinitionTemplates(SemanticVersion version); /// /// Saves the process definition file for a given app from a template. @@ -23,7 +23,7 @@ public interface IProcessModelingService /// Name of the template. /// Version of the app-lib. /// A that observes if operation is cancelled. - Task SaveProcessDefinitionFromTemplateAsync(AltinnRepoEditingContext altinnRepoEditingContext, string templateName, Version version, CancellationToken cancellationToken = default); + Task SaveProcessDefinitionFromTemplateAsync(AltinnRepoEditingContext altinnRepoEditingContext, string templateName, SemanticVersion version, CancellationToken cancellationToken = default); /// /// Saves the process definition file for a given app. diff --git a/backend/src/Designer/ViewModels/Response/VersionResponse.cs b/backend/src/Designer/ViewModels/Response/VersionResponse.cs index 1086105e06a..8ad970cb904 100644 --- a/backend/src/Designer/ViewModels/Response/VersionResponse.cs +++ b/backend/src/Designer/ViewModels/Response/VersionResponse.cs @@ -1,9 +1,10 @@ using System; +using NuGet.Versioning; namespace Altinn.Studio.Designer.ViewModels.Response { public class VersionResponse { - public Version Version { get; set; } + public SemanticVersion Version { get; set; } } } diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs index e2c69d829a7..c82e6bcc338 100644 --- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs +++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs @@ -21,6 +21,7 @@ public GetVersionOfTheAppLibTests(WebApplicationFactory factory) : base [Theory] [InlineData("ttd", "empty-app", "testUser", "7.4.0", "Templates/AppCsprojTemplate.txt")] + [InlineData("ttd", "empty-app", "testUser", "8.0.0-preview.11", "Templates/AppCsprojTemplate.txt")] public async Task GetAppLibVersion_GivenCsProjFile_ShouldReturnOK(string org, string app, string developer, string version, string csprojTemplate) { string targetRepository = TestDataHelper.GenerateTestRepoName(); diff --git a/backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs index bca0e8d2450..c45edd8e907 100644 --- a/backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs +++ b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/GetTemplatesTests.cs @@ -19,6 +19,7 @@ public GetTemplatesTests(WebApplicationFactory factory) : base(factory) [Theory] [InlineData("ttd", "empty-app", "8.0.0", "start-data-confirmation-end.bpmn", "start-data-confirmation-feedback-end.bpmn", "start-data-end.bpmn", "start-data-signing-end.bpmn")] + [InlineData("ttd", "empty-app", "8.0.0-preview.11", "start-data-confirmation-end.bpmn", "start-data-confirmation-feedback-end.bpmn", "start-data-end.bpmn", "start-data-signing-end.bpmn")] [InlineData("ttd", "empty-app", "7.4.0", "start-data-confirmation-end.bpmn", "start-data-data-data-end.bpmn", "start-data-end.bpmn")] [InlineData("ttd", "empty-app", "6.1.0")] public async Task GetTemplates_ShouldReturnOK(string org, string app, string version, params string[] expectedTemplates) diff --git a/backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs index 6cdd98524e9..fb4c0f4e629 100644 --- a/backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs +++ b/backend/tests/Designer.Tests/Controllers/ProcessModelingController/SaveProcessDefinitionFromTemplateTests.cs @@ -33,6 +33,7 @@ public async Task SaveProcessDefinitionFromTemplate_WrongTemplate_ShouldReturn40 [Theory] [InlineData("ttd", "empty-app", "testUser", "8.0.0", "start-data-confirmation-end.bpmn")] + [InlineData("ttd", "empty-app", "testUser", "8.0.0-preview.11", "start-data-confirmation-end.bpmn")] public async Task SaveProcessDefinitionFromTemplate_ShouldReturnOk_AndSaveTemplate(string org, string app, string developer, string version, string templateName) { string targetRepository = TestDataHelper.GenerateTestRepoName(); diff --git a/backend/tests/Designer.Tests/Helpers/PackageVersionHelperTests.cs b/backend/tests/Designer.Tests/Helpers/PackageVersionHelperTests.cs index e5e2eb6b9b6..5f6bdb5a3d8 100644 --- a/backend/tests/Designer.Tests/Helpers/PackageVersionHelperTests.cs +++ b/backend/tests/Designer.Tests/Helpers/PackageVersionHelperTests.cs @@ -16,7 +16,7 @@ public void TryGetPackageVersionFromCsprojFile_GivenValidCsprojFile_ReturnsTrue( { string testTemplateCsProjPath = Path.Combine(CommonDirectoryPath.GetSolutionDirectory().DirectoryPath, "..", "testdata", "AppTemplates", "AspNet", "App", "App.csproj"); - bool result = PackageVersionHelper.TryGetPackageVersionFromCsprojFile(testTemplateCsProjPath, packageName, out Version version); + bool result = PackageVersionHelper.TryGetPackageVersionFromCsprojFile(testTemplateCsProjPath, packageName, out var version); result.Should().Be(expectedResult); diff --git a/backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs b/backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs index 8a0e04bdaae..ec8a4ad5613 100644 --- a/backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs +++ b/backend/tests/Designer.Tests/Services/ProcessModelingServiceTests.cs @@ -11,6 +11,7 @@ using Designer.Tests.Utils; using FluentAssertions; using Moq; +using NuGet.Versioning; using SharedResources.Tests; using Xunit; @@ -22,7 +23,7 @@ public class ProcessModelingServiceTests : FluentTestsBase().Object); From 7caf9d656333669ad0dc9f9a2be579fade7310da Mon Sep 17 00:00:00 2001 From: Michael Queyrichon Date: Thu, 7 Dec 2023 16:03:12 +0100 Subject: [PATCH 2/4] Rename Administration to Overview and remove old Administration page (#11781) * Rename Administration to Overview and remove old Administration page * Fix cypress tests * Remove unused import * Fix translations --- frontend/app-development/App.tsx | 2 +- .../components/DatamodelsAdministration.tsx | 18 -- .../components/LegacyAdministration.test.tsx | 116 ---------- .../components/LegacyAdministration.tsx | 42 ---- .../components/MainContent.module.css | 20 -- .../administration/components/MainContent.tsx | 86 ------- .../components/ServiceAdministration.test.tsx | 209 ------------------ .../components/ServiceAdministration.tsx | 128 ----------- .../components/SideMenuContent.module.css | 5 - .../components/SideMenuContent.tsx | 106 --------- .../components/AppEnvironments.module.css | 0 .../components/AppEnvironments.test.tsx | 6 +- .../components/AppEnvironments.tsx | 2 +- .../components/AppLogs.module.css | 0 .../components/AppLogs.test.tsx | 14 +- .../components/AppLogs.tsx | 10 +- .../components/AppStatus.module.css | 0 .../components/AppStatus.test.tsx | 14 +- .../components/AppStatus.tsx | 14 +- .../components/Documentation.module.css | 0 .../components/Documentation.test.tsx | 6 +- .../components/Documentation.tsx | 6 +- .../components/Navigation.module.css | 0 .../components/Navigation.test.tsx | 0 .../components/Navigation.tsx | 2 +- .../components/News.module.css | 0 .../components/News.test.tsx | 4 +- .../components/News.tsx | 6 +- .../NoEnviormentsAlert.test.tsx | 0 .../NoEnvironmentsAlert.tsx | 0 .../components/NoEnvironmentsAlert/index.ts | 0 .../components/Overview.module.css} | 0 .../components/Overview.test.tsx} | 12 +- .../components/Overview.tsx} | 6 +- .../handleServiceInformationSagas.ts | 14 +- .../handleServiceInformationSlice.ts | 21 +- .../{administration => overview}/types.ts | 0 .../DownloadRepoModal.tsx | 8 +- .../simpleMerge/MergeConflictWarning.tsx | 4 +- .../RepoModal.module.css | 0 .../ResetRepoModal.test.tsx | 17 +- .../ResetRepoModal.tsx | 12 +- frontend/app-development/reducers/index.ts | 2 +- frontend/app-development/router/routes.tsx | 6 +- frontend/app-development/sagas/index.ts | 2 +- frontend/language/src/en.json | 41 +--- frontend/language/src/nb.json | 83 +++---- .../src/components/AltinnColumnLayout.md | 8 - .../components/AltinnColumnLayout.module.css | 22 -- .../components/AltinnColumnLayout.test.tsx | 29 --- .../src/components/AltinnColumnLayout.tsx | 32 --- .../shared/src/utils/featureToggleUtils.ts | 1 - .../RemoveChangesModal/RemoveChangesModal.tsx | 15 +- .../src/integration/studio/designer.js | 12 - .../cypress/src/integration/studio/new-app.js | 6 +- .../src/integration/studio/overview.js | 52 ++--- .../src/integration/studio/sync-app.js | 8 +- .../src/integration/usecase/usecase.js | 9 +- .../cypress/src/selectors/administration.js | 7 - .../testing/cypress/src/selectors/header.js | 4 +- .../testing/cypress/src/selectors/overview.js | 3 + .../testing/cypress/src/selectors/settings.js | 7 + 62 files changed, 181 insertions(+), 1078 deletions(-) delete mode 100644 frontend/app-development/features/administration/components/DatamodelsAdministration.tsx delete mode 100644 frontend/app-development/features/administration/components/LegacyAdministration.test.tsx delete mode 100644 frontend/app-development/features/administration/components/LegacyAdministration.tsx delete mode 100644 frontend/app-development/features/administration/components/MainContent.module.css delete mode 100644 frontend/app-development/features/administration/components/MainContent.tsx delete mode 100644 frontend/app-development/features/administration/components/ServiceAdministration.test.tsx delete mode 100644 frontend/app-development/features/administration/components/ServiceAdministration.tsx delete mode 100644 frontend/app-development/features/administration/components/SideMenuContent.module.css delete mode 100644 frontend/app-development/features/administration/components/SideMenuContent.tsx rename frontend/app-development/features/{administration => overview}/components/AppEnvironments.module.css (100%) rename frontend/app-development/features/{administration => overview}/components/AppEnvironments.test.tsx (92%) rename frontend/app-development/features/{administration => overview}/components/AppEnvironments.tsx (95%) rename frontend/app-development/features/{administration => overview}/components/AppLogs.module.css (100%) rename frontend/app-development/features/{administration => overview}/components/AppLogs.test.tsx (92%) rename frontend/app-development/features/{administration => overview}/components/AppLogs.tsx (91%) rename frontend/app-development/features/{administration => overview}/components/AppStatus.module.css (100%) rename frontend/app-development/features/{administration => overview}/components/AppStatus.test.tsx (88%) rename frontend/app-development/features/{administration => overview}/components/AppStatus.tsx (92%) rename frontend/app-development/features/{administration => overview}/components/Documentation.module.css (100%) rename frontend/app-development/features/{administration => overview}/components/Documentation.test.tsx (72%) rename frontend/app-development/features/{administration => overview}/components/Documentation.tsx (82%) rename frontend/app-development/features/{administration => overview}/components/Navigation.module.css (100%) rename frontend/app-development/features/{administration => overview}/components/Navigation.test.tsx (100%) rename frontend/app-development/features/{administration => overview}/components/Navigation.tsx (96%) rename frontend/app-development/features/{administration => overview}/components/News.module.css (100%) rename frontend/app-development/features/{administration => overview}/components/News.test.tsx (92%) rename frontend/app-development/features/{administration => overview}/components/News.tsx (85%) rename frontend/app-development/features/{administration => overview}/components/NoEnvironmentsAlert/NoEnviormentsAlert.test.tsx (100%) rename frontend/app-development/features/{administration => overview}/components/NoEnvironmentsAlert/NoEnvironmentsAlert.tsx (100%) rename frontend/app-development/features/{administration => overview}/components/NoEnvironmentsAlert/index.ts (100%) rename frontend/app-development/features/{administration/components/Administration.module.css => overview/components/Overview.module.css} (100%) rename frontend/app-development/features/{administration/components/Administration.test.tsx => overview/components/Overview.test.tsx} (89%) rename frontend/app-development/features/{administration/components/Administration.tsx => overview/components/Overview.tsx} (94%) rename frontend/app-development/features/{administration => overview}/handleServiceInformationSagas.ts (97%) rename frontend/app-development/features/{administration => overview}/handleServiceInformationSlice.ts (96%) rename frontend/app-development/features/{administration => overview}/types.ts (100%) rename frontend/app-development/features/{administration/components => simpleMerge}/DownloadRepoModal.tsx (85%) rename frontend/app-development/features/{administration/components => simpleMerge}/RepoModal.module.css (100%) rename frontend/app-development/features/{administration/components => simpleMerge}/ResetRepoModal.test.tsx (87%) rename frontend/app-development/features/{administration/components => simpleMerge}/ResetRepoModal.tsx (89%) delete mode 100644 frontend/packages/shared/src/components/AltinnColumnLayout.md delete mode 100644 frontend/packages/shared/src/components/AltinnColumnLayout.module.css delete mode 100644 frontend/packages/shared/src/components/AltinnColumnLayout.test.tsx delete mode 100644 frontend/packages/shared/src/components/AltinnColumnLayout.tsx delete mode 100644 frontend/testing/cypress/src/selectors/administration.js create mode 100644 frontend/testing/cypress/src/selectors/overview.js create mode 100644 frontend/testing/cypress/src/selectors/settings.js diff --git a/frontend/app-development/App.tsx b/frontend/app-development/App.tsx index 2d1d2c5da86..791a82acd89 100644 --- a/frontend/app-development/App.tsx +++ b/frontend/app-development/App.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useEffect, useRef } from 'react'; import postMessages from 'app-shared/utils/postMessages'; import { AltinnPopoverSimple } from 'app-shared/components/molecules/AltinnPopoverSimple'; -import { HandleServiceInformationActions } from './features/administration/handleServiceInformationSlice'; +import { HandleServiceInformationActions } from './features/overview/handleServiceInformationSlice'; import { fetchRemainingSession, keepAliveSession, diff --git a/frontend/app-development/features/administration/components/DatamodelsAdministration.tsx b/frontend/app-development/features/administration/components/DatamodelsAdministration.tsx deleted file mode 100644 index edf4156a0c4..00000000000 --- a/frontend/app-development/features/administration/components/DatamodelsAdministration.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { useTranslation } from 'react-i18next'; - -export function DatamodelsAdministration() { - const { t } = useTranslation(); - return ( -
-

{t('administration.datamodels_info1')}

-

{t('administration.datamodels_info2')}

-

- {t('administration.datamodels_info3')}  - - {t('administration.datamodels_info_link')} - -

-
- ); -} diff --git a/frontend/app-development/features/administration/components/LegacyAdministration.test.tsx b/frontend/app-development/features/administration/components/LegacyAdministration.test.tsx deleted file mode 100644 index e570e7dd64b..00000000000 --- a/frontend/app-development/features/administration/components/LegacyAdministration.test.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import React from 'react'; -import { screen } from '@testing-library/react'; -import { LegacyAdministration } from './LegacyAdministration'; -import type { ICommit } from '../../../types/global'; -import { APP_DEVELOPMENT_BASENAME } from 'app-shared/constants'; -import type { IHandleServiceInformationState } from '../handleServiceInformationSlice'; -import { renderWithProviders } from '../../../test/testUtils'; -import { textMock } from '../../../../testing/mocks/i18nMock'; -import type { Repository } from 'app-shared/types/Repository'; - -jest.mock('react-router-dom', () => jest.requireActual('react-router-dom')); - -describe('LegacyAdministration', () => { - const mockService: Repository = { - clone_url: '', - created_at: '', - default_branch: '', - description: '', - empty: false, - fork: false, - forks_count: 0, - full_name: '', - html_url: '', - id: 123, - is_cloned_to_local: true, - mirror: false, - name: 'CoolService', - open_issues_count: 0, - owner: { - avatar_url: '', - email: '', - full_name: 'Mons Monsen', - id: 234, - login: 'Mons', - UserType: 2, - }, - permissions: { - admin: true, - pull: true, - push: true, - }, - private: false, - repositoryCreatedStatus: 0, - size: 0, - ssh_url: '', - stars_count: 1337, - updated_at: '', - watchers_count: 0, - website: '', - }; - const mockServiceName = 'AppName'; - const mockInitialCommit: ICommit = { - message: '', - author: { - email: '', - name: 'Per', - when: '', - }, - comitter: { - email: '', - name: 'Per', - when: '', - }, - sha: '', - messageShort: '', - encoding: '', - }; - const mockServiceDescription = 'AppDescription'; - const mockServiceId = 'AppId'; - const mockServiceInformation: IHandleServiceInformationState = { - initialCommit: mockInitialCommit, - repositoryInfo: mockService, - serviceDescriptionObj: { - description: mockServiceDescription, - saving: false, - }, - serviceIdObj: { - serviceId: mockServiceId, - saving: false, - }, - serviceNameObj: { - name: mockServiceName, - saving: false, - }, - error: null, - }; - - it('should show spinner when loading required data', () => { - renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-app`, - }); - expect(screen.getByText(textMock('general.loading'))).toBeInTheDocument(); - }); - - it('should show Apps view when repository is app repository', () => { - renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-app`, - preloadedState: { - serviceInformation: mockServiceInformation, - }, - }); - const serviceIdText = screen.getByText(textMock('administration.service_id')); - expect(serviceIdText).not.toBeNull(); - }); - - it('should show Datamodels view when repository name matches "-datamodels" format', () => { - renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-org-datamodels`, - preloadedState: { - serviceInformation: mockServiceInformation, - }, - }); - const infoText = screen.getByText(textMock('administration.datamodels_info1')); - expect(infoText).not.toBeNull(); - }); -}); diff --git a/frontend/app-development/features/administration/components/LegacyAdministration.tsx b/frontend/app-development/features/administration/components/LegacyAdministration.tsx deleted file mode 100644 index 147f533a7e7..00000000000 --- a/frontend/app-development/features/administration/components/LegacyAdministration.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import { AltinnColumnLayout } from 'app-shared/components/AltinnColumnLayout'; -import { StudioPageSpinner } from '@studio/components'; -import { DatamodelsAdministration } from './DatamodelsAdministration'; -import { RepositoryType } from 'app-shared/types/global'; -import { ServiceAdministration } from './ServiceAdministration'; -import { SideMenuContent } from './SideMenuContent'; -import { getRepositoryType } from 'app-shared/utils/repository'; -import { useAppSelector } from '../../../hooks'; -import { useTranslation } from 'react-i18next'; -import { useStudioUrlParams } from 'app-shared/hooks/useStudioUrlParams'; - -export function LegacyAdministration() { - const repository = useAppSelector((state) => state.serviceInformation.repositoryInfo); - const initialCommit = useAppSelector((state) => state.serviceInformation.initialCommit); - const { t } = useTranslation(); - const { org, app } = useStudioUrlParams(); - const repositoryType = getRepositoryType(org, app); - - return ( -
- {repository && ( - - } - header={t('administration.administration')} - > - {repositoryType === RepositoryType.App && ( - - )} - {repositoryType === RepositoryType.Datamodels && } - - )} - {!repository && } -
- ); -} diff --git a/frontend/app-development/features/administration/components/MainContent.module.css b/frontend/app-development/features/administration/components/MainContent.module.css deleted file mode 100644 index b74ce883044..00000000000 --- a/frontend/app-development/features/administration/components/MainContent.module.css +++ /dev/null @@ -1,20 +0,0 @@ -.mainContentContainer { - display: flex; - flex-direction: column; - gap: 12px; - max-width: 750px; -} -.mainContentContainer h2 { - font-size: 20px; - margin-top: 20px; -} -.mainContentContainer > * { - margin: 0; -} -.sideBySide { - display: flex; - flex-direction: row; -} -.sideBySide :first-child { - flex: 1; -} diff --git a/frontend/app-development/features/administration/components/MainContent.tsx b/frontend/app-development/features/administration/components/MainContent.tsx deleted file mode 100644 index 62aa60f8b9b..00000000000 --- a/frontend/app-development/features/administration/components/MainContent.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react'; -import { Button, LegacyTextArea, Textfield } from '@digdir/design-system-react'; -import { AltinnPopper } from 'app-shared/components/AltinnPopper'; -import classes from './MainContent.module.css'; -import { Trans, useTranslation } from 'react-i18next'; -import { useSearchParams } from 'react-router-dom'; - -interface IMainContentProps { - repositoryName: string; - appDescription: string; - appId: string; - appName: string; - editAppName: boolean; - onAppDescriptionBlur: () => void; - onAppDescriptionChange: (event: any) => void; - onAppIdBlur: () => void; - onAppIdChange: (event: any) => void; - onAppNameBlur: () => void; - onAppNameChange: (event: any) => void; - onEditAppNameClick: () => void; - appNameAnchorEl: any; -} - -const nameLabelId = 'administrationInputAppNameHeader'; -const descriptionLabelId = 'administrationInputAppDescriptionHeader'; -const appIdLabelId = 'administrationInputAppIdHeader'; - -export const MainContent = (props: IMainContentProps): JSX.Element => { - const [searchParams] = useSearchParams(); - const copiedApp = Boolean(searchParams.get('copiedApp')); - const { t } = useTranslation(); - return ( -
- {copiedApp && ( - <> -

{t('administration.copied_app_header')}

-

- - - brukerdokumentasjon - - -

- - )} -

{t('general.service_name')}

-

{t('administration.service_name_administration_description')}

-
- - -
- -

{t('administration.service_id')}

-

{t('administration.service_id_description')}

- -

{t('general.service_saved_name')}

-

{t('administration.service_saved_name_administration_description')}

- -

{t('administration.service_comment')}

-

{t('administration.service_comment_description')}

- -
- ); -}; diff --git a/frontend/app-development/features/administration/components/ServiceAdministration.test.tsx b/frontend/app-development/features/administration/components/ServiceAdministration.test.tsx deleted file mode 100644 index 3d328dc9dd7..00000000000 --- a/frontend/app-development/features/administration/components/ServiceAdministration.test.tsx +++ /dev/null @@ -1,209 +0,0 @@ -import React from 'react'; -import { act, fireEvent, waitFor } from '@testing-library/react'; -import { LegacyAdministration } from './LegacyAdministration'; -import type { ICommit } from '../../../types/global'; -import { APP_DEVELOPMENT_BASENAME } from 'app-shared/constants'; -import type { IHandleServiceInformationState } from '../handleServiceInformationSlice'; -import { renderWithProviders } from '../../../test/testUtils'; -import { ServiceAdministration } from './ServiceAdministration'; -import { serviceConfigPath } from 'app-shared/api/paths'; -import { screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import { textMock } from '../../../../testing/mocks/i18nMock'; -import type { Repository } from 'app-shared/types/Repository'; - -const user = userEvent.setup(); - -jest.mock('react-router-dom', () => jest.requireActual('react-router-dom')); - -describe('Administration', () => { - const mockService: Repository = { - clone_url: '', - created_at: '', - default_branch: '', - description: '', - empty: false, - fork: false, - forks_count: 0, - full_name: '', - html_url: '', - id: 123, - is_cloned_to_local: true, - mirror: false, - name: 'CoolService', - open_issues_count: 0, - owner: { - avatar_url: '', - email: '', - full_name: 'Mons Monsen', - id: 234, - login: 'Mons', - UserType: 2, - }, - permissions: { - admin: true, - pull: true, - push: true, - }, - private: false, - repositoryCreatedStatus: 0, - size: 0, - ssh_url: '', - stars_count: 1337, - updated_at: '', - watchers_count: 0, - website: '', - }; - const mockServiceName = 'AppName'; - const mockInitialCommit: ICommit = { - message: '', - author: { - email: '', - name: 'Per', - when: '', - }, - comitter: { - email: '', - name: 'Per', - when: '', - }, - sha: '', - messageShort: '', - encoding: '', - }; - const mockServiceDescription = 'AppDescription'; - const mockServiceId = 'AppId'; - const mockServiceInformation: IHandleServiceInformationState = { - initialCommit: mockInitialCommit, - repositoryInfo: mockService, - serviceDescriptionObj: { - description: mockServiceDescription, - saving: false, - }, - serviceIdObj: { - serviceId: mockServiceId, - saving: false, - }, - serviceNameObj: { - name: mockServiceName, - saving: false, - }, - error: null, - }; - - it('should render the spinner when loading', () => { - renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-app`, - preloadedState: { - serviceInformation: { - ...mockServiceInformation, - serviceNameObj: { - ...mockServiceInformation.serviceNameObj, - name: null, - }, - }, - }, - }); - expect(screen.getByText(textMock('general.loading'))).toBeInTheDocument(); - }); - - it('should handle sucessfully updating app name', async () => { - const utils = renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-app`, - preloadedState: { - serviceInformation: mockServiceInformation, - }, - }); - const dispatchSpy = jest.spyOn(utils.store, 'dispatch'); - const mockEvent = { target: { value: 'New name' } }; - - const editButton = screen.getByRole('button', { name: textMock('general.edit') }); - await act(() => user.click(editButton)); - - const inputElement = screen.getByRole('textbox', { name: textMock('general.service_name') }); - expect((inputElement as HTMLInputElement).value).toEqual(mockServiceName); - - fireEvent.change(inputElement, mockEvent); - expect((inputElement as HTMLInputElement).value).toEqual(mockEvent.target.value); - - fireEvent.blur(inputElement); - - await waitFor(() => { - expect(dispatchSpy).toBeCalledWith({ - payload: { - url: serviceConfigPath('my-org', 'my-app'), - newServiceName: mockEvent.target.value, - newServiceId: mockServiceId, - newServiceDescription: mockServiceDescription, - }, - type: 'handleServiceInformation/saveServiceConfig', - }); - }); - }); - - it('should handle successfully updating app description', async () => { - const utils = renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-app`, - preloadedState: { - serviceInformation: mockServiceInformation, - }, - }); - const mockEvent = { target: { value: 'New description' } }; - const dispatchSpy = jest.spyOn(utils.store, 'dispatch'); - - const inputElement = screen.getByRole('textbox', { - name: textMock('administration.service_comment'), - }); - expect((inputElement as HTMLInputElement).value).toEqual(mockServiceDescription); - - fireEvent.change(inputElement, mockEvent); - expect((inputElement as HTMLInputElement).value).toEqual(mockEvent.target.value); - - fireEvent.blur(inputElement); - - await waitFor(() => { - expect(dispatchSpy).toBeCalledWith({ - payload: { - url: serviceConfigPath('my-org', 'my-app'), - newServiceName: mockServiceName, - newServiceId: mockServiceId, - newServiceDescription: mockEvent.target.value, - }, - type: 'handleServiceInformation/saveServiceConfig', - }); - }); - }); - - it('should handle sucessfully updating app id', async () => { - const utils = renderWithProviders(, { - startUrl: `${APP_DEVELOPMENT_BASENAME}/my-org/my-app`, - preloadedState: { - serviceInformation: mockServiceInformation, - }, - }); - const dispatchSpy = jest.spyOn(utils.store, 'dispatch'); - const mockEvent = { target: { value: 'New id' } }; - - const inputElement = screen.getByRole('textbox', { - name: textMock('administration.service_id'), - }); - expect((inputElement as HTMLInputElement).value).toEqual(mockServiceId); - - fireEvent.change(inputElement, mockEvent); - expect((inputElement as HTMLInputElement).value).toEqual(mockEvent.target.value); - - fireEvent.blur(inputElement); - - await waitFor(() => { - expect(dispatchSpy).toBeCalledWith({ - payload: { - url: serviceConfigPath('my-org', 'my-app'), - newServiceName: mockServiceName, - newServiceId: mockEvent.target.value, - newServiceDescription: mockServiceDescription, - }, - type: 'handleServiceInformation/saveServiceConfig', - }); - }); - }); -}); diff --git a/frontend/app-development/features/administration/components/ServiceAdministration.tsx b/frontend/app-development/features/administration/components/ServiceAdministration.tsx deleted file mode 100644 index 73bbf7abb66..00000000000 --- a/frontend/app-development/features/administration/components/ServiceAdministration.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import type { Repository } from 'app-shared/types/Repository'; -import { StudioPageSpinner } from '@studio/components'; -import { HandleServiceInformationActions } from '../handleServiceInformationSlice'; -import { MainContent } from './MainContent'; -import { serviceConfigPath } from 'app-shared/api/paths'; -import { useAppDispatch, useAppSelector } from '../../../hooks'; -import { useStudioUrlParams } from 'app-shared/hooks/useStudioUrlParams'; - -export interface ServiceAdministrationProps { - repository: Repository; -} - -export function ServiceAdministration({ repository }: ServiceAdministrationProps) { - const { org, app } = useStudioUrlParams(); - const name = useAppSelector((state) => state.serviceInformation.serviceNameObj.name); - const description = useAppSelector( - (state) => state.serviceInformation.serviceDescriptionObj.description, - ); - const id = useAppSelector((state) => state.serviceInformation.serviceIdObj.serviceId); - const dispatch = useAppDispatch(); - const [newName, setNewName] = useState(name); - const [newDescription, setNewDescription] = useState(description); - const [newId, setNewId] = useState(id); - const [editAppName, setEditAppName] = useState(); - const [editAppDescription, setEditAppDescription] = useState(); - const [editAppId, setEditAppId] = useState(); - const [appNameAnchorEl, setAppNameAnchorEl] = useState(); - - useEffect(() => { - setNewName(name); - }, [name]); - - useEffect(() => { - setNewDescription(description); - }, [description]); - - useEffect(() => { - setNewId(id); - }, [id]); - - const handleAppNameChange = (event: any) => { - setNewName(event.target.value); - setAppNameAnchorEl(null); - }; - - const handleEditAppNameClick = () => setEditAppName(true); - - const handleAppNameBlur = () => { - if (editAppName && !newName) { - setAppNameAnchorEl(document.getElementById('administrationInputAppName')); - } else { - dispatch( - HandleServiceInformationActions.saveServiceConfig({ - url: serviceConfigPath(org, app), - newServiceDescription: newDescription, - newServiceId: newId, - newServiceName: newName, - }), - ); - setEditAppName(false); - } - }; - - const handleAppDescriptionChange = (event: any) => { - setNewDescription(event.target.value); - setEditAppDescription(true); - }; - - const handleAppDescriptionBlur = () => { - if (editAppDescription) { - dispatch( - HandleServiceInformationActions.saveServiceConfig({ - url: serviceConfigPath(org, app), - newServiceDescription: newDescription, - newServiceId: newId, - newServiceName: newName, - }), - ); - setEditAppDescription(false); - } - }; - - const handleAppIdChange = (event: any) => { - setNewId(event.target.value); - setEditAppId(true); - }; - - const handleAppIdBlur = () => { - if (editAppId) { - dispatch( - HandleServiceInformationActions.saveServiceConfig({ - url: serviceConfigPath(org, app), - newServiceDescription: newDescription, - newServiceId: newId, - newServiceName: newName, - }), - ); - setEditAppId(false); - } - }; - - const render = repository && newName !== null && newDescription !== null && newId !== null; - - return ( -
- {render ? ( - - ) : ( - - )} -
- ); -} diff --git a/frontend/app-development/features/administration/components/SideMenuContent.module.css b/frontend/app-development/features/administration/components/SideMenuContent.module.css deleted file mode 100644 index 01dba92d591..00000000000 --- a/frontend/app-development/features/administration/components/SideMenuContent.module.css +++ /dev/null @@ -1,5 +0,0 @@ -.container { - display: flex; - flex-direction: column; - gap: 18px; -} diff --git a/frontend/app-development/features/administration/components/SideMenuContent.tsx b/frontend/app-development/features/administration/components/SideMenuContent.tsx deleted file mode 100644 index 215efc7e291..00000000000 --- a/frontend/app-development/features/administration/components/SideMenuContent.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import React, { useEffect, useRef, useState } from 'react'; -import { Button } from '@digdir/design-system-react'; -import { formatNameAndDate } from 'app-shared/utils/formatDate'; -import type { ICommit } from '../../../types/global'; -import { RepositoryType } from 'app-shared/types/global'; -import { ResetRepoModal } from './ResetRepoModal'; -import { DownloadRepoModal } from './DownloadRepoModal'; -import classes from './SideMenuContent.module.css'; -import { useTranslation } from 'react-i18next'; -import { useRepoStatusQuery } from 'app-shared/hooks/queries'; -import type { Repository } from 'app-shared/types/Repository'; -import { useStudioUrlParams } from 'app-shared/hooks/useStudioUrlParams'; - -interface ISideMenuContent { - service: Repository; - initialCommit: ICommit; - repoType: RepositoryType; -} - -export const SideMenuContent = (props: ISideMenuContent): JSX.Element => { - const { org, app } = useStudioUrlParams(); - const [resetRepoModalOpen, setResetRepoModalOpen] = useState(false); - const [downloadModalOpen, setDownloadModalOpen] = useState(false); - const { data: repoStatus } = useRepoStatusQuery(org, app); - const toggleDownloadModal = () => setDownloadModalOpen(!downloadModalOpen); - const onCloseModal = () => setResetRepoModalOpen(false); - const onClickResetRepo = () => setResetRepoModalOpen(true); - - useEffect(() => { - if ( - repoStatus && - !( - (repoStatus.aheadBy && repoStatus.aheadBy > 0) || - (repoStatus.contentStatus && repoStatus.contentStatus.length > 0) - ) - ) { - setResetRepoModalOpen(false); - } - }, [repoStatus]); - - const downloadModalAnchor = useRef(); - const resetRepoModalAnchor = useRef(); - const { t } = useTranslation(); - return ( -
- {/* App owner info */} -

{t('general.service_owner')}

-
- {t( - props.repoType === RepositoryType.Datamodels - ? 'administration.repo_owner_is' - : 'administration.service_owner_is', - )} -
-
- {' '} - {props.service.owner.full_name || props.service.owner.login} -
- {props.initialCommit && ( -
- {t('administration.created_by')}{' '} - {formatNameAndDate(props.initialCommit.author.name, props.service.created_at)} -
- )} - {/* Reset local repository */} -

{t('administration.reset_repo_heading')}

-
-
    -
  • {t('administration.reset_repo_info_i1')}
  • -
  • {t('administration.reset_repo_info_i2')}
  • -
  • {t('administration.reset_repo_info_i3')}
  • -
-
- -
- - {/* Download local repository */} -

{t('administration.download_repo')}

- -
- -
- ); -}; diff --git a/frontend/app-development/features/administration/components/AppEnvironments.module.css b/frontend/app-development/features/overview/components/AppEnvironments.module.css similarity index 100% rename from frontend/app-development/features/administration/components/AppEnvironments.module.css rename to frontend/app-development/features/overview/components/AppEnvironments.module.css diff --git a/frontend/app-development/features/administration/components/AppEnvironments.test.tsx b/frontend/app-development/features/overview/components/AppEnvironments.test.tsx similarity index 92% rename from frontend/app-development/features/administration/components/AppEnvironments.test.tsx rename to frontend/app-development/features/overview/components/AppEnvironments.test.tsx index 061a5808835..f0392563b71 100644 --- a/frontend/app-development/features/administration/components/AppEnvironments.test.tsx +++ b/frontend/app-development/features/overview/components/AppEnvironments.test.tsx @@ -38,7 +38,7 @@ describe('AppEnvironments', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); - expect(screen.getByText(textMock('administration.app_environments_error'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.app_environments_error'))).toBeInTheDocument(); }); it('shows no environments message when organization has no environment', async () => { @@ -106,7 +106,7 @@ describe('AppEnvironments', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); expect(screen.getByRole('heading', { name: envName })).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.unavailable'))).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.go_to_build_log'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.unavailable'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.go_to_build_log'))).toBeInTheDocument(); }); }); diff --git a/frontend/app-development/features/administration/components/AppEnvironments.tsx b/frontend/app-development/features/overview/components/AppEnvironments.tsx similarity index 95% rename from frontend/app-development/features/administration/components/AppEnvironments.tsx rename to frontend/app-development/features/overview/components/AppEnvironments.tsx index 8b1699d0f9d..cadb225b7d7 100644 --- a/frontend/app-development/features/administration/components/AppEnvironments.tsx +++ b/frontend/app-development/features/overview/components/AppEnvironments.tsx @@ -28,7 +28,7 @@ export const AppEnvironments = () => { if (envIsPending || orgsIsPending) return ; if (envIsError || orgsIsError) - return {t('administration.app_environments_error')}; + return {t('overview.app_environments_error')}; const selectedOrg = orgs.orgs[org]; const hasNoEnvironments = !(selectedOrg?.environments?.length ?? 0); diff --git a/frontend/app-development/features/administration/components/AppLogs.module.css b/frontend/app-development/features/overview/components/AppLogs.module.css similarity index 100% rename from frontend/app-development/features/administration/components/AppLogs.module.css rename to frontend/app-development/features/overview/components/AppLogs.module.css diff --git a/frontend/app-development/features/administration/components/AppLogs.test.tsx b/frontend/app-development/features/overview/components/AppLogs.test.tsx similarity index 92% rename from frontend/app-development/features/administration/components/AppLogs.test.tsx rename to frontend/app-development/features/overview/components/AppLogs.test.tsx index 003324f8308..407d0c5b01d 100644 --- a/frontend/app-development/features/administration/components/AppLogs.test.tsx +++ b/frontend/app-development/features/overview/components/AppLogs.test.tsx @@ -36,7 +36,7 @@ describe('AppLogs', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); - expect(screen.getByText(textMock('administration.app_logs_error'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.app_logs_error'))).toBeInTheDocument(); }); it('shows list of deployments', async () => { @@ -124,11 +124,11 @@ describe('AppLogs', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); expect( - screen.getByRole('heading', { name: textMock('administration.activity') }), + screen.getByRole('heading', { name: textMock('overview.activity') }), ).toBeInTheDocument(); expect( screen.getByText( - textMock('administration.app_logs_title', { + textMock('overview.app_logs_title', { tagName: '2', environment: textMock('general.production_environment'), envName: 'PRODUCTION', @@ -136,9 +136,7 @@ describe('AppLogs', () => { ), ).toBeInTheDocument(); expect( - screen.getByText( - textMock('administration.app_logs_title', { tagName: '1', envName: 'TT02' }), - ), + screen.getByText(textMock('overview.app_logs_title', { tagName: '1', envName: 'TT02' })), ).toBeInTheDocument(); }); @@ -209,8 +207,8 @@ describe('AppLogs', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); expect( - screen.getByRole('heading', { name: textMock('administration.activity') }), + screen.getByRole('heading', { name: textMock('overview.activity') }), ).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.no_activity'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.no_activity'))).toBeInTheDocument(); }); }); diff --git a/frontend/app-development/features/administration/components/AppLogs.tsx b/frontend/app-development/features/overview/components/AppLogs.tsx similarity index 91% rename from frontend/app-development/features/administration/components/AppLogs.tsx rename to frontend/app-development/features/overview/components/AppLogs.tsx index 5196e424fb7..aef7f6ec7c3 100644 --- a/frontend/app-development/features/administration/components/AppLogs.tsx +++ b/frontend/app-development/features/overview/components/AppLogs.tsx @@ -29,7 +29,7 @@ export const AppLogs = () => { if (isPendingDeploys || envIsPending) return ; if (deploysHasError || envIsError) - return {t('administration.app_logs_error')}; + return {t('overview.app_logs_error')}; const succeededDeployments = appDeployments.filter( (deployment: IDeployment) => @@ -51,7 +51,7 @@ export const AppLogs = () => { return (
- {t('administration.activity')} + {t('overview.activity')}
    {hasSucceededDeployments ? ( @@ -62,14 +62,14 @@ export const AppLogs = () => { return (
  • - {t('administration.app_logs_title', { + {t('overview.app_logs_title', { tagName: appDeployment.tagName, environment: keyToTranslationMap[environmentType], envName: appDeployment.envName?.toUpperCase() || '', })}
    - {t('administration.app_logs_created', { + {t('overview.app_logs_created', { createdBy: appDeployment.createdBy, createdDateTime: formatDateTime(appDeployment.created), })} @@ -78,7 +78,7 @@ export const AppLogs = () => { ); }) ) : ( -
  • {t('administration.no_activity')}
  • +
  • {t('overview.no_activity')}
  • )}
diff --git a/frontend/app-development/features/administration/components/AppStatus.module.css b/frontend/app-development/features/overview/components/AppStatus.module.css similarity index 100% rename from frontend/app-development/features/administration/components/AppStatus.module.css rename to frontend/app-development/features/overview/components/AppStatus.module.css diff --git a/frontend/app-development/features/administration/components/AppStatus.test.tsx b/frontend/app-development/features/overview/components/AppStatus.test.tsx similarity index 88% rename from frontend/app-development/features/administration/components/AppStatus.test.tsx rename to frontend/app-development/features/overview/components/AppStatus.test.tsx index ee3cea1a384..f2f72f10448 100644 --- a/frontend/app-development/features/administration/components/AppStatus.test.tsx +++ b/frontend/app-development/features/overview/components/AppStatus.test.tsx @@ -36,7 +36,7 @@ describe('AppStatus', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); - expect(screen.getByText(textMock('administration.app_status_error'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.app_status_error'))).toBeInTheDocument(); }); it('shows production when environment is production', async () => { @@ -107,8 +107,8 @@ describe('AppStatus', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); expect(screen.getByRole('heading', { name: envNameTest })).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.success'))).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.last_published'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.success'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.last_published'))).toBeInTheDocument(); }); it('shows no app alert when application not deployed', async () => { @@ -123,8 +123,8 @@ describe('AppStatus', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); expect(screen.getByRole('heading', { name: envNameTest })).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.no_app'))).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.go_to_publish'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.no_app'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.go_to_publish'))).toBeInTheDocument(); }); it('shows unavailable alert when application not reachable', async () => { @@ -156,7 +156,7 @@ describe('AppStatus', () => { await waitForElementToBeRemoved(() => screen.queryByTitle(textMock('general.loading'))); expect(screen.getByRole('heading', { name: envNameTest })).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.unavailable'))).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.go_to_build_log'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.unavailable'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.go_to_build_log'))).toBeInTheDocument(); }); }); diff --git a/frontend/app-development/features/administration/components/AppStatus.tsx b/frontend/app-development/features/overview/components/AppStatus.tsx similarity index 92% rename from frontend/app-development/features/administration/components/AppStatus.tsx rename to frontend/app-development/features/overview/components/AppStatus.tsx index b4fdddf4f36..1b2e4eb9174 100644 --- a/frontend/app-development/features/administration/components/AppStatus.tsx +++ b/frontend/app-development/features/overview/components/AppStatus.tsx @@ -69,7 +69,7 @@ export const AppStatus = ({ envName, envType }: AppStatusProps) => { return ( { envType={envType} envName={envName} severity='success' - content={t('administration.success')} + content={t('overview.success')} footer={ { envType={envType} envName={envName} severity='info' - content={t('administration.no_app')} + content={t('overview.no_app')} footer={ - + } @@ -118,9 +118,9 @@ export const AppStatus = ({ envName, envType }: AppStatusProps) => { envType={envType} envName={envName} severity='warning' - content={t('administration.unavailable')} + content={t('overview.unavailable')} footer={ - + } diff --git a/frontend/app-development/features/administration/components/Documentation.module.css b/frontend/app-development/features/overview/components/Documentation.module.css similarity index 100% rename from frontend/app-development/features/administration/components/Documentation.module.css rename to frontend/app-development/features/overview/components/Documentation.module.css diff --git a/frontend/app-development/features/administration/components/Documentation.test.tsx b/frontend/app-development/features/overview/components/Documentation.test.tsx similarity index 72% rename from frontend/app-development/features/administration/components/Documentation.test.tsx rename to frontend/app-development/features/overview/components/Documentation.test.tsx index 8c2c5a1ead8..f62cd7b4b91 100644 --- a/frontend/app-development/features/administration/components/Documentation.test.tsx +++ b/frontend/app-development/features/overview/components/Documentation.test.tsx @@ -20,11 +20,11 @@ describe('Documentation', () => { }); expect( - screen.getByRole('heading', { name: textMock('administration.documentation.title') }), + screen.getByRole('heading', { name: textMock('overview.documentation.title') }), ).toBeInTheDocument(); - expect(screen.getByText(textMock('administration.documentation.content'))).toBeInTheDocument(); + expect(screen.getByText(textMock('overview.documentation.content'))).toBeInTheDocument(); expect( - screen.getByRole('link', { name: textMock('administration.documentation.link') }), + screen.getByRole('link', { name: textMock('overview.documentation.link') }), ).toBeInTheDocument(); }); }); diff --git a/frontend/app-development/features/administration/components/Documentation.tsx b/frontend/app-development/features/overview/components/Documentation.tsx similarity index 82% rename from frontend/app-development/features/administration/components/Documentation.tsx rename to frontend/app-development/features/overview/components/Documentation.tsx index 4ad6849ade5..e5b2370d6d6 100644 --- a/frontend/app-development/features/administration/components/Documentation.tsx +++ b/frontend/app-development/features/overview/components/Documentation.tsx @@ -9,16 +9,16 @@ export const Documentation = () => { return (
- {t('administration.documentation.title')} + {t('overview.documentation.title')} - {t('administration.documentation.content')} + {t('overview.documentation.content')} - {t('administration.documentation.link')} + {t('overview.documentation.link')}
diff --git a/frontend/app-development/features/administration/components/Navigation.module.css b/frontend/app-development/features/overview/components/Navigation.module.css similarity index 100% rename from frontend/app-development/features/administration/components/Navigation.module.css rename to frontend/app-development/features/overview/components/Navigation.module.css diff --git a/frontend/app-development/features/administration/components/Navigation.test.tsx b/frontend/app-development/features/overview/components/Navigation.test.tsx similarity index 100% rename from frontend/app-development/features/administration/components/Navigation.test.tsx rename to frontend/app-development/features/overview/components/Navigation.test.tsx diff --git a/frontend/app-development/features/administration/components/Navigation.tsx b/frontend/app-development/features/overview/components/Navigation.tsx similarity index 96% rename from frontend/app-development/features/administration/components/Navigation.tsx rename to frontend/app-development/features/overview/components/Navigation.tsx index 1722ce41a16..96dcb5c877d 100644 --- a/frontend/app-development/features/administration/components/Navigation.tsx +++ b/frontend/app-development/features/overview/components/Navigation.tsx @@ -18,7 +18,7 @@ export const Navigation = () => { return (
- {t('administration.navigation_title')} + {t('overview.navigation_title')}
{menuItems.map((menuItem) => { diff --git a/frontend/app-development/features/administration/components/News.module.css b/frontend/app-development/features/overview/components/News.module.css similarity index 100% rename from frontend/app-development/features/administration/components/News.module.css rename to frontend/app-development/features/overview/components/News.module.css diff --git a/frontend/app-development/features/administration/components/News.test.tsx b/frontend/app-development/features/overview/components/News.test.tsx similarity index 92% rename from frontend/app-development/features/administration/components/News.test.tsx rename to frontend/app-development/features/overview/components/News.test.tsx index f39a204c5f2..7b9b74c5be4 100644 --- a/frontend/app-development/features/administration/components/News.test.tsx +++ b/frontend/app-development/features/overview/components/News.test.tsx @@ -49,7 +49,7 @@ describe('News', () => { }; render(newsList); - await screen.findByText(textMock('administration.fetch_news_loading_message')); + await screen.findByText(textMock('overview.fetch_news_loading_message')); }); it('error message is shown when content fails to load', async () => { @@ -66,7 +66,7 @@ describe('News', () => { getNewsList: jest.fn().mockImplementation(() => Promise.reject()), }); - await screen.findByText(textMock('administration.fetch_news_error_message')); + await screen.findByText(textMock('overview.fetch_news_error_message')); }); }); diff --git a/frontend/app-development/features/administration/components/News.tsx b/frontend/app-development/features/overview/components/News.tsx similarity index 85% rename from frontend/app-development/features/administration/components/News.tsx rename to frontend/app-development/features/overview/components/News.tsx index 665ef8da887..30c53206591 100644 --- a/frontend/app-development/features/administration/components/News.tsx +++ b/frontend/app-development/features/overview/components/News.tsx @@ -12,7 +12,7 @@ export const News = () => { if (isPending) { return ( - + ); } @@ -20,7 +20,7 @@ export const News = () => { if (isError) { return ( - {t('administration.fetch_news_error_message')} + {t('overview.fetch_news_error_message')} ); } @@ -50,7 +50,7 @@ const NewsTemplate = ({ children }: NewsTemplateProps) => { return ( <> - {t('administration.news_title')} + {t('overview.news_title')}
{children}
diff --git a/frontend/app-development/features/administration/components/NoEnvironmentsAlert/NoEnviormentsAlert.test.tsx b/frontend/app-development/features/overview/components/NoEnvironmentsAlert/NoEnviormentsAlert.test.tsx similarity index 100% rename from frontend/app-development/features/administration/components/NoEnvironmentsAlert/NoEnviormentsAlert.test.tsx rename to frontend/app-development/features/overview/components/NoEnvironmentsAlert/NoEnviormentsAlert.test.tsx diff --git a/frontend/app-development/features/administration/components/NoEnvironmentsAlert/NoEnvironmentsAlert.tsx b/frontend/app-development/features/overview/components/NoEnvironmentsAlert/NoEnvironmentsAlert.tsx similarity index 100% rename from frontend/app-development/features/administration/components/NoEnvironmentsAlert/NoEnvironmentsAlert.tsx rename to frontend/app-development/features/overview/components/NoEnvironmentsAlert/NoEnvironmentsAlert.tsx diff --git a/frontend/app-development/features/administration/components/NoEnvironmentsAlert/index.ts b/frontend/app-development/features/overview/components/NoEnvironmentsAlert/index.ts similarity index 100% rename from frontend/app-development/features/administration/components/NoEnvironmentsAlert/index.ts rename to frontend/app-development/features/overview/components/NoEnvironmentsAlert/index.ts diff --git a/frontend/app-development/features/administration/components/Administration.module.css b/frontend/app-development/features/overview/components/Overview.module.css similarity index 100% rename from frontend/app-development/features/administration/components/Administration.module.css rename to frontend/app-development/features/overview/components/Overview.module.css diff --git a/frontend/app-development/features/administration/components/Administration.test.tsx b/frontend/app-development/features/overview/components/Overview.test.tsx similarity index 89% rename from frontend/app-development/features/administration/components/Administration.test.tsx rename to frontend/app-development/features/overview/components/Overview.test.tsx index 6bb5d15b306..f6d5ade1826 100644 --- a/frontend/app-development/features/administration/components/Administration.test.tsx +++ b/frontend/app-development/features/overview/components/Overview.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { screen } from '@testing-library/react'; -import { Administration } from './Administration'; +import { Overview } from './Overview'; import { APP_DEVELOPMENT_BASENAME } from 'app-shared/constants'; import { renderWithProviders } from '../../../test/testUtils'; import { queriesMock } from 'app-development/test/mocks'; @@ -14,7 +14,7 @@ const title = 'test'; // Mocking console.error due to Tanstack Query removing custom logger between V4 and v5 see issue: #11692 const realConsole = console; -describe('Administration', () => { +describe('Overview', () => { beforeEach(() => { global.console = { ...console, @@ -50,7 +50,7 @@ describe('Administration', () => { getAppConfig: () => Promise.reject(), getOrgList: () => Promise.reject(), }); - expect(await screen.findByText(textMock('administration.fetch_title_error_message'))); + expect(await screen.findByText(textMock('overview.fetch_title_error_message'))); }); it('should display AppLogs if environments exist', async () => { @@ -109,7 +109,7 @@ describe('Administration', () => { ), }); expect( - await screen.findByRole('heading', { name: textMock('administration.activity') }), + await screen.findByRole('heading', { name: textMock('overview.activity') }), ).toBeInTheDocument(); }); @@ -123,13 +123,13 @@ describe('Administration', () => { ), }); expect( - screen.queryByRole('heading', { name: textMock('administration.activity') }), + screen.queryByRole('heading', { name: textMock('overview.activity') }), ).not.toBeInTheDocument(); }); }); const render = (queries = {}) => { - return renderWithProviders(, { + return renderWithProviders(, { startUrl: `${APP_DEVELOPMENT_BASENAME}/${org}/${app}`, queries: { ...queriesMock, diff --git a/frontend/app-development/features/administration/components/Administration.tsx b/frontend/app-development/features/overview/components/Overview.tsx similarity index 94% rename from frontend/app-development/features/administration/components/Administration.tsx rename to frontend/app-development/features/overview/components/Overview.tsx index 03823d55520..1b51f392e68 100644 --- a/frontend/app-development/features/administration/components/Administration.tsx +++ b/frontend/app-development/features/overview/components/Overview.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import classes from './Administration.module.css'; +import classes from './Overview.module.css'; import { useAppConfigQuery, useOrgListQuery } from 'app-development/hooks/queries'; import { useStudioUrlParams } from 'app-shared/hooks/useStudioUrlParams'; import { Heading, Link } from '@digdir/design-system-react'; @@ -13,7 +13,7 @@ import { News } from './News'; import { PageContainer } from 'app-shared/components/PageContainer/PageContainer'; import { StudioCenter, StudioSpinner } from '@studio/components'; -export const Administration = () => { +export const Overview = () => { const { org, app } = useStudioUrlParams(); const { data: orgs, @@ -32,7 +32,7 @@ export const Administration = () => { const { t } = useTranslation(); if (isAppConfigError || isOrgsError) { - toast.error(t('administration.fetch_title_error_message')); + toast.error(t('overview.fetch_title_error_message')); } if (isPendingAppConfig || isPendingOrgs) { diff --git a/frontend/app-development/features/administration/handleServiceInformationSagas.ts b/frontend/app-development/features/overview/handleServiceInformationSagas.ts similarity index 97% rename from frontend/app-development/features/administration/handleServiceInformationSagas.ts rename to frontend/app-development/features/overview/handleServiceInformationSagas.ts index b66ad57d553..5961dca69cb 100644 --- a/frontend/app-development/features/administration/handleServiceInformationSagas.ts +++ b/frontend/app-development/features/overview/handleServiceInformationSagas.ts @@ -22,7 +22,7 @@ export function* handleFetchServiceSaga({ yield put( HandleServiceInformationActions.fetchServiceFulfilled({ repository: result, - }) + }), ); } catch (error) { yield put(HandleServiceInformationActions.fetchServiceRejected({ error })); @@ -42,7 +42,7 @@ export function* handleFetchServiceNameSaga({ yield put( HandleServiceInformationActions.fetchServiceNameFulfilled({ serviceName: serviceName || '', - }) + }), ); } catch (error) { yield put(HandleServiceInformationActions.fetchServiceNameRejected({ error })); @@ -61,7 +61,7 @@ export function* handleSaveServiceNameSaga({ yield put( HandleServiceInformationActions.saveServiceNameFulfilled({ newServiceName, - }) + }), ); } catch (error) { yield put(HandleServiceInformationActions.saveServiceNameRejected({ error })); @@ -87,7 +87,7 @@ export function* handleFetchInitialCommitSaga({ export function* watchHandleFetchInitialCommitSaga(): SagaIterator { yield takeLatest( HandleServiceInformationActions.fetchInitialCommit, - handleFetchInitialCommitSaga + handleFetchInitialCommitSaga, ); } @@ -100,7 +100,7 @@ export function* handleFetchServiceConfigSaga({ yield put( HandleServiceInformationActions.fetchServiceConfigFulfilled({ serviceConfig: serviceConfig || null, - }) + }), ); } catch (error) { yield put(HandleServiceInformationActions.fetchInitialCommitRejected({ error })); @@ -110,7 +110,7 @@ export function* handleFetchServiceConfigSaga({ export function* watchHandleFetchServiceConfigSaga(): SagaIterator { yield takeLatest( HandleServiceInformationActions.fetchServiceConfig, - handleFetchServiceConfigSaga + handleFetchServiceConfigSaga, ); } @@ -128,7 +128,7 @@ export function* handleSaveServiceConfigSaga({ newServiceDescription, newServiceId, newServiceName, - }) + }), ); window.postMessage(postMessages.filesAreSaved, window.location.href); } catch (error) { diff --git a/frontend/app-development/features/administration/handleServiceInformationSlice.ts b/frontend/app-development/features/overview/handleServiceInformationSlice.ts similarity index 96% rename from frontend/app-development/features/administration/handleServiceInformationSlice.ts rename to frontend/app-development/features/overview/handleServiceInformationSlice.ts index 08c75be61df..9953cf631c3 100644 --- a/frontend/app-development/features/administration/handleServiceInformationSlice.ts +++ b/frontend/app-development/features/overview/handleServiceInformationSlice.ts @@ -1,11 +1,6 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { createAction, createSlice } from '@reduxjs/toolkit'; -import type { - ICommit, - IServiceDescription, - IServiceId, - IServiceName, -} from '../../types/global'; +import type { ICommit, IServiceDescription, IServiceId, IServiceName } from '../../types/global'; import type { IFetchInitialCommitFulfilled, IHandleServiceInformationActionRejected, @@ -61,7 +56,7 @@ const handleServiceInformationSlice = createSlice({ }, fetchInitialCommitRejected: ( state, - action: PayloadAction + action: PayloadAction, ) => { const { error } = action.payload; state.error = error; @@ -72,7 +67,7 @@ const handleServiceInformationSlice = createSlice({ }, fetchServiceRejected: ( state, - action: PayloadAction + action: PayloadAction, ) => { const { error } = action.payload; state.error = error; @@ -84,7 +79,7 @@ const handleServiceInformationSlice = createSlice({ }, fetchServiceConfigRejected: ( state, - action: PayloadAction + action: PayloadAction, ) => { const { error } = action.payload; state.error = error; @@ -96,7 +91,7 @@ const handleServiceInformationSlice = createSlice({ }, fetchServiceNameRejected: ( state, - action: PayloadAction + action: PayloadAction, ) => { const { error } = action.payload; state.error = error; @@ -104,7 +99,7 @@ const handleServiceInformationSlice = createSlice({ saveServiceConfig: ( state, // eslint-disable-next-line @typescript-eslint/no-unused-vars - action: PayloadAction + action: PayloadAction, ) => { state.serviceDescriptionObj.saving = true; state.serviceIdObj.saving = true; @@ -118,7 +113,7 @@ const handleServiceInformationSlice = createSlice({ }, saveServiceConfigRejected: ( state, - action: PayloadAction + action: PayloadAction, ) => { const { error } = action.payload; state.error = error; @@ -136,7 +131,7 @@ const handleServiceInformationSlice = createSlice({ }, saveServiceNameRejected: ( state, - action: PayloadAction + action: PayloadAction, ) => { const { error } = action.payload; state.error = error; diff --git a/frontend/app-development/features/administration/types.ts b/frontend/app-development/features/overview/types.ts similarity index 100% rename from frontend/app-development/features/administration/types.ts rename to frontend/app-development/features/overview/types.ts diff --git a/frontend/app-development/features/administration/components/DownloadRepoModal.tsx b/frontend/app-development/features/simpleMerge/DownloadRepoModal.tsx similarity index 85% rename from frontend/app-development/features/administration/components/DownloadRepoModal.tsx rename to frontend/app-development/features/simpleMerge/DownloadRepoModal.tsx index d5ee7950efc..af14243f8d4 100644 --- a/frontend/app-development/features/administration/components/DownloadRepoModal.tsx +++ b/frontend/app-development/features/simpleMerge/DownloadRepoModal.tsx @@ -31,18 +31,18 @@ export function DownloadRepoModal(props: IDownloadRepoModalProps) { }} >
-

{t('administration.download_repo_heading')}

+

{t('overview.download_repo_heading')}

- +

- {t('administration.download_repo_changes')} + {t('overview.download_repo_changes')}

- {t('administration.download_repo_full')} + {t('overview.download_repo_full')}

diff --git a/frontend/app-development/features/simpleMerge/MergeConflictWarning.tsx b/frontend/app-development/features/simpleMerge/MergeConflictWarning.tsx index 253c76073ca..ec97d2fe1f4 100644 --- a/frontend/app-development/features/simpleMerge/MergeConflictWarning.tsx +++ b/frontend/app-development/features/simpleMerge/MergeConflictWarning.tsx @@ -3,8 +3,8 @@ import classes from './MergeConflictWarning.module.css'; import { Button } from '@digdir/design-system-react'; import { Download } from '@navikt/ds-icons'; import { ButtonContainer } from 'app-shared/primitives'; -import { DownloadRepoModal } from '../administration/components/DownloadRepoModal'; -import { ResetRepoModal } from '../administration/components/ResetRepoModal'; +import { DownloadRepoModal } from './DownloadRepoModal'; +import { ResetRepoModal } from './ResetRepoModal'; import { useTranslation } from 'react-i18next'; interface MergeConflictWarningProps { diff --git a/frontend/app-development/features/administration/components/RepoModal.module.css b/frontend/app-development/features/simpleMerge/RepoModal.module.css similarity index 100% rename from frontend/app-development/features/administration/components/RepoModal.module.css rename to frontend/app-development/features/simpleMerge/RepoModal.module.css diff --git a/frontend/app-development/features/administration/components/ResetRepoModal.test.tsx b/frontend/app-development/features/simpleMerge/ResetRepoModal.test.tsx similarity index 87% rename from frontend/app-development/features/administration/components/ResetRepoModal.test.tsx rename to frontend/app-development/features/simpleMerge/ResetRepoModal.test.tsx index 49eaef79e40..d5a2d2eb171 100644 --- a/frontend/app-development/features/administration/components/ResetRepoModal.test.tsx +++ b/frontend/app-development/features/simpleMerge/ResetRepoModal.test.tsx @@ -5,9 +5,9 @@ import { act, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { renderWithMockStore } from 'app-development/test/mocks'; -import { mockUseTranslation } from '../../../../testing/mocks/i18nMock'; +import { mockUseTranslation } from '../../../testing/mocks/i18nMock'; import { ServicesContextProps } from 'app-shared/contexts/ServicesContext'; -import * as testids from '../../../../testing/testids'; +import * as testids from '../../../testing/testids'; const user = userEvent.setup(); @@ -18,10 +18,10 @@ const resetModalButton = 'Reset repository'; const resetModalCancel = 'Cancel'; const texts = { - 'administration.reset_repo_confirm_heading': resetModalHeading, - 'administration.reset_repo_confirm_info': resetModalConfirmInfo, - 'administration.reset_repo_confirm_repo_name': resetModalConfirmRepoName, - 'administration.reset_repo_button': resetModalButton, + 'overview.reset_repo_confirm_heading': resetModalHeading, + 'overview.reset_repo_confirm_info': resetModalConfirmInfo, + 'overview.reset_repo_confirm_repo_name': resetModalConfirmRepoName, + 'overview.reset_repo_button': resetModalButton, 'general.cancel': resetModalCancel, }; @@ -59,7 +59,8 @@ describe('ResetRepoModal', () => { repositoryName: mockRepoName, org: 'testOrg', }; - return renderWithMockStore({}, queries)()}; + return renderWithMockStore({}, queries)(); + }; it('renders the component', () => { render(); @@ -112,6 +113,6 @@ describe('ResetRepoModal', () => { const repoNameInput = screen.getByLabelText(resetModalConfirmRepoName); await act(() => user.type(repoNameInput, mockRepoName)); await act(() => user.click(screen.getByRole('button', { name: resetModalButton }))); - expect(await screen.findByText('administration.reset_repo_completed')).toBeInTheDocument(); + expect(await screen.findByText('overview.reset_repo_completed')).toBeInTheDocument(); }); }); diff --git a/frontend/app-development/features/administration/components/ResetRepoModal.tsx b/frontend/app-development/features/simpleMerge/ResetRepoModal.tsx similarity index 89% rename from frontend/app-development/features/administration/components/ResetRepoModal.tsx rename to frontend/app-development/features/simpleMerge/ResetRepoModal.tsx index fae06150d4e..681984aad21 100644 --- a/frontend/app-development/features/administration/components/ResetRepoModal.tsx +++ b/frontend/app-development/features/simpleMerge/ResetRepoModal.tsx @@ -5,7 +5,7 @@ import { Button, Textfield } from '@digdir/design-system-react'; import { Popover } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { useResetRepositoryMutation } from 'app-development/hooks/mutations/useResetRepositoryMutation'; -import * as testids from '../../../../testing/testids'; +import * as testids from '../../../testing/testids'; import { toast } from 'react-toastify'; import { Trans } from 'react-i18next'; import { useQueryClient } from '@tanstack/react-query'; @@ -38,7 +38,7 @@ export function ResetRepoModal(props: IResetRepoModalProps) { setCanDelete(false); repoResetMutation.mutate(undefined, { onSuccess: () => { - toast.success(t('administration.reset_repo_completed')); + toast.success(t('overview.reset_repo_completed')); queryClient.removeQueries(); onCloseWrapper(); }, @@ -73,16 +73,16 @@ export function ResetRepoModal(props: IResetRepoModalProps) { }} >
-

{t('administration.reset_repo_confirm_heading')}

+

{t('overview.reset_repo_confirm_heading')}

}} />
- {t('administration.reset_repo_button')} + {t('overview.reset_repo_button')}
} - sideMenuChildren={
Side menu content
} - aboveMenuChildren={
Above the column content
} - header={'The header'} -/> -``` diff --git a/frontend/packages/shared/src/components/AltinnColumnLayout.module.css b/frontend/packages/shared/src/components/AltinnColumnLayout.module.css deleted file mode 100644 index deb305b687f..00000000000 --- a/frontend/packages/shared/src/components/AltinnColumnLayout.module.css +++ /dev/null @@ -1,22 +0,0 @@ -.root { - --padding: 2rem; - - display: flex; - flex-direction: row; - padding: var(--padding) 0; -} - -.header { - margin-bottom: 3rem; -} - -.left { - flex-grow: 2; - padding: 0 var(--padding); -} - -.right { - border-left: 1px solid #bcc7cc; - flex-grow: 1; - padding: 0 var(--padding); -} diff --git a/frontend/packages/shared/src/components/AltinnColumnLayout.test.tsx b/frontend/packages/shared/src/components/AltinnColumnLayout.test.tsx deleted file mode 100644 index adf8b8a7567..00000000000 --- a/frontend/packages/shared/src/components/AltinnColumnLayout.test.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import { render as rtlRender, screen } from '@testing-library/react'; -import type { IAltinnColumnLayoutProps } from './AltinnColumnLayout'; -import { AltinnColumnLayout } from './AltinnColumnLayout'; - -describe('AltinnColumnLayout', () => { - it('should render title and all children', () => { - render({ - children:
, - sideMenuChildren:
, - header: 'Header text', - }); - - expect(screen.getByText('Header text')).toBeInTheDocument(); - expect(screen.getByTestId('children')).toBeInTheDocument(); - expect(screen.getByTestId('sideMenuChildren')).toBeInTheDocument(); - }); -}); - -const render = (props: Partial = {}) => { - const allProps = { - children:
, - sideMenuChildren:
, - header: 'Header text', - ...props, - } as IAltinnColumnLayoutProps; - // eslint-disable-next-line testing-library/no-node-access - rtlRender({allProps.children}); -}; diff --git a/frontend/packages/shared/src/components/AltinnColumnLayout.tsx b/frontend/packages/shared/src/components/AltinnColumnLayout.tsx deleted file mode 100644 index a6f76fb4c7a..00000000000 --- a/frontend/packages/shared/src/components/AltinnColumnLayout.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; -import cn from 'classnames'; -import classes from './AltinnColumnLayout.module.css'; - -export interface IAltinnColumnLayoutProps { - className?: string; - /** Children rendered as main content */ - children: any; - /** Children rendered in the side menu */ - sideMenuChildren: any; - /** The header displayed above the main content */ - header: string; -} - -export const AltinnColumnLayout = ({ - children, - className, - header, - sideMenuChildren, -}: IAltinnColumnLayoutProps) => { - return ( -
-
-

{header}

-
{children}
-
-
- {sideMenuChildren} -
-
- ); -}; diff --git a/frontend/packages/shared/src/utils/featureToggleUtils.ts b/frontend/packages/shared/src/utils/featureToggleUtils.ts index 88b4f6444a4..71dea040985 100644 --- a/frontend/packages/shared/src/utils/featureToggleUtils.ts +++ b/frontend/packages/shared/src/utils/featureToggleUtils.ts @@ -9,7 +9,6 @@ export type SupportedFeatureFlags = | 'expressions' | 'processEditor' | 'configureLayoutSet' - | 'newAdministration' | 'shouldOverrideAppLibCheck'; /* diff --git a/frontend/resourceadm/components/MergeConflictModal/RemoveChangesModal/RemoveChangesModal.tsx b/frontend/resourceadm/components/MergeConflictModal/RemoveChangesModal/RemoveChangesModal.tsx index 03ff8a37a9f..126125e7a9c 100644 --- a/frontend/resourceadm/components/MergeConflictModal/RemoveChangesModal/RemoveChangesModal.tsx +++ b/frontend/resourceadm/components/MergeConflictModal/RemoveChangesModal/RemoveChangesModal.tsx @@ -4,7 +4,6 @@ import { Button, Textfield, Paragraph } from '@digdir/design-system-react'; import classes from './RemoveChangesModal.module.css'; import { Modal } from 'resourceadm/components/Modal'; import { ScreenReaderSpan } from 'resourceadm/components/ScreenReaderSpan'; -import { Trans } from 'react-i18next'; type RemoveChangesModalProps = { onClose: () => void; @@ -39,13 +38,13 @@ export const RemoveChangesModal = forwardRef + - }} - /> + {t('settings_modal.local_changes_tab_delete_modal_text')}
- {t('administration.reset_repo_button')} + {t('settings_modal.local_changes_tab_delete_modal_delete_button')}