mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Migrate to @angular-eslint/prefer-inject and @typescript-eslint/prefer-readonly (#11665)
This commit is contained in:
@@ -15,13 +15,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { ContentApi } 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 {
|
||||
@@ -31,8 +33,6 @@ export class ContentVersionService {
|
||||
return this._contentApi;
|
||||
}
|
||||
|
||||
constructor(private alfrescoApi: AlfrescoApiService) {}
|
||||
|
||||
/**
|
||||
* Get content URL for the given nodeId and specific version.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, Input, ViewEncapsulation, inject } from '@angular/core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { FileTypePipe, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -29,6 +29,8 @@ import { TranslatePipe } from '@ngx-translate/core';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class VersionComparisonComponent {
|
||||
thumbnailService = inject(ThumbnailService);
|
||||
|
||||
/** Target node. */
|
||||
@Input({ required: true })
|
||||
node: Node;
|
||||
@@ -36,6 +38,4 @@ export class VersionComparisonComponent {
|
||||
/** New file for updating current version. */
|
||||
@Input({ required: true })
|
||||
newFileVersion: File;
|
||||
|
||||
constructor(public thumbnailService: ThumbnailService) {}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
export class VersionListDataSource extends InfiniteScrollDatasource<VersionEntry> {
|
||||
constructor(
|
||||
private versionsApi: VersionsApi,
|
||||
private node: Node
|
||||
private readonly versionsApi: VersionsApi,
|
||||
private readonly node: Node
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -72,6 +72,11 @@ export class VersionListDataSource extends InfiniteScrollDatasource<VersionEntry
|
||||
host: { class: 'adf-version-list' }
|
||||
})
|
||||
export class VersionListComponent implements OnChanges, OnInit {
|
||||
private readonly alfrescoApi = inject(AlfrescoApiService);
|
||||
private readonly contentService = inject(ContentService);
|
||||
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());
|
||||
@@ -135,13 +140,6 @@ export class VersionListComponent implements OnChanges, OnInit {
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
private alfrescoApi: AlfrescoApiService,
|
||||
private contentService: ContentService,
|
||||
private contentVersionService: ContentVersionService,
|
||||
private dialog: MatDialog
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.versionsDataSource = new VersionListDataSource(this.versionsApi, this.node);
|
||||
this.versionsDataSource.isLoading.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((isLoading) => {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewEncapsulation, inject } from '@angular/core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { VersionListComponent } from './version-list.component';
|
||||
import { animate, state, style, transition, trigger } from '@angular/animations';
|
||||
@@ -44,6 +44,9 @@ import { TranslatePipe } from '@ngx-translate/core';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class VersionManagerComponent implements OnInit {
|
||||
private readonly contentService = inject(ContentService);
|
||||
private readonly nodesApiService = inject(NodesApiService);
|
||||
|
||||
/** Target node to manage version history. */
|
||||
@Input({ required: true })
|
||||
node: Node;
|
||||
@@ -97,8 +100,6 @@ export class VersionManagerComponent implements OnInit {
|
||||
|
||||
uploadState: string = 'close';
|
||||
|
||||
constructor(private contentService: ContentService, private nodesApiService: NodesApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.newFileVersion) {
|
||||
this.toggleNewVersion();
|
||||
|
||||
@@ -48,6 +48,9 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
host: { class: 'adf-version-upload' }
|
||||
})
|
||||
export class VersionUploadComponent implements OnInit {
|
||||
private readonly contentService = inject(ContentService);
|
||||
private readonly uploadService = inject(UploadService);
|
||||
|
||||
semanticVersion: string = 'minor';
|
||||
comment: string;
|
||||
uploadVersion: boolean = false;
|
||||
@@ -106,8 +109,6 @@ export class VersionUploadComponent implements OnInit {
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor(private contentService: ContentService, private uploadService: UploadService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.uploadService.fileUploadStarting.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event: FileUploadEvent) => {
|
||||
this.disabled = true;
|
||||
|
||||
Reference in New Issue
Block a user