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:
@@ -17,7 +17,7 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/no-input-rename */
|
||||
|
||||
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core';
|
||||
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit, inject } from '@angular/core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { ContentService } from '../common/services/content.service';
|
||||
import { AllowableOperationsEnum } from '../common/models/allowable-operations.enum';
|
||||
@@ -28,6 +28,11 @@ import { ContentNodeDialogService } from '../content-node-selector/content-node-
|
||||
selector: '[adf-node-lock]'
|
||||
})
|
||||
export class NodeLockDirective implements AfterViewInit {
|
||||
element = inject(ElementRef);
|
||||
private readonly renderer = inject(Renderer2);
|
||||
private readonly contentService = inject(ContentService);
|
||||
private readonly contentNodeDialogService = inject(ContentNodeDialogService);
|
||||
|
||||
/** Node to lock/unlock. */
|
||||
@Input('adf-node-lock')
|
||||
node: Node;
|
||||
@@ -38,13 +43,6 @@ export class NodeLockDirective implements AfterViewInit {
|
||||
this.contentNodeDialogService.openLockNodeDialog(this.node);
|
||||
}
|
||||
|
||||
constructor(
|
||||
public element: ElementRef,
|
||||
private renderer: Renderer2,
|
||||
private contentService: ContentService,
|
||||
private contentNodeDialogService: ContentNodeDialogService
|
||||
) {}
|
||||
|
||||
ngAfterViewInit() {
|
||||
const hasAllowableOperations = this.contentService.hasAllowableOperations(this.node, AllowableOperationsEnum.LOCK);
|
||||
this.renderer.setProperty(this.element.nativeElement, 'disabled', !hasAllowableOperations);
|
||||
|
||||
Reference in New Issue
Block a user