Skip to content

Commit

Permalink
UI: Make KWA's main table responsive and add toolbar (#1982)
Browse files Browse the repository at this point in the history
* 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]>

* build: Update Dockerfile and README file

Update Dockerfile and README file to check out to the commit in master
branch from the Kubeflow repository that includes the corresponding
changes.

Signed-off-by: Elena Zioga <[email protected]>

Signed-off-by: Elena Zioga <[email protected]>
  • Loading branch information
elenzio9 authored Oct 31, 2022
1 parent aee2109 commit 766fef9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion cmd/new-ui/v1beta1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install git -y
WORKDIR /kf
RUN git clone https://github.com/kubeflow/kubeflow.git && \
cd kubeflow && \
git checkout ecb72c2
git checkout c4ca7a9

# --- Build the frontend kubeflow library ---
FROM node:12 AS frontend-kubeflow-lib
Expand Down
2 changes: 1 addition & 1 deletion pkg/new-ui/v1beta1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You can build the common library with:
```bash
cd /tmp && git clone https://github.com/kubeflow/kubeflow.git \
&& cd kubeflow \
&& git checkout ecb72c2 \
&& git checkout c4ca7a9 \
&& cd components/crud-web-apps/common/frontend/kubeflow-common-lib

# build the common library module
Expand Down
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 766fef9

Please sign in to comment.