Initial commit

This commit is contained in:
aditya.chandel
2024-12-13 12:58:23 -07:00
commit baff376b9c
414 changed files with 552987 additions and 0 deletions
@@ -0,0 +1,33 @@
<div style="margin-bottom: 1.5rem; display: flex; align-items: center; gap: 1rem;">
<input
id="disabled-input"
type="text"
pInputText
[value]="selectedProductName"
[disabled]="true"
[ngStyle]="{ 'width': '100%', 'padding': '0.5rem', 'font-size': '1rem' }"
/>
<p-button label="Select" severity="success" [ngStyle]="{ 'width': '100px' }" (click)="onSelect()"/>
</div>
<ng-container>
<div style="overflow-x: auto;">
<p-table [value]="paths" [tableStyle]="{ 'min-width': '50rem' }" class="product-table">
<ng-template pTemplate="header">
<tr>
<th [style.width]="'10%'">Type</th>
<th [style.width]="'90%'">Name</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-product>
<tr (click)="onRowClick(product)">
<td>
<i *ngIf="product === '...'" class="pi pi-arrow-up"></i>
<i *ngIf="product !== '...'" class="pi pi-folder-open"></i>
</td>
<td>{{ product }}</td>
</tr>
</ng-template>
</p-table>
</div>
</ng-container>
@@ -0,0 +1,53 @@
import {Component, OnInit} from '@angular/core';
import {DynamicDialogRef} from 'primeng/dynamicdialog';
import {UtilityService} from '../../service/utility.service';
@Component({
selector: 'app-directory-picker-v2',
standalone: false,
templateUrl: './directory-picker.component.html',
styleUrls: ['./directory-picker.component.scss']
})
export class DirectoryPickerComponent implements OnInit {
value: any;
paths: string[] = ['...'];
selectedProductName: string = '';
constructor(private utilityService: UtilityService, private dynamicDialogRef: DynamicDialogRef) {
}
ngOnInit() {
const initialPath = '/';
this.getFolders(initialPath);
}
getFolders(path: string): void {
this.utilityService.getFolders(path).subscribe(
(folders: string[]) => {
this.paths = ['...', ...folders];
},
(error) => {
console.error('Error fetching folders:', error);
}
);
}
onRowClick(path: string): void {
if (path === '...') {
if (this.selectedProductName === '' || this.selectedProductName === '/') {
this.getFolders('/');
} else {
const result = this.selectedProductName.substring(0, this.selectedProductName.lastIndexOf('/')) || '/';
this.selectedProductName = result;
this.getFolders(result);
}
} else {
this.selectedProductName = path;
this.getFolders(path);
}
}
onSelect(): void {
this.dynamicDialogRef.close(this.selectedProductName);
}
}