Skip to content

Commit

Permalink
UI: Make KWA's main table responsive and add toolbar
Browse files Browse the repository at this point in the history
* 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 <elena@arrikto.com>
  • Loading branch information
elenzio9 committed Oct 25, 2022
1 parent 6de74e9 commit 68ec419
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
import { ExperimentOptimalTrialComponent } from './optimal-trial/experiment-optimal-trial.component';

export const experimentsTableConfig: TableConfig = {
title: 'Experiments',
newButtonText: 'NEW EXPERIMENT',
columns: [
{
matHeaderCellDef: 'Status',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<lib-namespace-select
*ngIf="(ns.dashboardConnected$ | async) === dashboardDisconnectedState"
namespacesUrl="/katib/fetch_namespaces"
></lib-namespace-select>
<div class="lib-content-wrapper">
<lib-title-actions-toolbar title="Experiments" [buttons]="buttons" i18n-title>
<lib-namespace-select
*ngIf="(ns.dashboardConnected$ | async) === dashboardDisconnectedState"
namespacesUrl="/katib/fetch_namespaces"
></lib-namespace-select>
</lib-title-actions-toolbar>

<lib-resource-table
[config]="config"
[data]="experiments"
[trackByFn]="trackByFn"
(actionsEmitter)="reactToAction($event)"
></lib-resource-table>
<div class="page-padding lib-flex-grow lib-overflow-auto">
<lib-table
[config]="config"
[data]="experiments"
[trackByFn]="trackByFn"
(actionsEmitter)="reactToAction($event)"
>
</lib-table>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
TemplateValue,
ActionEvent,
DashboardState,
ToolbarButton,
} from 'kubeflow';

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

buttons: ToolbarButton[] = [
new ToolbarButton({
text: `New Experiment`,
icon: 'add',
stroked: true,
fn: () => {
this.router.navigate(['/new']);
},
}),
];

constructor(
private backend: KWABackendService,
private confirmDialog: ConfirmDialogService,
Expand Down Expand Up @@ -73,9 +85,6 @@ export class ExperimentsComponent implements OnInit, OnDestroy {
reactToAction(a: ActionEvent) {
const exp = a.data as Experiment;
switch (a.action) {
case 'newResourceButton': // TODO: could also use enums here
this.router.navigate(['/new']);
break;
case 'name:link':
this.router.navigate([`/experiment/${exp.name}`]);
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import {
NamespaceSelectModule,
ResourceTableModule,
ConfirmDialogModule,
} from 'kubeflow';

import { KubeflowModule } from 'kubeflow';
import { ExperimentsComponent } from './experiments.component';
import { ExperimentOptimalTrialModule } from './optimal-trial/experiment-optimal-trial.module';

@NgModule({
declarations: [ExperimentsComponent],
imports: [
CommonModule,
NamespaceSelectModule,
ResourceTableModule,

ConfirmDialogModule,
ExperimentOptimalTrialModule,
MatCardModule,
ConfirmDialogModule,
MatCardModule,
],
imports: [CommonModule, ExperimentOptimalTrialModule, KubeflowModule],
exports: [ExperimentsComponent],
})
export class ExperimentsModule {}

0 comments on commit 68ec419

Please sign in to comment.