From 61940205d86b70431e8bf985d2f7218502ccdac7 Mon Sep 17 00:00:00 2001
From: Lone Iversen <108085781+loivsen@users.noreply.github.com>
Date: Mon, 21 Nov 2022 11:05:31 +0100
Subject: [PATCH] consumeallcontexts, strict checking, pathname link
---
.../views/section-view-examine-indexers.ts | 10 ++++------
.../views/section-view-examine-overview.ts | 12 +++++-------
.../views/section-view-examine-searchers.ts | 12 +++++-------
.../mocks/domains/examine-management.handlers.ts | 8 ++++----
4 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts
index 8044a9548c..d20e902aca 100644
--- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts
+++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts
@@ -108,11 +108,9 @@ export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(Lit
constructor() {
super();
- this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => {
- this._notificationService = notificationService;
- });
- this.consumeContext('umbModalService', (modalService: UmbModalService) => {
- this._modalService = modalService;
+ this.consumeAllContexts(['umbNotificationService', 'umbModalService'], (instances) => {
+ this._notificationService = instances['umbNotificationService'];
+ this._modalService = instances['umbModalService'];
});
}
@@ -191,7 +189,7 @@ export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(Lit
? Object.entries(this._indexData.providerProperties).map((entry) => {
return html`
${entry[0]}
- ${JSON.stringify(entry[1]).replace(/,/g, ', ')}
+ ${entry[1]}
`;
})
: ''}
diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-overview.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-overview.ts
index ea918d4df3..9f2f2e0f2a 100644
--- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-overview.ts
+++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-overview.ts
@@ -94,11 +94,9 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin(
this._getIndexers();
this._getSearchers();
- this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => {
- this._notificationService = notificationService;
- });
- this.consumeContext('umbModalService', (modalService: UmbModalService) => {
- this._modalService = modalService;
+ this.consumeAllContexts(['umbNotificationService', 'umbModalService'], (instances) => {
+ this._notificationService = instances['umbNotificationService'];
+ this._modalService = instances['umbModalService'];
});
}
@@ -137,7 +135,7 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin(
- ${index.name}
+ ${index.name}
`;
@@ -159,7 +157,7 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin(
- ${searcher.name}
+ ${searcher.name}
`;
})}
diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts
index 659556397e..c65e4008ac 100644
--- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts
+++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts
@@ -120,11 +120,9 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin(
constructor() {
super();
- this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => {
- this._notificationService = notificationService;
- });
- this.consumeContext('umbModalService', (modalService: UmbModalService) => {
- this._modalService = modalService;
+ this.consumeAllContexts(['umbNotificationService', 'umbModalService'], (instances) => {
+ this._notificationService = instances['umbNotificationService'];
+ this._modalService = instances['umbModalService'];
});
}
@@ -160,7 +158,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin(
private _updateFieldFilter() {
this._searchResults?.map((doc) => {
const document = doc.fields?.filter((field) => {
- return field.name?.toUpperCase() != 'NODENAME';
+ return field.name?.toUpperCase() !== 'NODENAME';
});
if (document) {
const newFieldNames = document.map((field) => {
@@ -227,7 +225,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin(
${rowData.fields?.find((field) => {
- if (field.name?.toUpperCase() == 'NODENAME') return field.values;
+ if (field.name?.toUpperCase() === 'NODENAME') return field.values;
else return;
})?.values}
diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/domains/examine-management.handlers.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/domains/examine-management.handlers.ts
index 9138b6d894..00867bd1a3 100644
--- a/src/Umbraco.Web.UI.Client/src/core/mocks/domains/examine-management.handlers.ts
+++ b/src/Umbraco.Web.UI.Client/src/core/mocks/domains/examine-management.handlers.ts
@@ -2,7 +2,7 @@ import { rest } from 'msw';
import { searchResultMockData, getIndexByName, PagedIndexers } from '../data/examine.data';
import { umbracoPath } from '@umbraco-cms/utils';
-import { Index, PagedIndex, PagedSearcher, PagedSearchResult, SearchResult } from '@umbraco-cms/backend-api';
+import { Index, PagedIndex, PagedSearcher, PagedSearchResult } from '@umbraco-cms/backend-api';
export const handlers = [
rest.get(umbracoPath('/search/index'), (_req, res, ctx) => {
@@ -14,7 +14,7 @@ export const handlers = [
}),
// TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName
- rest.get('/umbraco/management/api/v1/search/index/:indexName', (_req, res, ctx) => {
+ rest.get(umbracoPath('/search/index/:indexName'), (_req, res, ctx) => {
const indexName = _req.params.indexName as string;
if (!indexName) return;
@@ -28,7 +28,7 @@ export const handlers = [
}),
// TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName
- rest.post('/umbraco/management/api/v1/search/index/:indexName/rebuild', async (_req, res, ctx) => {
+ rest.post(umbracoPath('/search/index/:indexName/rebuild'), async (_req, res, ctx) => {
await new Promise((resolve) => setTimeout(resolve, (Math.random() + 1) * 1000)); // simulate a delay of 1-2 seconds
const indexName = _req.params.indexName as string;
@@ -53,7 +53,7 @@ export const handlers = [
}),
// TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName
- rest.get('/umbraco/management/api/v1/search/searcher/:searcherName/search', (_req, res, ctx) => {
+ rest.get(umbracoPath('/search/searcher/:searcherName/search'), (_req, res, ctx) => {
const query = _req.url.searchParams.get('query');
const take = _req.url.searchParams.get('take');