[ACS-5088] Replaced function calls in templates with variable references (#3227)

* [ACS-5088] Replaced method calls in templates with variables

* [ACS-5088] Replaced method calls in templates with variables

* [ACS-5088] Replaced method calls for *ngIf and *ngFor with variables - Batch 1 (WIP)

* [ACS-5088] Replaced method calls for *ngIf and *ngFor with variables - Batch 2 (WIP)

* [ACS-5088] Replaced instances of $any with cast pipe. Replaced other instances of method calls in templates with variables

* [ACS-5088] Resolved test cases

* [ACS-5088] Resolved test cases in aca-content library

* [ACS-5088] Resolved test cases in aca-shared library

* [ACS-5088] Resolved test cases in aca-folder-rules library

* [ACS-5088] Reverted usage of cast pipe to $any()

* [ACS-5088] Fixed incorrect revert

* [ACS-5088] Resolved code review findings - shortened expressions and made onDestroy subjects use void instead of boolean

* [ACS-5088] Resolved code review findings - changed parameter name in sort function

* [ACS-5088] Resolved code review findings - added 'void' type to onDestroy subjects

* [ACS-5088] Upgraded eslint version to 8.41.0. Added "@angular-eslint/template/no-call-expression" rule to prevent function calls in templates unless needed (reports warnings)

* [ACS-5088] Resolved typo in ToggleFavoriteComponent
This commit is contained in:
swapnil-verma-gl
2023-06-06 14:02:19 +05:30
committed by GitHub
parent e9dce5f65a
commit d125fe5ff9
52 changed files with 314 additions and 297 deletions

View File

@@ -46,12 +46,17 @@ import { TranslateModule } from '@ngx-translate/core';
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit, OnDestroy {
private onDestroy$$ = new Subject<boolean>();
isFile: boolean;
isFileWriteLocked: boolean;
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private nodesService: NodesApiService) {
super(element, nodesService);
}
ngOnInit() {
this.updateValue();
this.isFile = this.node?.entry && !this.node.entry.isFolder;
this.isFileWriteLocked = isLocked(this.node);
this.nodesService.nodeUpdated.pipe(takeUntil(this.onDestroy$$)).subscribe((node: any) => {
const row = this.context.row;
@@ -65,6 +70,9 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
row.node = { entry };
this.updateValue();
}
this.isFile = this.node?.entry && !this.node.entry.isFolder;
this.isFileWriteLocked = isLocked(this.node);
}
});
@@ -75,6 +83,7 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
takeUntil(this.onDestroy$$)
)
.subscribe(() => {
this.isFileWriteLocked = isLocked(this.node);
this.cd.detectChanges();
});
}
@@ -90,12 +99,4 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
this.onDestroy$$.next(true);
this.onDestroy$$.complete();
}
get isFile(): boolean {
return this.node && this.node.entry && !this.node.entry.isFolder;
}
get isFileWriteLocked(): boolean {
return isLocked(this.node);
}
}

View File

@@ -22,16 +22,15 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { ShareDataRow, TagModule } from '@alfresco/adf-content-services';
import { ChangeDetectorRef, Component, Input, ViewEncapsulation } from '@angular/core';
import { TagModule } from '@alfresco/adf-content-services';
import { ChangeDetectorRef, Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
@Component({
standalone: true,
imports: [TagModule],
selector: 'aca-tags-column',
template: `
<adf-tag-node-list [showDelete]="false" [limitTagsDisplayed]="true" [nodeId]="getNodeId(context.row)" (results)="onTagsLoaded()">
</adf-tag-node-list>
<adf-tag-node-list [showDelete]="false" [limitTagsDisplayed]="true" [nodeId]="nodeId" (results)="onTagsLoaded()"> </adf-tag-node-list>
`,
styleUrls: ['./tags-column.component.scss'],
encapsulation: ViewEncapsulation.None,
@@ -39,14 +38,16 @@ import { ChangeDetectorRef, Component, Input, ViewEncapsulation } from '@angular
class: 'adf-datatable-content-cell aca-tags-name-column'
}
})
export class TagsColumnComponent {
export class TagsColumnComponent implements OnInit {
@Input()
context: any;
nodeId: string;
constructor(private cd: ChangeDetectorRef) {}
getNodeId(row: ShareDataRow): string {
return row.id;
ngOnInit(): void {
this.nodeId = this.context?.row?.id;
}
onTagsLoaded(): void {