Skip to content

Commit 05e96a0

Browse files
committed
UI: Make KWA's main table responsive and add toolbar
* Add a top row toolbar with the title of the app and the button to create a new Experiment. * Replace the card with a responsive table that shows the items. The component also has a paginator. Signed-off-by: Elena Zioga <[email protected]>
1 parent 6de74e9 commit 05e96a0

File tree

4 files changed

+24
-29
lines changed

4 files changed

+24
-29
lines changed

pkg/new-ui/v1beta1/frontend/src/app/pages/experiments/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import {
1919
import { ExperimentOptimalTrialComponent } from './optimal-trial/experiment-optimal-trial.component';
2020

2121
export const experimentsTableConfig: TableConfig = {
22-
title: 'Experiments',
23-
newButtonText: 'NEW EXPERIMENT',
2422
columns: [
2523
{
2624
matHeaderCellDef: 'Status',
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<lib-namespace-select
2-
*ngIf="(ns.dashboardConnected$ | async) === dashboardDisconnectedState"
3-
namespacesUrl="/katib/fetch_namespaces"
4-
></lib-namespace-select>
1+
<div class="lib-content-wrapper">
2+
<lib-title-actions-toolbar title="Experiments" [buttons]="buttons" i18n-title>
3+
<lib-namespace-select *ngIf="(ns.dashboardConnected$ | async) === dashboardDisconnectedState"
4+
namespacesUrl="/katib/fetch_namespaces"></lib-namespace-select>
5+
</lib-title-actions-toolbar>
56

6-
<lib-resource-table
7-
[config]="config"
8-
[data]="experiments"
9-
[trackByFn]="trackByFn"
10-
(actionsEmitter)="reactToAction($event)"
11-
></lib-resource-table>
7+
<div class="page-padding lib-flex-grow lib-overflow-auto">
8+
<lib-table [config]="config" [data]="experiments" [trackByFn]="trackByFn" (actionsEmitter)="reactToAction($event)">
9+
</lib-table>
10+
</div>
11+
</div>

pkg/new-ui/v1beta1/frontend/src/app/pages/experiments/experiments.component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
TemplateValue,
1919
ActionEvent,
2020
DashboardState,
21+
ToolbarButton,
2122
} from 'kubeflow';
2223

2324
import { KWABackendService } from 'src/app/services/backend.service';
@@ -42,6 +43,17 @@ export class ExperimentsComponent implements OnInit, OnDestroy {
4243
private subs = new Subscription();
4344
private poller: ExponentialBackoff;
4445

46+
buttons: ToolbarButton[] = [
47+
new ToolbarButton({
48+
text: `New Experiment`,
49+
icon: 'add',
50+
stroked: true,
51+
fn: () => {
52+
this.router.navigate(['/new']);
53+
},
54+
}),
55+
];
56+
4557
constructor(
4658
private backend: KWABackendService,
4759
private confirmDialog: ConfirmDialogService,
@@ -73,9 +85,6 @@ export class ExperimentsComponent implements OnInit, OnDestroy {
7385
reactToAction(a: ActionEvent) {
7486
const exp = a.data as Experiment;
7587
switch (a.action) {
76-
case 'newResourceButton': // TODO: could also use enums here
77-
this.router.navigate(['/new']);
78-
break;
7988
case 'name:link':
8089
this.router.navigate([`/experiment/${exp.name}`]);
8190
break;

pkg/new-ui/v1beta1/frontend/src/app/pages/experiments/experiments.module.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
3-
import { MatCardModule } from '@angular/material/card';
4-
import {
5-
NamespaceSelectModule,
6-
ResourceTableModule,
7-
ConfirmDialogModule,
8-
} from 'kubeflow';
9-
3+
import { KubeflowModule } from 'kubeflow';
104
import { ExperimentsComponent } from './experiments.component';
115
import { ExperimentOptimalTrialModule } from './optimal-trial/experiment-optimal-trial.module';
126

137
@NgModule({
148
declarations: [ExperimentsComponent],
159
imports: [
1610
CommonModule,
17-
NamespaceSelectModule,
18-
ResourceTableModule,
19-
20-
ConfirmDialogModule,
2111
ExperimentOptimalTrialModule,
22-
MatCardModule,
23-
ConfirmDialogModule,
24-
MatCardModule,
12+
KubeflowModule,
2513
],
2614
exports: [ExperimentsComponent],
2715
})

0 commit comments

Comments
 (0)