From a609e5f1534ce8853509cd0d9167ae2761c7b22c Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Sun, 23 Oct 2022 19:40:03 +0200 Subject: [PATCH 01/29] init --- src/Umbraco.Web.UI.Client/schemas/api/api.yml | 229 ++++++++++++++ .../schemas/generated-schema.ts | 169 +++++++++++ ...hboard-examine-management-index.element.ts | 284 ++++++++++++++++++ ...ard-examine-management-searcher.element.ts | 170 +++++++++++ .../dashboard-examine-management.element.ts | 190 +++++++++++- .../src/core/api/fetcher.ts | 11 +- .../src/core/models/index.ts | 1 + .../fields-viewer/fields-viewer.element.ts | 90 ++++++ .../src/mocks/browser-handlers.ts | 2 + .../src/mocks/data/examine.data.ts | 216 +++++++++++++ .../domains/examine-management.handlers.ts | 82 +++++ .../src/mocks/e2e-handlers.ts | 2 + .../temp-schema-generator/api.ts | 1 + .../examine-management.ts | 108 +++++++ 14 files changed, 1548 insertions(+), 7 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts create mode 100644 src/Umbraco.Web.UI.Client/src/mocks/data/examine.data.ts create mode 100644 src/Umbraco.Web.UI.Client/src/mocks/domains/examine-management.handlers.ts create mode 100644 src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts diff --git a/src/Umbraco.Web.UI.Client/schemas/api/api.yml b/src/Umbraco.Web.UI.Client/schemas/api/api.yml index 532bec33a9..14e8693db1 100644 --- a/src/Umbraco.Web.UI.Client/schemas/api/api.yml +++ b/src/Umbraco.Web.UI.Client/schemas/api/api.yml @@ -399,6 +399,140 @@ paths: application/json: schema: $ref: '#/components/schemas/ProblemDetails' + /examine/index: + get: + operationId: getIndexers + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Indexer' + default: + description: default response + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + /examine/index/{indexName}: + get: + operationId: getIndex + parameters: + - name: indexName + in: path + required: true + schema: + type: string + responses: + '200': + description: 200 response + content: + application/json: + schema: + $ref: '#/components/schemas/Indexer' + default: + description: default response + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + /examine/searchers: + get: + operationId: getSearchers + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Searcher' + default: + description: default response + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + /examine/index/{indexName}/rebuild: + post: + operationId: postIndexRebuild + parameters: + - name: indexName + in: path + required: true + schema: + type: string + responses: + '201': + description: 201 response + '400': + description: 400 response + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + /examine/searchers/{searcherName}/{searchQuery}: + get: + operationId: getSearchSearchers + parameters: + - name: searcherName + in: path + required: true + schema: + type: string + - name: searchQuery + in: path + required: true + schema: + type: string + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SearchResult' + '400': + description: 400 response + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' + /examine/index/{indexName}/{searchQuery}: + get: + operationId: getSearchIndex + parameters: + - name: indexName + in: path + required: true + schema: + type: string + - name: searchQuery + in: path + required: true + schema: + type: string + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SearchResult' + '400': + description: 400 response + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetails' components: schemas: ConsentLevel: @@ -1292,3 +1426,98 @@ components: $ref: '#/components/schemas/ConsentLevel' required: - telemetryLevel + Health: + type: string + enum: + - Healthy + - Unhealthy + ProviderProperties: + type: object + properties: + CommitCount: + type: number + format: float + DefaultAnalyzer: + type: string + DocumentCount: + type: number + format: float + FieldCount: + type: number + format: float + LuceneDirectory: + type: string + LuceneIndexFolder: + type: string + DirectoryFactory: + type: string + EnableDefaultEventHandler: + type: boolean + PublishedValuesOnly: + type: boolean + SupportProtectedContent: + type: boolean + IncludeFields: + type: array + items: + type: string + required: + - CommitCount + - DefaultAnalyzer + - DocumentCount + - FieldCount + - LuceneDirectory + - LuceneIndexFolder + - DirectoryFactory + - EnableDefaultEventHandler + - PublishedValuesOnly + - SupportProtectedContent + Indexer: + type: object + properties: + name: + type: string + canRebuild: + type: boolean + healthStatus: + $ref: '#/components/schemas/Health' + isHealthy: + type: boolean + providerProperties: + $ref: '#/components/schemas/ProviderProperties' + required: + - name + - canRebuild + - healthStatus + - isHealthy + - providerProperties + Searcher: + type: object + properties: + name: + type: string + providerProperties: + type: array + items: + type: string + required: + - name + - providerProperties + SearchResult: + type: object + properties: + id: + type: number + format: float + name: + type: string + fields: + type: object + score: + type: number + format: float + required: + - id + - name + - fields + - score diff --git a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts index 5abca1cf7e..27d8745ba2 100644 --- a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts +++ b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts @@ -74,6 +74,24 @@ export interface paths { "/telemetry/ConsentLevels": { get: operations["ConsentLevels"]; }; + "/examine/index": { + get: operations["getIndexers"]; + }; + "/examine/index/{indexName}": { + get: operations["getIndex"]; + }; + "/examine/searchers": { + get: operations["getSearchers"]; + }; + "/examine/index/{indexName}/rebuild": { + post: operations["postIndexRebuild"]; + }; + "/examine/searchers/{searcherName}/{searchQuery}": { + get: operations["getSearchSearchers"]; + }; + "/examine/index/{indexName}/{searchQuery}": { + get: operations["getSearchIndex"]; + }; } export interface components { @@ -437,6 +455,43 @@ export interface components { ConsentLevelSettings: { telemetryLevel: components["schemas"]["ConsentLevel"]; }; + /** @enum {string} */ + Health: "Healthy" | "Unhealthy"; + ProviderProperties: { + /** Format: float */ + CommitCount: number; + DefaultAnalyzer: string; + /** Format: float */ + DocumentCount: number; + /** Format: float */ + FieldCount: number; + LuceneDirectory: string; + LuceneIndexFolder: string; + DirectoryFactory: string; + EnableDefaultEventHandler: boolean; + PublishedValuesOnly: boolean; + SupportProtectedContent: boolean; + IncludeFields?: string[]; + }; + Indexer: { + name: string; + canRebuild: boolean; + healthStatus: components["schemas"]["Health"]; + isHealthy: boolean; + providerProperties: components["schemas"]["ProviderProperties"]; + }; + Searcher: { + name: string; + providerProperties: string[]; + }; + SearchResult: { + /** Format: float */ + id: number; + name: string; + fields: { [key: string]: unknown }; + /** Format: float */ + score: number; + }; }; } @@ -830,6 +885,120 @@ export interface operations { }; }; }; + getIndexers: { + responses: { + /** 200 response */ + 200: { + content: { + "application/json": components["schemas"]["Indexer"][]; + }; + }; + /** default response */ + default: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; + getIndex: { + parameters: { + path: { + indexName: string; + }; + }; + responses: { + /** 200 response */ + 200: { + content: { + "application/json": components["schemas"]["Indexer"]; + }; + }; + /** default response */ + default: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; + getSearchers: { + responses: { + /** 200 response */ + 200: { + content: { + "application/json": components["schemas"]["Searcher"][]; + }; + }; + /** default response */ + default: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; + postIndexRebuild: { + parameters: { + path: { + indexName: string; + }; + }; + responses: { + /** 201 response */ + 201: unknown; + /** 400 response */ + 400: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; + getSearchSearchers: { + parameters: { + path: { + searcherName: string; + searchQuery: string; + }; + }; + responses: { + /** 200 response */ + 200: { + content: { + "application/json": components["schemas"]["SearchResult"][]; + }; + }; + /** 400 response */ + 400: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; + getSearchIndex: { + parameters: { + path: { + indexName: string; + searchQuery: string; + }; + }; + responses: { + /** 200 response */ + 200: { + content: { + "application/json": components["schemas"]["SearchResult"][]; + }; + }; + /** 400 response */ + 400: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; } export interface external {} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts new file mode 100644 index 0000000000..7398a27824 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts @@ -0,0 +1,284 @@ +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { css, html, LitElement } from 'lit'; +import { customElement, query, state, property } from 'lit/decorators.js'; + +import { UUIButtonState } from '@umbraco-ui/uui'; +import { getIndex, postIndexRebuild, getSearchResultFromIndex } from '../../../core/api/fetcher'; + +import { Indexer, SearchResult } from '../../../mocks/data/examine.data'; + +import { UmbContextConsumerMixin } from '../../../core/context'; +import { UmbModalService } from '../../../core/services/modal'; +import { UmbNotificationService } from '../../../core/services/notification'; +import { UmbNotificationDefaultData } from '../../../core/services/notification/layouts/default'; +import { UmbModalLayoutElement } from '../../../core/services/modal/layouts/modal-layout.element'; + +@customElement('examine-management-index') +export class UmbDashboardExamineManagementIndexElement extends UmbContextConsumerMixin(LitElement) { + static styles = [ + UUITextStyles, + css` + :host { + display: block; + } + uui-box + uui-box { + margin-top: var(--uui-size-space-5); + } + + uui-box p { + margin-top: 0; + } + + div.flex { + display: flex; + } + div.flex > uui-button { + padding-left: var(--uui-size-space-4); + height: 0; + } + + uui-input { + width: 100%; + margin-bottom: var(--uui-size-space-5); + } + + uui-table.info uui-table-row:first-child uui-table-cell { + border-top: none; + } + + uui-table-head-cell { + text-transform: capitalize; + } + + uui-table-row:last-child uui-table-cell { + padding-bottom: 0; + } + + uui-icon { + vertical-align: top; + padding-right: var(--uui-size-space-5); + } + + .positive { + color: var(--uui-color-positive); + } + .danger { + color: var(--uui-color-danger); + } + + button { + background: none; + border: none; + text-decoration: underline; + cursor: pointer; + } + button.bright { + font-style: italic; + color: var(--uui-color-positive-emphasis); + } + `, + ]; + + @property() + indexName!: string; + + @state() + private _searchResults?: SearchResult[]; + + @state() + private _buttonState?: UUIButtonState = undefined; + + @query('#search') + private _searchInput!: HTMLInputElement; + + @state() + private _indexData!: Indexer; + + private _notificationService?: UmbNotificationService; + private _modalService?: UmbModalService; + + private async _getIndexData() { + try { + const index = await getIndex({ indexName: this.indexName }); + this._indexData = index.data as Indexer; + } catch (e) { + if (e instanceof getIndex.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch index' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + constructor() { + super(); + + this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { + this._notificationService = notificationService; + }); + this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this._modalService = modalService; + }); + } + + connectedCallback(): void { + super.connectedCallback(); + this._getIndexData(); + } + + private _onKeyPress(e: KeyboardEvent) { + if (e.key == 'Enter') this._onSearch(); + } + + private async _onSearch() { + if (this._searchInput.value.length) { + try { + const res = await getSearchResultFromIndex({ + indexName: this._indexData.name, + searchQuery: this._searchInput.value, + }); + this._searchResults = res.data as SearchResult[]; + console.log(this._searchResults); + } catch (e) { + if (e instanceof getSearchResultFromIndex.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch search results' }; + this._notificationService?.peek('danger', { data }); + } + } + } else this._searchResults = undefined; + } + + private async _onRebuildHandler() { + const modalHandler = this._modalService?.confirm({ + headline: `Rebuild ${this.indexName}`, + content: html` + This will cause the index to be rebuilt.
+ Depending on how much content there is in your site this could take a while.
+ It is not recommended to rebuild an index during times of high website traffic or when editors are editing + content. + `, + color: 'danger', + confirmLabel: 'Rebuild', + }); + modalHandler?.onClose().then(({ confirmed }) => { + if (confirmed) this._rebuild(); + }); + } + private async _rebuild() { + this._buttonState = 'waiting'; + try { + await postIndexRebuild({ indexName: this._indexData.name }); + this._buttonState = 'success'; + } catch (e) { + this._buttonState = 'failed'; + if (e instanceof postIndexRebuild.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Rebuild error' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + render() { + if (this._indexData) { + return html` +

+ Health Status
+ The health status of the ${this._indexData.name} and if it can be read +

+
+ + + + + ${this._indexData.healthStatus} +
+
+ +

Search the ${this._indexData.name} and view the results

+
+ + + Search +
+ ${this.renderSearchResults()} +
+ ${this.renderPropertyList()} ${this.renderTools()}`; + } else return; + } + + private renderSearchResults() { + if (this._searchResults?.length) { + return html` + + Id + Name + Fields + Score + + ${this._searchResults?.map((rowData) => { + return html` + ${rowData.id} + + + + + ${rowData.score} + `; + })} + `; + } + return; + } + + private renderPropertyList() { + return html` +

Lists the properties of the ${this._indexData.name}

+ + ${Object.entries(this._indexData.providerProperties).map((entry) => { + return html` + ${entry[0]} + ${JSON.stringify(entry[1]).replace(/,/g, ', ')} + `; + })} + +
`; + } + + private renderTools() { + return html` +

Tools to manage the ${this._indexData.name}

+ + Rebuild + +
`; + } +} + +declare global { + interface HTMLElementTagNameMap { + 'examine-management-index': UmbDashboardExamineManagementIndexElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts new file mode 100644 index 0000000000..89bd877376 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts @@ -0,0 +1,170 @@ +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { css, html, LitElement } from 'lit'; +import { customElement, query, state, property } from 'lit/decorators.js'; + +import { UUIButtonState } from '@umbraco-ui/uui'; +import { getSearchResultFromSearchers } from '../../../core/api/fetcher'; + +import { SearchResult } from '../../../mocks/data/examine.data'; + +import { UmbContextConsumerMixin } from '../../../core/context'; +import { UmbModalService } from '../../../core/services/modal'; +import { UmbNotificationService } from '../../../core/services/notification'; +import { UmbNotificationDefaultData } from '../../../core/services/notification/layouts/default'; +import '../../../core/services/modal/layouts/fields-viewer/fields-viewer.element'; + +@customElement('examine-management-searchers') +export class UmbDashboardExamineManagementSearcherElement extends UmbContextConsumerMixin(LitElement) { + static styles = [ + UUITextStyles, + css` + :host { + display: block; + } + uui-box + uui-box { + margin-top: var(--uui-size-space-5); + } + + uui-box p { + margin-top: 0; + } + + div.flex { + display: flex; + } + div.flex > uui-button { + padding-left: var(--uui-size-space-4); + height: 0; + } + + uui-input { + width: 100%; + margin-bottom: var(--uui-size-space-5); + } + + uui-table-head-cell { + text-transform: capitalize; + } + + uui-table-row:last-child uui-table-cell { + padding-bottom: 0; + } + + uui-radio-group { + display: flex; + } + + uui-radio { + padding-right: var(--uui-size-space-5); + } + + button { + background: none; + border: none; + font-style: italic; + color: var(--uui-color-positive-emphasis); + text-decoration: underline; + cursor: pointer; + } + `, + ]; + + @property() + searcherName!: string; + + @state() + private _searchResults?: SearchResult[]; + + @query('#search') + private _searchInput!: HTMLInputElement; + + private _notificationService?: UmbNotificationService; + private _modalService?: UmbModalService; + + constructor() { + super(); + this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { + this._notificationService = notificationService; + }); + this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this._modalService = modalService; + }); + } + + connectedCallback(): void { + super.connectedCallback(); + } + + private _onKeyPress(e: KeyboardEvent) { + if (e.key == 'Enter') this._onSearch(); + } + + private async _onSearch() { + if (!this._searchInput.value.length) return; + try { + const res = await getSearchResultFromSearchers({ + searcherName: this.searcherName, + searchQuery: this._searchInput.value, + }); + this._searchResults = res.data as SearchResult[]; + } catch (e) { + if (e instanceof getSearchResultFromSearchers.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch search results' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + render() { + return html` +

Search tools

+
+ + Search +
+ ${this.renderSearchResults()} +
`; + } + + private renderSearchResults() { + if (this._searchResults?.length) { + return html` + + Id + Name + Fields + Score + + ${this._searchResults?.map((rowData) => { + return html` + ${rowData.id} + ${rowData.name} + + + + ${rowData.score} + `; + })} + `; + } + return; + } +} +declare global { + interface HTMLElementTagNameMap { + 'examine-management-searchers': UmbDashboardExamineManagementSearcherElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts index cf83ad6c0d..c682b885a9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts @@ -1,16 +1,194 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, LitElement } from 'lit'; -import { customElement } from 'lit/decorators.js'; +import { customElement, state, query } from 'lit/decorators.js'; + +import '../examine-management/dashboard-examine-management-index.element'; +import '../examine-management/dashboard-examine-management-searcher.element'; + +import { getIndexers, getSearchers } from '../../../core/api/fetcher'; + +import { Indexer, Searcher } from '../../../mocks/data/examine.data'; + +import { UmbContextConsumerMixin } from '../../../core/context'; +import { UmbModalService } from '../../../core/services/modal'; +import { UmbNotificationService } from '../../../core/services/notification'; +import { UmbNotificationDefaultData } from '../../../core/services/notification/layouts/default'; + +type ExaminePageType = 'Index' | 'Searcher'; @customElement('umb-dashboard-examine-management') -export class UmbDashboardExamineManagementElement extends LitElement { - static styles = [UUITextStyles, css``]; +export class UmbDashboardExamineManagementElement extends UmbContextConsumerMixin(LitElement) { + static styles = [ + UUITextStyles, + css` + uui-box + uui-box { + margin-top: var(--uui-size-space-5); + } + + uui-box p { + margin-top: 0; + } + + button { + background: transparent; + border: none; + text-decoration: underline; + cursor: pointer; + } + + button.back { + margin-bottom: var(--uui-size-space-5); + } + + uui-table-cell { + line-height: 0; + vertical-align: middle; + } + + uui-table-row:last-child uui-table-cell { + padding-bottom: 0; + } + + .positive { + color: var(--uui-color-positive); + } + + .danger { + color: var(--uui-color-danger); + } + + .not-found-message { + font-style: italic; + color: var(--uui-color-text-alt); + } + `, + ]; + + @state() + private _indexers?: Indexer[]; + + @state() + private _searchers?: Searcher[]; + + @state() + private _page?: { type: ExaminePageType; name: string }; + + @query('#pop') + private _popover!: HTMLElement; + + private _notificationService?: UmbNotificationService; + private _modalService?: UmbModalService; + + private async _getIndexers() { + try { + const indexers = await getIndexers({}); + this._indexers = indexers.data as Indexer[]; + } catch (e) { + if (e instanceof getIndexers.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch indexers' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + private async _getSearchers() { + try { + const searchers = await getSearchers({}); + this._searchers = searchers.data as Searcher[]; + } catch (e) { + if (e instanceof getSearchers.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch searchers' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + constructor() { + super(); + this._getIndexers(); + this._getSearchers(); + + this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { + this._notificationService = notificationService; + }); + this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this._modalService = modalService; + }); + } render() { + if (this._page?.type == 'Index') { + return html` + `; + } else if (this._page?.type == 'Searcher') { + return html` + `; + } else { + return html` + +

+ Manage Examine's indexes
+ Allows you to view the details of each index and provides some tools for managing the indexes +

+ ${this.renderIndexersList()} +
+ +

+ Configured Searchers
+ Shows properties and tools for any configured Searcher (i.e. such as a multi-index searcher) +

+ ${this.renderSearchersList()} +
+ `; + } + } + + private renderIndexersList() { + if (!this._indexers) return; + return html` + ${this._indexers.map((index) => { + return html` + + + + + + + + + + + + `; + })} + `; + } + + private renderSearchersList() { + if (!this._searchers) return html`No searchers were found`; return html` - -

Examine Management

-
+ + ${this._searchers.map((searcher) => { + return html` + + + + + + + + + `; + })} + `; } } diff --git a/src/Umbraco.Web.UI.Client/src/core/api/fetcher.ts b/src/Umbraco.Web.UI.Client/src/core/api/fetcher.ts index 9a45dc0f8e..8c572fc5cb 100644 --- a/src/Umbraco.Web.UI.Client/src/core/api/fetcher.ts +++ b/src/Umbraco.Web.UI.Client/src/core/api/fetcher.ts @@ -25,6 +25,15 @@ export const getConsentLevels = fetcher.path('/telemetry/ConsentLevels').method( export const getConsentLevel = fetcher.path('/telemetry/ConsentLevel').method('get').create(); export const postConsentLevel = fetcher.path('/telemetry/ConsentLevel').method('post').create(); +export const getIndexers = fetcher.path('/examine/index').method('get').create(); +export const getSearchers = fetcher.path('/examine/searchers').method('get').create(); +export const getIndex = fetcher.path('/examine/index/{indexName}').method('get').create(); +export const postIndexRebuild = fetcher.path('/examine/index/{indexName}/rebuild').method('post').create(); +export const getSearchResultFromIndex = fetcher.path('/examine/index/{indexName}/{searchQuery}').method('get').create(); +export const getSearchResultFromSearchers = fetcher + .path('/examine/searchers/{searcherName}/{searchQuery}') + .method('get') + .create(); // Property Editors export const getPropertyEditorsList = fetcher.path('/property-editors/list').method('get').create(); @@ -36,8 +45,8 @@ export const getPropertyEditorConfig = fetcher .path('/property-editors/property-editor/config/{propertyEditorAlias}') .method('get') .create(); + export const getPublishedCacheStatus = fetcher.path('/published-cache/status').method('get').create(); export const postPublishedCacheReload = fetcher.path('/published-cache/reload').method('post').create(); export const postPublishedCacheRebuild = fetcher.path('/published-cache/rebuild').method('post').create(); export const getPublishedCacheCollect = fetcher.path('/published-cache/collect').method('get').create(); - diff --git a/src/Umbraco.Web.UI.Client/src/core/models/index.ts b/src/Umbraco.Web.UI.Client/src/core/models/index.ts index 4ba781d242..d5f7e0b50e 100644 --- a/src/Umbraco.Web.UI.Client/src/core/models/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/models/index.ts @@ -35,6 +35,7 @@ export type ManifestCustom = components['schemas']['IManifestCustom']; export type ManifestPackageView = components['schemas']['IManifestPackageView']; export type PackageInstalled = components['schemas']['PackageInstalled']; export type ConsentLevelSettings = components['schemas']['ConsentLevelSettings']; +export type Indexer = components['schemas']['Indexer']; // Property Editors export type PropertyEditorsListResponse = components['schemas']['PropertyEditorsListResponse']; diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts new file mode 100644 index 0000000000..813e7cdd2c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts @@ -0,0 +1,90 @@ +import { html, TemplateResult, css } from 'lit'; +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { customElement } from 'lit/decorators.js'; +import { UmbModalLayoutElement } from '../modal-layout.element'; + +export interface UmbModalFieldsViewerData { + document: UmbModalDocumentData; + values: object; +} + +export interface UmbModalDocumentData { + id: number; + name: string; + score: number; +} + +@customElement('umb-modal-layout-fields-viewer') +export class UmbModalLayoutFieldsViewerElement extends UmbModalLayoutElement { + static styles = [ + UUITextStyles, + css` + :host { + display: relative; + } + uui-dialog-layout { + display: flex; + flex-direction: column; + height: 100%; + background-color: white; + box-shadow: var(--uui-shadow-depth-1, 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)); + border-radius: var(--uui-border-radius); + padding: var(--uui-size-space-5); + box-sizing: border-box; + } + uui-scroll-container { + line-height: 0; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(40px, auto)); + overflow-y: scroll; + max-height: 100%; + min-height: 0; + } + div { + display: flex; + flex-direction: row-reverse; + } + `, + ]; + + private _isIteratable(check: any) { + if (typeof check[Symbol.iterator] == 'function' && typeof check != 'string') return true; + else return false; + } + + private _handleClose() { + this.modalHandler?.close(); + } + + render() { + if (this.data?.values) { + return html` + + + + + Field + Value + + ${Object.entries(this.data?.values).map((cell) => { + return html` + ${cell[0]} + ${JSON.stringify(cell[1]).replace(/,/g, ', ')} + `; + })} + + +
+ Close +
+
+ `; + } else return html``; + } +} + +declare global { + interface HTMLElementTagNameMap { + 'umb-modal-layout-fields-viewer': UmbModalLayoutFieldsViewerElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/mocks/browser-handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/browser-handlers.ts index 04345b3989..2590329fca 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/browser-handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/browser-handlers.ts @@ -12,6 +12,7 @@ import { handlers as telemetryHandlers } from './domains/telemetry.handlers'; import { handlers as propertyEditorHandlers } from './domains/property-editor.handlers'; import { handlers as usersHandlers } from './domains/users.handlers'; import { handlers as userGroupsHandlers } from './domains/user-groups.handlers'; +import { handlers as examineManagementHandlers } from './domains/examine-management.handlers'; const handlers = [ serverHandlers.serverVersionHandler, @@ -28,6 +29,7 @@ const handlers = [ ...publishedStatusHandlers, ...usersHandlers, ...userGroupsHandlers, + ...examineManagementHandlers, ]; switch (import.meta.env.VITE_UMBRACO_INSTALL_STATUS) { diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/examine.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/examine.data.ts new file mode 100644 index 0000000000..aebc821443 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/examine.data.ts @@ -0,0 +1,216 @@ +export function getIndexByName(indexName: string) { + return Indexers.find((index) => { + return index.name.toLocaleLowerCase() == indexName.toLocaleLowerCase(); + }); +} + +export function getIndexers() { + return Indexers; +} + +export function searchResFromIndex() { + return ResultsFromIndex; +} + +export interface Searcher { + name: string; + providerProperties: string[]; +} + +export interface Indexer { + name: string; + canRebuild: boolean; + healthStatus: Health; + isHealthy: boolean; + providerProperties: ProviderProperties; +} + +export interface IndexDisplay { + name: string; + healthStatus: Health; +} + +export interface ProviderProperties { + CommitCount: number; + DefaultAnalyzer: string; + DocumentCount: number; + FieldCount: number; + LuceneDirectory: string; + LuceneIndexFolder: string; + DirectoryFactory: string; + EnableDefaultEventHandler: boolean; + PublishedValuesOnly: boolean; + SupportProtectedContent: boolean; + IncludeFields?: string[]; +} + +export interface SearchResult { + id: number; + name: string; + fields: {}; //DocumentKeyFields; + score: number; +} + +export interface DocumentKeyFields { + __Icon: string; + __IndexType: string; + __Key: string; + __NodeId: number; + __NodeTypeAlias: string; + __Path: number; + __Published: string; + __VariesByCulture: string; + createDate: number; + creatorId: number; + creatorName: string; + icon: string; + id: number; + image: DocumentImageFieldKeys[]; + level: number; + nodeName: string; + nodeType: number; + parentID: number; + path: number; + sortOrder: number; + templateID: number; + updateDate: number; + urlName: string; + writerID: number; + writerName: string; +} + +export default interface DocumentImageFieldKeys { + key: string; + mediaKey: string; +} + +type Health = 'Healthy' | 'Unhealthy'; + +const Indexers: Indexer[] = [ + { + name: 'ExternalIndex', + canRebuild: true, + healthStatus: 'Healthy', + isHealthy: true, + providerProperties: { + CommitCount: 0, + DefaultAnalyzer: 'StandardAnalyzer', + DocumentCount: 0, + FieldCount: 0, + LuceneDirectory: 'SimpleFSDirectory', + LuceneIndexFolder: '/ /umbraco /data /temp /examineindexes /externalindex', + DirectoryFactory: + 'Umbraco.Cms.Infrastructure.Examine.ConfigurationEnabledDirectoryFactory, Umbraco.Examine.Lucene, Version=10.2.0.0, Culture=neutral, PublicKeyToken=null', + EnableDefaultEventHandler: true, + PublishedValuesOnly: true, + SupportProtectedContent: false, + }, + }, + { + name: 'InternalIndex', + canRebuild: true, + healthStatus: 'Healthy', + isHealthy: true, + providerProperties: { + CommitCount: 0, + DefaultAnalyzer: 'CultureInvariantWhitespaceAnalyzer', + DocumentCount: 0, + FieldCount: 0, + LuceneDirectory: 'SimpleFSDirectory', + LuceneIndexFolder: '/ /umbraco /data /temp /examineindexes /internalindex', + DirectoryFactory: + 'Umbraco.Cms.Infrastructure.Examine.ConfigurationEnabledDirectoryFactory, Umbraco.Examine.Lucene, Version=10.2.0.0, Culture=neutral, PublicKeyToken=null', + EnableDefaultEventHandler: true, + PublishedValuesOnly: false, + SupportProtectedContent: true, + IncludeFields: ['id', 'nodeName', 'updateDate', 'loginName', 'email', '__Key'], + }, + }, + { + name: 'MemberIndex', + canRebuild: true, + healthStatus: 'Healthy', + isHealthy: true, + providerProperties: { + CommitCount: 0, + DefaultAnalyzer: 'CultureInvariantWhitespaceAnalyzer', + DirectoryFactory: + 'Umbraco.Cms.Infrastructure.Examine.ConfigurationEnabledDirectoryFactory, Umbraco.Examine.Lucene, Version=10.2.0.0, Culture=neutral, PublicKeyToken=null', + DocumentCount: 0, + EnableDefaultEventHandler: true, + FieldCount: 0, + IncludeFields: ['id', 'nodeName', 'updateDate', 'loginName', 'email', '__Key'], + LuceneDirectory: 'SimpleFSDirectory', + LuceneIndexFolder: '/ /umbraco /data /temp /examineindexes /membersindex', + PublishedValuesOnly: false, + SupportProtectedContent: false, + }, + }, +]; + +const ResultsFromIndex: SearchResult[] = [ + { + id: 1, + name: 'Home', + fields: { + __Icon: 'icon-document', + __IndexType: 'content', + __Key: '903wyrqwjf-33wrefef-wefwef3-erw', + __NodeId: 1059, + __NodeTypeAlias: 'Home', + __Path: -1.345, + __Published: 'y', + __VariesByCulture: 'n', + createDate: 30752539, + creatorId: -1, + creatorName: 'Lone', + icon: 'icon-document', + id: 1059, + image: [{ key: '34343-3wdsw-sd35-3s', mediaKey: 'afewr-q5-23rd-3red' }], + level: 1, + nodeName: 'Just a picture', + nodeType: 1056, + parentID: -1, + path: -3.325, + sortOrder: 1, + templateID: 1055, + updateDate: 9573024532945, + urlName: 'just-a-picture', + writerID: -1, + writerName: 'Lone', + }, + score: 1, + }, + { + id: 2, + name: 'NotHome', + score: 0.1, + fields: { + __Icon: 'icon-document', + __IndexType: 'content', + __Key: '903wyrqwjf-33wrefef-wefwef3-erw', + __NodeId: 1059, + __NodeTypeAlias: 'Home', + __Path: -1.345, + __Published: 'y', + __VariesByCulture: 'n', + createDate: 30752539, + creatorId: -1, + creatorName: 'Lone', + icon: 'icon-document', + id: 1059, + image: [{ key: '34343-3wdsw-sd35-3s', mediaKey: 'afewr-q5-23rd-3red' }], + level: 1, + nodeName: 'Just a picture', + nodeType: 1056, + parentID: -1, + path: -3.325, + sortOrder: 1, + templateID: 1055, + updateDate: 9573024532945, + urlName: 'just-a-picture', + writerID: -1, + writerName: 'Lone', + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/domains/examine-management.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/domains/examine-management.handlers.ts new file mode 100644 index 0000000000..5533c3af77 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/mocks/domains/examine-management.handlers.ts @@ -0,0 +1,82 @@ +import { rest } from 'msw'; +// import dashboardMediaManagementStories from '../../backoffice/dashboards/media-management/dashboard-media-management.stories'; + +import umbracoPath from '../../core/helpers/umbraco-path'; + +import { Indexer, Searcher, getIndexByName, getIndexers, SearchResult, searchResFromIndex } from '../data/examine.data'; + +export const handlers = [ + rest.get(umbracoPath('/examine/index'), (_req, res, ctx) => { + return res( + // Respond with a 200 status code + ctx.status(200), + ctx.json(getIndexers()) + ); + }), + rest.get(umbracoPath('/examine/index/:indexName'), (_req, res, ctx) => { + const indexName = _req.params.indexName as string; + if (!indexName) return; + + const indexFound = getIndexByName(indexName); + if (indexFound) { + return res(ctx.status(200), ctx.json(indexFound)); + } else { + return res(ctx.status(404)); + } + }), + rest.get(umbracoPath('/examine/searchers'), (_req, res, ctx) => { + return res( + ctx.status(200), + ctx.json([ + { name: 'ExternalSearcher', providerProperties: ['Cake'] }, + { name: 'InternalSearcher', providerProperties: ['Panda'] }, + { name: 'InternalMemberSearcher', providerProperties: ['Bamboo?'] }, + ]) + ); + }), + rest.post(umbracoPath('/examine/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; + if (!indexName) return; + + const indexFound = getIndexByName(indexName); + if (indexFound) { + return res(ctx.status(201)); + } else { + return res(ctx.status(404)); + } + }), + + rest.get(umbracoPath('/examine/index/:indexName/:searchQuery'), (_req, res, ctx) => { + const indexName = _req.params.indexName as string; + const searchQuery = _req.params.searchQuery as string; + if (!indexName || !searchQuery) return; + + const indexFound = getIndexByName(indexName); + if (indexFound) { + return res(ctx.status(200), ctx.json(searchResFromIndex())); + } else { + return res(ctx.status(404)); + } + }), + + rest.get(umbracoPath('/examine/searchers/:searcherName/:searchQuery'), (_req, res, ctx) => { + const searcherName = _req.params.searcherName as string; + const searchQuery = _req.params.searchQuery as string; + if (!searcherName || !searchQuery) return; + + //const searcherFound = getIndexByName(indexName); + if (searcherName) { + return res( + ctx.status(200), + ctx.json([ + { id: 1, name: 'Home', fields: { __Key: 'Stuff' }, score: 10 }, + { id: 2, score: 5, name: 'NotHome', fields: { __Key: 'Stuff' } }, + ]) + ); + } else { + return res(ctx.status(404)); + } + }), +]; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/e2e-handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/e2e-handlers.ts index 53252b4f1b..341453b44a 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/e2e-handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/e2e-handlers.ts @@ -10,6 +10,7 @@ import { handlers as userHandlers } from './domains/user.handlers'; import { handlers as telemetryHandlers } from './domains/telemetry.handlers'; import { handlers as treeHandlers } from './domains/entity.handlers'; import { handlers as propertyEditorHandlers } from './domains/property-editor.handlers'; +import { handlers as examineManagementHandlers } from './domains/examine-management.handlers'; export const handlers = [ serverHandlers.serverRunningHandler, @@ -26,4 +27,5 @@ export const handlers = [ ...publishedStatusHandlers, ...treeHandlers, ...propertyEditorHandlers, + ...examineManagementHandlers, ]; diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts index 7a52baaf5d..1509d2b255 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/api.ts @@ -6,6 +6,7 @@ import './upgrader'; import './user'; import './telemetry'; import './property-editors'; +import './examine-management'; import { api } from '@airtasker/spot'; diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts new file mode 100644 index 0000000000..14856da90b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts @@ -0,0 +1,108 @@ +import { body, defaultResponse, endpoint, pathParams, request, response, String } from '@airtasker/spot'; +import { ProblemDetails } from './models'; +import { Indexer, Searcher, SearchResult } from '../src/mocks/data/examine.data'; + +@endpoint({ + method: 'GET', + path: '/examine/index', +}) +export class getIndexers { + @response({ status: 200 }) + success(@body body: Indexer[]) {} + + @defaultResponse + default(@body body: ProblemDetails) {} +} + +@endpoint({ + method: 'GET', + path: '/examine/index/:indexName', +}) +export class getIndex { + @request + request( + @pathParams + pathParams: { + indexName: String; + } + ) {} + + @response({ status: 200 }) + success(@body body: Indexer) {} + + @defaultResponse + default(@body body: ProblemDetails) {} +} + +@endpoint({ + method: 'GET', + path: '/examine/searchers', +}) +export class getSearchers { + @response({ status: 200 }) + success(@body body: Searcher[]) {} + + @defaultResponse + default(@body body: ProblemDetails) {} +} + +@endpoint({ + method: 'POST', + path: '/examine/index/:indexName/rebuild', +}) +export class postIndexRebuild { + @request + request( + @pathParams + pathParams: { + indexName: String; + } + ) {} + @response({ status: 201 }) + success() {} + + @response({ status: 400 }) + badRequest(@body body: ProblemDetails) {} +} + +@endpoint({ + method: 'GET', + path: '/examine/searchers/:searcherName/:searchQuery', +}) +export class getSearchSearchers { + @request + request( + @pathParams + pathParams: { + searcherName: String; + searchQuery: String; + } + ) {} + + @response({ status: 200 }) + success(@body body: SearchResult[]) {} + + @response({ status: 400 }) + badRequest(@body body: ProblemDetails) {} +} + +@endpoint({ + method: 'GET', + path: '/examine/index/:indexName/:searchQuery', +}) +export class getSearchIndex { + @request + request( + @pathParams + pathParams: { + indexName: String; + searchQuery: String; + } + ) {} + + @response({ status: 200 }) + success(@body body: SearchResult[]) {} + + @response({ status: 400 }) + badRequest(@body body: ProblemDetails) {} +} From 81c42f7884942d050c9e9a8162a66cf30cbd00b2 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Mon, 24 Oct 2022 10:26:34 +0200 Subject: [PATCH 02/29] pop ups --- .../dashboard-examine-management-index.element.ts | 7 ++++++- ...ashboard-examine-management-searcher.element.ts | 14 +++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts index 7398a27824..ed23b23674 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts @@ -180,6 +180,11 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume } } + private _onNameClick() { + const data: UmbNotificationDefaultData = { message: 'TODO: Open editor for this' }; // TODO + this._notificationService?.peek('warning', { data }); + } + render() { if (this._indexData) { return html` @@ -226,7 +231,7 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume ${this._searchResults?.map((rowData) => { return html` ${rowData.id} - + - `; - } else if (this._page?.type == 'Searcher') { - return html` - `; - } else { - return html` - -

- Manage Examine's indexes
- Allows you to view the details of each index and provides some tools for managing the indexes -

- ${this.renderIndexersList()} -
- -

- Configured Searchers
- Shows properties and tools for any configured Searcher (i.e. such as a multi-index searcher) -

- ${this.renderSearchersList()} -
- `; - } - } - - private renderIndexersList() { - if (!this._indexers) return; - return html` - ${this._indexers.map((index) => { - return html` - - - - - - - - - - - - `; - })} - `; - } - - private renderSearchersList() { - if (!this._searchers) return html`No searchers were found`; - return html` - - ${this._searchers.map((searcher) => { - return html` - - - - - - - - - `; - })} - - `; + return html` ${this.backbutton + ? html` ← Back to overview ` + : ``} + `; } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts new file mode 100644 index 0000000000..9a0801db18 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts @@ -0,0 +1,38 @@ +export interface SearcherModel { + name: string; + providerProperties: string[]; //TODO +} + +export interface IndexModel { + name: string; + canRebuild: boolean; + healthStatus: string; + isHealthy: boolean; + providerProperties: ProviderPropertiesModel; +} + +export interface ProviderPropertiesModel { + CommitCount: number; + DefaultAnalyzer: string; + DocumentCount: number; + FieldCount: number; + LuceneDirectory: string; + LuceneIndexFolder: string; + DirectoryFactory: string; + EnableDefaultEventHandler: boolean; + PublishedValuesOnly: boolean; + SupportProtectedContent: boolean; + IncludeFields?: string[]; +} + +export interface FieldViewModel { + name: string; + values: string[]; +} + +export interface SearchResultsModel { + id: number; + name: string; + fields: FieldViewModel[]; + score: number; +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts similarity index 57% rename from src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts rename to src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts index 5b533b3a08..d262dbac19 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-index.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-indexers.ts @@ -1,27 +1,28 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, LitElement } from 'lit'; -import { customElement, query, state, property } from 'lit/decorators.js'; +import { customElement, state, property } from 'lit/decorators.js'; import { UUIButtonState } from '@umbraco-ui/uui'; +import { IndexModel } from '../examine-extension'; -import { Indexer, SearchResult } from '../../../core/mocks/data/examine.data'; - -import { UmbModalService } from '../../../core/services/modal'; -import { UmbNotificationService } from '../../../core/services/notification'; -import { UmbNotificationDefaultData } from '../../../core/services/notification/layouts/default'; - +import { UmbModalService } from '../../../../core/services/modal'; +import { UmbNotificationService } from '../../../../core/services/notification'; +import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; +import { getIndex, postIndexRebuild } from '@umbraco-cms/backend-api'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; -import { getIndex, getSearchResultFromSearchers, postIndexRebuild } from '@umbraco-cms/backend-api'; +import './section-view-examine-searchers'; -@customElement('examine-management-index') -export class UmbDashboardExamineManagementIndexElement extends UmbContextConsumerMixin(LitElement) { +@customElement('umb-dashboard-examine-index') +export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(LitElement) { static styles = [ UUITextStyles, css` :host { display: block; } - uui-box + uui-box { + + uui-box, + umb-dashboard-examine-searcher { margin-top: var(--uui-size-space-5); } @@ -82,17 +83,11 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume @property() indexName!: string; - @state() - private _searchResults?: SearchResult[]; - @state() private _buttonState?: UUIButtonState = undefined; - @query('#search') - private _searchInput!: HTMLInputElement; - @state() - private _indexData!: Indexer; + private _indexData!: IndexModel; private _notificationService?: UmbNotificationService; private _modalService?: UmbModalService; @@ -100,7 +95,7 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume private async _getIndexData() { try { const index = await getIndex({ indexName: this.indexName }); - this._indexData = index.data as Indexer; + this._indexData = index.data as IndexModel; } catch (e) { if (e instanceof getIndex.Error) { const error = e.getActualType(); @@ -126,30 +121,6 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume this._getIndexData(); } - private _onKeyPress(e: KeyboardEvent) { - if (e.key == 'Enter') this._onSearch(); - } - - private async _onSearch() { - if (this._searchInput.value.length) { - try { - const res = await getSearchResultFromSearchers({ - searcherName: this._indexData.name, - query: this._searchInput.value, - take: 100, - }); - this._searchResults = res.data as SearchResult[]; - console.log(this._searchResults); - } catch (e) { - if (e instanceof getSearchResultFromSearchers.Error) { - const error = e.getActualType(); - const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch search results' }; - this._notificationService?.peek('danger', { data }); - } - } - } else this._searchResults = undefined; - } - private async _onRebuildHandler() { const modalHandler = this._modalService?.confirm({ headline: `Rebuild ${this.indexName}`, @@ -181,14 +152,9 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume } } - private _onNameClick() { - const data: UmbNotificationDefaultData = { message: 'TODO: Open editor for this' }; // TODO - this._notificationService?.peek('warning', { data }); - } - render() { if (this._indexData) { - return html` + return html`

Health Status
The health status of the ${this._indexData.name} and if it can be read @@ -203,54 +169,9 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume ${this._indexData.healthStatus} - -

Search the ${this._indexData.name} and view the results

-
- - - Search -
- ${this.renderSearchResults()} -
+ ${this.renderPropertyList()} ${this.renderTools()}`; - } else return; - } - - private renderSearchResults() { - if (this._searchResults?.length) { - return html` - - Id - Name - Fields - Score - - ${this._searchResults?.map((rowData) => { - return html` - ${rowData.id} - - - - - ${rowData.score} - `; - })} - `; - } - return; + } else return html`← Back to overview`; } private renderPropertyList() { @@ -283,8 +204,10 @@ export class UmbDashboardExamineManagementIndexElement extends UmbContextConsume } } +export default UmbDashboardExamineIndexElement; + declare global { interface HTMLElementTagNameMap { - 'examine-management-index': UmbDashboardExamineManagementIndexElement; + 'umb-dashboard-examine-index': UmbDashboardExamineIndexElement; } } 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 new file mode 100644 index 0000000000..042d313eb1 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-overview.ts @@ -0,0 +1,178 @@ +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { css, html, LitElement } from 'lit'; +import { customElement, state } from 'lit/decorators.js'; + +import { IndexModel, SearcherModel } from '../examine-extension'; + +import { UmbModalService } from '../../../../core/services/modal'; +import { UmbNotificationService } from '../../../../core/services/notification'; +import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; +import { getIndexers, getSearchers } from '@umbraco-cms/backend-api'; +import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; + +@customElement('umb-dashboard-examine-overview') +export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin(LitElement) { + static styles = [ + UUITextStyles, + css` + uui-box + uui-box { + margin-top: var(--uui-size-space-5); + } + + uui-box p { + margin-top: 0; + } + + a { + color: var(--uui-color-text); + background: transparent; + border: none; + text-decoration: underline; + cursor: pointer; + } + + uui-table-cell { + line-height: 0; + vertical-align: middle; + } + + uui-table-row:last-child uui-table-cell { + padding-bottom: 0; + } + + .positive { + color: var(--uui-color-positive); + } + + .danger { + color: var(--uui-color-danger); + } + + .not-found-message { + font-style: italic; + color: var(--uui-color-text-alt); + } + `, + ]; + + @state() + private _indexers?: IndexModel[]; + + @state() + private _searchers?: SearcherModel[]; + + private _notificationService?: UmbNotificationService; + private _modalService?: UmbModalService; + + private async _getIndexers() { + try { + const indexers = await getIndexers({ skip: 0, take: 3 }); + this._indexers = indexers.data as IndexModel[]; + } catch (e) { + if (e instanceof getIndexers.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch indexers' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + private async _getSearchers() { + try { + const searchers = await getSearchers({ skip: 0, take: 3 }); + this._searchers = searchers.data as SearcherModel[]; + } catch (e) { + if (e instanceof getSearchers.Error) { + const error = e.getActualType(); + const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch searchers' }; + this._notificationService?.peek('danger', { data }); + } + } + } + + constructor() { + super(); + this._getIndexers(); + this._getSearchers(); + + this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { + this._notificationService = notificationService; + }); + this.consumeContext('umbModalService', (modalService: UmbModalService) => { + this._modalService = modalService; + }); + } + + render() { + return html` + +

+ Manage Examine's indexes
+ Allows you to view the details of each index and provides some tools for managing the indexes +

+ ${this.renderIndexersList()} +
+ +

+ Configured Searchers
+ Shows properties and tools for any configured Searcher (i.e. such as a multi-index searcher) +

+ ${this.renderSearchersList()} +
+ `; + } + + private renderIndexersList() { + if (!this._indexers) return; + return html` + ${this._indexers.map((index) => { + return html` + + + + + + + + + ${index.name} + + + `; + })} + `; + } + + private renderSearchersList() { + if (!this._searchers) return html`No searchers were found`; + return html` + + ${this._searchers.map((searcher) => { + return html` + + + + + + + ${searcher.name} + + `; + })} + + `; + } +} + +export default UmbDashboardExamineOverviewElement; + +declare global { + interface HTMLElementTagNameMap { + 'umb-dashboard-examine-overview': UmbDashboardExamineOverviewElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts similarity index 66% rename from src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts rename to src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts index f04f5ff3e9..b935d395cf 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management-searcher.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/section-view-examine-searchers.ts @@ -1,26 +1,27 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, LitElement } from 'lit'; -import { customElement, query, state, property } from 'lit/decorators.js'; +import { customElement, state, query, property } from 'lit/decorators.js'; -import { SearchResult } from '../../../core/mocks/data/examine.data'; +import { UmbModalService } from '../../../../core/services/modal'; +import { UmbNotificationService } from '../../../../core/services/notification'; +import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; -import { UmbModalService } from '../../../core/services/modal'; -import { UmbNotificationService } from '../../../core/services/notification'; -import { UmbNotificationDefaultData } from '../../../core/services/notification/layouts/default'; -import '../../../core/services/modal/layouts/fields-viewer/fields-viewer.element'; +import { SearchResultsModel } from '../examine-extension'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; -import { getSearchResultFromSearchers } from '@umbraco-cms/backend-api'; +import { getSearchResults } from '@umbraco-cms/backend-api'; -@customElement('examine-management-searchers') -export class UmbDashboardExamineManagementSearcherElement extends UmbContextConsumerMixin(LitElement) { +import '../../../../core/services/modal/layouts/fields-viewer/fields-viewer.element'; + +@customElement('umb-dashboard-examine-searcher') +export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin(LitElement) { static styles = [ UUITextStyles, css` :host { display: block; } - uui-box + uui-box { + uui-box { margin-top: var(--uui-size-space-5); } @@ -57,12 +58,6 @@ export class UmbDashboardExamineManagementSearcherElement extends UmbContextCons padding-right: var(--uui-size-space-5); } - button { - background: none; - border: none; - text-decoration: underline; - cursor: pointer; - } button.bright { font-style: italic; color: var(--uui-color-positive-emphasis); @@ -70,18 +65,18 @@ export class UmbDashboardExamineManagementSearcherElement extends UmbContextCons `, ]; + private _notificationService?: UmbNotificationService; + private _modalService?: UmbModalService; + @property() searcherName!: string; @state() - private _searchResults?: SearchResult[]; + private _searchResults?: SearchResultsModel[]; - @query('#search') + @query('#search-input') private _searchInput!: HTMLInputElement; - private _notificationService?: UmbNotificationService; - private _modalService?: UmbModalService; - constructor() { super(); this.consumeContext('umbNotificationService', (notificationService: UmbNotificationService) => { @@ -92,25 +87,26 @@ export class UmbDashboardExamineManagementSearcherElement extends UmbContextCons }); } - connectedCallback(): void { - super.connectedCallback(); + private _onNameClick() { + const data: UmbNotificationDefaultData = { message: 'TODO: Open editor for this' }; // TODO + this._notificationService?.peek('warning', { data }); } private _onKeyPress(e: KeyboardEvent) { - if (e.key == 'Enter') this._onSearch(); + e.key == 'Enter' ? this._onSearch() : undefined; } private async _onSearch() { if (!this._searchInput.value.length) return; try { - const res = await getSearchResultFromSearchers({ + const res = await getSearchResults({ searcherName: this.searcherName, query: this._searchInput.value, take: 100, }); - this._searchResults = res.data as SearchResult[]; + this._searchResults = res.data as SearchResultsModel[]; } catch (e) { - if (e instanceof getSearchResultFromSearchers.Error) { + if (e instanceof getSearchResults.Error) { const error = e.getActualType(); const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch search results' }; this._notificationService?.peek('danger', { data }); @@ -118,24 +114,22 @@ export class UmbDashboardExamineManagementSearcherElement extends UmbContextCons } } - private _onNameClick() { - const data: UmbNotificationDefaultData = { message: 'TODO: Open editor for this' }; //TODO - this._notificationService?.peek('warning', { data }); - } - render() { - return html` -

Search tools

-
- - Search -
- ${this.renderSearchResults()} -
`; + return html` + +

Search the ${this.searcherName} and view the results

+
+ + + Search +
+ ${this.renderSearchResults()} +
+ `; } private renderSearchResults() { @@ -171,8 +165,11 @@ export class UmbDashboardExamineManagementSearcherElement extends UmbContextCons return; } } + +export default UmbDashboardExamineSearcherElement; + declare global { interface HTMLElementTagNameMap { - 'examine-management-searchers': UmbDashboardExamineManagementSearcherElement; + 'umb-dashboard-examine-searcher': UmbDashboardExamineSearcherElement; } } diff --git a/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts b/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts index 14c7690f49..21c47474cc 100644 --- a/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts +++ b/src/Umbraco.Web.UI.Client/src/core/backend-api/fetcher.ts @@ -29,7 +29,7 @@ export const getIndexers = fetcher.path('/search/index').method('get').create(); export const getIndex = fetcher.path('/search/index/{indexName}').method('get').create(); export const postIndexRebuild = fetcher.path('/search/index/{indexName}/rebuild').method('post').create(); export const getSearchers = fetcher.path('/search/searcher').method('get').create(); -export const getSearchResultFromSearchers = fetcher.path('/search/searcher/{searcherName}').method('get').create(); +export const getSearchResults = fetcher.path('/search/searcher/{searcherName}').method('get').create(); // Property Editors export const getPropertyEditorsList = fetcher.path('/property-editors/list').method('get').create(); diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts index f75fcf03dc..102669ee3f 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts @@ -1,64 +1,24 @@ +import { + IndexModel, + SearchResultsModel, + SearcherModel, +} from 'src/backoffice/dashboards/examine-management/examine-extension'; + export function getIndexByName(indexName: string) { return Indexers.find((index) => { return index.name.toLocaleLowerCase() == indexName.toLocaleLowerCase(); }); } -export function getIndexers() { +export function getIndexers(): IndexModel[] { return Indexers; } -export function searchResFromIndex() { - return ResultsFromIndex; +export function getSearchResultsMockData(): SearchResultsModel[] { + return searchResultMockData; } -export interface Searcher { - name: string; - providerProperties: string[]; -} - -export interface Indexer { - name: string; - canRebuild: boolean; - healthStatus: Health; - isHealthy: boolean; - providerProperties: ProviderProperties; -} - -export interface IndexDisplay { - name: string; - healthStatus: Health; -} - -export interface ProviderProperties { - CommitCount: number; - DefaultAnalyzer: string; - DocumentCount: number; - FieldCount: number; - LuceneDirectory: string; - LuceneIndexFolder: string; - DirectoryFactory: string; - EnableDefaultEventHandler: boolean; - PublishedValuesOnly: boolean; - SupportProtectedContent: boolean; - IncludeFields?: string[]; -} - -export interface SearchResult { - id: number; - name: string; - fields: any; - score: number; -} - -export default interface DocumentImageFieldKeys { - key: string; - mediaKey: string; -} - -type Health = 'Healthy' | 'Unhealthy'; - -const Indexers: Indexer[] = [ +const Indexers: IndexModel[] = [ { name: 'ExternalIndex', canRebuild: true, @@ -120,69 +80,69 @@ const Indexers: Indexer[] = [ }, ]; -const ResultsFromIndex: SearchResult[] = [ +export const searchResultMockData: SearchResultsModel[] = [ { id: 1, name: 'Home', - fields: { - __Icon: 'icon-document', - __IndexType: 'content', - __Key: '903wyrqwjf-33wrefef-wefwef3-erw', - __NodeId: 1059, - __NodeTypeAlias: 'Home', - __Path: -1.345, - __Published: 'y', - __VariesByCulture: 'n', - createDate: 30752539, - creatorId: -1, - creatorName: 'Lone', - icon: 'icon-document', - id: 1059, - image: [{ key: '34343-3wdsw-sd35-3s', mediaKey: 'afewr-q5-23rd-3red' }], - level: 1, - nodeName: 'Just a picture', - nodeType: 1056, - parentID: -1, - path: -3.325, - sortOrder: 1, - templateID: 1055, - updateDate: 9573024532945, - urlName: 'just-a-picture', - writerID: -1, - writerName: 'Lone', - }, score: 1, + fields: [ + { name: '__Icon', values: ['icon-document'] }, + { name: '__IndexType', values: ['content'] }, + { name: '__Key', values: ['903wyrqwjf-33wrefef-wefwef3-erw'] }, + { name: '__NodeId', values: ['1059'] }, + { name: '__NodeTypeAlias', values: ['Home'] }, + { name: '__Path', values: ['-1.345'] }, + { name: '__Published', values: ['y'] }, + { name: '__VariesByCulture', values: ['n'] }, + { name: 'createDate', values: ['30752539'] }, + { name: 'creatorId', values: ['-1'] }, + { name: 'creatorName', values: ['Lone'] }, + { name: 'icon', values: ['icon-document'] }, + { name: 'id', values: ['1059'] }, + { name: 'image', values: ['34343-3wdsw-sd35-3s', 'afewr-q5-23rd-3red'] }, + { name: 'level', values: ['1'] }, + { name: 'nodeName', values: ['Just a picture'] }, + { name: 'nodeType', values: ['1056'] }, + { name: 'parentID', values: ['-1'] }, + { name: 'path', values: ['-3.325'] }, + { name: 'sortOrder', values: ['1'] }, + { name: 'templateID', values: ['1055'] }, + { name: 'updateDate', values: ['9573024532945'] }, + { name: 'urlName', values: ['just-a-picture'] }, + { name: 'writerID', values: ['-1'] }, + { name: 'writerName', values: ['Lone'] }, + ], }, { id: 2, - name: 'NotHome', - score: 0.1, - fields: { - __Icon: 'icon-document', - __IndexType: 'content', - __Key: '903wyrqwjf-33wrefef-wefwef3-erw', - __NodeId: 1059, - __NodeTypeAlias: 'Home', - __Path: -1.345, - __Published: 'y', - __VariesByCulture: 'n', - createDate: 30752539, - creatorId: -1, - creatorName: 'Lone', - icon: 'icon-document', - id: 1059, - image: [{ key: '34343-3wdsw-sd35-3s', mediaKey: 'afewr-q5-23rd-3red' }], - level: 1, - nodeName: 'Just a picture', - nodeType: 1056, - parentID: -1, - path: -3.325, - sortOrder: 1, - templateID: 1055, - updateDate: 9573024532945, - urlName: 'just-a-picture', - writerID: -1, - writerName: 'Lone', - }, + name: 'Dojo', + score: 0.9, + fields: [ + { name: '__Icon', values: ['icon-document'] }, + { name: '__IndexType', values: ['content'] }, + { name: '__Key', values: ['903wyrqwjf-33wrefef-wefwef3-erw'] }, + { name: '__NodeId', values: ['1059'] }, + { name: '__NodeTypeAlias', values: ['Home'] }, + { name: '__Path', values: ['-1.345'] }, + { name: '__Published', values: ['y'] }, + { name: '__VariesByCulture', values: ['n'] }, + { name: 'createDate', values: ['30752539'] }, + { name: 'creatorId', values: ['-1'] }, + { name: 'creatorName', values: ['Lone'] }, + { name: 'icon', values: ['icon-document'] }, + { name: 'id', values: ['1059'] }, + { name: 'image', values: ['34343-3wdsw-sd35-3s', 'afewr-q5-23rd-3red'] }, + { name: 'level', values: ['1'] }, + { name: 'nodeName', values: ['Just a picture'] }, + { name: 'nodeType', values: ['1056'] }, + { name: 'parentID', values: ['-1'] }, + { name: 'path', values: ['-3.325'] }, + { name: 'sortOrder', values: ['1'] }, + { name: 'templateID', values: ['1055'] }, + { name: 'updateDate', values: ['9573024532945'] }, + { name: 'urlName', values: ['just-a-picture'] }, + { name: 'writerID', values: ['-1'] }, + { name: 'writerName', values: ['Lone'] }, + ], }, ]; 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 62d8aa7f8a..7a7262fd03 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 @@ -1,19 +1,19 @@ import { rest } from 'msw'; -// import dashboardMediaManagementStories from '../../backoffice/dashboards/media-management/dashboard-media-management.stories'; -import { Indexer, Searcher, getIndexByName, getIndexers, SearchResult, searchResFromIndex } from '../data/examine.data'; +import { searchResultMockData, getIndexByName, getIndexers } from '../data/examine.data'; +import { + IndexModel, + SearcherModel, + SearchResultsModel, +} from 'src/backoffice/dashboards/examine-management/examine-extension'; + import { umbracoPath } from '@umbraco-cms/utils'; -const test = '/search/index/:indexName'; - -// use a regex to replace :indexName with {indexName} -const regex = new RegExp(test.replace(/:[^/]+/g, '([^/]+)')); - export const handlers = [ rest.get(umbracoPath('/search/index'), (_req, res, ctx) => { return res( // Respond with a 200 status code ctx.status(200), - ctx.json(getIndexers()) + ctx.json(getIndexers()) ); }), @@ -25,7 +25,7 @@ export const handlers = [ const indexFound = getIndexByName(indexName); if (indexFound) { - return res(ctx.status(200), ctx.json(indexFound)); + return res(ctx.status(200), ctx.json(indexFound)); } else { return res(ctx.status(404)); } @@ -49,7 +49,7 @@ export const handlers = [ rest.get(umbracoPath('/search/searcher'), (_req, res, ctx) => { return res( ctx.status(200), - ctx.json([ + ctx.json([ { name: 'ExternalSearcher', providerProperties: ['Cake'] }, { name: 'InternalSearcher', providerProperties: ['Panda'] }, { name: 'InternalMemberSearcher', providerProperties: ['Bamboo?'] }, @@ -57,24 +57,6 @@ export const handlers = [ ); }), - /* - rest.get(umbracoPath('/search/index/:indexName'), (_req, res, ctx) => { - const query = _req.url.searchParams.get('query'); - debugger; - - const indexName = _req.params.indexName as string; - const searchQuery = _req.params.searchQuery as string; - if (!indexName || !searchQuery) return; - - const indexFound = getIndexByName(indexName); - if (indexFound) { - return res(ctx.status(200), ctx.json(searchResFromIndex())); - } else { - return res(ctx.status(404)); - } - }), - */ - // TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName rest.get('/umbraco/backoffice/search/searcher/:searcherName', (_req, res, ctx) => { const query = _req.url.searchParams.get('query'); @@ -86,7 +68,7 @@ export const handlers = [ //const searcherFound = getIndexByName(indexName); if (searcherName) { - return res(ctx.status(200), ctx.json(searchResFromIndex())); + return res(ctx.status(200), ctx.json(searchResultMockData)); } else { return res(ctx.status(404)); } diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts index d731153fa2..4d7b52bee2 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts @@ -1,6 +1,5 @@ import { body, defaultResponse, endpoint, pathParams, queryParams, request, response, String } from '@airtasker/spot'; import { ProblemDetails } from './models'; -import { Indexer, Searcher, SearchResult } from '../src/core/mocks/data/examine.data'; @endpoint({ method: 'GET', @@ -17,7 +16,7 @@ export class getIndexers { ) {} @response({ status: 200 }) - success(@body body: Indexer[]) {} + success(@body body: IndexModel[]) {} @defaultResponse default(@body body: ProblemDetails) {} @@ -37,7 +36,7 @@ export class getIndex { ) {} @response({ status: 200 }) - success(@body body: Indexer) {} + success(@body body: IndexModel) {} @defaultResponse default(@body body: ProblemDetails) {} @@ -77,7 +76,7 @@ export class getSearchers { ) {} @response({ status: 200 }) - success(@body body: Searcher[]) {} + success(@body body: SearcherModel[]) {} @defaultResponse default(@body body: ProblemDetails) {} @@ -102,8 +101,49 @@ export class getSearchSearchers { ) {} @response({ status: 200 }) - success(@body body: SearchResult[]) {} + success(@body body: SearchResultsModel[]) {} @response({ status: 400 }) badRequest(@body body: ProblemDetails) {} } + +//Interfaces + +export interface SearcherModel { + name: string; + providerProperties: ProviderPropertiesModel; +} + +export interface IndexModel { + name: string; + canRebuild: boolean; + healthStatus: string; + isHealthy: boolean; + providerProperties: ProviderPropertiesModel; +} + +export interface SearchResultsModel { + id: number; + name: string; + fields: FieldViewModel[]; + score: number; +} + +export interface ProviderPropertiesModel { + CommitCount: number; + DefaultAnalyzer: string; + DocumentCount: number; + FieldCount: number; + LuceneDirectory: string; + LuceneIndexFolder: string; + DirectoryFactory: string; + EnableDefaultEventHandler: boolean; + PublishedValuesOnly: boolean; + SupportProtectedContent: boolean; + IncludeFields?: string[]; +} + +export interface FieldViewModel { + name: string; + values: string[]; +} From 20b920601bba47c2f48f5aa0485d87d364a9033d Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Tue, 8 Nov 2022 14:13:35 +0100 Subject: [PATCH 12/29] added filter for fields --- .../examine-management/examine-extension.ts | 2 +- .../views/section-view-examine-searchers.ts | 96 +++++++++++++++++-- .../fields-viewer/fields-settings.element.ts | 93 ++++++++++++++++++ .../fields-viewer/fields-viewer.element.ts | 29 ++---- 4 files changed, 187 insertions(+), 33 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts index 9a0801db18..d263fd5492 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/examine-extension.ts @@ -1,6 +1,6 @@ export interface SearcherModel { name: string; - providerProperties: string[]; //TODO + providerProperties: unknown; //TODO } export interface IndexModel { 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 b935d395cf..18907bcc64 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 @@ -6,12 +6,18 @@ import { UmbModalService } from '../../../../core/services/modal'; import { UmbNotificationService } from '../../../../core/services/notification'; import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; -import { SearchResultsModel } from '../examine-extension'; +import { FieldViewModel, SearchResultsModel } from '../examine-extension'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import { getSearchResults } from '@umbraco-cms/backend-api'; import '../../../../core/services/modal/layouts/fields-viewer/fields-viewer.element'; +import '../../../../core/services/modal/layouts/fields-viewer/fields-settings.element'; + +interface ExposedField { + name: string; + exposed: boolean; +} @customElement('umb-dashboard-examine-searcher') export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin(LitElement) { @@ -62,6 +68,12 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( font-style: italic; color: var(--uui-color-positive-emphasis); } + + .field-adder { + width: 0; + line-height: 0; + cursor: pointer; + } `, ]; @@ -74,6 +86,9 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( @state() private _searchResults?: SearchResultsModel[]; + @state() + private _fields?: ExposedField[]; + @query('#search-input') private _searchInput!: HTMLInputElement; @@ -105,6 +120,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( take: 100, }); this._searchResults = res.data as SearchResultsModel[]; + this._updateFieldFilter(); } catch (e) { if (e instanceof getSearchResults.Error) { const error = e.getActualType(); @@ -114,6 +130,34 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( } } + private _updateFieldFilter() { + this._searchResults?.map((result) => { + const fieldNames = result.fields.map((field) => { + return { name: field.name, exposed: false }; + }); + + this._fields = fieldNames.map((field, i) => { + return this._fields + ? this._fields[i].name == field.name + ? { name: this._fields[i].name, exposed: this._fields[i].exposed } + : field + : field; + }); + }); + } + + private _onFieldFilterClick() { + const modalHandler = this._modalService?.open('umb-modal-layout-fields-settings', { + type: 'sidebar', + size: 'small', + data: { ...this._fields }, + }); + modalHandler?.onClose().then(({ fields } = {}) => { + if (!fields) return; + this._fields = fields; + }); + } + render() { return html` @@ -136,34 +180,66 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( if (this._searchResults?.length) { return html` - Id + Score + Id Name - Fields - Score + Fields + ${this.renderHeadCells()} + + + + + + + ${this._searchResults?.map((rowData) => { return html` + ${rowData.score} ${rowData.id} - - + ${Object.keys(rowData.fields).length} fields + - ${rowData.score} + ${this.renderBodyCells(rowData.fields)} + `; })} `; } return; } + + renderHeadCells() { + return html`${this._fields?.map((field) => { + return field.exposed ? html`${field.name}` : html``; + })}`; + } + + renderBodyCells(cellData: FieldViewModel[]) { + return html`${this._fields?.map((field) => { + return cellData.map((option) => { + return option.name == field.name && field.exposed + ? html`${option.values}` + : ``; + }); + })}`; + } } export default UmbDashboardExamineSearcherElement; diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts new file mode 100644 index 0000000000..ab3ac26523 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts @@ -0,0 +1,93 @@ +import { html, css } from 'lit'; +import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; +import { customElement, state } from 'lit/decorators.js'; +import { UmbModalLayoutElement } from '../modal-layout.element'; + +export interface UmbModalFieldsSettingsData { + name: string; + exposed: boolean; +} + +@customElement('umb-modal-layout-fields-settings') +export class UmbModalLayoutFieldsSettingsElement extends UmbModalLayoutElement { + static styles = [ + UUITextStyles, + css` + :host { + display: relative; + } /* + uui-dialog-layout { + display: flex; + flex-direction: column; + height: 100%; + background-color: white; + box-shadow: var(--uui-shadow-depth-1, 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)); + border-radius: var(--uui-border-radius); + padding: var(--uui-size-space-5); + box-sizing: border-box; + } + uui-scroll-container { + line-height: 0; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(40px, auto)); + overflow-y: scroll; + max-height: 100%; + min-height: 0; + }*/ + div { + display: flex; + flex-direction: row-reverse; + } + `, + ]; + + @state() + private _fields?: UmbModalFieldsSettingsData[]; + + private _handleClose() { + this.modalHandler?.close({ fields: this._fields }); + } + + disconnectedCallback(): void { + super.disconnectedCallback(); + this._handleClose(); + } + + firstUpdated() { + this.data + ? (this._fields = Object.values(this.data).map((field) => { + return { name: field.name, exposed: field.exposed }; + })) + : ''; + } + + render() { + if (this._fields) { + return html` + + + ${Object.values(this._fields).map((field, index) => { + return html` +
`; + })} +
+
+ Close +
+
+ `; + } else return html``; + } +} + +declare global { + interface HTMLElementTagNameMap { + 'umb-modal-layout-fields-settings': UmbModalLayoutFieldsSettingsElement; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts index 813e7cdd2c..872bb83e7e 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts @@ -2,20 +2,10 @@ import { html, TemplateResult, css } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement } from 'lit/decorators.js'; import { UmbModalLayoutElement } from '../modal-layout.element'; - -export interface UmbModalFieldsViewerData { - document: UmbModalDocumentData; - values: object; -} - -export interface UmbModalDocumentData { - id: number; - name: string; - score: number; -} +import { SearchResultsModel } from 'src/backoffice/dashboards/examine-management/examine-extension'; @customElement('umb-modal-layout-fields-viewer') -export class UmbModalLayoutFieldsViewerElement extends UmbModalLayoutElement { +export class UmbModalLayoutFieldsViewerElement extends UmbModalLayoutElement { static styles = [ UUITextStyles, css` @@ -47,29 +37,24 @@ export class UmbModalLayoutFieldsViewerElement extends UmbModalLayoutElement + Field Value - ${Object.entries(this.data?.values).map((cell) => { + ${Object.values(this.data.fields).map((cell) => { return html` - ${cell[0]} - ${JSON.stringify(cell[1]).replace(/,/g, ', ')} + ${cell.name} + ${cell.values.join(', ')} `; })} From 146fdd1a98d77cc1a11826649b8c952b72d8026c Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Wed, 16 Nov 2022 13:20:53 +0100 Subject: [PATCH 13/29] added overflow scroll when filtering search results --- .../views/section-view-examine-searchers.ts | 112 ++++++++++-------- .../section-dashboards.element.ts | 1 + 2 files changed, 61 insertions(+), 52 deletions(-) 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 60569d33fa..380e55feb9 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 @@ -80,6 +80,12 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( line-height: 0; cursor: pointer; } + + .table-container { + padding-bottom: var(--uui-size-space-4); + max-width: calc(-336px + 100vw); + overflow-x: scroll; + } `, ]; @@ -93,7 +99,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( private _searchResults?: SearchResult[]; @state() - private _fields?: ExposedField[]; + private _exposedFields?: ExposedField[]; @query('#search-input') private _searchInput!: HTMLInputElement; @@ -144,10 +150,10 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( return { name: '', exposed: false }; }); - this._fields = fieldNames?.map((field, i) => { - return this._fields - ? this._fields[i].name == field.name - ? { name: this._fields[i].name, exposed: this._fields[i].exposed } + this._exposedFields = fieldNames?.map((field, i) => { + return this._exposedFields + ? this._exposedFields[i].name == field.name + ? { name: this._exposedFields[i].name, exposed: this._exposedFields[i].exposed } : field : field; }); @@ -158,11 +164,11 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( const modalHandler = this._modalService?.open('umb-modal-layout-fields-settings', { type: 'sidebar', size: 'small', - data: { ...this._fields }, + data: { ...this._exposedFields }, }); modalHandler?.onClose().then(({ fields } = {}) => { if (!fields) return; - this._fields = fields; + this._exposedFields = fields; }); } @@ -186,61 +192,63 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( private renderSearchResults() { if (this._searchResults?.length) { - return html` - - Score - Id - Name - Fields - ${this.renderHeadCells()} - - - - - - - - - ${this._searchResults?.map((rowData) => { - return html` - ${rowData.score} - ${rowData.id} - - - Document - - - - - ${rowData.fields ? Object.keys(rowData.fields).length : ''} fields - - - ${rowData.fields ? this.renderBodyCells(rowData.fields) : ''} - - `; - })} - `; + return html` + + + Score + Id + Name + Fields + ${this.renderHeadCells()} + + + + + + + + + ${this._searchResults?.map((rowData) => { + return html` + ${rowData.score} + ${rowData.id} + + + Document + + + + + ${rowData.fields ? Object.keys(rowData.fields).length : ''} fields + + + ${rowData.fields ? this.renderBodyCells(rowData.fields) : ''} + + `; + })} + + `; } return; } renderHeadCells() { - return html`${this._fields?.map((field) => { + return html`${this._exposedFields?.map((field) => { return field.exposed ? html`${field.name}` : html``; })}`; } renderBodyCells(cellData: Field[]) { - return html`${this._fields?.map((slot) => { + return html`${this._exposedFields?.map((slot) => { return cellData.map((field) => { return slot.exposed && field.name == slot.name ? html`${field.values}` diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-dashboards/section-dashboards.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-dashboards/section-dashboards.element.ts index 89574d7c01..48f4279f48 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-dashboards/section-dashboards.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/sections/shared/section-dashboards/section-dashboards.element.ts @@ -28,6 +28,7 @@ export class UmbSectionDashboardsElement extends UmbContextConsumerMixin(UmbObse } #scroll-container { + width: calc(-300px + 100vw); height: calc(100vh - 70px - 60px); // TODO: This is a temporary fix to get scrolling to work // changed it so the height is correct but the fix is still not ideal. the 70px and 60px are the height of the blue top bar and the dashboard menu. Need a better solution still. } From 5f39afd01b72767c0bb0c645540023537bfad674 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Wed, 16 Nov 2022 14:06:31 +0100 Subject: [PATCH 14/29] overflow text --- .../views/section-view-examine-searchers.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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 380e55feb9..f97f4e4adb 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 @@ -62,12 +62,8 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( padding-bottom: 0; } - uui-radio-group { - display: flex; - } - - uui-radio { - padding-right: var(--uui-size-space-5); + uui-table-cell:not(:last-child) { + min-width: 100px; } button.bright { @@ -251,7 +247,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( return html`${this._exposedFields?.map((slot) => { return cellData.map((field) => { return slot.exposed && field.name == slot.name - ? html`${field.values}` + ? html`${field.values}` : html``; }); })}`; From f5e5c99309c1c3d8941b31c782a9038a87f632a5 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Wed, 16 Nov 2022 14:59:39 +0100 Subject: [PATCH 15/29] added fast remove option for filter --- .../views/section-view-examine-searchers.ts | 140 ++++++++++++------ 1 file changed, 91 insertions(+), 49 deletions(-) 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 f97f4e4adb..8bf1d69825 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 @@ -62,7 +62,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( padding-bottom: 0; } - uui-table-cell:not(:last-child) { + uui-table-cell { min-width: 100px; } @@ -72,15 +72,40 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( } .field-adder { - width: 0; line-height: 0; cursor: pointer; + vertical-align: top; + background: transparent; + border: none; } - .table-container { + .table-container uui-scroll-container { padding-bottom: var(--uui-size-space-4); max-width: calc(-336px + 100vw); overflow-x: scroll; + flex: 1; + } + + .table-container { + display: flex; + align-items: flex-start; + } + uui-tag { + margin-block: var(--uui-size-5, 15px); + } + + .exposed-head-field uui-button { + align-items: center; + font-weight: normal; + font-size: 10px; + height: 10px; + width: 10px; + margin-top: -5px; + } + + .exposed-head-field-container { + display: flex; + justify-content: space-between; } `, ]; @@ -188,58 +213,75 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( private renderSearchResults() { if (this._searchResults?.length) { - return html` - - - Score - Id - Name - Fields - ${this.renderHeadCells()} - - - - - - - - - ${this._searchResults?.map((rowData) => { - return html` - ${rowData.score} - ${rowData.id} - - - Document - - - - - ${rowData.fields ? Object.keys(rowData.fields).length : ''} fields - - - ${rowData.fields ? this.renderBodyCells(rowData.fields) : ''} - - `; - })} - - `; + return html`
+ + + + Score + Id + Name + Fields + ${this.renderHeadCells()} + + ${this._searchResults?.map((rowData) => { + return html` + ${rowData.score} + ${rowData.id} + + + Document + + + + + ${rowData.fields ? Object.keys(rowData.fields).length : ''} fields + + + ${rowData.fields ? this.renderBodyCells(rowData.fields) : ''} + `; + })} + + + +
`; } return; } renderHeadCells() { return html`${this._exposedFields?.map((field) => { - return field.exposed ? html`${field.name}` : html``; + return field.exposed + ? html` +
+ ${field.name} + x +
+
` + : html``; })}`; } From 652337556c4e1a824b674248285fcb60d6d0a976 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:27:03 +0100 Subject: [PATCH 16/29] fix trycatch and remove skip take data to api call --- .../views/section-view-examine-indexers.ts | 4 ++-- .../views/section-view-examine-overview.ts | 14 +++++++------- .../views/section-view-examine-searchers.ts | 1 - 3 files changed, 9 insertions(+), 10 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 e194fc47e9..0b9d346272 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 @@ -146,8 +146,8 @@ export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(Lit } catch (e) { this._buttonState = 'failed'; if (e instanceof ApiError) { - const error = e.body as ProblemDetails; - const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Rebuild error' }; + const error = e as ProblemDetails; + const data: UmbNotificationDefaultData = { message: error.message ?? 'Rebuild error' }; this._notificationService?.peek('danger', { data }); } } 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 3e99110fd4..390561044b 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 @@ -7,7 +7,7 @@ import { UmbNotificationService } from '../../../../core/services/notification'; import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; -import { ApiError, ProblemDetails, Searcher, Index, PagedIndex, SearchResource } from '@umbraco-cms/backend-api'; +import { ApiError, ProblemDetails, Searcher, Index, SearchResource } from '@umbraco-cms/backend-api'; @customElement('umb-dashboard-examine-overview') export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin(LitElement) { @@ -65,12 +65,12 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin( private async _getIndexers() { try { - const indexers = await SearchResource.getSearchIndex({ skip: 0, take: 3 }); + const indexers = await SearchResource.getSearchIndex({}); this._indexers = indexers.items as Index[]; } catch (e) { if (e instanceof ApiError) { - const error = e.body as ProblemDetails; - const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch indexers' }; + const error = e as ProblemDetails; + const data: UmbNotificationDefaultData = { message: error.message ?? 'Could not fetch indexers' }; this._notificationService?.peek('danger', { data }); } } @@ -78,12 +78,12 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin( private async _getSearchers() { try { - const searchers = await SearchResource.getSearchSearcher({ skip: 0, take: 3 }); + const searchers = await SearchResource.getSearchSearcher({}); this._searchers = searchers.items as Searcher[]; } catch (e) { if (e instanceof ApiError) { - const error = e.body as ProblemDetails; - const data: UmbNotificationDefaultData = { message: error.data.detail ?? 'Could not fetch searchers' }; + const error = e as ProblemDetails; + const data: UmbNotificationDefaultData = { message: error.message ?? 'Could not fetch searchers' }; this._notificationService?.peek('danger', { data }); } } 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 8bf1d69825..8cf7a8480f 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 @@ -150,7 +150,6 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( const res = await SearchResource.getSearchSearcherBySearcherNameSearch({ searcherName: this.searcherName, query: this._searchInput.value, - take: 100, }); const pagedSearchResults = res.items as PagedSearchResult[]; this._searchResults = pagedSearchResults[0].items; From 51209fac960d31b07e1b810cd3692136c44f0136 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Wed, 16 Nov 2022 15:29:59 +0100 Subject: [PATCH 17/29] label and todo --- .../examine-management/views/section-view-examine-indexers.ts | 1 + .../examine-management/views/section-view-examine-searchers.ts | 1 + 2 files changed, 2 insertions(+) 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 0b9d346272..86a849176f 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 @@ -180,6 +180,7 @@ export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(Lit

Lists the properties of the ${this._indexData.name}

${Object.entries(this._indexData).map((entry) => { + //TODO: This should be providerProperties showing up here return html` ${entry[0]} ${JSON.stringify(entry[1]).replace(/,/g, ', ')} 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 8cf7a8480f..4f25944fee 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 @@ -270,6 +270,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( ${field.name} - Document + ${rowData.fields?.find((field) => { + if (field.name?.toUpperCase() == 'NODENAME') return field.values; + else return; + })?.values}
@@ -265,8 +274,8 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( renderHeadCells() { return html`${this._exposedFields?.map((field) => { return field.exposed - ? html` -
+ ? html` +
${field.name} Date: Fri, 18 Nov 2022 09:42:58 +0100 Subject: [PATCH 19/29] adjusted api calls --- .../views/section-view-examine-indexers.ts | 23 +++++++++++++------ .../views/section-view-examine-searchers.ts | 3 +-- .../src/core/mocks/data/examine.data.ts | 20 +++++++--------- .../domains/examine-management.handlers.ts | 11 +++------ 4 files changed, 28 insertions(+), 29 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 86a849176f..8044a9548c 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 @@ -179,13 +179,22 @@ export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(Lit return html`

Lists the properties of the ${this._indexData.name}

- ${Object.entries(this._indexData).map((entry) => { - //TODO: This should be providerProperties showing up here - return html` - ${entry[0]} - ${JSON.stringify(entry[1]).replace(/,/g, ', ')} - `; - })} + + documentCount + ${this._indexData.documentCount} + + + fieldCount + ${this._indexData.fieldCount} + + ${this._indexData.providerProperties + ? Object.entries(this._indexData.providerProperties).map((entry) => { + return html` + ${entry[0]} + ${JSON.stringify(entry[1]).replace(/,/g, ', ')} + `; + }) + : ''}
`; } 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 dc17f4a2ff..ed4a14035d 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 @@ -153,8 +153,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( take: 9999, skip: 0, }); - const pagedSearchResults = res.items as PagedSearchResult[]; - this._searchResults = pagedSearchResults[0].items; + this._searchResults = res.items as SearchResult[]; this._updateFieldFilter(); } catch (e) { if (e instanceof ApiError) { diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts index 012d877932..66aae70e10 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/data/examine.data.ts @@ -17,12 +17,12 @@ export const Indexers: Index[] = [ canRebuild: true, healthStatus: 'Healthy', isHealthy: true, - /* + documentCount: 0, + fieldCount: 0, providerProperties: { CommitCount: 0, DefaultAnalyzer: 'StandardAnalyzer', - DocumentCount: 0, - FieldCount: 0, + LuceneDirectory: 'SimpleFSDirectory', LuceneIndexFolder: '/ /umbraco /data /temp /examineindexes /externalindex', DirectoryFactory: @@ -30,19 +30,18 @@ export const Indexers: Index[] = [ EnableDefaultEventHandler: true, PublishedValuesOnly: true, SupportProtectedContent: false, - },*/ + }, }, { name: 'InternalIndex', canRebuild: true, healthStatus: 'Healthy', isHealthy: true, - /* + documentCount: 0, + fieldCount: 0, providerProperties: { CommitCount: 0, DefaultAnalyzer: 'CultureInvariantWhitespaceAnalyzer', - DocumentCount: 0, - FieldCount: 0, LuceneDirectory: 'SimpleFSDirectory', LuceneIndexFolder: '/ /umbraco /data /temp /examineindexes /internalindex', DirectoryFactory: @@ -52,29 +51,26 @@ export const Indexers: Index[] = [ SupportProtectedContent: true, IncludeFields: ['id', 'nodeName', 'updateDate', 'loginName', 'email', '__Key'], }, - */ }, { name: 'MemberIndex', canRebuild: true, healthStatus: 'Healthy', isHealthy: true, - /* + fieldCount: 0, + documentCount: 0, providerProperties: { CommitCount: 0, DefaultAnalyzer: 'CultureInvariantWhitespaceAnalyzer', DirectoryFactory: 'Umbraco.Cms.Infrastructure.Examine.ConfigurationEnabledDirectoryFactory, Umbraco.Examine.Lucene, Version=10.2.0.0, Culture=neutral, PublicKeyToken=null', - DocumentCount: 0, EnableDefaultEventHandler: true, - FieldCount: 0, IncludeFields: ['id', 'nodeName', 'updateDate', 'loginName', 'email', '__Key'], LuceneDirectory: 'SimpleFSDirectory', LuceneIndexFolder: '/ /umbraco /data /temp /examineindexes /membersindex', PublishedValuesOnly: false, SupportProtectedContent: false, }, - */ }, ]; 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 d72adddc6d..9138b6d894 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, PagedPaged, PagedSearcher, SearchResult } from '@umbraco-cms/backend-api'; +import { Index, PagedIndex, PagedSearcher, PagedSearchResult, SearchResult } from '@umbraco-cms/backend-api'; export const handlers = [ rest.get(umbracoPath('/search/index'), (_req, res, ctx) => { @@ -64,14 +64,9 @@ export const handlers = [ if (searcherName) { return res( ctx.status(200), - ctx.json({ + ctx.json({ total: 0, - items: [ - { - total: 0, - items: searchResultMockData, - }, - ], + items: searchResultMockData, }) ); } else { From c2869152c72f573ab5e3ede588a1b0fe946b9886 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Fri, 18 Nov 2022 09:56:55 +0100 Subject: [PATCH 20/29] package updates --- src/Umbraco.Web.UI.Client/package-lock.json | 102 +++++++++--------- src/Umbraco.Web.UI.Client/package.json | 12 +-- .../public/mockServiceWorker.js | 6 +- 3 files changed, 59 insertions(+), 61 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index c75b83054a..2e19c773b8 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -16,7 +16,7 @@ "@umbraco-ui/uui-modal-dialog": "file:umbraco-ui-uui-modal-dialog-0.0.0.tgz", "@umbraco-ui/uui-modal-sidebar": "file:umbraco-ui-uui-modal-sidebar-0.0.0.tgz", "element-internals-polyfill": "^1.1.16", - "lit": "^2.4.0", + "lit": "^2.4.1", "lodash": "^4.17.21", "openapi-typescript-fetch": "^1.1.3", "router-slot": "^1.5.5", @@ -27,7 +27,7 @@ "@babel/core": "^7.20.2", "@mdx-js/react": "^2.1.5", "@open-wc/testing": "^3.1.7", - "@playwright/test": "^1.27.1", + "@playwright/test": "^1.28.0", "@storybook/addon-a11y": "^6.5.13", "@storybook/addon-actions": "^6.5.13", "@storybook/addon-essentials": "^6.5.13", @@ -37,7 +37,7 @@ "@storybook/web-components": "^6.5.13", "@types/chai": "^4.3.4", "@types/lodash-es": "^4.17.6", - "@types/mocha": "^9.1.1", + "@types/mocha": "^10.0.0", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^5.43.0", "@typescript-eslint/parser": "^5.43.0", @@ -55,15 +55,15 @@ "eslint-plugin-local-rules": "^1.3.2", "eslint-plugin-storybook": "^0.6.7", "lit-html": "^2.4.0", - "msw": "^0.47.4", + "msw": "^0.48.3", "msw-storybook-addon": "^1.6.3", "openapi-typescript-codegen": "^0.23.0", "playwright-msw": "^2.0.1", "plop": "^3.1.1", "prettier": "2.7.1", "tiny-glob": "^0.2.9", - "typescript": "^4.8.4", - "vite": "^3.2.3", + "typescript": "^4.9.3", + "vite": "^3.2.4", "vite-plugin-static-copy": "^0.12.0", "vite-tsconfig-paths": "^3.5.2", "web-component-analyzer": "^2.0.0-next.4" @@ -2898,13 +2898,13 @@ "dev": true }, "node_modules/@playwright/test": { - "version": "1.27.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz", - "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==", + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.0.tgz", + "integrity": "sha512-vrHs5DFTPwYox5SGKq/7TDn/S4q6RA1zArd7uhO6EyP9hj3XgZBBM12ktMbnDQNxh/fL1IUKsTNLxihmsU38lQ==", "dev": true, "dependencies": { "@types/node": "*", - "playwright-core": "1.27.1" + "playwright-core": "1.28.0" }, "bin": { "playwright": "cli.js" @@ -2914,9 +2914,9 @@ } }, "node_modules/@playwright/test/node_modules/playwright-core": { - "version": "1.27.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz", - "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==", + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.28.0.tgz", + "integrity": "sha512-nJLknd28kPBiCNTbqpu6Wmkrh63OEqJSFw9xOfL9qxfNwody7h6/L3O2dZoWQ6Oxcm0VOHjWmGiCUGkc0X3VZA==", "dev": true, "bin": { "playwright": "cli.js" @@ -6131,9 +6131,9 @@ "dev": true }, "node_modules/@types/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==", "dev": true }, "node_modules/@types/ms": { @@ -17515,9 +17515,9 @@ "dev": true }, "node_modules/lit": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lit/-/lit-2.4.0.tgz", - "integrity": "sha512-fdgzxEtLrZFQU/BqTtxFQCLwlZd9bdat+ltzSFjvWkZrs7eBmeX0L5MHUMb3kYIkuS8Xlfnii/iI5klirF8/Xg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.4.1.tgz", + "integrity": "sha512-qohSgLiyN1cFnJG26dIiY03S4F49857A0AHQfnS0zYtnUVnD2MFvx+UT52rtXsIuNFQrnUupX+zyGSATlk1f/A==", "dependencies": { "@lit/reactive-element": "^1.4.0", "lit-element": "^3.2.0", @@ -19572,9 +19572,9 @@ "dev": true }, "node_modules/msw": { - "version": "0.47.4", - "resolved": "https://registry.npmjs.org/msw/-/msw-0.47.4.tgz", - "integrity": "sha512-Psftt8Yfl0+l+qqg9OlmKEsxF8S/vtda0CmlR6y8wTaWrMMzuCDa55n2hEGC0ZRDwuV6FFWc/4CjoDsBpATKBw==", + "version": "0.48.3", + "resolved": "https://registry.npmjs.org/msw/-/msw-0.48.3.tgz", + "integrity": "sha512-8ENBcX7JVWPA5v9WTeOnCWCMOVtyBiXZyD/0+AKlhOysJRB1ZdBAcMGLIiQ2/VpQ2lC0Yd7SFKg9aviAQSVeaw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -19594,7 +19594,6 @@ "node-fetch": "^2.6.7", "outvariant": "^1.3.0", "path-to-regexp": "^6.2.0", - "statuses": "^2.0.0", "strict-event-emitter": "^0.2.6", "type-fest": "^2.19.0", "yargs": "^17.3.1" @@ -25902,9 +25901,9 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -26663,9 +26662,9 @@ } }, "node_modules/vite": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.3.tgz", - "integrity": "sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.4.tgz", + "integrity": "sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==", "dev": true, "dependencies": { "esbuild": "^0.15.9", @@ -30726,19 +30725,19 @@ } }, "@playwright/test": { - "version": "1.27.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz", - "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==", + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.0.tgz", + "integrity": "sha512-vrHs5DFTPwYox5SGKq/7TDn/S4q6RA1zArd7uhO6EyP9hj3XgZBBM12ktMbnDQNxh/fL1IUKsTNLxihmsU38lQ==", "dev": true, "requires": { "@types/node": "*", - "playwright-core": "1.27.1" + "playwright-core": "1.28.0" }, "dependencies": { "playwright-core": { - "version": "1.27.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz", - "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==", + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.28.0.tgz", + "integrity": "sha512-nJLknd28kPBiCNTbqpu6Wmkrh63OEqJSFw9xOfL9qxfNwody7h6/L3O2dZoWQ6Oxcm0VOHjWmGiCUGkc0X3VZA==", "dev": true } } @@ -33091,9 +33090,9 @@ "dev": true }, "@types/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==", "dev": true }, "@types/ms": { @@ -41967,9 +41966,9 @@ "dev": true }, "lit": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lit/-/lit-2.4.0.tgz", - "integrity": "sha512-fdgzxEtLrZFQU/BqTtxFQCLwlZd9bdat+ltzSFjvWkZrs7eBmeX0L5MHUMb3kYIkuS8Xlfnii/iI5klirF8/Xg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.4.1.tgz", + "integrity": "sha512-qohSgLiyN1cFnJG26dIiY03S4F49857A0AHQfnS0zYtnUVnD2MFvx+UT52rtXsIuNFQrnUupX+zyGSATlk1f/A==", "requires": { "@lit/reactive-element": "^1.4.0", "lit-element": "^3.2.0", @@ -43458,9 +43457,9 @@ "dev": true }, "msw": { - "version": "0.47.4", - "resolved": "https://registry.npmjs.org/msw/-/msw-0.47.4.tgz", - "integrity": "sha512-Psftt8Yfl0+l+qqg9OlmKEsxF8S/vtda0CmlR6y8wTaWrMMzuCDa55n2hEGC0ZRDwuV6FFWc/4CjoDsBpATKBw==", + "version": "0.48.3", + "resolved": "https://registry.npmjs.org/msw/-/msw-0.48.3.tgz", + "integrity": "sha512-8ENBcX7JVWPA5v9WTeOnCWCMOVtyBiXZyD/0+AKlhOysJRB1ZdBAcMGLIiQ2/VpQ2lC0Yd7SFKg9aviAQSVeaw==", "dev": true, "requires": { "@mswjs/cookies": "^0.2.2", @@ -43479,7 +43478,6 @@ "node-fetch": "^2.6.7", "outvariant": "^1.3.0", "path-to-regexp": "^6.2.0", - "statuses": "^2.0.0", "strict-event-emitter": "^0.2.6", "type-fest": "^2.19.0", "yargs": "^17.3.1" @@ -48402,9 +48400,9 @@ } }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "dev": true }, "typical": { @@ -48968,9 +48966,9 @@ } }, "vite": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.3.tgz", - "integrity": "sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-3.2.4.tgz", + "integrity": "sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==", "dev": true, "requires": { "esbuild": "^0.15.9", diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index eaafdafb10..c385afa9b7 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -48,7 +48,7 @@ "@umbraco-ui/uui-modal-dialog": "file:umbraco-ui-uui-modal-dialog-0.0.0.tgz", "@umbraco-ui/uui-modal-sidebar": "file:umbraco-ui-uui-modal-sidebar-0.0.0.tgz", "element-internals-polyfill": "^1.1.16", - "lit": "^2.4.0", + "lit": "^2.4.1", "lodash": "^4.17.21", "openapi-typescript-fetch": "^1.1.3", "router-slot": "^1.5.5", @@ -59,7 +59,7 @@ "@babel/core": "^7.20.2", "@mdx-js/react": "^2.1.5", "@open-wc/testing": "^3.1.7", - "@playwright/test": "^1.27.1", + "@playwright/test": "^1.28.0", "@storybook/addon-a11y": "^6.5.13", "@storybook/addon-actions": "^6.5.13", "@storybook/addon-essentials": "^6.5.13", @@ -69,7 +69,7 @@ "@storybook/web-components": "^6.5.13", "@types/chai": "^4.3.4", "@types/lodash-es": "^4.17.6", - "@types/mocha": "^9.1.1", + "@types/mocha": "^10.0.0", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^5.43.0", "@typescript-eslint/parser": "^5.43.0", @@ -87,15 +87,15 @@ "eslint-plugin-local-rules": "^1.3.2", "eslint-plugin-storybook": "^0.6.7", "lit-html": "^2.4.0", - "msw": "^0.47.4", + "msw": "^0.48.3", "msw-storybook-addon": "^1.6.3", "openapi-typescript-codegen": "^0.23.0", "playwright-msw": "^2.0.1", "plop": "^3.1.1", "prettier": "2.7.1", "tiny-glob": "^0.2.9", - "typescript": "^4.8.4", - "vite": "^3.2.3", + "typescript": "^4.9.3", + "vite": "^3.2.4", "vite-plugin-static-copy": "^0.12.0", "vite-tsconfig-paths": "^3.5.2", "web-component-analyzer": "^2.0.0-next.4" diff --git a/src/Umbraco.Web.UI.Client/public/mockServiceWorker.js b/src/Umbraco.Web.UI.Client/public/mockServiceWorker.js index ab63a84955..6269fd6f2a 100644 --- a/src/Umbraco.Web.UI.Client/public/mockServiceWorker.js +++ b/src/Umbraco.Web.UI.Client/public/mockServiceWorker.js @@ -2,13 +2,13 @@ /* tslint:disable */ /** - * Mock Service Worker (0.47.4). + * Mock Service Worker (0.48.3). * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = 'b3066ef78c2f9090b4ce87e874965995' +const INTEGRITY_CHECKSUM = '3d6b9f06410d179a7f7404d4bf4c3c70' const activeClientIds = new Set() self.addEventListener('install', function () { @@ -174,7 +174,7 @@ async function handleRequest(event, requestId) { async function resolveMainClient(event) { const client = await self.clients.get(event.clientId) - if (client.frameType === 'top-level') { + if (client?.frameType === 'top-level') { return client } From cf0d35ee026b4ffdf155ae491edc5b7eeaf1ede0 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Fri, 18 Nov 2022 10:06:46 +0100 Subject: [PATCH 21/29] fix overflow on the modal sidebars --- .../fields-viewer/fields-settings.element.ts | 31 +++++++++++-------- .../fields-viewer/fields-viewer.element.ts | 3 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts index ab3ac26523..fbe99cdee6 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts @@ -15,7 +15,8 @@ export class UmbModalLayoutFieldsSettingsElement extends UmbModalLayoutElement - - ${Object.values(this._fields).map((field, index) => { - return html` -
`; - })} + + + ${Object.values(this._fields).map((field, index) => { + return html` +
`; + })} +
Close diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts index 872bb83e7e..a13f76472b 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts @@ -31,6 +31,7 @@ export class UmbModalLayoutFieldsViewerElement extends UmbModalLayoutElement - + Field From cdc40829f9874d7d1023210d51e1ca610b5f44cc Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Fri, 18 Nov 2022 10:30:01 +0100 Subject: [PATCH 22/29] delete tempschema --- .../examine-management.ts | 149 ------------------ 1 file changed, 149 deletions(-) delete mode 100644 src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts deleted file mode 100644 index 4d7b52bee2..0000000000 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/examine-management.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { body, defaultResponse, endpoint, pathParams, queryParams, request, response, String } from '@airtasker/spot'; -import { ProblemDetails } from './models'; - -@endpoint({ - method: 'GET', - path: '/search/index', -}) -export class getIndexers { - @request - request( - @queryParams - queryParams: { - skip: number; - take: number; - } - ) {} - - @response({ status: 200 }) - success(@body body: IndexModel[]) {} - - @defaultResponse - default(@body body: ProblemDetails) {} -} - -@endpoint({ - method: 'GET', - path: '/search/index/:indexName', -}) -export class getIndex { - @request - request( - @pathParams - pathParams: { - indexName: String; - } - ) {} - - @response({ status: 200 }) - success(@body body: IndexModel) {} - - @defaultResponse - default(@body body: ProblemDetails) {} -} - -@endpoint({ - method: 'POST', - path: '/search/index/:indexName/rebuild', -}) -export class postIndexRebuild { - @request - request( - @pathParams - pathParams: { - indexName: String; - } - ) {} - @response({ status: 201 }) - success() {} - - @response({ status: 400 }) - badRequest(@body body: ProblemDetails) {} -} - -@endpoint({ - method: 'GET', - path: '/search/searcher', -}) -export class getSearchers { - @request - request( - @queryParams - queryParams: { - skip: number; - take: number; - } - ) {} - - @response({ status: 200 }) - success(@body body: SearcherModel[]) {} - - @defaultResponse - default(@body body: ProblemDetails) {} -} - -@endpoint({ - method: 'GET', - path: '/search/searcher/:searcherName', -}) -export class getSearchSearchers { - @request - request( - @pathParams - pathParams: { - searcherName: String; - }, - @queryParams - queryParams: { - query: String; - take: number; - } - ) {} - - @response({ status: 200 }) - success(@body body: SearchResultsModel[]) {} - - @response({ status: 400 }) - badRequest(@body body: ProblemDetails) {} -} - -//Interfaces - -export interface SearcherModel { - name: string; - providerProperties: ProviderPropertiesModel; -} - -export interface IndexModel { - name: string; - canRebuild: boolean; - healthStatus: string; - isHealthy: boolean; - providerProperties: ProviderPropertiesModel; -} - -export interface SearchResultsModel { - id: number; - name: string; - fields: FieldViewModel[]; - score: number; -} - -export interface ProviderPropertiesModel { - CommitCount: number; - DefaultAnalyzer: string; - DocumentCount: number; - FieldCount: number; - LuceneDirectory: string; - LuceneIndexFolder: string; - DirectoryFactory: string; - EnableDefaultEventHandler: boolean; - PublishedValuesOnly: boolean; - SupportProtectedContent: boolean; - IncludeFields?: string[]; -} - -export interface FieldViewModel { - name: string; - values: string[]; -} From c35af65973499b13b8aeab5db041501bf009e295 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Fri, 18 Nov 2022 11:22:12 +0100 Subject: [PATCH 23/29] storybook --- .../dashboard-examine-management.stories.ts | 19 +++++++++-- .../views/section-view-examine-searchers.ts | 11 ++---- .../fields-viewer/fields-settings.element.ts | 5 ++- .../fields-viewer/fields-viewer.element.ts | 34 +++++++++++-------- 4 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.stories.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.stories.ts index 2a49b99e7e..3e3b5c194e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.stories.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.stories.ts @@ -4,12 +4,27 @@ import { html } from 'lit-html'; import type { UmbDashboardExamineManagementElement } from './dashboard-examine-management.element'; import './dashboard-examine-management.element'; +import type { UmbDashboardExamineOverviewElement } from './views/section-view-examine-overview'; +import './views/section-view-examine-overview'; + +import type { UmbDashboardExamineIndexElement } from './views/section-view-examine-indexers'; +import './views/section-view-examine-indexers'; + +import type { UmbDashboardExamineSearcherElement } from './views/section-view-examine-searchers'; +import './views/section-view-examine-searchers'; + export default { title: 'Dashboards/Examine Management', component: 'umb-dashboard-examine-management', id: 'umb-dashboard-examine-management', } as Meta; -export const AAAOverview: Story = () => - html` `; +export const AAAOverview: Story = () => + html` `; AAAOverview.storyName = 'Overview'; + +export const Index: Story = () => + html` `; + +export const Searcher: Story = () => + html` `; 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 ed4a14035d..659556397e 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 @@ -8,14 +8,7 @@ import { UmbNotificationDefaultData } from '../../../../core/services/notificati import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; -import { - ApiError, - ProblemDetails, - SearchResult, - SearchResource, - Field, - PagedSearchResult, -} from '@umbraco-cms/backend-api'; +import { ApiError, ProblemDetails, SearchResult, SearchResource, Field } from '@umbraco-cms/backend-api'; import '../../../../core/services/modal/layouts/fields-viewer/fields-viewer.element'; import '../../../../core/services/modal/layouts/fields-viewer/fields-settings.element'; @@ -81,7 +74,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( .table-container uui-scroll-container { padding-bottom: var(--uui-size-space-4); - max-width: calc(-336px + 100vw); + max-width: 100%; overflow-x: scroll; flex: 1; } diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts index fbe99cdee6..eca7095f0b 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts @@ -29,13 +29,12 @@ export class UmbModalLayoutFieldsSettingsElement extends UmbModalLayoutElement - - - Field - Value - - ${Object.values(this.data.fields).map((cell) => { - return html` - ${cell.name} - ${cell.values.join(', ')} - `; - })} - + + + + Field + Value + + ${Object.values(this.data.fields).map((cell) => { + return html` + ${cell.name} + ${cell.values.join(', ')} + `; + })} + +
Close From 8f915e16b1e50dd063522ede1b4c6ca333d22768 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Mon, 21 Nov 2022 11:02:44 +0100 Subject: [PATCH 24/29] shortcut --- src/Umbraco.Web.UI.Client/src/core/services/index.ts | 7 +++++++ src/Umbraco.Web.UI.Client/tsconfig.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Web.UI.Client/src/core/services/index.ts diff --git a/src/Umbraco.Web.UI.Client/src/core/services/index.ts b/src/Umbraco.Web.UI.Client/src/core/services/index.ts new file mode 100644 index 0000000000..6f51f1de22 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/services/index.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export { UmbModalService } from './modal'; +export { UmbNotificationService } from './notification'; +export type { UmbNotificationDefaultData } from './notification/layouts/default'; diff --git a/src/Umbraco.Web.UI.Client/tsconfig.json b/src/Umbraco.Web.UI.Client/tsconfig.json index 511373fdc5..16a1c718f0 100644 --- a/src/Umbraco.Web.UI.Client/tsconfig.json +++ b/src/Umbraco.Web.UI.Client/tsconfig.json @@ -31,7 +31,8 @@ "@umbraco-cms/extensions-registry": ["src/core/extensions-registry"], "@umbraco-cms/observable-api": ["src/core/observable-api"], "@umbraco-cms/utils": ["src/core/utils"], - "@umbraco-cms/test-utils": ["src/core/test-utils"] + "@umbraco-cms/test-utils": ["src/core/test-utils"], + "@umbraco-cms/services": ["/src/core/services"] }, }, "include": [ 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 25/29] 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'); From c572470f8f535b589fa84695c39ac5f5bb5ffaf7 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Mon, 21 Nov 2022 11:08:41 +0100 Subject: [PATCH 26/29] remove 'as' --- .../examine-management/views/section-view-examine-indexers.ts | 2 +- .../examine-management/views/section-view-examine-overview.ts | 4 ++-- .../views/section-view-examine-searchers.ts | 2 +- 3 files changed, 4 insertions(+), 4 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 d20e902aca..0a3e1d0d50 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 @@ -95,7 +95,7 @@ export class UmbDashboardExamineIndexElement extends UmbContextConsumerMixin(Lit private async _getIndexData() { try { const index = await SearchResource.getSearchIndexByIndexName({ indexName: this.indexName }); - this._indexData = index as Index; + this._indexData = index; } catch (e) { if (e instanceof ApiError) { const error = e as ProblemDetails; 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 9f2f2e0f2a..a4aafcf9c1 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 @@ -66,7 +66,7 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin( private async _getIndexers() { try { const indexers = await SearchResource.getSearchIndex({ take: 9999, skip: 0 }); - this._indexers = indexers.items as Index[]; + this._indexers = indexers.items; } catch (e) { if (e instanceof ApiError) { const error = e as ProblemDetails; @@ -79,7 +79,7 @@ export class UmbDashboardExamineOverviewElement extends UmbContextConsumerMixin( private async _getSearchers() { try { const searchers = await SearchResource.getSearchSearcher({ take: 9999, skip: 0 }); - this._searchers = searchers.items as Searcher[]; + this._searchers = searchers.items; } catch (e) { if (e instanceof ApiError) { const error = e as ProblemDetails; 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 c65e4008ac..2851f3d17f 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 @@ -144,7 +144,7 @@ export class UmbDashboardExamineSearcherElement extends UmbContextConsumerMixin( take: 9999, skip: 0, }); - this._searchResults = res.items as SearchResult[]; + this._searchResults = res.items; this._updateFieldFilter(); } catch (e) { if (e instanceof ApiError) { From c5e261d12d84c56326fffb885b49078fe9113261 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Mon, 21 Nov 2022 11:56:25 +0100 Subject: [PATCH 27/29] umbraco-cms services --- .../dashboard-examine-management.element.ts | 4 ++-- .../views/modal-views}/fields-settings.element.ts | 2 +- .../views/modal-views}/fields-viewer.element.ts | 4 ++-- .../views/section-view-examine-indexers.ts | 5 ++--- .../views/section-view-examine-overview.ts | 4 +--- .../views/section-view-examine-searchers.ts | 8 +++----- src/Umbraco.Web.UI.Client/src/core/services/index.ts | 2 +- .../src/core/services/modal/index.ts | 1 + src/Umbraco.Web.UI.Client/tsconfig.json | 2 +- 9 files changed, 14 insertions(+), 18 deletions(-) rename src/Umbraco.Web.UI.Client/src/{core/services/modal/layouts/fields-viewer => backoffice/dashboards/examine-management/views/modal-views}/fields-settings.element.ts (97%) rename src/Umbraco.Web.UI.Client/src/{core/services/modal/layouts/fields-viewer => backoffice/dashboards/examine-management/views/modal-views}/fields-viewer.element.ts (94%) diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts index 2aff6d2598..f3b68b97a1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/dashboard-examine-management.element.ts @@ -1,4 +1,4 @@ -import { html, LitElement, css } from 'lit'; +import { html, LitElement, css, nothing } from 'lit'; import { customElement, state } from 'lit/decorators.js'; import { IRoute, IRoutingInfo, path } from 'router-slot'; @@ -59,7 +59,7 @@ export class UmbDashboardExamineManagementElement extends UmbContextConsumerMixi render() { return html` ${this.backbutton ? html` ← Back to overview ` - : ``} + : nothing} `; } } diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/modal-views/fields-settings.element.ts similarity index 97% rename from src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts rename to src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/modal-views/fields-settings.element.ts index eca7095f0b..24e84c728e 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-settings.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/modal-views/fields-settings.element.ts @@ -1,7 +1,7 @@ import { html, css } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement, state } from 'lit/decorators.js'; -import { UmbModalLayoutElement } from '../modal-layout.element'; +import { UmbModalLayoutElement } from '@umbraco-cms/services'; export interface UmbModalFieldsSettingsData { name: string; diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/modal-views/fields-viewer.element.ts similarity index 94% rename from src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts rename to src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/modal-views/fields-viewer.element.ts index de7e701314..8fe77cde9b 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/fields-viewer/fields-viewer.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/dashboards/examine-management/views/modal-views/fields-viewer.element.ts @@ -1,7 +1,7 @@ -import { html, TemplateResult, css } from 'lit'; +import { html, css } from 'lit'; import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { customElement } from 'lit/decorators.js'; -import { UmbModalLayoutElement } from '../modal-layout.element'; +import { UmbModalLayoutElement } from '@umbraco-cms/services'; import { SearchResultsModel } from 'src/backoffice/dashboards/examine-management/examine-extension'; @customElement('umb-modal-layout-fields-viewer') 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 0a3e1d0d50..188c5f0a73 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 @@ -4,9 +4,8 @@ import { customElement, state, property } from 'lit/decorators.js'; import { UUIButtonState } from '@umbraco-ui/uui-button'; -import { UmbModalService } from '../../../../core/services/modal'; -import { UmbNotificationService } from '../../../../core/services/notification'; -import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; +import { UmbModalService, UmbNotificationService, UmbNotificationDefaultData } from '@umbraco-cms/services'; + import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import './section-view-examine-searchers'; 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 a4aafcf9c1..d98024df55 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 @@ -2,9 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, LitElement } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../core/services/modal'; -import { UmbNotificationService } from '../../../../core/services/notification'; -import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; +import { UmbModalService, UmbNotificationService, UmbNotificationDefaultData } from '@umbraco-cms/services'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import { ApiError, ProblemDetails, Searcher, Index, SearchResource } from '@umbraco-cms/backend-api'; 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 2851f3d17f..a5ec5bcf44 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 @@ -2,16 +2,14 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib'; import { css, html, LitElement } from 'lit'; import { customElement, state, query, property } from 'lit/decorators.js'; -import { UmbModalService } from '../../../../core/services/modal'; -import { UmbNotificationService } from '../../../../core/services/notification'; -import { UmbNotificationDefaultData } from '../../../../core/services/notification/layouts/default'; +import { UmbModalService, UmbNotificationService, UmbNotificationDefaultData } from '@umbraco-cms/services'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import { ApiError, ProblemDetails, SearchResult, SearchResource, Field } from '@umbraco-cms/backend-api'; -import '../../../../core/services/modal/layouts/fields-viewer/fields-viewer.element'; -import '../../../../core/services/modal/layouts/fields-viewer/fields-settings.element'; +import './modal-views/fields-viewer.element'; +import './modal-views/fields-settings.element'; interface ExposedSearchResultField { name?: string | null; diff --git a/src/Umbraco.Web.UI.Client/src/core/services/index.ts b/src/Umbraco.Web.UI.Client/src/core/services/index.ts index 6f51f1de22..9a44d0ea7a 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/index.ts @@ -2,6 +2,6 @@ /* tslint:disable */ /* eslint-disable */ -export { UmbModalService } from './modal'; +export * from './modal'; export { UmbNotificationService } from './notification'; export type { UmbNotificationDefaultData } from './notification/layouts/default'; diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/index.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/index.ts index 7cd0d81ba6..7595eda631 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/index.ts @@ -1,2 +1,3 @@ export * from './modal.service'; export * from './modal-handler'; +export * from './layouts/modal-layout.element'; diff --git a/src/Umbraco.Web.UI.Client/tsconfig.json b/src/Umbraco.Web.UI.Client/tsconfig.json index 16a1c718f0..26285c6e00 100644 --- a/src/Umbraco.Web.UI.Client/tsconfig.json +++ b/src/Umbraco.Web.UI.Client/tsconfig.json @@ -32,7 +32,7 @@ "@umbraco-cms/observable-api": ["src/core/observable-api"], "@umbraco-cms/utils": ["src/core/utils"], "@umbraco-cms/test-utils": ["src/core/test-utils"], - "@umbraco-cms/services": ["/src/core/services"] + "@umbraco-cms/services": ["src/core/services"] }, }, "include": [ From 034386c9fc4a7efd932600e99ed476ff512f9c7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Nov 2022 18:45:52 +0000 Subject: [PATCH 28/29] Bump eslint-plugin-lit-a11y from 2.2.3 to 2.3.0 Bumps [eslint-plugin-lit-a11y](https://github.com/open-wc/open-wc/tree/HEAD/packages/eslint-plugin-lit-a11y) from 2.2.3 to 2.3.0. - [Release notes](https://github.com/open-wc/open-wc/releases) - [Changelog](https://github.com/open-wc/open-wc/blob/master/packages/eslint-plugin-lit-a11y/CHANGELOG.md) - [Commits](https://github.com/open-wc/open-wc/commits/eslint-plugin-lit-a11y@2.3.0/packages/eslint-plugin-lit-a11y) --- updated-dependencies: - dependency-name: eslint-plugin-lit-a11y dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Umbraco.Web.UI.Client/package-lock.json | 219 ++++++++++++++------ src/Umbraco.Web.UI.Client/package.json | 2 +- 2 files changed, 159 insertions(+), 62 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index 2e19c773b8..47260954b8 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -51,7 +51,7 @@ "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.26.0", "eslint-plugin-lit": "^1.6.1", - "eslint-plugin-lit-a11y": "^2.2.3", + "eslint-plugin-lit-a11y": "^2.3.0", "eslint-plugin-local-rules": "^1.3.2", "eslint-plugin-storybook": "^0.6.7", "lit-html": "^2.4.0", @@ -1928,19 +1928,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/runtime-corejs3": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.19.1.tgz", - "integrity": "sha512-j2vJGnkopRzH+ykJ8h68wrHnEUmtK//E723jjixiAl/PPf6FhqY/vYRcMVlNydRKQjQsTsYEjpx+DZMIvnGk/g==", - "dev": true, - "dependencies": { - "core-js-pure": "^3.25.1", - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/template": { "version": "7.18.10", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", @@ -8610,16 +8597,38 @@ } }, "node_modules/aria-query": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz", - "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", "dev": true, "dependencies": { - "@babel/runtime": "^7.10.2", - "@babel/runtime-corejs3": "^7.10.2" + "deep-equal": "^2.0.5" + } + }, + "node_modules/aria-query/node_modules/deep-equal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.1.0.tgz", + "integrity": "sha512-2pxgvWu3Alv1PoWEyVg7HS8YhGlUFUV7N5oOvfL6d+7xAmLSemMwv/c8Zv/i9KFzxV5Kt5CAvQc70fLwVuf4UA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.2", + "get-intrinsic": "^1.1.3", + "is-arguments": "^1.1.1", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.8" }, - "engines": { - "node": ">=6.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/arr-diff": { @@ -10990,17 +10999,6 @@ "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-pure": { - "version": "3.25.4", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.25.4.tgz", - "integrity": "sha512-qRbgm0ADrsNTU66UcW47YMJjXm+ShhUP2gkoEoAShT2BHO3cb5gGqLtmWpjnM6Wx9h5hMSF4uZ+jEV/8+4KCsw==", - "dev": true, - "hasInstallScript": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -12976,12 +12974,12 @@ } }, "node_modules/eslint-plugin-lit-a11y": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-lit-a11y/-/eslint-plugin-lit-a11y-2.2.3.tgz", - "integrity": "sha512-vlD3+7a/hiw/Cw1thZTX1dpi6pOEsRwtEgUFvbl+MQmiu8E8S8CxcXcSkzPkkkeir3W4NqH/MY8lS1or3ml8Ng==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-lit-a11y/-/eslint-plugin-lit-a11y-2.3.0.tgz", + "integrity": "sha512-k6j7I6hGJmcojFHIotACgnNgggcK4fvYy+uTVrdseenyzp13yacSlaJtvC3k5kEAKoSIVK1fYiKbufYnvEFegQ==", "dev": true, "dependencies": { - "aria-query": "^4.2.2", + "aria-query": "^5.1.3", "axe-core": "^4.3.3", "axobject-query": "^2.2.0", "dom5": "^3.0.1", @@ -16697,6 +16695,15 @@ "dev": true, "optional": true }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -16709,6 +16716,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-whitespace-character": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", @@ -20233,6 +20253,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -28373,6 +28409,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", @@ -29955,16 +30006,6 @@ "regenerator-runtime": "^0.13.4" } }, - "@babel/runtime-corejs3": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.19.1.tgz", - "integrity": "sha512-j2vJGnkopRzH+ykJ8h68wrHnEUmtK//E723jjixiAl/PPf6FhqY/vYRcMVlNydRKQjQsTsYEjpx+DZMIvnGk/g==", - "dev": true, - "requires": { - "core-js-pure": "^3.25.1", - "regenerator-runtime": "^0.13.4" - } - }, "@babel/template": { "version": "7.18.10", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", @@ -35179,13 +35220,37 @@ } }, "aria-query": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz", - "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", "dev": true, "requires": { - "@babel/runtime": "^7.10.2", - "@babel/runtime-corejs3": "^7.10.2" + "deep-equal": "^2.0.5" + }, + "dependencies": { + "deep-equal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.1.0.tgz", + "integrity": "sha512-2pxgvWu3Alv1PoWEyVg7HS8YhGlUFUV7N5oOvfL6d+7xAmLSemMwv/c8Zv/i9KFzxV5Kt5CAvQc70fLwVuf4UA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.2", + "get-intrinsic": "^1.1.3", + "is-arguments": "^1.1.1", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.8" + } + } } }, "arr-diff": { @@ -37008,12 +37073,6 @@ "browserslist": "^4.21.4" } }, - "core-js-pure": { - "version": "3.25.4", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.25.4.tgz", - "integrity": "sha512-qRbgm0ADrsNTU66UcW47YMJjXm+ShhUP2gkoEoAShT2BHO3cb5gGqLtmWpjnM6Wx9h5hMSF4uZ+jEV/8+4KCsw==", - "dev": true - }, "core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -38598,12 +38657,12 @@ } }, "eslint-plugin-lit-a11y": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-lit-a11y/-/eslint-plugin-lit-a11y-2.2.3.tgz", - "integrity": "sha512-vlD3+7a/hiw/Cw1thZTX1dpi6pOEsRwtEgUFvbl+MQmiu8E8S8CxcXcSkzPkkkeir3W4NqH/MY8lS1or3ml8Ng==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-lit-a11y/-/eslint-plugin-lit-a11y-2.3.0.tgz", + "integrity": "sha512-k6j7I6hGJmcojFHIotACgnNgggcK4fvYy+uTVrdseenyzp13yacSlaJtvC3k5kEAKoSIVK1fYiKbufYnvEFegQ==", "dev": true, "requires": { - "aria-query": "^4.2.2", + "aria-query": "^5.1.3", "axe-core": "^4.3.3", "axobject-query": "^2.2.0", "dom5": "^3.0.1", @@ -41315,6 +41374,12 @@ "dev": true, "optional": true }, + "is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true + }, "is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -41324,6 +41389,16 @@ "call-bind": "^1.0.2" } }, + "is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "is-whitespace-character": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz", @@ -43997,6 +44072,16 @@ "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", "dev": true }, + "object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -50209,6 +50294,18 @@ "is-symbol": "^1.0.3" } }, + "which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "requires": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index c385afa9b7..7daa712796 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -83,7 +83,7 @@ "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.26.0", "eslint-plugin-lit": "^1.6.1", - "eslint-plugin-lit-a11y": "^2.2.3", + "eslint-plugin-lit-a11y": "^2.3.0", "eslint-plugin-local-rules": "^1.3.2", "eslint-plugin-storybook": "^0.6.7", "lit-html": "^2.4.0", From 6089547150ff7da56fbe7a1b5415f66c67cb1450 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Mon, 21 Nov 2022 12:51:23 +0100 Subject: [PATCH 29/29] remove todo in handler --- .../src/core/mocks/domains/examine-management.handlers.ts | 3 --- 1 file changed, 3 deletions(-) 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 00867bd1a3..360c434c5b 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 @@ -13,7 +13,6 @@ export const handlers = [ ); }), - // TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName rest.get(umbracoPath('/search/index/:indexName'), (_req, res, ctx) => { const indexName = _req.params.indexName as string; @@ -27,7 +26,6 @@ export const handlers = [ } }), - // TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName 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 @@ -52,7 +50,6 @@ export const handlers = [ ); }), - // TODO: when using the umbracoPath helper you have to write parameters like {indexName}. MSW wants parameters as :indexName rest.get(umbracoPath('/search/searcher/:searcherName/search'), (_req, res, ctx) => { const query = _req.url.searchParams.get('query'); const take = _req.url.searchParams.get('take');