-
Notifications
You must be signed in to change notification settings - Fork 42
feat: dynamic datafiles table #2429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
abdellah257
wants to merge
1
commit into
SciCatProject:master
Choose a base branch
from
abdellah257:dynamic-datafile-table
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/app/datasets/datafiles/datafiles-wrapper.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { CommonModule } from "@angular/common"; | ||
| import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
| import { AppConfigInterface, AppConfigService } from "app-config.service"; | ||
| import { DatafilesWrapperComponent } from "./datafiles-wrapper.component"; | ||
| import { DynamicDatafilesComponent } from "./dynamic-datafiles/dynamic-datafiles.component"; | ||
| import { DatafilesComponent } from "./static-datafiles/datafiles.component"; | ||
|
|
||
| describe("DatafilesWrapperComponent", () => { | ||
| let component: DatafilesWrapperComponent; | ||
| let fixture: ComponentFixture<DatafilesWrapperComponent>; | ||
| let appConfigService: jasmine.SpyObj<AppConfigService>; | ||
|
|
||
| beforeEach(() => { | ||
| const appConfigServiceSpy = jasmine.createSpyObj("AppConfigService", [ | ||
| "getConfig", | ||
| ]); | ||
|
|
||
| TestBed.configureTestingModule({ | ||
| imports: [CommonModule], | ||
| declarations: [DatafilesWrapperComponent], | ||
| providers: [{ provide: AppConfigService, useValue: appConfigServiceSpy }], | ||
| }).compileComponents(); | ||
|
|
||
| fixture = TestBed.createComponent(DatafilesWrapperComponent); | ||
| component = fixture.componentInstance; | ||
| appConfigService = TestBed.inject( | ||
| AppConfigService, | ||
| ) as jasmine.SpyObj<AppConfigService>; | ||
| }); | ||
|
|
||
| it("should create the component", () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("should load DynamicDatafilesComponent when dynamicDatafilesViewEnabled is true", () => { | ||
| appConfigService.getConfig.and.returnValue({ | ||
| dynamicDatafilesViewEnabled: true, | ||
| } as AppConfigInterface); | ||
|
|
||
| expect(component.getDatafilesComponent()).toBe(DynamicDatafilesComponent); | ||
| }); | ||
|
|
||
| it("should load DatafilesComponent when dynamicDatafilesViewEnabled is false", () => { | ||
| appConfigService.getConfig.and.returnValue({ | ||
| dynamicDatafilesViewEnabled: false, | ||
| } as AppConfigInterface); | ||
|
|
||
| expect(component.getDatafilesComponent()).toBe(DatafilesComponent); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Component } from "@angular/core"; | ||
| import { AppConfigService } from "app-config.service"; | ||
| import { DynamicDatafilesComponent } from "./dynamic-datafiles/dynamic-datafiles.component"; | ||
| import { DatafilesComponent } from "./static-datafiles/datafiles.component"; | ||
|
|
||
| @Component({ | ||
| selector: "app-datafiles-wrapper", | ||
| template: ` <ng-container *ngComponentOutlet="getDatafilesComponent()" /> `, | ||
| standalone: false, | ||
| }) | ||
| export class DatafilesWrapperComponent { | ||
| constructor(private appConfigService: AppConfigService) {} | ||
|
|
||
| getDatafilesComponent() { | ||
| return this.appConfigService.getConfig().dynamicDatafilesViewEnabled | ||
| ? DynamicDatafilesComponent | ||
| : DatafilesComponent; | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
src/app/datasets/datafiles/dynamic-datafiles/dynamic-datafiles.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <ng-template [ngIf]="dataset$ | async"> | ||
| <ng-template [ngIf]="maxFileSize && tooLargeFile"> | ||
| <span> | ||
| <mat-icon class="warning-icon"> warning </mat-icon> | ||
| <span [innerHTML]="hasFileAboveMaxSizeWarning()"></span> | ||
| </span> | ||
| </ng-template> | ||
|
|
||
| <ng-template [ngIf]="maxFileSize"> | ||
| <div> | ||
| <mat-icon> info </mat-icon> | ||
| Maximum allowed download size: {{ maxFileSize | filesize }} | ||
| </div> | ||
| </ng-template> | ||
|
|
||
| <ng-template [ngIf]="files && maxFileSize"> | ||
| <div class="selected" fxLayout="row" fxLayoutAlign="space-evenly end"> | ||
| <div fxFlex="auto" style="margin-bottom: 0.5em"> | ||
| Selected: {{ selectedFileSize | filesize | ||
| }}{{ maxFileSize ? " / " + (maxFileSize | filesize) : "" }} | ||
| </div> | ||
| </div> | ||
| </ng-template> | ||
|
|
||
| <div class="datafiles-header"> | ||
| <span [ngPlural]="count" class="nbr-of-files"> | ||
| <ng-template ngPluralCase="=0">No datafiles.</ng-template> | ||
| <ng-template ngPluralCase="=1">1 datafile.</ng-template> | ||
| <ng-template ngPluralCase="other">{{ count }} datafiles.</ng-template> | ||
| </span> | ||
|
|
||
| <configurable-actions | ||
| [actionsConfig]="appConfig.datafilesActions" | ||
| [actionItems]="actionItems" | ||
| ></configurable-actions> | ||
| </div> | ||
|
|
||
| <dynamic-mat-table | ||
| [tableName]="tableName" | ||
| [columns]="columns" | ||
| [pending]="pending" | ||
| [setting]="setting" | ||
| [pagingMode]="paginationMode" | ||
| [dataSource]="dataSource" | ||
| [pagination]="pagination" | ||
| [rowSelectionMode]="rowSelectionMode" | ||
| [rowSelectionModel]="rowSelectionModel" | ||
| [showGlobalTextSearch]="false" | ||
| (paginationChange)="onPaginationChange($event)" | ||
| (globalTextSearchChange)="onGlobalTextSearchChange($event)" | ||
| (onRowEvent)="onRowClick($event)" | ||
| (settingChange)="onSettingChange($event)" | ||
| (onTableEvent)="onTableEvent($event)" | ||
| class="mat-elevation-z2" | ||
| [emptyMessage]="'No files available'" | ||
| [emptyIcon]="'folder'" | ||
| > | ||
| </dynamic-mat-table> | ||
| </ng-template> |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (typo): Consider adding a possessive to clarify "file origdatablock row".
This wording is a bit ungrammatical. Rephrase to something like “file’s origdatablock row” (or similar for your domain) to make the relationship clearer.
Suggested implementation:
If there are other occurrences of the phrase “file origdatablock row” elsewhere in the documentation, they should similarly be updated to “file’s origdatablock row” (or another possessive construction consistent with your domain terminology).