This is an automated email from the ASF dual-hosted git repository. hshpak pushed a commit to branch fix/DATALAB-2843/scope-of-tasks-for-view-all-images in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 9f331bf56a5b69727f9e9358afe4dcf5b82679e9 Author: Hennadii_Shpak <[email protected]> AuthorDate: Sat Jun 18 09:26:18 2022 +0300 [DATALAB-2843] - fixed minor bug in scope this ticket --- .../src/app/resources/images/images.component.html | 15 ++++++++------- .../src/app/resources/images/images.component.ts | 18 ++++++++++++++++-- .../webapp/src/app/resources/resources.module.ts | 4 +++- .../webapp/src/app/shared/time-picker/index.ts | 2 +- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.html index 16f7bf728..3e86244ca 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.html @@ -25,12 +25,14 @@ [ngClass]="{'disabled-select': !isProjectsMoreThanOne}" > <mat-form-field> - <mat-label>Select project</mat-label> + <mat-label>{{placeholder}}</mat-label> <mat-select disableOptionCentering + name="project" + [(value)]="activeProjectName" panelClass="top-select scrolling" - [disabled]="!projectList.length" + [disabled]="!isProjectsMoreThanOne" > <mat-option *ngIf="isProjectsMoreThanOne" @@ -49,7 +51,7 @@ Projects list is empty </mat-option> </mat-select> - <button class="caret" [disabled]="false"> + <button class="caret" [disabled]="!isProjectsMoreThanOne"> <i class="material-icons">keyboard_arrow_down</i> </button> </mat-form-field> @@ -90,7 +92,7 @@ </div> </span> <span> - <button mat-raised-button class="butt"> + <button mat-raised-button (click)="onRefresh()"> <i class="material-icons highlight">autorenew</i> Refresh </button> @@ -104,7 +106,7 @@ <ng-container matColumnDef="checkbox"> <th mat-header-cell *matHeaderCellDef class="image-checkbox--wrapper"> <div class="header-cell--wrapper"> - <span> + <span *ngIf="dataSource.length" > <datalab-checkbox (click)="allCheckboxToggle()" [checked]="checkboxSelected" @@ -147,8 +149,7 @@ </div> </th> <td mat-cell *matCellDef="let element"> - <span class="date-item"> {{element.timestamp | date: 'yyyy-MM-dd'}} </span> - <span> {{element.timestamp | date: 'HH:mm:ss'}} </span> + <span> {{element.timestamp | localDate : 'short'}} </span> </td> </ng-container> diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts index 7e0e449d3..e4c422a49 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/images/images.component.ts @@ -44,6 +44,8 @@ export class ImagesComponent implements OnInit { dataSource: ImageModel[] = []; checkboxSelected: boolean = false; projectList: string[] = []; + activeProjectName: string = ''; + readonly placeholder: string = 'Select project'; readonly sharedStatus: typeof Shared_Status = Shared_Status; private cashedImageListData: ProjectModel[] = []; @@ -79,9 +81,16 @@ export class ImagesComponent implements OnInit { onSelectClick(projectName: string): void { if (!projectName) { this.dataSource = this.getImageList(); + return; } - const { images } = this.cashedImageListData.find(({project}) => project === projectName); - this.dataSource = [...images]; + const currentProject = this.cashedImageListData.find(({project}) => project === projectName); + this.dataSource = [...currentProject.images]; + this.activeProjectName = currentProject.project; + } + + onRefresh(): void { + this.getUserImagePageInfo(); + this.activeProjectName = ''; } private getImageList(): ImageModel[] { @@ -105,12 +114,17 @@ export class ImagesComponent implements OnInit { this.cashedImageListData = imagePageList; this.getProjectList(imagePageList); this.dataSource = this.getImageList(); + + if (imagePageList.length === 1) { + this.activeProjectName = imagePageList[0].project; + } } private getProjectList(imagePageList: ProjectModel[]): void { if (!imagePageList) { return; } + this.projectList = []; imagePageList.forEach(({project}) => this.projectList.push(project)); } diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts index 996c347d4..f34410617 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts @@ -35,6 +35,7 @@ import { ImagesComponent } from './images/images.component'; import {CheckboxModule} from '../shared/checkbox'; import {BubbleModule} from '../shared'; import { CapitalizeFirstLetterPipeModule } from '../core/pipes'; +import { LocalDatePipeModule } from '../core/pipes/local-date-pipe'; @NgModule({ imports: [ @@ -49,7 +50,8 @@ import { CapitalizeFirstLetterPipeModule } from '../core/pipes'; BucketBrowserModule, CheckboxModule, BubbleModule, - CapitalizeFirstLetterPipeModule + CapitalizeFirstLetterPipeModule, + LocalDatePipeModule ], declarations: [ ResourcesComponent, diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/time-picker/index.ts b/services/self-service/src/main/resources/webapp/src/app/shared/time-picker/index.ts index 4133045d1..0fe6caab5 100644 --- a/services/self-service/src/main/resources/webapp/src/app/shared/time-picker/index.ts +++ b/services/self-service/src/main/resources/webapp/src/app/shared/time-picker/index.ts @@ -33,7 +33,7 @@ import {LocalDatePipeModule} from '../../core/pipes/local-date-pipe'; export * from './time-picker.component'; @NgModule({ - imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, LocalDatePipeModule], + imports: [CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, LocalDatePipeModule], declarations: [TimePickerComponent, TimePickerDialogComponent, TimeCoverComponent, TickerComponent], entryComponents: [TimePickerDialogComponent], exports: [TimePickerComponent] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
