Skip to content

Commit

Permalink
NAS-133308: Remove some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanY147 committed Jan 6, 2025
1 parent 1bc441e commit 7ac5de7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { TranslateService, TranslateModule } from '@ngx-translate/core';
import { firstValueFrom, Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { catchError } from 'rxjs/operators';
import { RequiresRolesDirective } from 'app/directives/requires-roles/requires-roles.directive';
import { ExplorerNodeType } from 'app/enums/explorer-type.enum';
import { mntPath } from 'app/enums/mnt-path.enum';
Expand Down Expand Up @@ -112,13 +112,11 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
};

treeOptions: Signal<ITreeOptions> = computed<ITreeOptions>(() => {
const readonly = this.readonly();

return {
idField: 'path',
displayField: 'name',
getChildren: (node: TreeNode<ExplorerNodeData>) => firstValueFrom(this.loadChildren(node)),
actionMapping: readonly ? {} : this.actionMapping,
actionMapping: this.actionMapping,
useTriState: false,
useCheckbox: this.multiple(),
};
Expand Down Expand Up @@ -269,7 +267,7 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
{
path: this.root(),
name: this.root(),
hasChildren: !this.readonly(),
hasChildren: true,
type: ExplorerNodeType.Directory,
isMountpoint: true,
},
Expand All @@ -281,9 +279,6 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
}

private selectTreeNodes(nodeIds: string[]): void {
if (this.readonly()) {
return;
}
const treeState = {
...this.tree().treeModel.getState(),
selectedLeafNodeIds: nodeIds.reduce((acc, nodeId) => ({ ...acc, [nodeId]: true }), {}),
Expand All @@ -293,9 +288,6 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
}

private loadChildren(node: TreeNode<ExplorerNodeData>): Observable<ExplorerNodeData[]> {
if (this.readonly()) {
return of([]);
}
this.loadingError = null;
this.cdr.markForCheck();

Expand All @@ -304,10 +296,6 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
}

return this.nodeProvider()(node).pipe(
map((childNodes) => childNodes.map((data) => {
data.hasChildren = !this.readonly() && data.hasChildren;
return data;
})),
catchError((error: unknown) => {
this.loadingError = this.errorHandler.getFirstErrorMessage(error);
this.cdr.markForCheck();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
[label]="helptext.path_placeholder | translate"
[tooltip]="helptext.path_tooltip | translate"
[required]="true"
[readonly]="!hasRequiredRoles()"
[nodeProvider]="fileNodeProvider"
></ix-explorer>
}
Expand All @@ -51,7 +50,6 @@
formControlName="path_source"
[label]="helptext.path_placeholder | translate"
[tooltip]="helptext.path_tooltip | translate"
[readonly]="!hasRequiredRoles()"
[required]="true"
[multiple]="true"
[nodeProvider]="fileNodeProvider"
Expand Down Expand Up @@ -99,6 +97,7 @@
<ix-explorer
formControlName="folder_destination"
root="/"
[readonly]="!hasRequiredRoles()"
[label]="helptext.folder_placeholder | translate"
[tooltip]="helptext.folder_tooltip | translate"
[nodeProvider]="bucketNodeProvider"
Expand All @@ -108,6 +107,7 @@
<ix-explorer
formControlName="folder_source"
root="/"
[readonly]="!hasRequiredRoles()"
[label]="helptext.folder_placeholder | translate"
[tooltip]="helptext.folder_tooltip | translate"
[multiple]="true"
Expand Down

0 comments on commit 7ac5de7

Please sign in to comment.