Skip to content

Commit

Permalink
Merge pull request #1050 from SciCatProject/SWAP-3160-scicat-fe-inves…
Browse files Browse the repository at this point in the history
…tigate-and-test-files-section

fix: files page does not render data
  • Loading branch information
nitrosx authored Apr 20, 2023
2 parents 757d079 + 7c32a64 commit d2a51ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<shared-table [dataSource]="dataSource" [columnsdef]="columns" [pageSize]="5" (rowClick)="onRowClick($event)">
<shared-table [dataSource]="dataSource" [isFilesDashboard]="true" [columnsdef]="columns" [pageSize]="5" (rowClick)="onRowClick($event)">
</shared-table>
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ describe("SharedTableComponent", () => {
component.sort.active,
component.sort.direction,
component.paginator.pageIndex,
component.paginator.pageSize
component.paginator.pageSize,
component.isFilesDashboard
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class SharedTableComponent

// Shared Variables
@Input() dataSource: SciCatDataSource;
@Input() isFilesDashboard: boolean;
@Input() columnsdef: Column[];
@Input() pageSize = 10;
@Input() pageSizeOptions: number[] = [5, 10, 25, 100];
Expand Down Expand Up @@ -216,7 +217,8 @@ export class SharedTableComponent
this.sort.active,
this.sort.direction,
this.paginator.pageIndex,
this.paginator.pageSize
this.paginator.pageSize,
this.isFilesDashboard
);
}

Expand Down
9 changes: 7 additions & 2 deletions src/app/shared/services/scicat-data-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export class ScicatDataService {
sortField?: string,
sortOrder = "asc",
pageNumber = 0,
pageSize = 10
pageSize = 10,
isFilesDashboard = false
): Observable<any[]> {
// Dataset filter syntax (not used here)
// {"limit":3,"skip":11,"where":{"ownerGroup":"p16633"},"order":"size ASC"}
Expand Down Expand Up @@ -150,7 +151,11 @@ export class ScicatDataService {
.set("fields", JSON.stringify(filterFields))
.set("limits", JSON.stringify(limits))
.append("access_token", this.auth.getToken().id);
return this.http.get<any[]>(`${url}/fullquery`, {


const origDatablocksFiles = url.includes("Origdatablocks") && isFilesDashboard ? "/files" : "";

return this.http.get<any[]>(`${url}/fullquery${origDatablocksFiles}`, {
params,
headers: { Authorization: this.auth.getAccessTokenId() },
});
Expand Down
6 changes: 4 additions & 2 deletions src/app/shared/services/scicat.datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export class SciCatDataSource implements DataSource<any> {
sortField?: string,
sortDirection = "asc",
pageIndex = 0,
pageSize = 10
pageSize = 10,
isFilesDashboard?: boolean,
) {
this.loadingSubject.next(true);

Expand All @@ -89,7 +90,8 @@ export class SciCatDataSource implements DataSource<any> {
sortField,
sortDirection,
pageIndex,
pageSize
pageSize,
isFilesDashboard
)
.pipe(
catchError(() => of([])),
Expand Down

0 comments on commit d2a51ca

Please sign in to comment.