diff --git a/src/Umbraco.Cms.Api.Management/Mapping/Dictionary/DictionaryMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/Dictionary/DictionaryMapDefinition.cs index 27922570f0c6..b750a09a5b89 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/Dictionary/DictionaryMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/Dictionary/DictionaryMapDefinition.cs @@ -1,4 +1,4 @@ -using Umbraco.Cms.Api.Management.ViewModels; +using Umbraco.Cms.Api.Management.ViewModels; using Umbraco.Cms.Core.Mapping; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Api.Management.ViewModels.Dictionary; @@ -62,5 +62,10 @@ private void Map(IDictionaryItem source, DictionaryOverviewResponseModel target, .Where(translation => translation.Value.IsNullOrWhiteSpace() == false) .Select(translation => translation.LanguageIsoCode) .ToArray(); + target.Translations = source + .Translations + .ToDictionary( + translation => translation.LanguageIsoCode, + translation => translation.Value ?? string.Empty); } } diff --git a/src/Umbraco.Cms.Api.Management/OpenApi.json b/src/Umbraco.Cms.Api.Management/OpenApi.json index 57392e2f4f47..779ae89fa927 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi.json +++ b/src/Umbraco.Cms.Api.Management/OpenApi.json @@ -39507,7 +39507,8 @@ "DictionaryOverviewResponseModel": { "required": [ "id", - "translatedIsoCodes" + "translatedIsoCodes", + "translations" ], "type": "object", "properties": { @@ -39532,6 +39533,12 @@ "items": { "type": "string" } + }, + "translations": { + "type": "object", + "additionalProperties": { + "type": "string" + } } }, "additionalProperties": false @@ -46936,6 +46943,7 @@ "required": [ "allowLocalLogin", "allowPasswordReset", + "umbracoCssPath", "versionCheckPeriod" ], "type": "object", @@ -46949,6 +46957,9 @@ }, "allowLocalLogin": { "type": "boolean" + }, + "umbracoCssPath": { + "type": "string" } }, "additionalProperties": false @@ -50509,4 +50520,4 @@ "name": "Webhook" } ] -} +} \ No newline at end of file diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/Dictionary/DictionaryOverviewResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/Dictionary/DictionaryOverviewResponseModel.cs index 5dfa92b059aa..35749f7e2968 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/Dictionary/DictionaryOverviewResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/Dictionary/DictionaryOverviewResponseModel.cs @@ -1,4 +1,4 @@ -namespace Umbraco.Cms.Api.Management.ViewModels.Dictionary; +namespace Umbraco.Cms.Api.Management.ViewModels.Dictionary; public class DictionaryOverviewResponseModel { @@ -21,4 +21,9 @@ public class DictionaryOverviewResponseModel /// Sets the translations. /// public IEnumerable TranslatedIsoCodes { get; set; } = Enumerable.Empty(); + + /// + /// Gets or sets the translation values by ISO code. + /// + public Dictionary Translations { get; set; } = new(); } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs index 79f71c33d8e4..45e9b14f8b79 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DictionaryRepository.cs @@ -112,7 +112,8 @@ public IEnumerable GetDictionaryItemDescendants(Guid? parentId, if (filter.IsNullOrWhiteSpace() is false) { - sql.Where(x => x.Key.StartsWith(filter)); + // Search in both dictionary key and translation values + sql.Where($"({QuotedColumn("key")} LIKE @filter OR EXISTS (SELECT 1 FROM {SqlContext.SqlSyntax.GetQuotedTableName(LanguageTextDto.TableName)} lt WHERE lt.{SqlContext.SqlSyntax.GetQuotedColumnName("UniqueId")} = {QuotedColumn("id")} AND lt.{SqlContext.SqlSyntax.GetQuotedColumnName("value")} LIKE @filter))", new { filter = $"%{filter}%" }); } sql.OrderBy(x => x.UniqueId); @@ -130,7 +131,8 @@ public IEnumerable GetDictionaryItemDescendants(Guid? parentId, if (filter.IsNullOrWhiteSpace() is false) { - sql.Where(x => x.Key.StartsWith(filter)); + // Search in both dictionary key and translation values + sql.Where($"({QuotedColumn("key")} LIKE @filter OR EXISTS (SELECT 1 FROM {SqlContext.SqlSyntax.GetQuotedTableName(LanguageTextDto.TableName)} lt WHERE lt.{SqlContext.SqlSyntax.GetQuotedColumnName("UniqueId")} = {QuotedColumn("id")} AND lt.{SqlContext.SqlSyntax.GetQuotedColumnName("value")} LIKE @filter))", new { filter = $"%{filter}%" }); } return Database diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/backend-api/types.gen.ts b/src/Umbraco.Web.UI.Client/src/packages/core/backend-api/types.gen.ts index 5eae92a9cc1c..e4e6d370b984 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/backend-api/types.gen.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/backend-api/types.gen.ts @@ -599,6 +599,9 @@ export type DictionaryOverviewResponseModel = { id: string; parent?: ReferenceByIdModel | null; translatedIsoCodes: Array; + translations: { + [key: string]: string; + }; }; export enum DirectionModel { @@ -6688,8 +6691,14 @@ export type GetDocumentByIdReferencedByErrors = { * The authenticated user does not have access to this resource */ 403: unknown; + /** + * Not Found + */ + 404: ProblemDetails; }; +export type GetDocumentByIdReferencedByError = GetDocumentByIdReferencedByErrors[keyof GetDocumentByIdReferencedByErrors]; + export type GetDocumentByIdReferencedByResponses = { /** * OK @@ -6720,8 +6729,14 @@ export type GetDocumentByIdReferencedDescendantsErrors = { * The authenticated user does not have access to this resource */ 403: unknown; + /** + * Not Found + */ + 404: ProblemDetails; }; +export type GetDocumentByIdReferencedDescendantsError = GetDocumentByIdReferencedDescendantsErrors[keyof GetDocumentByIdReferencedDescendantsErrors]; + export type GetDocumentByIdReferencedDescendantsResponses = { /** * OK @@ -9677,8 +9692,14 @@ export type GetMediaByIdReferencedByErrors = { * The authenticated user does not have access to this resource */ 403: unknown; + /** + * Not Found + */ + 404: ProblemDetails; }; +export type GetMediaByIdReferencedByError = GetMediaByIdReferencedByErrors[keyof GetMediaByIdReferencedByErrors]; + export type GetMediaByIdReferencedByResponses = { /** * OK @@ -9709,8 +9730,14 @@ export type GetMediaByIdReferencedDescendantsErrors = { * The authenticated user does not have access to this resource */ 403: unknown; + /** + * Not Found + */ + 404: ProblemDetails; }; +export type GetMediaByIdReferencedDescendantsError = GetMediaByIdReferencedDescendantsErrors[keyof GetMediaByIdReferencedDescendantsErrors]; + export type GetMediaByIdReferencedDescendantsResponses = { /** * OK @@ -11523,8 +11550,14 @@ export type GetMemberByIdReferencedByErrors = { * The authenticated user does not have access to this resource */ 403: unknown; + /** + * Not Found + */ + 404: ProblemDetails; }; +export type GetMemberByIdReferencedByError = GetMemberByIdReferencedByErrors[keyof GetMemberByIdReferencedByErrors]; + export type GetMemberByIdReferencedByResponses = { /** * OK @@ -11555,8 +11588,14 @@ export type GetMemberByIdReferencedDescendantsErrors = { * The authenticated user does not have access to this resource */ 403: unknown; + /** + * Not Found + */ + 404: ProblemDetails; }; +export type GetMemberByIdReferencedDescendantsError = GetMemberByIdReferencedDescendantsErrors[keyof GetMemberByIdReferencedDescendantsErrors]; + export type GetMemberByIdReferencedDescendantsResponses = { /** * OK diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/repository/dictionary-collection.server.data-source.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/repository/dictionary-collection.server.data-source.ts index 1246297245cc..90a8ab1c5655 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/repository/dictionary-collection.server.data-source.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/repository/dictionary-collection.server.data-source.ts @@ -38,6 +38,7 @@ export class UmbDictionaryCollectionServerDataSource implements UmbCollectionDat name: item.name!, parentUnique: item.parent ? item.parent.id : null, translatedIsoCodes: item.translatedIsoCodes, + translations: item.translations || {}, unique: item.id, }; return model; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/types.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/types.ts index 563f8388068d..259f165aafde 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/types.ts @@ -10,5 +10,6 @@ export interface UmbDictionaryCollectionModel { name: string; parentUnique: string | null; translatedIsoCodes: Array; + translations: Record; unique: string; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts index 3f2e8901bf66..52d131e6ebaa 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts @@ -88,11 +88,10 @@ export class UmbDictionaryTableCollectionViewElement extends UmbLitElement { value: html` ${dictionary.name} `, }, ...languages.map((language) => { + const translation = dictionary.translations?.[language.unique]; return { columnAlias: language.unique, - value: dictionary.translatedIsoCodes?.includes(language.unique) - ? this.#renderCheckIcon(language.name) - : this.#renderAlertIcon(language.name), + value: translation ? this.#renderTranslation(translation) : this.#renderMissingTranslation(language.name), }; }), ], @@ -100,18 +99,12 @@ export class UmbDictionaryTableCollectionViewElement extends UmbLitElement { }); } - #renderCheckIcon(name: string) { - return html``; + #renderTranslation(value: string) { + return html`${value}`; } - #renderAlertIcon(name: string) { - return html``; + #renderMissingTranslation(languageName: string) { + return html``; } override render() {