mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-11205] Add LazyApi decorator (#11711)
* [ACS-11205] Add LazyApi decorator * [ACS-11205] Add unit tests and CR fixes * [ACS-11259] Storybook build fix
This commit is contained in:
@@ -17,21 +17,15 @@
|
||||
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { ContentApi } from '@alfresco/js-api';
|
||||
import { ContentApi, LazyApi } from '@alfresco/js-api';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ContentVersionService {
|
||||
private readonly alfrescoApi = inject(AlfrescoApiService);
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
|
||||
get contentApi(): ContentApi {
|
||||
if (!this._contentApi) {
|
||||
this._contentApi = new ContentApi(this.alfrescoApi.getInstance());
|
||||
}
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: ContentVersionService) => new ContentApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
/**
|
||||
* Get content URL for the given nodeId and specific version.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { ConfirmDialogComponent, IconModule } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ContentApi, ContentPagingQuery, Node, NodeEntry, NodesApi, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { ContentApi, ContentPagingQuery, LazyApi, Node, NodeEntry, NodesApi, VersionEntry, VersionsApi } from '@alfresco/js-api';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ContentVersionService } from './content-version.service';
|
||||
import { ContentService } from '../common';
|
||||
@@ -77,23 +77,14 @@ export class VersionListComponent implements OnChanges, OnInit {
|
||||
private readonly contentVersionService = inject(ContentVersionService);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
|
||||
private _contentApi: ContentApi;
|
||||
get contentApi(): ContentApi {
|
||||
this._contentApi = this._contentApi ?? new ContentApi(this.alfrescoApi.getInstance());
|
||||
return this._contentApi;
|
||||
}
|
||||
@LazyApi((self: VersionListComponent) => new ContentApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly contentApi: ContentApi;
|
||||
|
||||
private _versionsApi: VersionsApi;
|
||||
get versionsApi(): VersionsApi {
|
||||
this._versionsApi = this._versionsApi ?? new VersionsApi(this.alfrescoApi.getInstance());
|
||||
return this._versionsApi;
|
||||
}
|
||||
@LazyApi((self: VersionListComponent) => new VersionsApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly versionsApi: VersionsApi;
|
||||
|
||||
private _nodesApi: NodesApi;
|
||||
get nodesApi(): NodesApi {
|
||||
this._nodesApi = this._nodesApi ?? new NodesApi(this.alfrescoApi.getInstance());
|
||||
return this._nodesApi;
|
||||
}
|
||||
@LazyApi((self: VersionListComponent) => new NodesApi(self.alfrescoApi.getInstance()))
|
||||
declare readonly nodesApi: NodesApi;
|
||||
|
||||
versionsDataSource: VersionListDataSource;
|
||||
latestVersion: VersionEntry;
|
||||
|
||||
Reference in New Issue
Block a user