From 534bd82cf2805b398f0b79834dfaaa04c5ca3fe4 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Mon, 21 Sep 2026 15:57:11 +0200 Subject: [PATCH] Frontend improvements (#1338) * Improvements * Frontend improvements. --- CLAUDE.md | 1 + backend/i18n/frontend_de.json | 2 + backend/i18n/frontend_en.json | 2 + backend/i18n/frontend_fr.json | 2 + backend/i18n/frontend_it.json | 2 + backend/i18n/frontend_nl.json | 2 + backend/i18n/frontend_pt.json | 2 + backend/i18n/frontend_zh.json | 2 + backend/i18n/source/frontend_en.json | 2 + .../guards/user-must-exist.guard.spec.ts | 4 - .../state/event-consumers.state.spec.ts | 1 - .../administration/state/users.state.spec.ts | 1 - .../shared/forms/field-editor.component.html | 3 + .../shared/forms/field-editor.component.scss | 5 + .../shared/forms/field-editor.component.ts | 3 +- .../teams/state/team-auth.state.spec.ts | 1 - .../state/team-contributors.state.spec.ts | 1 - .../teams/state/team-plans.state.spec.ts | 2 - .../forms/confirm-click.directive.spec.ts | 1 - .../angular/routers/router-2-state.spec.ts | 4 - .../framework/services/dialog.service.spec.ts | 3 - .../guards/app-must-exist.guard.spec.ts | 1 - .../guards/content-must-exist.guard.spec.ts | 4 - .../app/shared/guards/load-apps.guard.spec.ts | 1 - .../guards/load-languages.guard.spec.ts | 1 - .../shared/guards/load-schemas.guard.spec.ts | 1 - .../shared/guards/load-settings.guard.spec.ts | 1 - .../shared/guards/load-teams.guard.spec.ts | 1 - .../must-be-authenticated.guard.spec.ts | 3 - .../must-be-not-authenticated.guard.spec.ts | 4 - .../guards/rule-must-exist.guard.spec.ts | 4 - .../schema-must-exist-published.guard.spec.ts | 4 - .../guards/schema-must-exist.guard.spec.ts | 1 - ...schema-must-not-be-singleton.guard.spec.ts | 6 - .../guards/team-must-exist.guard.spec.ts | 1 - .../app/shared/guards/unset-app.guard.spec.ts | 1 - .../shared/guards/unset-team.guard.spec.ts | 1 - .../interceptors/auth.interceptor.spec.ts | 1 - .../shared/services/assets.service.spec.ts | 20 +- .../src/app/shared/services/assets.service.ts | 4 +- .../shared/services/autosave.service.spec.ts | 3 - .../services/users-provider.service.spec.ts | 4 - .../src/app/shared/state/apps.state.spec.ts | 2 - .../shared/state/asset-scripts.state.spec.ts | 1 - .../shared/state/asset-uploader.state.spec.ts | 42 +- .../app/shared/state/asset-uploader.state.ts | 16 +- .../src/app/shared/state/assets.state.spec.ts | 1 - .../app/shared/state/clients.state.spec.ts | 1 - .../shared/state/contributors.state.spec.ts | 1 - .../app/shared/state/indexes.state.spec.ts | 3 - .../src/app/shared/state/jobs.state.spec.ts | 3 - .../app/shared/state/languages.state.spec.ts | 2 - .../src/app/shared/state/plans.state.spec.ts | 2 - frontend/src/app/shared/state/queries.spec.ts | 4 - .../src/app/shared/state/resolvers.spec.ts | 3 - .../src/app/shared/state/roles.state.spec.ts | 1 - .../shared/state/rule-events.state.spec.ts | 1 - .../shared/state/rule-simulator.state.spec.ts | 2 - .../src/app/shared/state/rules.state.spec.ts | 1 - .../app/shared/state/schemas.state.spec.ts | 2 - .../app/shared/state/table-settings.spec.ts | 4 - .../app/shared/state/template.state.spec.ts | 1 - .../app/shared/state/workflows.state.spec.ts | 1 - todo.md | 510 +++++++++++++++++- 64 files changed, 591 insertions(+), 126 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index bc0665a5d..6bf579fff 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -28,6 +28,7 @@ npm run lint - i18n texts live in `backend/i18n`, translations are generated into the frontend — do not edit generated translation files by hand. - Do not write JsDoc comments. +- In tests, keep `verify` calls and `expect` calls next to each other, without blank lines between them. ## Backend diff --git a/backend/i18n/frontend_de.json b/backend/i18n/frontend_de.json index 4da35d159..eee6a426d 100644 --- a/backend/i18n/frontend_de.json +++ b/backend/i18n/frontend_de.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Asset löschen", "assets.downloadVersion": "Diese Version herunterladen", "assets.dropToUpdate": "Zum Aktualisieren hier ablegen", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "Asset wurde bereits hochgeladen.", "assets.edit": "Asset bearbeiten", "assets.editor.flipHorizontally": "Horizontal spiegeln", diff --git a/backend/i18n/frontend_en.json b/backend/i18n/frontend_en.json index be749d4e1..353256504 100644 --- a/backend/i18n/frontend_en.json +++ b/backend/i18n/frontend_en.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Delete asset", "assets.downloadVersion": "Download this Version", "assets.dropToUpdate": "Drop to update", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "Asset has already been uploaded.", "assets.edit": "Edit Asset", "assets.editor.flipHorizontally": "Flip Horizontally", diff --git a/backend/i18n/frontend_fr.json b/backend/i18n/frontend_fr.json index 41d4dc725..5564d6820 100644 --- a/backend/i18n/frontend_fr.json +++ b/backend/i18n/frontend_fr.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Supprimer l'actif", "assets.downloadVersion": "Télécharger cette version", "assets.dropToUpdate": "Déposez pour mettre à jour", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "L'actif a déjà été téléchargé.", "assets.edit": "Modifier l'actif", "assets.editor.flipHorizontally": "Retourner horizontalement", diff --git a/backend/i18n/frontend_it.json b/backend/i18n/frontend_it.json index 175ce9119..aa0174924 100644 --- a/backend/i18n/frontend_it.json +++ b/backend/i18n/frontend_it.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Risorsa cancellata", "assets.downloadVersion": "Scarica questa versione", "assets.dropToUpdate": "Trascina il file per aggiornare", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "La risorsa è già stata caricata.", "assets.edit": "Edit Asset", "assets.editor.flipHorizontally": "Capovolgi orizzontalmente", diff --git a/backend/i18n/frontend_nl.json b/backend/i18n/frontend_nl.json index 53332ddc0..e8dfba553 100644 --- a/backend/i18n/frontend_nl.json +++ b/backend/i18n/frontend_nl.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Verwijder bestand", "assets.downloadVersion": "Download deze versie", "assets.dropToUpdate": "Zet neer om te updaten", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "Asset is al geüpload.", "assets.edit": "Asset aanpassen", "assets.editor.flipHorizontally": "Horizontaal spiegelen", diff --git a/backend/i18n/frontend_pt.json b/backend/i18n/frontend_pt.json index 8f148a34b..f918b9d5b 100644 --- a/backend/i18n/frontend_pt.json +++ b/backend/i18n/frontend_pt.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Excluir o ficheiro", "assets.downloadVersion": "Descarregue esta versão", "assets.dropToUpdate": "Deixar para atualizar", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "O ficheiro já foi carregado.", "assets.edit": "Edição de ficheiros", "assets.editor.flipHorizontally": "Virar horizontalmente", diff --git a/backend/i18n/frontend_zh.json b/backend/i18n/frontend_zh.json index 3e58dfea5..27fc0c379 100644 --- a/backend/i18n/frontend_zh.json +++ b/backend/i18n/frontend_zh.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "删除资源", "assets.downloadVersion": "下载此版本", "assets.dropToUpdate": "下拉更新", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "资源已经上传。", "assets.edit": "Edit Asset", "assets.editor.flipHorizontally": "Flip Horizontally", diff --git a/backend/i18n/source/frontend_en.json b/backend/i18n/source/frontend_en.json index be749d4e1..353256504 100644 --- a/backend/i18n/source/frontend_en.json +++ b/backend/i18n/source/frontend_en.json @@ -87,6 +87,8 @@ "assets.deleteReferrerConfirmTitle": "Delete asset", "assets.downloadVersion": "Download this Version", "assets.dropToUpdate": "Drop to update", + "assets.duplicateConfirmText": "This file has already been uploaded. Do you want to upload it anyway as a new asset?", + "assets.duplicateConfirmTitle": "Duplicate asset", "assets.duplicateFile": "Asset has already been uploaded.", "assets.edit": "Edit Asset", "assets.editor.flipHorizontally": "Flip Horizontally", diff --git a/frontend/src/app/features/administration/guards/user-must-exist.guard.spec.ts b/frontend/src/app/features/administration/guards/user-must-exist.guard.spec.ts index 789f7f05b..69838d17b 100644 --- a/frontend/src/app/features/administration/guards/user-must-exist.guard.spec.ts +++ b/frontend/src/app/features/administration/guards/user-must-exist.guard.spec.ts @@ -47,7 +47,6 @@ describe('UserMustExistGuard', () => { const result = await firstValueFrom(userMustExistGuard(route)); expect(result).toBeTruthy(); - usersState.verify(x => x.select('123'), Times.once()); }); @@ -64,7 +63,6 @@ describe('UserMustExistGuard', () => { const result = await firstValueFrom(userMustExistGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); @@ -81,7 +79,6 @@ describe('UserMustExistGuard', () => { const result = await firstValueFrom(userMustExistGuard(route)); expect(result).toBeTruthy(); - usersState.verify(x => x.select(null), Times.once()); }); @@ -98,7 +95,6 @@ describe('UserMustExistGuard', () => { const result = await firstValueFrom(userMustExistGuard(route)); expect(result).toBeTruthy(); - usersState.verify(x => x.select(null), Times.once()); }); }); diff --git a/frontend/src/app/features/administration/state/event-consumers.state.spec.ts b/frontend/src/app/features/administration/state/event-consumers.state.spec.ts index 3978e034d..33c21ea88 100644 --- a/frontend/src/app/features/administration/state/event-consumers.state.spec.ts +++ b/frontend/src/app/features/administration/state/event-consumers.state.spec.ts @@ -41,7 +41,6 @@ describe('EventConsumersState', () => { expect(eventConsumersState.snapshot.eventConsumers).toEqual([eventConsumer1, eventConsumer2]); expect(eventConsumersState.snapshot.isLoaded).toBeTruthy(); expect(eventConsumersState.snapshot.isLoading).toBeFalsy(); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/features/administration/state/users.state.spec.ts b/frontend/src/app/features/administration/state/users.state.spec.ts index bc09ee2cd..d5863d2de 100644 --- a/frontend/src/app/features/administration/state/users.state.spec.ts +++ b/frontend/src/app/features/administration/state/users.state.spec.ts @@ -44,7 +44,6 @@ describe('UsersState', () => { expect(usersState.snapshot.isLoaded).toBeTruthy(); expect(usersState.snapshot.isLoading).toBeFalsy(); expect(usersState.snapshot.total).toEqual(200); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/features/content/shared/forms/field-editor.component.html b/frontend/src/app/features/content/shared/forms/field-editor.component.html index b5ec46740..8b99e1bbd 100644 --- a/frontend/src/app/features/content/shared/forms/field-editor.component.html +++ b/frontend/src/app/features/content/shared/forms/field-editor.component.html @@ -5,6 +5,9 @@
@if (field.isDisabled) { Disabled diff --git a/frontend/src/app/features/content/shared/forms/field-editor.component.scss b/frontend/src/app/features/content/shared/forms/field-editor.component.scss index d224c26b2..72986d422 100644 --- a/frontend/src/app/features/content/shared/forms/field-editor.component.scss +++ b/frontend/src/app/features/content/shared/forms/field-editor.component.scss @@ -7,6 +7,11 @@ color: $color-theme-error; } + &-required-publish { + color: $color-theme-warning; + cursor: default; + } + &-disabled { color: $color-text-decent; font-size: $font-smallest; diff --git a/frontend/src/app/features/content/shared/forms/field-editor.component.ts b/frontend/src/app/features/content/shared/forms/field-editor.component.ts index c584586ac..5e1e3415c 100644 --- a/frontend/src/app/features/content/shared/forms/field-editor.component.ts +++ b/frontend/src/app/features/content/shared/forms/field-editor.component.ts @@ -9,7 +9,7 @@ import { AsyncPipe } from '@angular/common'; import { booleanAttribute, Component, ElementRef, EventEmitter, Input, numberAttribute, Output, ViewChild } from '@angular/core'; import { AbstractControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BehaviorSubject, Observable } from 'rxjs'; -import { AbstractContentForm, AnnotationCreate, AnnotationsSelected, AnyFieldDto, AppLanguageDto, ChatDialogComponent, CheckboxGroupComponent, CodeEditorComponent, ColorPickerComponent, CommentSelected, CommentsState, ControlErrorsComponent, DateTimeEditorComponent, DialogModel, disabled$, EditContentForm, FieldSelected, FormHintComponent, GeolocationEditorComponent, hasNoValue$, HTTP, IndeterminateValueDirective, MarkdownDirective, MathHelper, MenuComponent, MenuItemComponent, MessageBus, ModalDirective, RadioGroupComponent, ReferenceInputComponent, ReferencesFieldPropertiesDto, RichEditorComponent, StarsComponent, Subscriptions, TagEditorComponent, ToggleComponent, TransformInputDirective, TypedSimpleChanges, Types } from '@app/shared'; +import { AbstractContentForm, AnnotationCreate, AnnotationsSelected, AnyFieldDto, AppLanguageDto, ChatDialogComponent, CheckboxGroupComponent, CodeEditorComponent, ColorPickerComponent, CommentSelected, CommentsState, ControlErrorsComponent, DateTimeEditorComponent, DialogModel, disabled$, EditContentForm, FieldSelected, FormHintComponent, GeolocationEditorComponent, hasNoValue$, HTTP, IndeterminateValueDirective, MarkdownDirective, MathHelper, MenuComponent, MenuItemComponent, MessageBus, ModalDirective, RadioGroupComponent, ReferenceInputComponent, ReferencesFieldPropertiesDto, RichEditorComponent, StarsComponent, Subscriptions, TagEditorComponent, ToggleComponent, TooltipDirective, TransformInputDirective, TypedSimpleChanges, Types } from '@app/shared'; import { ReferenceDropdownComponent } from '../references/reference-dropdown.component'; import { ReferencesCheckboxesComponent } from '../references/references-checkboxes.component'; import { ReferencesEditorComponent } from '../references/references-editor.component'; @@ -59,6 +59,7 @@ import { UserInfoEditorComponent } from './user-info-editor.component'; StockPhotoEditorComponent, TagEditorComponent, ToggleComponent, + TooltipDirective, TransformInputDirective, UserInfoEditorComponent, ], diff --git a/frontend/src/app/features/teams/state/team-auth.state.spec.ts b/frontend/src/app/features/teams/state/team-auth.state.spec.ts index e2aca304f..33650e0e3 100644 --- a/frontend/src/app/features/teams/state/team-auth.state.spec.ts +++ b/frontend/src/app/features/teams/state/team-auth.state.spec.ts @@ -48,7 +48,6 @@ describe('TeamAuthState', () => { expect(authState.snapshot.isLoaded).toBeTruthy(); expect(authState.snapshot.canUpdate).toBeTruthy(); expect(authState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/features/teams/state/team-contributors.state.spec.ts b/frontend/src/app/features/teams/state/team-contributors.state.spec.ts index 1a1d4777a..7be0fe6e5 100644 --- a/frontend/src/app/features/teams/state/team-contributors.state.spec.ts +++ b/frontend/src/app/features/teams/state/team-contributors.state.spec.ts @@ -52,7 +52,6 @@ describe('TeamContributorsState', () => { expect(contributorsState.snapshot.total).toEqual(20); expect(contributorsState.snapshot.maxContributors).toBe(oldContributors.maxContributors); expect(contributorsState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/features/teams/state/team-plans.state.spec.ts b/frontend/src/app/features/teams/state/team-plans.state.spec.ts index 95af855f3..de2a4d778 100644 --- a/frontend/src/app/features/teams/state/team-plans.state.spec.ts +++ b/frontend/src/app/features/teams/state/team-plans.state.spec.ts @@ -76,7 +76,6 @@ describe('TeamPlansState', () => { ]); expect(plansState.snapshot.isLoaded).toBeTruthy(); expect(plansState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); @@ -93,7 +92,6 @@ describe('TeamPlansState', () => { expect(plansState.snapshot.isLoaded).toBeTruthy(); expect(plansState.snapshot.isLoading).toBeFalsy(); expect(plansState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/framework/angular/forms/confirm-click.directive.spec.ts b/frontend/src/app/framework/angular/forms/confirm-click.directive.spec.ts index 76db5c0f0..387940118 100644 --- a/frontend/src/app/framework/angular/forms/confirm-click.directive.spec.ts +++ b/frontend/src/app/framework/angular/forms/confirm-click.directive.spec.ts @@ -35,7 +35,6 @@ describe('ConfirmClickDirective', () => { confirmClickDirective.onClick(new Event('click')); expect(invoked).toBe(true); - dialogs.verify(x => x.confirm(It.isAnyString(), It.isAnyString(), It.isAny()), Times.never()); }); diff --git a/frontend/src/app/framework/angular/routers/router-2-state.spec.ts b/frontend/src/app/framework/angular/routers/router-2-state.spec.ts index 0d5a6116a..9fe2ea901 100644 --- a/frontend/src/app/framework/angular/routers/router-2-state.spec.ts +++ b/frontend/src/app/framework/angular/routers/router-2-state.spec.ts @@ -116,7 +116,6 @@ describe('Router2State', () => { const query = synchronizer.parseFromState(state); expect(query).toEqual({ page: '10', pageSize: '20' }); - localStore.verify(x => x.setInt('contents.pageSize', 20), Times.once()); }); @@ -126,7 +125,6 @@ describe('Router2State', () => { const query = synchronizer.parseFromState(state); expect(query).toEqual({ page: undefined, pageSize: '20' }); - localStore.verify(x => x.setInt('contents.pageSize', 20), Times.once()); }); @@ -239,7 +237,6 @@ describe('Router2State', () => { expect(routeExtras!.replaceUrl).toBe(true); expect(routeExtras!.queryParamsHandling).toBe('merge'); expect(routeExtras!.queryParams).toEqual({ state1: 'hello', state2: 'squidex,cms' }); - router.verify(x => x.navigate(It.isAny(), It.isAny()), Times.exactly(2)); }); @@ -262,7 +259,6 @@ describe('Router2State', () => { expect(routeExtras!.replaceUrl).toBe(true); expect(routeExtras!.queryParamsHandling).toBe('merge'); expect(routeExtras!.queryParams).toEqual({ state1: 'hello', state2: 'squidex,cms' }); - router.verify(x => x.navigate(It.isAny(), It.isAny()), Times.exactly(2)); }); }); diff --git a/frontend/src/app/framework/services/dialog.service.spec.ts b/frontend/src/app/framework/services/dialog.service.spec.ts index 57366580c..f9ed1928d 100644 --- a/frontend/src/app/framework/services/dialog.service.spec.ts +++ b/frontend/src/app/framework/services/dialog.service.spec.ts @@ -60,7 +60,6 @@ describe('DialogService', () => { expect(isCompleted).toBeTruthy(); expect(isNext!).toEqual(confirmed); - localStore.verify(x => x.setInt(It.isAnyString(), It.isAnyNumber()), Times.never()); }); }); @@ -87,7 +86,6 @@ describe('DialogService', () => { expect(isCompleted).toBeTruthy(); expect(isNext!).toEqual(confirmed); - localStore.verify(x => x.setInt(It.isAnyString(), It.isAnyNumber()), Times.never()); }); }); @@ -118,7 +116,6 @@ describe('DialogService', () => { expect(isCompleted).toBeTruthy(); expect(isNext!).toEqual(confirmed); - localStore.verify(x => x.setBoolean('dialogs.confirm.MyKey', It.isAny()), Times.exactly(saved)); }); }); diff --git a/frontend/src/app/shared/guards/app-must-exist.guard.spec.ts b/frontend/src/app/shared/guards/app-must-exist.guard.spec.ts index e4eb5d39d..4bb7a8aa6 100644 --- a/frontend/src/app/shared/guards/app-must-exist.guard.spec.ts +++ b/frontend/src/app/shared/guards/app-must-exist.guard.spec.ts @@ -53,7 +53,6 @@ describe('AppMustExistGuard', () => { const result = await firstValueFrom(appMustExistGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); diff --git a/frontend/src/app/shared/guards/content-must-exist.guard.spec.ts b/frontend/src/app/shared/guards/content-must-exist.guard.spec.ts index e620f1626..fb84a7351 100644 --- a/frontend/src/app/shared/guards/content-must-exist.guard.spec.ts +++ b/frontend/src/app/shared/guards/content-must-exist.guard.spec.ts @@ -47,7 +47,6 @@ describe('ContentMustExistGuard', () => { const result = await firstValueFrom(contentMustExistGuard(route)); expect(result).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); @@ -64,7 +63,6 @@ describe('ContentMustExistGuard', () => { const result = await firstValueFrom(contentMustExistGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); @@ -81,7 +79,6 @@ describe('ContentMustExistGuard', () => { const result = await firstValueFrom(contentMustExistGuard(route)); expect(result!).toBeTruthy(); - contentsState.verify(x => x.select(null), Times.once()); }); @@ -98,7 +95,6 @@ describe('ContentMustExistGuard', () => { const result = await firstValueFrom(contentMustExistGuard(route)); expect(result!).toBeTruthy(); - contentsState.verify(x => x.select(null), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/load-apps.guard.spec.ts b/frontend/src/app/shared/guards/load-apps.guard.spec.ts index dc6076499..48b6b417c 100644 --- a/frontend/src/app/shared/guards/load-apps.guard.spec.ts +++ b/frontend/src/app/shared/guards/load-apps.guard.spec.ts @@ -27,7 +27,6 @@ describe('LoadAppsGuard', () => { const result = await firstValueFrom(loadAppsGuard()); expect(result).toBeTruthy(); - appsState.verify(x => x.load(), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/load-languages.guard.spec.ts b/frontend/src/app/shared/guards/load-languages.guard.spec.ts index 33f7c7329..26634247f 100644 --- a/frontend/src/app/shared/guards/load-languages.guard.spec.ts +++ b/frontend/src/app/shared/guards/load-languages.guard.spec.ts @@ -27,7 +27,6 @@ describe('LoadLanguagesGuard', () => { const result = await firstValueFrom(loadLanguagesGuard()); expect(result).toBeTruthy(); - languagesState.verify(x => x.load(), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/load-schemas.guard.spec.ts b/frontend/src/app/shared/guards/load-schemas.guard.spec.ts index 190d0dc55..e9217b751 100644 --- a/frontend/src/app/shared/guards/load-schemas.guard.spec.ts +++ b/frontend/src/app/shared/guards/load-schemas.guard.spec.ts @@ -27,7 +27,6 @@ describe('LoadSchemasGuard', () => { const result = await firstValueFrom(loadSchemasGuard()); expect(result).toBeTruthy(); - schemasState.verify(x => x.load(), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/load-settings.guard.spec.ts b/frontend/src/app/shared/guards/load-settings.guard.spec.ts index 3e85428e2..021ea3908 100644 --- a/frontend/src/app/shared/guards/load-settings.guard.spec.ts +++ b/frontend/src/app/shared/guards/load-settings.guard.spec.ts @@ -27,7 +27,6 @@ describe('LoadAppsGuard', () => { const result = await firstValueFrom(loadSettingsGuard()); expect(result).toBeTruthy(); - uiState.verify(x => x.load(), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/load-teams.guard.spec.ts b/frontend/src/app/shared/guards/load-teams.guard.spec.ts index 1caa617a3..0beb546c7 100644 --- a/frontend/src/app/shared/guards/load-teams.guard.spec.ts +++ b/frontend/src/app/shared/guards/load-teams.guard.spec.ts @@ -27,7 +27,6 @@ describe('LoadTeamsGuard', () => { const result = await firstValueFrom(loadTeamsGuard()); expect(result).toBeTruthy(); - teamsState.verify(x => x.load(), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/must-be-authenticated.guard.spec.ts b/frontend/src/app/shared/guards/must-be-authenticated.guard.spec.ts index bfc6501c0..9aab9d1aa 100644 --- a/frontend/src/app/shared/guards/must-be-authenticated.guard.spec.ts +++ b/frontend/src/app/shared/guards/must-be-authenticated.guard.spec.ts @@ -55,7 +55,6 @@ describe('MustBeAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeAuthenticatedGuard()); expect(result).toBeFalsy(); - router.verify(x => x.navigate([''], { queryParams: { redirectPath: '/my-path' } }), Times.once()); }); @@ -66,7 +65,6 @@ describe('MustBeAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeAuthenticatedGuard()); expect(result!).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); @@ -79,7 +77,6 @@ describe('MustBeAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeAuthenticatedGuard()); expect(result!).toBeFalsy(); - authService.verify(x => x.loginRedirect('/my-path'), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/must-be-not-authenticated.guard.spec.ts b/frontend/src/app/shared/guards/must-be-not-authenticated.guard.spec.ts index bfe168642..9b5e8bb0a 100644 --- a/frontend/src/app/shared/guards/must-be-not-authenticated.guard.spec.ts +++ b/frontend/src/app/shared/guards/must-be-not-authenticated.guard.spec.ts @@ -55,7 +55,6 @@ describe('MustBeNotAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeNotAuthenticatedGuard({} as any)); expect(result!).toBeFalsy(); - router.verify(x => x.navigate(['app'], { queryParams: { redirectPath: '/my-path' } }), Times.once()); }); @@ -66,7 +65,6 @@ describe('MustBeNotAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeNotAuthenticatedGuard({} as any)); expect(result).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); @@ -79,7 +77,6 @@ describe('MustBeNotAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeNotAuthenticatedGuard({ queryParams: {} } as any)); expect(result).toBeFalsy(); - authService.verify(x => x.loginRedirect('/my-path'), Times.once()); }); @@ -92,7 +89,6 @@ describe('MustBeNotAuthenticatedGuard', () => { const result = await firstValueFrom(mustBeNotAuthenticatedGuard({ queryParams: { logout: true } } as any)); expect(result).toBeTruthy(); - authService.verify(x => x.loginRedirect('/my-path'), Times.never()); }); }); diff --git a/frontend/src/app/shared/guards/rule-must-exist.guard.spec.ts b/frontend/src/app/shared/guards/rule-must-exist.guard.spec.ts index 45b282298..094c1c6fe 100644 --- a/frontend/src/app/shared/guards/rule-must-exist.guard.spec.ts +++ b/frontend/src/app/shared/guards/rule-must-exist.guard.spec.ts @@ -47,7 +47,6 @@ describe('RuleMustExistGuard', () => { const result = await firstValueFrom(ruleMustExistGuard(route)); expect(result).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); @@ -64,7 +63,6 @@ describe('RuleMustExistGuard', () => { const result = await firstValueFrom(ruleMustExistGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); @@ -81,7 +79,6 @@ describe('RuleMustExistGuard', () => { const result = await firstValueFrom(ruleMustExistGuard(route)); expect(result).toBeTruthy(); - rulesState.verify(x => x.select(null), Times.once()); }); @@ -98,7 +95,6 @@ describe('RuleMustExistGuard', () => { const result = await firstValueFrom(ruleMustExistGuard(route)); expect(result).toBeTruthy(); - rulesState.verify(x => x.select(null), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/schema-must-exist-published.guard.spec.ts b/frontend/src/app/shared/guards/schema-must-exist-published.guard.spec.ts index 49acc0901..b937415f8 100644 --- a/frontend/src/app/shared/guards/schema-must-exist-published.guard.spec.ts +++ b/frontend/src/app/shared/guards/schema-must-exist-published.guard.spec.ts @@ -47,7 +47,6 @@ describe('SchemaMustExistPublishedGuard', () => { const result = await firstValueFrom(schemaMustExistPublishedGuard(route)); expect(result).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); @@ -58,7 +57,6 @@ describe('SchemaMustExistPublishedGuard', () => { const result = await firstValueFrom(schemaMustExistPublishedGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); @@ -69,7 +67,6 @@ describe('SchemaMustExistPublishedGuard', () => { const result = await firstValueFrom(schemaMustExistPublishedGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); @@ -80,7 +77,6 @@ describe('SchemaMustExistPublishedGuard', () => { const result = await firstValueFrom(schemaMustExistPublishedGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/schema-must-exist.guard.spec.ts b/frontend/src/app/shared/guards/schema-must-exist.guard.spec.ts index e0eaccd81..ab54e99cf 100644 --- a/frontend/src/app/shared/guards/schema-must-exist.guard.spec.ts +++ b/frontend/src/app/shared/guards/schema-must-exist.guard.spec.ts @@ -56,7 +56,6 @@ describe('SchemaMustExistGuard', () => { const result = await firstValueFrom(schemaMustExistGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/schema-must-not-be-singleton.guard.spec.ts b/frontend/src/app/shared/guards/schema-must-not-be-singleton.guard.spec.ts index 06823ee0a..c19febf97 100644 --- a/frontend/src/app/shared/guards/schema-must-not-be-singleton.guard.spec.ts +++ b/frontend/src/app/shared/guards/schema-must-not-be-singleton.guard.spec.ts @@ -54,7 +54,6 @@ describe('SchemaMustNotBeSingletonGuard', () => { const result = await firstValueFrom(schemaMustNotBeSingletonGuard(false)(route, state)); expect(result).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); @@ -67,7 +66,6 @@ describe('SchemaMustNotBeSingletonGuard', () => { const result = await firstValueFrom(schemaMustNotBeSingletonGuard(false)(route, state)); expect(result).toBeFalsy(); - router.verify(x => x.navigate([state.url, '123']), Times.once()); }); @@ -80,7 +78,6 @@ describe('SchemaMustNotBeSingletonGuard', () => { const result = await firstValueFrom(schemaMustNotBeSingletonGuard(false)(route, state)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['schemas/my-schema/', '123']), Times.once()); }); @@ -93,7 +90,6 @@ describe('SchemaMustNotBeSingletonGuard', () => { const result = await firstValueFrom(schemaMustNotBeSingletonGuard(false)(route, state)); expect(result).toBeFalsy(); - router.verify(x => x.navigate([state.url, 'extension']), Times.once()); }); @@ -106,7 +102,6 @@ describe('SchemaMustNotBeSingletonGuard', () => { const result = await firstValueFrom(schemaMustNotBeSingletonGuard(true)(route, state)); expect(result).toBeFalsy(); - router.verify(x => x.navigate([state.url, '..']), Times.once()); }); @@ -119,7 +114,6 @@ describe('SchemaMustNotBeSingletonGuard', () => { const result = await firstValueFrom(schemaMustNotBeSingletonGuard(true)(route, state)); expect(result).toBeTruthy(); - router.verify(x => x.navigate(It.isAny()), Times.never()); }); }); diff --git a/frontend/src/app/shared/guards/team-must-exist.guard.spec.ts b/frontend/src/app/shared/guards/team-must-exist.guard.spec.ts index 4247bf12a..7d4df1bef 100644 --- a/frontend/src/app/shared/guards/team-must-exist.guard.spec.ts +++ b/frontend/src/app/shared/guards/team-must-exist.guard.spec.ts @@ -47,7 +47,6 @@ describe('TeamMustExistGuard', () => { const result = await firstValueFrom(teamMustExistGuard(route)); expect(result).toBeFalsy(); - router.verify(x => x.navigate(['/404']), Times.once()); }); diff --git a/frontend/src/app/shared/guards/unset-app.guard.spec.ts b/frontend/src/app/shared/guards/unset-app.guard.spec.ts index 768ff64e6..13971574e 100644 --- a/frontend/src/app/shared/guards/unset-app.guard.spec.ts +++ b/frontend/src/app/shared/guards/unset-app.guard.spec.ts @@ -27,7 +27,6 @@ describe('UnsetAppGuard', () => { const result = await firstValueFrom(unsetAppGuard()); expect(result).toBeTruthy(); - appsState.verify(x => x.select(null), Times.once()); }); }); diff --git a/frontend/src/app/shared/guards/unset-team.guard.spec.ts b/frontend/src/app/shared/guards/unset-team.guard.spec.ts index 3ad0aee12..f2f1e8253 100644 --- a/frontend/src/app/shared/guards/unset-team.guard.spec.ts +++ b/frontend/src/app/shared/guards/unset-team.guard.spec.ts @@ -27,7 +27,6 @@ describe('UnsetTeamGuard', () => { const result = await firstValueFrom(unsetTeamGuard()); expect(result).toBeTruthy(); - teamsState.verify(x => x.select(null), Times.once()); }); }); diff --git a/frontend/src/app/shared/interceptors/auth.interceptor.spec.ts b/frontend/src/app/shared/interceptors/auth.interceptor.spec.ts index 3f1839f91..348ca03e9 100644 --- a/frontend/src/app/shared/interceptors/auth.interceptor.spec.ts +++ b/frontend/src/app/shared/interceptors/auth.interceptor.spec.ts @@ -144,7 +144,6 @@ describe('AuthInterceptor', () => { expect(invokedRequest.length).toEqual(2); expect(req1.headers.get('Authorization')).toEqual('token1'); expect(req2.headers.get('Authorization')).toEqual('token2'); - authService.verify(x => x.logoutRedirect('/my-path'), Times.once()); }); diff --git a/frontend/src/app/shared/services/assets.service.spec.ts b/frontend/src/app/shared/services/assets.service.spec.ts index b25e2d830..3b379d19a 100644 --- a/frontend/src/app/shared/services/assets.service.spec.ts +++ b/frontend/src/app/shared/services/assets.service.spec.ts @@ -248,6 +248,22 @@ describe('AssetsService', () => { expect(asset!).toEqual(createAsset(12)); })); + it('should make post with duplicate flag to create asset', inject([AssetsService, HttpTestingController], (assetsService: AssetsService, httpMock: HttpTestingController) => { + let asset: AssetDto; + assetsService.postAssetFile('my-app', null!, 'parent1', true).subscribe(result => { + asset = result; + }); + + const req = httpMock.expectOne('http://service/p/api/apps/my-app/assets?parentId=parent1&duplicate=true'); + + expect(req.request.method).toEqual('POST'); + expect(req.request.headers.get('If-Match')).toBeNull(); + + req.flush(assetResponse(12)); + + expect(asset!).toEqual(createAsset(12)); + })); + it('should return proper error if upload failed with 413', inject([AssetsService, HttpTestingController], (assetsService: AssetsService, httpMock: HttpTestingController) => { let error: ErrorDto; assetsService.postAssetFile('my-app', null!).subscribe({ @@ -517,7 +533,7 @@ describe('AssetsService', () => { } }); -export function createAsset(id: number, tags?: string[], suffix = '', parentId?: string) { +export function createAsset(id: number, tags?: string[], suffix = '', parentId?: string, isDuplicate = true) { parentId = parentId || MathHelper.EMPTY_GUID; const key = `${id}${suffix}`; @@ -553,7 +569,7 @@ export function createAsset(id: number, tags?: string[], suffix = '', parentId?: update: new ResourceLinkDto({ method: 'PUT', href: `/assets/${id}` }), }, _meta: new AssetMetaDto({ - isDuplicate: 'true', + isDuplicate: isDuplicate ? 'true' : 'false', }), }); } diff --git a/frontend/src/app/shared/services/assets.service.ts b/frontend/src/app/shared/services/assets.service.ts index 5f3d2a21e..864747268 100644 --- a/frontend/src/app/shared/services/assets.service.ts +++ b/frontend/src/app/shared/services/assets.service.ts @@ -106,8 +106,8 @@ export class AssetsService { pretifyError('i18n:assets.loadFailed')); } - public postAssetFile(appName: string, file: HTTP.UploadFile, parentId?: string): Observable { - const url = this.apiUrl.buildUrl(`api/apps/${appName}/assets${StringHelper.buildQuery({ parentId })}`); + public postAssetFile(appName: string, file: HTTP.UploadFile, parentId?: string, duplicate?: boolean): Observable { + const url = this.apiUrl.buildUrl(`api/apps/${appName}/assets${StringHelper.buildQuery({ parentId, duplicate })}`); return HTTP.upload(this.http, 'POST', url, file).pipe( filter(event => diff --git a/frontend/src/app/shared/services/autosave.service.spec.ts b/frontend/src/app/shared/services/autosave.service.spec.ts index 13b9fb1e1..634e0f5ab 100644 --- a/frontend/src/app/shared/services/autosave.service.spec.ts +++ b/frontend/src/app/shared/services/autosave.service.spec.ts @@ -70,7 +70,6 @@ describe('AutoSaveService', () => { const content = autoSaveService.fetch(key); expect(content).toEqual({ text: 'Hello' }); - localStore.verify(x => x.remove(It.isAnyString()), Times.once()); }); @@ -83,7 +82,6 @@ describe('AutoSaveService', () => { const content = autoSaveService.fetch(key); expect(content).toEqual({ text: 'Hello' }); - localStore.verify(x => x.remove(It.isAnyString()), Times.once()); }); @@ -93,7 +91,6 @@ describe('AutoSaveService', () => { const content = autoSaveService.fetch(null!); expect(content).toBeNull(); - localStore.verify(x => x.get(It.isAnyString()), Times.never()); }); }); diff --git a/frontend/src/app/shared/services/users-provider.service.spec.ts b/frontend/src/app/shared/services/users-provider.service.spec.ts index 3e2c6009f..73edc264d 100644 --- a/frontend/src/app/shared/services/users-provider.service.spec.ts +++ b/frontend/src/app/shared/services/users-provider.service.spec.ts @@ -33,7 +33,6 @@ describe('UsersProviderService', () => { }).unsubscribe(); expect(resultingUser!).toBe(user); - usersService.verifyAll(); }); @@ -52,7 +51,6 @@ describe('UsersProviderService', () => { }).unsubscribe(); expect(resultingUser!).toBe(user); - usersService.verifyAll(); }); @@ -72,7 +70,6 @@ describe('UsersProviderService', () => { }).unsubscribe(); expect(resultingUser!).toEqual(new UserDto({ id: '123', displayName: 'Me' } as any)); - usersService.verifyAll(); }); @@ -90,7 +87,6 @@ describe('UsersProviderService', () => { }).unsubscribe(); expect(resultingUser!).toEqual(new UserDto({ id: 'Unknown', displayName: 'Unknown' } as any)); - usersService.verifyAll(); }); }); diff --git a/frontend/src/app/shared/state/apps.state.spec.ts b/frontend/src/app/shared/state/apps.state.spec.ts index 704432ba4..b24ead5ba 100644 --- a/frontend/src/app/shared/state/apps.state.spec.ts +++ b/frontend/src/app/shared/state/apps.state.spec.ts @@ -48,7 +48,6 @@ describe('AppsState', () => { expect(appSelect).toBe(app1); expect(appsState.snapshot.selectedApp).toBe(app1); expect(appsState.snapshot.selectedSettings).not.toBeNull(); - appsService.verify(x => x.getSettings(app1.name), Times.once()); }); @@ -71,7 +70,6 @@ describe('AppsState', () => { expect(appSelected).toBeNull(); expect(appsState.snapshot.selectedApp).toBeNull(); expect(appsState.snapshot.selectedSettings).toBeNull(); - appsService.verify(x => x.getSettings(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/asset-scripts.state.spec.ts b/frontend/src/app/shared/state/asset-scripts.state.spec.ts index 14647e272..a9fd2bcfa 100644 --- a/frontend/src/app/shared/state/asset-scripts.state.spec.ts +++ b/frontend/src/app/shared/state/asset-scripts.state.spec.ts @@ -45,7 +45,6 @@ describe('AssetScriptsState', () => { expect(assetScriptsState.snapshot.isLoaded).toBeTruthy(); expect(assetScriptsState.snapshot.isLoading).toBeFalsy(); expect(assetScriptsState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/asset-uploader.state.spec.ts b/frontend/src/app/shared/state/asset-uploader.state.spec.ts index 1a460a736..7fcdfd0ec 100644 --- a/frontend/src/app/shared/state/asset-uploader.state.spec.ts +++ b/frontend/src/app/shared/state/asset-uploader.state.spec.ts @@ -6,7 +6,7 @@ */ import { lastValueFrom, NEVER, Observable, of, onErrorResumeNextWith, throwError } from 'rxjs'; -import { IMock, Mock } from 'typemoq'; +import { IMock, It, Mock, Times } from 'typemoq'; import { AssetsService, AssetUploaderState, DialogService } from '@app/shared/internal'; import { createAsset } from '../services/assets.service.spec'; import { TestValues } from './_test-helpers'; @@ -18,7 +18,7 @@ describe('AssetUploaderState', () => { let dialogs: IMock; let assetUploader: AssetUploaderState; - const asset = createAsset(1); + const asset = createAsset(1, undefined, '', undefined, false); beforeEach(() => { dialogs = Mock.ofType(); @@ -88,6 +88,44 @@ describe('AssetUploaderState', () => { expect(uploadedAsset).toEqual(asset); }); + it('should upload file again if duplicate is confirmed', async () => { + const file: File = { name: 'my-file' }; + + const duplicate = createAsset(2); + + assetsService.setup(x => x.postAssetFile(app, file, undefined)) + .returns(() => of(10, duplicate)).verifiable(); + + assetsService.setup(x => x.postAssetFile(app, file, undefined, true)) + .returns(() => of(10, asset)).verifiable(); + + dialogs.setup(x => x.confirm(It.isAnyString(), It.isAnyString())) + .returns(() => of(true)).verifiable(); + + const uploadedAsset = await lastValueFrom(assetUploader.uploadFile(file)); + + expect(uploadedAsset).toEqual(asset); + dialogs.verifyAll(); + }); + + it('should return existing asset if duplicate is not confirmed', async () => { + const file: File = { name: 'my-file' }; + + const duplicate = createAsset(2); + + assetsService.setup(x => x.postAssetFile(app, file, undefined)) + .returns(() => of(10, duplicate)).verifiable(); + + dialogs.setup(x => x.confirm(It.isAnyString(), It.isAnyString())) + .returns(() => of(false)).verifiable(); + + const uploadedAsset = await lastValueFrom(assetUploader.uploadFile(file)); + + expect(uploadedAsset).toEqual(duplicate); + assetsService.verify(x => x.postAssetFile(app, file, undefined, true), Times.never()); + dialogs.verifyAll(); + }); + it('should create initial state if uploading asset', () => { const file: File = { name: 'my-file' }; diff --git a/frontend/src/app/shared/state/asset-uploader.state.ts b/frontend/src/app/shared/state/asset-uploader.state.ts index bc8497190..d44631441 100644 --- a/frontend/src/app/shared/state/asset-uploader.state.ts +++ b/frontend/src/app/shared/state/asset-uploader.state.ts @@ -6,7 +6,7 @@ */ import { Injectable } from '@angular/core'; -import { Observable, shareReplay, Subject, takeUntil } from 'rxjs'; +import { Observable, of, shareReplay, Subject, switchMap, take, takeUntil } from 'rxjs'; import { debug, DialogService, HTTP, MathHelper, State, Types } from '@app/framework'; import { AssetDto } from '../model'; import { AssetsService } from '../services/assets.service'; @@ -72,7 +72,19 @@ export class AssetUploaderState extends State { } public uploadFile(file: HTTP.UploadFile, parentId?: string): Observable { - const stream = this.assetsService.postAssetFile(this.appName, file, parentId); + const stream = this.assetsService.postAssetFile(this.appName, file, parentId).pipe( + switchMap(event => { + if (Types.isNumber(event) || !event.isDuplicate) { + return of(event); + } + + // Let the user decide whether to keep the existing asset or upload the file again. + return this.dialogs.confirm('i18n:assets.duplicateConfirmTitle', 'i18n:assets.duplicateConfirmText').pipe( + take(1), + switchMap(confirmed => confirmed ? + this.assetsService.postAssetFile(this.appName, file, parentId, true) : + of(event))); + })); return this.upload(stream, MathHelper.guid(), file.name); } diff --git a/frontend/src/app/shared/state/assets.state.spec.ts b/frontend/src/app/shared/state/assets.state.spec.ts index 299cbb46a..feea34ca5 100644 --- a/frontend/src/app/shared/state/assets.state.spec.ts +++ b/frontend/src/app/shared/state/assets.state.spec.ts @@ -57,7 +57,6 @@ describe('AssetsState', () => { expect(assetsState.snapshot.isLoaded).toBeTruthy(); expect(assetsState.snapshot.isLoading).toBeFalsy(); expect(assetsState.snapshot.total).toEqual(200); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/clients.state.spec.ts b/frontend/src/app/shared/state/clients.state.spec.ts index 968fb96a6..7315943d8 100644 --- a/frontend/src/app/shared/state/clients.state.spec.ts +++ b/frontend/src/app/shared/state/clients.state.spec.ts @@ -42,7 +42,6 @@ describe('ClientsState', () => { expect(clientsState.snapshot.isLoaded).toBeTruthy(); expect(clientsState.snapshot.isLoading).toBeFalsy(); expect(clientsState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/contributors.state.spec.ts b/frontend/src/app/shared/state/contributors.state.spec.ts index abbf0fa33..f41d9e263 100644 --- a/frontend/src/app/shared/state/contributors.state.spec.ts +++ b/frontend/src/app/shared/state/contributors.state.spec.ts @@ -51,7 +51,6 @@ describe('ContributorsState', () => { expect(contributorsState.snapshot.total).toEqual(20); expect(contributorsState.snapshot.maxContributors).toBe(oldContributors.maxContributors); expect(contributorsState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/indexes.state.spec.ts b/frontend/src/app/shared/state/indexes.state.spec.ts index 070b14e3d..bc4f4fcff 100644 --- a/frontend/src/app/shared/state/indexes.state.spec.ts +++ b/frontend/src/app/shared/state/indexes.state.spec.ts @@ -47,7 +47,6 @@ describe('IndexesState', () => { expect(indexesState.snapshot.indexes).toEqual([index1, index2]); expect(indexesState.snapshot.isLoaded).toBeTruthy(); expect(indexesState.snapshot.isLoading).toBeFalsy(); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); @@ -105,7 +104,6 @@ describe('IndexesState', () => { indexesState.create(request).subscribe(); expect(indexesState.snapshot.indexes.length).toBe(2); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); }); @@ -116,7 +114,6 @@ describe('IndexesState', () => { indexesState.delete(index1).subscribe(); expect(indexesState.snapshot.indexes.length).toBe(2); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); }); }); diff --git a/frontend/src/app/shared/state/jobs.state.spec.ts b/frontend/src/app/shared/state/jobs.state.spec.ts index b8c03025e..0e2b449da 100644 --- a/frontend/src/app/shared/state/jobs.state.spec.ts +++ b/frontend/src/app/shared/state/jobs.state.spec.ts @@ -42,7 +42,6 @@ describe('JobsState', () => { expect(jobsState.snapshot.jobs).toEqual([job1, job2]); expect(jobsState.snapshot.isLoaded).toBeTruthy(); expect(jobsState.snapshot.isLoading).toBeFalsy(); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); @@ -98,7 +97,6 @@ describe('JobsState', () => { jobsState.startBackup().subscribe(); expect(jobsState.snapshot.jobs.length).toBe(2); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); }); @@ -109,7 +107,6 @@ describe('JobsState', () => { jobsState.delete(job1).subscribe(); expect(jobsState.snapshot.jobs.length).toBe(2); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); }); }); diff --git a/frontend/src/app/shared/state/languages.state.spec.ts b/frontend/src/app/shared/state/languages.state.spec.ts index bc64a1df2..7b5e769a6 100644 --- a/frontend/src/app/shared/state/languages.state.spec.ts +++ b/frontend/src/app/shared/state/languages.state.spec.ts @@ -42,7 +42,6 @@ describe('LanguagesState', () => { afterEach(() => { languagesService.verifyAll(); - allLanguagesService.verifyAll(); }); @@ -65,7 +64,6 @@ describe('LanguagesState', () => { expect(languagesState.snapshot.isLoaded).toBeTruthy(); expect(languagesState.snapshot.isLoading).toBeFalsy(); expect(languagesState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/plans.state.spec.ts b/frontend/src/app/shared/state/plans.state.spec.ts index f627aeec5..71e57b910 100644 --- a/frontend/src/app/shared/state/plans.state.spec.ts +++ b/frontend/src/app/shared/state/plans.state.spec.ts @@ -75,7 +75,6 @@ describe('PlansState', () => { ]); expect(plansState.snapshot.isLoaded).toBeTruthy(); expect(plansState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); @@ -92,7 +91,6 @@ describe('PlansState', () => { expect(plansState.snapshot.isLoaded).toBeTruthy(); expect(plansState.snapshot.isLoading).toBeFalsy(); expect(plansState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/queries.spec.ts b/frontend/src/app/shared/state/queries.spec.ts index 8a824f525..2acecb559 100644 --- a/frontend/src/app/shared/state/queries.spec.ts +++ b/frontend/src/app/shared/state/queries.spec.ts @@ -105,7 +105,6 @@ describe('Queries', () => { queries.addUser('key3', { fullText: 'text3' }); expect(true).toBeTruthy(); - uiState.verify(x => x.setAppUser('schemas.my-schema.queries.key3', '{"fullText":"text3"}'), Times.once()); }); @@ -113,7 +112,6 @@ describe('Queries', () => { queries.addShared('key3', { fullText: 'text3' }); expect(true).toBeTruthy(); - uiState.verify(x => x.setAppShared('schemas.my-schema.queries.key3', '{"fullText":"text3"}'), Times.once()); }); @@ -121,7 +119,6 @@ describe('Queries', () => { queries.removeShared({ name: 'key3' }); expect(true).toBeTruthy(); - uiState.verify(x => x.removeAppShared('schemas.my-schema.queries.key3'), Times.once()); }); @@ -129,7 +126,6 @@ describe('Queries', () => { queries.removeUser({ name: 'key3' }); expect(true).toBeTruthy(); - uiState.verify(x => x.removeAppUser('schemas.my-schema.queries.key3'), Times.once()); }); }); diff --git a/frontend/src/app/shared/state/resolvers.spec.ts b/frontend/src/app/shared/state/resolvers.spec.ts index 19f1af0a3..99d223ca9 100644 --- a/frontend/src/app/shared/state/resolvers.spec.ts +++ b/frontend/src/app/shared/state/resolvers.spec.ts @@ -113,7 +113,6 @@ describe('ResolveContents', () => { contents[1], contents[2], ]); - contentsService.verify(x => x.getAllContents(app, { ids }), Times.once()); }); @@ -137,7 +136,6 @@ describe('ResolveContents', () => { contents[0], contents[1], ]); - contentsService.verify(x => x.getAllContents(app, { ids }), Times.once()); }); @@ -159,7 +157,6 @@ describe('ResolveContents', () => { contents[0], contents[1], ]); - contentsService.verify(x => x.getAllContents(app, { ids }), Times.once()); }); diff --git a/frontend/src/app/shared/state/roles.state.spec.ts b/frontend/src/app/shared/state/roles.state.spec.ts index 36da9f0b1..bdf4012cc 100644 --- a/frontend/src/app/shared/state/roles.state.spec.ts +++ b/frontend/src/app/shared/state/roles.state.spec.ts @@ -38,7 +38,6 @@ describe('RolesState', () => { expect(rolesState.snapshot.isLoading).toBeFalsy(); expect(rolesState.snapshot.roles).toEqual(oldRoles.items); expect(rolesState.snapshot.version).toEqual(version); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/rule-events.state.spec.ts b/frontend/src/app/shared/state/rule-events.state.spec.ts index b373d809a..f0d80e97b 100644 --- a/frontend/src/app/shared/state/rule-events.state.spec.ts +++ b/frontend/src/app/shared/state/rule-events.state.spec.ts @@ -43,7 +43,6 @@ describe('RuleEventsState', () => { expect(ruleEventsState.snapshot.isLoaded).toBeTruthy(); expect(ruleEventsState.snapshot.isLoading).toBeFalsy(); expect(ruleEventsState.snapshot.total).toEqual(200); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/rule-simulator.state.spec.ts b/frontend/src/app/shared/state/rule-simulator.state.spec.ts index 4e6307674..d2c336000 100644 --- a/frontend/src/app/shared/state/rule-simulator.state.spec.ts +++ b/frontend/src/app/shared/state/rule-simulator.state.spec.ts @@ -47,7 +47,6 @@ describe('RuleSimulatorState', () => { expect(ruleSimulatorState.snapshot.isLoaded).toBeTruthy(); expect(ruleSimulatorState.snapshot.isLoading).toBeFalsy(); expect(ruleSimulatorState.snapshot.total).toEqual(200); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); @@ -62,7 +61,6 @@ describe('RuleSimulatorState', () => { expect(ruleSimulatorState.snapshot.isLoaded).toBeTruthy(); expect(ruleSimulatorState.snapshot.isLoading).toBeFalsy(); expect(ruleSimulatorState.snapshot.total).toEqual(200); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/rules.state.spec.ts b/frontend/src/app/shared/state/rules.state.spec.ts index 5877b11ed..265091bf2 100644 --- a/frontend/src/app/shared/state/rules.state.spec.ts +++ b/frontend/src/app/shared/state/rules.state.spec.ts @@ -53,7 +53,6 @@ describe('RulesState', () => { expect(ruleRunning).toBe(rule1); expect(rulesState.snapshot.runningRuleId).toBe(rule1.id); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/schemas.state.spec.ts b/frontend/src/app/shared/state/schemas.state.spec.ts index 398a61ed4..a5cbd4603 100644 --- a/frontend/src/app/shared/state/schemas.state.spec.ts +++ b/frontend/src/app/shared/state/schemas.state.spec.ts @@ -51,7 +51,6 @@ describe('SchemasState', () => { expect(schemasState.snapshot.schemas).toEqualIgnoringProps(oldSchemas.items); expect(schemasState.snapshot.isLoaded).toBeTruthy(); - schemasService.verifyAll(); }); @@ -65,7 +64,6 @@ describe('SchemasState', () => { expect(schemasState.snapshot.isLoaded).toBeTruthy(); expect(schemasState.snapshot.isLoading).toBeFalsy(); expect(schemasState.snapshot.schemas).toEqualIgnoringProps(oldSchemas.items); - schemasService.verifyAll(); }); diff --git a/frontend/src/app/shared/state/table-settings.spec.ts b/frontend/src/app/shared/state/table-settings.spec.ts index 63a91a7ce..5158eab68 100644 --- a/frontend/src/app/shared/state/table-settings.spec.ts +++ b/frontend/src/app/shared/state/table-settings.spec.ts @@ -177,7 +177,6 @@ describe('TableSettings', () => { tableSettings.updateSize(META_FIELDS.version.name, 100, true); uiState.verify(x => x.setAppUser('schemas.my-schema.config', { ...EMPTY, sizes: { [META_FIELDS.version.name]: 100 } }), Times.once()); - expect(fieldSizes!).toEqual({ [META_FIELDS.version.name]: 100 }); }); @@ -196,7 +195,6 @@ describe('TableSettings', () => { tableSettings.updateSize(META_FIELDS.version.name, 100, false); uiState.verify(x => x.setAppUser('schemas.my-schema.config', It.isAny()), Times.never()); - expect(fieldSizes!).toEqual({ [META_FIELDS.version.name]: 100 }); }); @@ -215,7 +213,6 @@ describe('TableSettings', () => { tableSettings.toggleWrapping(META_FIELDS.version.name, true); uiState.verify(x => x.setAppUser('schemas.my-schema.config', { ...EMPTY, wrappings: { [META_FIELDS.version.name]: true } }), Times.once()); - expect(fieldWrappings!).toEqual({ [META_FIELDS.version.name]: true }); }); @@ -234,7 +231,6 @@ describe('TableSettings', () => { tableSettings.toggleWrapping(META_FIELDS.version.name, false); uiState.verify(x => x.setAppUser('schemas.my-schema.config', It.isAny()), Times.never()); - expect(fieldWrappings!).toEqual({ [META_FIELDS.version.name]: true }); }); diff --git a/frontend/src/app/shared/state/template.state.spec.ts b/frontend/src/app/shared/state/template.state.spec.ts index 49f165c58..3516cff9b 100644 --- a/frontend/src/app/shared/state/template.state.spec.ts +++ b/frontend/src/app/shared/state/template.state.spec.ts @@ -39,7 +39,6 @@ describe('TemplatesState', () => { expect(templatesState.snapshot.templates).toEqual([template1, template2]); expect(templatesState.snapshot.isLoaded).toBeTruthy(); expect(templatesState.snapshot.isLoading).toBeFalsy(); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/frontend/src/app/shared/state/workflows.state.spec.ts b/frontend/src/app/shared/state/workflows.state.spec.ts index c99066a9d..bf72f4585 100644 --- a/frontend/src/app/shared/state/workflows.state.spec.ts +++ b/frontend/src/app/shared/state/workflows.state.spec.ts @@ -42,7 +42,6 @@ describe('WorkflowsState', () => { expect(workflowsState.snapshot.isLoading).toBeFalsy(); expect(workflowsState.snapshot.version).toEqual(version); expect(workflowsState.snapshot.workflows).toEqual(oldWorkflows.items); - dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); }); diff --git a/todo.md b/todo.md index dd57a0108..cfffbf450 100644 --- a/todo.md +++ b/todo.md @@ -1,29 +1,499 @@ -# Backend Improvements +# Ten feature requests worth implementing next -All four items are fixed on `migration-improvements`. +Selected from the **195 not-implemented feature requests** extracted from + (see [FEATURE-REQUESTS.md](FEATURE-REQUESTS.md) for +all 588). Every item was checked against the working copy at `D:\Squidex` +(branch `stability`, HEAD `fc026a3`, v7.23.0) before being listed. -## 1. Protected assets were served with `Cache-Control: public` — done +**This revision:** self-service password reset was dropped — with an external +identity provider in most deployments it is dead weight. The list is also +weighted towards substantial features, and every *declined* and *postponed* +candidate was re-read against today's code rather than taken at face value. -`AssetContentController` now sends `private,no-store` when `asset.IsProtected`, so a CDN or shared -proxy can no longer store the file under a URL that needs no credentials. The client-supplied -`?cache=` value is clamped to `assets:maxCacheDuration` (default 365 days). +## Why re-reading the declines mattered -## 2. GraphQL had no depth or complexity limit — done +Most declines date from 2019–2022 and several rest on constraints the codebase +no longer has. Three of the ten below are recommended **because the maintainer's +own stated blocker has since been removed:** -`AddSquidexGraphQL` registers the complexity analyzer from `graphQL:maxDepth` (default 30, 0 -disables) and `graphQL:maxComplexity` (default 0 — off, because the factor depends on the schema). -Apollo tracing instrumented every field of every request; it is now behind -`graphQL:enableTracing`, off by default. +| Then | Now | +| --- | --- | +| #5286: *"we are only dealing with strings at the moment. So a solution could be to save the remirror state tree instead of html or string"* (2023) | Exactly that shipped — *"New rich text field that stores the content as JSON structure"* (`CHANGELOG.md:300`), with `RichTextNode`/`RichTextMark`/`SquidexRichText` in the domain | +| #1366/#3461: UI export is *"a lot of work with very little benefit"*, *"not possible"* (2019–2021) | A generic job framework exists — `IJobRunner` with `RunAsync` **and `DownloadAsync(job, stream, ct)`**, described as unifying *"rules, backups and future background jobs"* (`CHANGELOG.md:266`) | +| #1229/#5676: asset permissions are *"super complicated"* (2019–2024) | Per-schema scoping is now proven in the same permission grammar — `contents.{schema}.read`, even `contents.{schema}.read.own` (`PermissionIds.cs:212-215`) | -## 3. Image resizing had no deduplication and no concurrency cap — done +Conversely, the same exercise **removed** items: #3321 (concrete GraphQL +reference types) and #1852 (markdown editor) have quietly been implemented since +being postponed and declined. See +[Rejected because already covered](#rejected-because-already-covered). -New `AssetResizeGate` serializes per `(appId, assetId, fileVersion, suffix)` and bounds the total -number of parallel resizes via `assets:maxConcurrentResizes` (default: number of cores). Requests -that lose the race re-check the file store after the gate instead of decoding the image again. -Applied to both `AssetContentController` and `AppImageController`. +## The list -## 4. In-process caches had no size limit — done +| # | Feature | Forum status | Views | Size | +| --- | --- | --- | --- | --- | +| [1](#1-visual-diff-between-content-versions-5286) | Visual diff between content versions | Postponed | 1412 | large | +| [2](#2-export-and-import-content-from-the-ui-as-jobs-3461-1366-3438) | Export/import content from the UI as jobs | Declined ×2 | 5381 | large | +| [3](#3-scope-asset-permissions-to-folders-5921-5676-1229) | Scope asset permissions to folders | Open ×2 + Declined | 3857 | large | +| [4](#4-dark-mode-and-per-app-theming-5720-816) | Dark mode and per-app theming | Open + Declined | 2102 | large | +| [5](#5-azure-service-bus-flow-step-4522) | Azure Service Bus flow step | Postponed | 1838 | medium | +| [6](#6-give-scripts-a-way-to-log-2822) | Give scripts a way to log | Unresolved | 2575 | medium | +| [7](#7-upsert-mode-for-the-create-content-flow-step-5616) | Upsert mode for "Create content" step | Unresolved | 786 | small | +| [8](#8-regenerate-a-client-secret-from-the-ui-5807) | Regenerate a client secret from the UI | Open | 1383 | small | +| [9](#9-show-which-fields-are-required-when-publishing-4375) | ✅ **Done** — Mark "required when publishing" fields | Declined | 1707 | tiny | +| [10](#10-let-users-upload-a-duplicate-asset-anyway-3144) | ✅ **Done** — "Upload anyway" for duplicate assets | Declined | 1356 | tiny | -`UsageGate`, `AssetUsageTracker` and the extensions' `ClientPool` now set `SizeLimit` on their -`MemoryCache` and a `Size` on every entry, so they no longer grow with the number of tenants, -assets or client configurations. +Items 1–4 are projects. 5–6 are a few days each. 7–10 are hours, and are kept +because they are cheap enough that leaving them undone is the expensive choice. + +--- + +## 1. Visual diff between content versions (#5286) + +**Asked:** highlight what changed between two versions of a long article, +instead of leaving the reviewer to read both. + +· Postponed · 1412 views · 2023-11 + +**Why it matters.** Review is where a CMS earns its keep, and it is the one +place Squidex currently hands the work back to the human. The same need arrives +from three directions in the archive: this request, +[#6120](https://support.squidex.io/t/implement-a-way-to-add-suggestions-to-draft-items/6120) +(*"We need to review blog posts before they are published… comments aren't well +suited to review longer blogposts as it's hard to reference the actual +content"*, Open, 2026-03) and +[#4518](https://support.squidex.io/t/very-unlikely-allow-multiple-users-to-view-content-and-only-one-user-to-edit/4518) +(knowing whether someone else is mid-edit). Workflows already move content +through review states; what is missing is seeing *what* is under review. + +**Why the decline no longer applies.** This is the clearest changed-circumstance +in the archive. The maintainer's reasoning in 2023 was: + +> *"The problem is that we are only dealing with strings at the moment. So a +> solution could be to save the remirror state tree instead of html or string +> and then make the html or markdown conversion on the fly."* + +That prerequisite is now shipped. `CHANGELOG.md:300` records a *"New rich text +field that stores the content as JSON structure and provides on demand +formatting into HTML and markdown over GraphQL"*, and the domain model is +there: `RichTextNode`, `RichTextMark`, `RichTextExtensions`, `SquidexRichText` +(`backend/src/Squidex.Domain.Apps.Core.Model/Contents/`). Retrieving the two +versions to compare is already supported — +`ContentsController.GetContent(app, schema, id, long version)` (line 147) takes +a version and passes it to `contentQuery.FindAsync`. + +**Scope it narrowly.** The second objection in that thread was that a two-state +diff is ambiguous (*"Hello World"* → *"World is big"* — what changed?) and that +tools like the Yjs demo work by keeping a change history instead. That is an +argument against *perfect attribution*, not against a diff. The requester asked +for the modest version — *"the simplest implementation… would be to add change +highlighting"*. A node-level structural diff over `RichTextNode` (paragraph or +block added / removed / changed, with text-level diff inside a changed block) +answers the actual need and needs no new storage. Full change tracking can +follow the collaborative-editing work +([#5186](https://support.squidex.io/t/collaborative-editing/5186)) if it is ever +wanted. + +**Note.** Non-rich-text fields (strings, numbers, references) can be diffed +trivially and are worth doing in the same pass — the existing comparison view +is where this belongs. + +--- + +## 2. Export and import content from the UI as jobs (#3461, #1366, #3438) + +**Asked:** export schemas and content to CSV from the UI, and import from a +spreadsheet, without dropping to the CLI. +- · Declined · 1514 views +- · Declined · 1424 views +- · Unresolved · 2443 views + +**Why it matters.** 5381 views across three threads spanning 2019–2021, and the +maintainer acknowledged the pattern himself: *"it has been requested a few times +now"*. The standing answer is "use the CLI", which does not help the people who +ask — editors and evaluators, not operators. One thread is explicitly a customer +evaluating Squidex *"as a master database"*. Cloud users cannot be pointed at a +CLI-shaped answer as readily as self-hosters, and #3461 is precisely about that. + +**Why the declines no longer apply.** Both were refused on cost and +feasibility — *"there are no plans to implement such features in the UI, as it +is a lot of work with very little benefit"* (2020) and *"it is not possible and +also not planned"* (2021). The expensive parts were long-running work, progress +reporting, and delivering a large file. All three are now framework concerns: + +- `IJobRunner` (`backend/src/Squidex.Domain.Apps.Entities/Jobs/IJobRunner.cs`) + is a four-member interface: `Name`, `RunAsync(JobRunContext, ct)`, and + optional `DownloadAsync(Job, Stream, ct)` / `CleanupAsync`. +- `DownloadAsync` exists *for exactly this shape of job* — `BackupJob` implements + it to stream an archive back to the user + (`.../Backup/BackupJob.cs:28,32,54`). +- `JobLogMessage` and `JobProcessor` give per-job progress and logs, which is + what an importer needs to report which rows failed. +- Six runners already exist to copy from: `BackupJob`, `RestoreJob`, + `CreateIndexJob`, `DropIndexJob`, `MigrateContentsJob`, `RuleRunnerJob`. + +**Split the two halves; they are not equally hard.** + +*Export* is now genuinely straightforward: a job that runs the existing content +query, writes CSV/JSON to a stream, and returns it through `DownloadAsync`. The +CLI already contains the field-flattening logic to borrow. + +*Import* keeps the one objection that still stands — from #3438: *"Usually the +CSV does not match to the content format. Therefore you need some kind of +mapping and a UI to define this mapping."* That is real, and it is the mapping +UI, not the ingestion. The write path is already there: `BulkUpdateContents`, +`BulkUpdateJob` and `UpsertContent` +(`backend/src/Squidex.Domain.Apps.Entities/Contents/Commands/`). Ship export +first; it is most of the demand and a fraction of the work. + +--- + +## 3. Scope asset permissions to folders (#5921, #5676, #1229) + +**Asked:** restrict a role to particular asset folders rather than all-or-nothing +read/write. +- · **Open** · 775 views · 2025-05 +- · **Open** · 1174 views · 2024-09 +- · Declined · 1908 views · 2019-10 + +**Why it matters.** Asked three times over six years, twice still open, 3857 +views combined, and always with the same concrete shape: an agency or +multi-tenant install wanting `clients/XYZ` visible only to that client's +editors. The current workaround the maintainer offers — *"a workaround would be +to have a second app"*, *"create multiple apps and automate app management with +the API or CLI"* — fragments content across apps and, as he notes himself in +#5676, *"linking is difficult then"*. This is the largest recurring gap in the +permission model. + +**Why the decline deserves another look.** Assets are the only major entity with +no scoping. Content has had per-schema permissions all along, and the grammar +supports finer grain than that: + +``` +backend/src/Squidex.Shared/PermissionIds.cs:212-215 +public const string AppContents = "squidex.apps.{app}.contents.{schema}"; +public const string AppContentsRead = "squidex.apps.{app}.contents.{schema}.read"; +public const string AppContentsReadOwn = "squidex.apps.{app}.contents.{schema}.read.own"; +``` + +Assets, by contrast, are flat (lines 166-178): `assets.read`, `assets.create`, +`assets.upload`, `assets.update`, `assets.delete`, plus `assets.folders.*` for +managing folders themselves. Adding a folder placeholder follows a pattern that +already works, in the same file, with the same matching machinery. + +**Decide the two open design questions up front** — they are why this stalled, +and both have a defensible narrow answer: + +1. *Folders are renamed and moved, so paths are unstable* (#5921). Scope by + folder **id**, not path, exactly as content scopes by schema id. The + maintainer reached the same conclusion in-thread: *"only the folder ID would + work. You probably just want to associate a folder with a role."* +2. *What happens when a permitted user references an asset that another user + cannot see?* (#5676: *"user A adds an asset to a field that he is allowed to + see and user B opens the content. What is supposed to happen?"*). Scope + **browsing and picking** — the asset library and the picker — and keep + already-referenced assets resolvable. That is what "this client's folder" + actually means, it avoids breaking published content, and it does not pretend + to be a confidentiality boundary. Say so in the docs; the alternative + (filtering referenced assets out of delivery) is the version that, in his + words, *"would remove the asset"* from content that legitimately uses it. + +--- + +## 4. Dark mode and per-app theming (#5720, #816) + +**Asked:** a dark UI; and separately, brand colours and a custom logo per app. +- · **Open** · 745 views · 2024-11 +- · Declined · 1357 views · 2019-06 + +**Why it matters.** 2102 views across two threads. Editors live in this UI all +day, and dark mode has moved from a preference to an expectation in tools of +this kind. The theming half is a different and commercially sharper case: +agencies putting clients into Squidex want their own logo and colours, and today +the only route is *"if you build Squidex by yourself you can customize the +colors in a single file"* — i.e. maintain a fork, which is the same trap the +Service Bus requester described in #4522. + +**Why these declines are worth revisiting.** Neither was refused on technical +grounds. #5720: *"It is very likely not going to happen. Just a matter of +priority tbh."* #816: *"It is planned, but with very low priority"*, then *"I +have decided not to work on this"* — with a Trello link that is now dead. In +neither case was cost the argument. The +requester's own suggestion was to fold it into other work: *"Hopefully this will +be considered in the future when doing a UI refresh or something related."* +That is the situation now — 7.22 alone brought improved form rows, a new +responsive field menu, an option to disable the frontend UI, accessibility +fixes and an Angular 21 upgrade, and a previous +[design modernization](https://support.squidex.io/t/implemented-design-modernization/2442) +(5765 views) already shipped once. + +**The honest cost, and why it buys two features.** The theme is still +build-time SCSS: `frontend/src/app/theme/_vars.scss` defines `$color-border`, +`$color-theme-brand`, `$color-dark-onboarding` and the rest as Sass variables, +and the file contains **zero CSS custom properties**. Dark mode therefore is not +a stylesheet you can add — it needs the palette converted to CSS custom +properties on `:root` so it can be swapped at runtime. That conversion is large +but mechanical and low-risk, and it is the same prerequisite for per-app +theming: once colours are runtime values, #816 becomes a settings form writing a +handful of variables, and dark mode becomes one alternate block plus a +`prefers-color-scheme` default. + +**Sequence it:** convert the palette to custom properties and ship dark mode +first (one palette, no API, no persistence beyond a user preference), then +per-app branding on top. Doing theming first without the refactor is what made +it look expensive in 2019. + +--- + +## 5. Azure Service Bus flow step (#4522) + +**Asked:** contribute a Service Bus action upstream. + +· Postponed (`INACTIVE`) · 1838 views · 4 likes · **3 votes** (joint highest of +any not-implemented request, with #669 and #4305) + +**Why it matters.** Service Bus is the default eventing backbone in Azure +estates, and Squidex already ships twenty rule actions / flow steps including +Kafka, Azure Queue, SignalR, Elasticsearch, OpenSearch and Typesense. The +requester was running a **forked build** to get it — *"currently we have to +merge our plugin code with Squidex's source code and then build a Docker +image"* — and offered to generalise their code and get employer approval to +contribute it. The maintainer's answer was *"Yes, why not. Sounds helpful, but +only if the credentials can be configured in the action."* Nobody refused this; +it lapsed. + +**Why it is easy.** `AzureQueueFlowStep` is a template for nearly the whole +file — `[FlowStep(Title/IconImage/Display/Description/ReadMore)]` metadata, +`[Editor]`/`[Expression]`-annotated settings (which is also how the +credentials-in-the-action condition is met), a static `ClientPool` for +connection reuse, `ValidateAsync` and `ExecuteAsync` +(`backend/extensions/Squidex.Extensions/Actions/AzureQueue/AzureQueueFlowStep.cs`). +A Service Bus step swaps `CloudQueue` for `ServiceBusClient` and adds a +queue/topic name. + +**Why not already covered.** Only `AzureQueue` exists. Azure Queue Storage is a +different service: no topics or subscriptions, no sessions, no FIFO guarantees, +64 KB messages. Fan-out to multiple subscribers — the usual reason to want +this — cannot be expressed with it. + +**For whoever picks it up:** write a `FlowStep`, not a `RuleAction`. +`CreateContentAction` is `[Obsolete("Has been replaced by flows.")]`; existing +actions keep a thin `IConvertibleToAction` shim for migration only. + +--- + +## 6. Give scripts a way to log (#2822) + +**Asked:** `console.log` in scripting, and documentation of what `ctx` holds. + +· Unresolved · 2575 views · 2021-01 + +**Why it matters.** Scripting is the standard answer to requests declined +elsewhere in this very forum — *"you could also achieve that with scripting"* +(#5045), *"the only option would be scripting"* (#1229), *"create a script to +fill the field automatically"* (#330). That answer is only as good as the +debugging story, and right now a script author cannot print a value, trace a +branch, or see why nothing happened. The reporter was evaluating platforms and +concluded Squidex *"can probably do everything I need, but the lack of detailed +documentation may make execution very difficult"*. The same pain recurs as +[#5624](https://support.squidex.io/t/stale-scripts-execute-maybe-a-error/5624) +(`[STALE] Scripts execute maybe a error`) and +[#5089](https://support.squidex.io/t/getassetblurhash-asset-script-example/5089), +where a user needed someone else to write the example because they had no way to +inspect anything. + +**Why it is easy.** There is a purpose-built extension point. Script functions +come from classes implementing `IJintExtension, IScriptDescriptor` — +`StringJintExtension`, `HttpJintExtension`, `DateTimeJintExtension` and four +more, registered in +`backend/src/Squidex/Config/Domain/InfrastructureServices.cs:75-93`. A +`LoggerJintExtension` in the same shape is one new file plus one registration +line, and implementing `IScriptDescriptor` puts the new function into the script +editor's autocomplete for free — the completion list is built from those +descriptors (`.../Scripting/ScriptingCompleter.cs:25`). + +**Why not already covered.** There is no logging, console or debug facility in +the scripting tree at all; the only match for "debug" is `Debugger.IsAttached` +in `JintScript.cs:64`, which concerns the host process. + +**Design note.** Output has to reach the *script author*, who on the cloud has +no server logs. Collecting it and returning it with the validation/preview +response is the version that helps. `JobLogMessage` shows the codebase already +has a notion of user-visible log lines to imitate. + +--- + +## 7. Upsert mode for the "Create content" flow step (#5616) + +**Asked:** a rule that creates content when it does not exist and updates it +when it does. + +· Unresolved · 786 views · 2024-08 + +**Why it matters.** This is the shape of every sync-from-another-system +integration — the requester lists `page`, `product`, `brand`, `marketplace` +collections kept in step with an external source. Without upsert each run either +fails on the second pass or creates duplicates, so the work moves out of rules +into bespoke code, taking the rule engine's retry, logging and configurability +with it. + +**Why it is easy.** The domain already has the operation: `UpsertContent.cs` +sits beside `CreateContent.cs` in +`backend/src/Squidex.Domain.Apps.Entities/Contents/Commands/`. The flow step +simply never offers it — `CreateContentFlowStep` carries only `Data`, `Schema`, +`Client`, `Publish` +(`backend/extensions/Squidex.Extensions/Actions/CreateContent/CreateContentFlowStep.cs:38-51`). +Add an optional id/key and switch the command issued. No new infrastructure. + +**The requester's framing was accurate:** *"The CreateContent rule almost does +exactly what it needs to do."* + +--- + +## 8. Regenerate a client secret from the UI (#5807) + +**Asked:** a button to issue a new secret for an existing client. + +· Open · 1383 views · 2025-01 + +**Why it matters.** Rotation is routine security hygiene — after a leak, after +someone leaves, on a schedule. The only route today is deleting the client and +creating a new one, which changes the **client id** too and breaks every +integration using it. A 30-second rotation becomes a coordinated redeployment, +so in practice secrets never get rotated. + +**Why it is easy.** The generation logic exists: `AttachClient` sets +`Secret = RandomHash.New()` +(`backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/AttachClient.cs:22`). +The work is letting an existing client take a new one — `UpdateClient` (same +folder) carries only `Name`, `Role`, `ApiCallsLimit`, `ApiTrafficLimit`, +`AllowAnonymous` — plus an event and a button. + +**Why not already covered.** `AppClientsController` exposes only `HttpPost`, +`HttpPut` and `HttpDelete` (lines 63/89/113). Nothing can change a secret. + +**The maintainer already agreed:** *"Actually not, but should be easy to build."* +The thread then stalled on *"The secret never expires"* — which is the reason +rotation must be manual, not a reason to omit it. + +--- + +## 9. Show which fields are required when publishing (#4375) + +> ✅ **Implemented.** Fields with *Required when publishing* (and not plain *Required*) show an orange `*` with a tooltip next to the label in the content editor (`field-editor.component.html`). + +**Asked:** a visual indicator for fields validated by *Required when publishing*, +like the asterisk plain *Required* fields get. + +· Declined (`VERY_UNLIKELY`) · 1707 views · 2 votes + +**Why it matters.** Precise complaint: nothing marks the field, so publishing +fails and the editor then hunts for the cause. It hits the least technical users +at the moment they are trying to ship. + +**Why it is easy.** One template binding. The marker already exists for the +other flag: + +``` +frontend/src/app/features/content/shared/forms/field-editor.component.html:7 +{{ field.displayName }} {{ displaySuffix }} +* +``` + +`isRequiredOnPublish` is on the same properties object — edited in +`field-form-validation.component.html:6`, present in +`shared/model/generated.ts:3124`. A second marker bound to it, a CSS rule and an +i18n key. + +**Why not already covered.** Nothing in the content editor reads +`isRequiredOnPublish`; the only occurrences are the schema editor and the +generated model. + +**On the decline.** The reply was *"Just write a hint for your users 😉"* and the +topic auto-closed after two days — asking every customer to document around a +missing marker whose data the UI already holds. Cheapest item here and worth +reversing. + +--- + +## 10. Let users upload a duplicate asset anyway (#3144) + +> ✅ **Implemented.** Uploading a new file that the backend reports as a duplicate now asks the user whether to upload it anyway; confirming retries the upload with `duplicate=true` (`asset-uploader.state.ts`), declining keeps the existing asset as before. + +**Asked:** stop blocking a file because an identical one exists in another +folder. + +· Declined · 1356 views + +**Why it matters.** The uploader hits a wall with no way past it, and folders +are routinely used to separate clients, campaigns or locales where holding the +same file twice is deliberate. + +**Why it is easy.** The backend already supports the override. `CreateAsset` and +`UpsertAsset` both carry a `Duplicate` flag, and +`AssetCommandMiddleware.UploadWithDuplicateCheckAsync` skips the check when it +is set, otherwise completing with an `AssetDuplicate` result +(`.../Assets/DomainObject/AssetCommandMiddleware.cs:57-84`). Only the UI is +missing: handle `AssetDuplicate`, confirm, retry with `duplicate: true`. + +**Why not already covered.** Nothing in the frontend references duplicates — the +flag is reachable only by calling the API directly. + +**The maintainer already scoped it:** *"it is only a flag in the API, so I can +probably enhance the UI to upload the file anyway. Like with an extra confirm +dialog or so."* + +**Worth knowing:** the check is `FindByHashAsync(context, fileHash, fileName, +fileSize)` — content hash *and* name *and* size, app-wide — so it only fires for +genuinely identical files. That makes "upload anyway" the right fix and a +per-folder scope change unnecessary. + +--- + +## Rejected because already covered + +Verified in the source, not taken from the thread. Two had been postponed or +declined and have since been implemented without the thread being updated — +which is the main reason this check is worth running: + +| Request | Views | Why it was dropped | +| --- | --- | --- | +| [#3321 Fetch concrete references with GraphQL](https://support.squidex.io/t/unlikely-fetch-concrete-references-with-graphql-and-the-other-array-fields/3321) | 2170 | **Implemented since being postponed.** `ContentUnionGraphType` / `ComponentUnionGraphType` exist and are used for reference fields, components and rich text (`FieldVisitor.cs:285,309`, `RichTextGraphType.cs:55`). | +| [#1852 Update the markdown editor](https://support.squidex.io/t/declined-update-markdown-editor-component/1852) | 2130 | **Superseded since being declined.** A new structured content editor shipped (`CHANGELOG.md:300,323`), with the old one kept as a sample editor. | +| [#3442 SignalR notification rule](https://support.squidex.io/t/add-signalr-notification-rule/3442) | 1991 | Already shipped — `backend/extensions/Squidex.Extensions/Actions/SignalR/` has `SignalRAction`, `SignalRFlowStep`, `SignalRPlugin`. | +| [#5672 Hide "business account" / signup on login](https://support.squidex.io/t/login-popup-possiblity-to-remove-enter-business-account-and-signup/5672) | 940 | Already configurable — `Login.cshtml:62` gates that form on `HasCustomAuth`, set from `allowCustomDomains` (`AccountController.cs:217`). | +| [#4499 Change image format via URL](https://support.squidex.io/t/assets-change-image-format-via-url/4499) | 1453 | Already supported — `Format` and `Auto` on `AssetContentQueryDto` (lines 88, 106). | +| [#538 Preview URL supports one placeholder](https://support.squidex.io/t/solved-preview-url-support-only-1-placeholder-increase-the-limit/538) | 969 | Fixed — `interpolate()` replaces every match (`frontend/src/app/framework/utils/interpolator.ts:13`). | +| [#1168 Expose schemas as JSON Schema](https://support.squidex.io/t/declined-squidexs-json-schema/1168) | 3500 | Covered by the generated OpenAPI documents, which embed JSON Schema. | +| [#1625 Content revisions / versions](https://support.squidex.io/t/content-revisions-versions/1625) | 4745 | A maintainer-authored 2020 concept for reworking the workflow system; the workflow feature it describes shipped. | + +## Re-examined declines that still hold + +The blocker is unchanged, so these stay off the list: + +- [#3025 Filter assets not linked to any content](https://support.squidex.io/t/declined-filter-by-assets-not-linked-to-any-contents/3025) (1380 views) — *"a lot of effort to maintain a secondary index"*. Still true; nothing in the archive or the code changes it. +- [#2306 Backup all apps at once](https://support.squidex.io/t/declined-backup-all-apps-with-one-click/2306) (1032) — *"you can easier backup your mongodb database"*. The job framework would make it easy now, but the objection was value, not cost, and it is a fair one. +- [#3568 Full-text search improvements](https://support.squidex.io/t/unlikely-content-fulltext-search-improvement/3568) (2246) — answered with a detailed technical rebuttal, and search has since moved on independently (Atlas Search option at `appsettings.json:736`, plus searchable string fields in 7.22). +- [#4462 Localizable components](https://support.squidex.io/t/localizable-components/4462) (2179) — declined on a defensible design ground: localized fields containing localized subfields. +- [#1675 Taxonomies](https://support.squidex.io/t/taxonomies-for-content-items/1675) (4983) and [#1667 Tree view](https://support.squidex.io/t/unlikely-tree-view-for-content/1667) (3737) — the most-demanded cluster in the archive, but the maintainer's objection is a design one he has not resolved (*"we would create a second system for references"*), and it is unresolved by anything in the current code. Worth a decision, not a ticket. + +## Dropped from the previous revision + +Removed to make room for larger items, not because they stopped being worth +doing. Each is still small and still uncovered: + +- [#4363 Say when auto-translate is not configured](https://support.squidex.io/t/auto-translation-with-google-translate-api-and-frontend-settings/4363) — **7038 views**, the most-viewed unresolved request in the archive. The translate action renders unconditionally (`content-field.component.html:119-125`) with no check for a configured provider, and the key lives only in `appsettings.json:819`. Cheap to fix and high-traffic; promote it if you want an eleventh. +- [#1363 Respect `maxItems` in the asset editor](https://support.squidex.io/t/postponed-single-asset-media-image-type/1363) (2622) — `array-editor.component.ts:91,104` gates adding at the limit; `assets-editor.component.ts` does not. +- [#2183 Larger page sizes in list views](https://support.squidex.io/t/declined-content-view-display-250/2183) (1189) — one constant, `pager.component.ts:15`. The decline's cloud-performance concern argues for making it configurable, not for refusing. +- [#1042 Hide UI sections a role should not see](https://support.squidex.io/t/ui-customization/1042) (1499) — a separate ask from theming, despite the title: hiding the schemas section from content editors and specific dashboard charts. *"Why should the user who only has very minimum content access be able to see the whole site schema?"* The maintainer's reply was *"we could make it more customizable and hide specific charts"* and *"I think it has already been requested somewhere, but it is not on my roadmap yet"*. 7.22 added an option to disable the whole frontend, which is all-or-nothing rather than per-section. A reasonable follow-on to item 3, since both are permission-shaped. +- Self-service password reset (#5997) — **dropped at your direction**; most deployments use an external identity provider, so it would mostly be unused code. No trace of it exists in the backend if it is ever wanted. + +## Caveats + +- Status reflects the forum's categorisation at archive time (2026-09-20). Where + it mattered, the claim was checked in the source and the file and line cited. +- Size labels come from reading the code, not building it, and assume the change + stays within the extension point named. Items 1–4 have genuine unknowns; items + 3 and 4 each need a design decision before work starts, and both decisions are + spelled out above. +- `D:\Squidex` is on branch `stability`, ahead of public `master`. Anything + merged after `fc026a3` is not reflected here.