-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: Harmonize layout of resource tables * Modify page title
- Loading branch information
1 parent
21bfbd2
commit 2320d08
Showing
24 changed files
with
927 additions
and
1,352 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-table.component.html
This file contains 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,40 @@ | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
~ contributor license agreements. See the NOTICE file distributed with | ||
~ this work for additional information regarding copyright ownership. | ||
~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
~ (the "License"); you may not use this file except in compliance with | ||
~ the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~ | ||
--> | ||
|
||
<div fxLayout="column"> | ||
<table mat-table class="sp-table" [dataSource]="dataSource"> | ||
<ng-content></ng-content> | ||
|
||
<tr mat-header-row *matHeaderRowDef="columns"></tr> | ||
<tr mat-row *matRowDef="let row; columns: columns"></tr> | ||
|
||
<tr class="mat-row" *matNoDataRow> | ||
<td class="mat-cell" [colSpan]="columns.length"> | ||
No entries available. | ||
</td> | ||
</tr> | ||
</table> | ||
<div fxFlex="100" fxLayoutAlign="end end" class="paginator-container"> | ||
<mat-paginator | ||
#paginator | ||
[pageSize]="20" | ||
[hidePageSize]="true" | ||
[showFirstLastButtons]="true" | ||
></mat-paginator> | ||
</div> | ||
</div> |
30 changes: 30 additions & 0 deletions
30
ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-table.component.scss
This file contains 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,30 @@ | ||
/*! | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
.paginator-container { | ||
border-top: 1px solid rgba(0, 0, 0, 0.12); | ||
} | ||
|
||
.mat-mdc-row:hover { | ||
background-color: var(--color-bg-2); | ||
} | ||
|
||
.mat-mdc-no-data-row { | ||
height: var(--mat-table-row-item-container-height, 52px); | ||
text-align: center; | ||
} |
74 changes: 74 additions & 0 deletions
74
ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-table.component.ts
This file contains 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,74 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
import { | ||
AfterContentInit, | ||
AfterViewInit, | ||
Component, | ||
ContentChild, | ||
ContentChildren, | ||
Input, | ||
QueryList, | ||
ViewChild, | ||
} from '@angular/core'; | ||
import { | ||
MatColumnDef, | ||
MatHeaderRowDef, | ||
MatNoDataRow, | ||
MatRowDef, | ||
MatTable, | ||
MatTableDataSource, | ||
} from '@angular/material/table'; | ||
import { MatPaginator } from '@angular/material/paginator'; | ||
|
||
@Component({ | ||
selector: 'sp-table', | ||
templateUrl: './sp-table.component.html', | ||
styleUrls: ['./sp-table.component.scss'], | ||
}) | ||
export class SpTableComponent<T> implements AfterViewInit, AfterContentInit { | ||
@ContentChildren(MatHeaderRowDef) headerRowDefs: QueryList<MatHeaderRowDef>; | ||
@ContentChildren(MatRowDef) rowDefs: QueryList<MatRowDef<T>>; | ||
@ContentChildren(MatColumnDef) columnDefs: QueryList<MatColumnDef>; | ||
@ContentChild(MatNoDataRow) noDataRow: MatNoDataRow; | ||
|
||
@ViewChild(MatTable, { static: true }) table: MatTable<T>; | ||
|
||
@Input() columns: string[]; | ||
|
||
@Input() dataSource: MatTableDataSource<T>; | ||
|
||
@ViewChild('paginator') paginator: MatPaginator; | ||
|
||
pageSize = 1; | ||
|
||
ngAfterViewInit() { | ||
this.dataSource.paginator = this.paginator; | ||
} | ||
|
||
ngAfterContentInit() { | ||
this.columnDefs.forEach(columnDef => | ||
this.table.addColumnDef(columnDef), | ||
); | ||
this.rowDefs.forEach(rowDef => this.table.addRowDef(rowDef)); | ||
this.headerRowDefs.forEach(headerRowDef => | ||
this.table.addHeaderRowDef(headerRowDef), | ||
); | ||
this.table.setNoDataRow(this.noDataRow); | ||
} | ||
} |
This file contains 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 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 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
Oops, something went wrong.