-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Document Workspace Info reload components (#2492)
* Adds Document URL Repository * Extracts Document Workspace Info Links to its own component Refactored to use the new Document URL Repository. Plus other housekeeping on the main Document Workspace Info component. * Refactored Document Workspace Info History component to listen for the "Request Reload Structure" event * Refactored Document Workspace Info Reference component
- Loading branch information
1 parent
647ed15
commit 0d1b21e
Showing
15 changed files
with
391 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export { UmbDocumentDetailRepository, UMB_DOCUMENT_DETAIL_REPOSITORY_ALIAS } from './detail/index.js'; | ||
export { UmbDocumentItemRepository, UMB_DOCUMENT_ITEM_REPOSITORY_ALIAS } from './item/index.js'; | ||
export { UmbDocumentPublishingRepository, UMB_DOCUMENT_PUBLISHING_REPOSITORY_ALIAS } from './publishing/index.js'; | ||
export { UmbDocumentUrlRepository, UMB_DOCUMENT_URL_REPOSITORY_ALIAS } from './url/index.js'; | ||
export { UmbDocumentPreviewRepository } from './preview/index.js'; | ||
|
||
export type { UmbDocumentItemModel } from './item/types.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { manifests as detailManifests } from './detail/manifests.js'; | ||
import { manifests as itemManifests } from './item/manifests.js'; | ||
import { manifests as publishingManifests } from './publishing/manifests.js'; | ||
import { manifests as urlManifests } from './url/manifests.js'; | ||
|
||
export const manifests: Array<UmbExtensionManifest> = [...detailManifests, ...itemManifests, ...publishingManifests]; | ||
export const manifests: Array<UmbExtensionManifest> = [ | ||
...detailManifests, | ||
...itemManifests, | ||
...publishingManifests, | ||
...urlManifests, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const UMB_DOCUMENT_URL_REPOSITORY_ALIAS = 'Umb.Repository.Document.Url'; | ||
export const UMB_DOCUMENT_URL_STORE_ALIAS = 'Umb.Store.Document.Url'; |
13 changes: 13 additions & 0 deletions
13
src/packages/documents/documents/repository/url/document-url.repository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { UmbDocumentUrlsModel } from './types.js'; | ||
import { UMB_DOCUMENT_URL_STORE_CONTEXT } from './document-url.store.context-token.js'; | ||
import { UmbDocumentUrlServerDataSource } from './document-url.server.data-source.js'; | ||
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository'; | ||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; | ||
|
||
export class UmbDocumentUrlRepository extends UmbItemRepositoryBase<UmbDocumentUrlsModel> { | ||
constructor(host: UmbControllerHost) { | ||
super(host, UmbDocumentUrlServerDataSource, UMB_DOCUMENT_URL_STORE_CONTEXT); | ||
} | ||
} | ||
|
||
export { UmbDocumentUrlRepository as api }; |
29 changes: 29 additions & 0 deletions
29
src/packages/documents/documents/repository/url/document-url.server.data-source.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { UmbDocumentUrlsModel } from './types.js'; | ||
import { DocumentService } from '@umbraco-cms/backoffice/external/backend-api'; | ||
import { UmbItemServerDataSourceBase } from '@umbraco-cms/backoffice/repository'; | ||
import type { DocumentUrlInfoResponseModel } from '@umbraco-cms/backoffice/external/backend-api'; | ||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; | ||
|
||
/** | ||
* A server data source for Document URLs | ||
* @class UmbDocumentUrlServerDataSource | ||
* @implements {DocumentTreeDataSource} | ||
*/ | ||
export class UmbDocumentUrlServerDataSource extends UmbItemServerDataSourceBase< | ||
DocumentUrlInfoResponseModel, | ||
UmbDocumentUrlsModel | ||
> { | ||
/** | ||
* Creates an instance of UmbDocumentUrlServerDataSource. | ||
* @param {UmbControllerHost} host - The controller host for this controller to be appended to | ||
* @memberof UmbDocumentUrlServerDataSource | ||
*/ | ||
constructor(host: UmbControllerHost) { | ||
super(host, { getItems, mapper }); | ||
} | ||
} | ||
|
||
/* eslint-disable local-rules/no-direct-api-import */ | ||
const getItems = (uniques: Array<string>) => DocumentService.getDocumentUrls({ id: uniques }); | ||
|
||
const mapper = (item: DocumentUrlInfoResponseModel): UmbDocumentUrlsModel => ({ unique: item.id, urls: item.urlInfos }); |
4 changes: 4 additions & 0 deletions
4
src/packages/documents/documents/repository/url/document-url.store.context-token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type UmbDocumentUrlStore from './document-url.store.js'; | ||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; | ||
|
||
export const UMB_DOCUMENT_URL_STORE_CONTEXT = new UmbContextToken<UmbDocumentUrlStore>('UmbDocumentUrlStore'); |
23 changes: 23 additions & 0 deletions
23
src/packages/documents/documents/repository/url/document-url.store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { UmbDocumentDetailModel } from '../../types.js'; | ||
import { UMB_DOCUMENT_URL_STORE_CONTEXT } from './document-url.store.context-token.js'; | ||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; | ||
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store'; | ||
|
||
/** | ||
* @class UmbDocumentUrlStore | ||
* @augments {UmbStoreBase} | ||
* @description - Data Store for Document URLs | ||
*/ | ||
|
||
export class UmbDocumentUrlStore extends UmbItemStoreBase<UmbDocumentDetailModel> { | ||
/** | ||
* Creates an instance of UmbDocumentUrlStore. | ||
* @param {UmbControllerHost} host - The controller host for this controller to be appended to | ||
* @memberof UmbDocumentUrlStore | ||
*/ | ||
constructor(host: UmbControllerHost) { | ||
super(host, UMB_DOCUMENT_URL_STORE_CONTEXT.toString()); | ||
} | ||
} | ||
|
||
export default UmbDocumentUrlStore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { UmbDocumentUrlRepository } from './document-url.repository.js'; | ||
export { UMB_DOCUMENT_URL_REPOSITORY_ALIAS } from './constants.js'; |
18 changes: 18 additions & 0 deletions
18
src/packages/documents/documents/repository/url/manifests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { UMB_DOCUMENT_URL_REPOSITORY_ALIAS, UMB_DOCUMENT_URL_STORE_ALIAS } from './constants.js'; | ||
import type { ManifestItemStore, ManifestRepository } from '@umbraco-cms/backoffice/extension-registry'; | ||
|
||
const urlRepository: ManifestRepository = { | ||
type: 'repository', | ||
alias: UMB_DOCUMENT_URL_REPOSITORY_ALIAS, | ||
name: 'Document Url Repository', | ||
api: () => import('./document-url.repository.js'), | ||
}; | ||
|
||
const urlStore: ManifestItemStore = { | ||
type: 'itemStore', | ||
alias: UMB_DOCUMENT_URL_STORE_ALIAS, | ||
name: 'Document Url Store', | ||
api: () => import('./document-url.store.js'), | ||
}; | ||
|
||
export const manifests = [urlRepository, urlStore]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface UmbDocumentUrlsModel { | ||
unique: string; | ||
urls: Array<UmbDocumentUrlModel>; | ||
} | ||
|
||
export interface UmbDocumentUrlModel { | ||
culture?: string | null; | ||
url?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.