Skip to content

Commit

Permalink
frontend: Create a yaml tab for Trials (#2011)
Browse files Browse the repository at this point in the history
* Create a dedicated yaml tab for Trials.

Signed-off-by: Elena Zioga <elena@arrikto.com>
  • Loading branch information
elenzio9 committed Nov 22, 2022
1 parent b3c3807 commit 1cbecf3
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@
<div class="tab-height-fix">
<mat-tab-group dynamicHeight animationDuration="0ms">
<mat-tab label="OVERVIEW">
<app-trial-modal-overview
[trialName]="trialName"
[experimentName]="experimentName"
[trial]="trialDetails"
></app-trial-modal-overview>
<ng-template matTabContent>
<app-trial-modal-overview
[trialName]="trialName"
[experimentName]="experimentName"
[trial]="trialDetails"
></app-trial-modal-overview>
</ng-template>
</mat-tab>

<mat-tab label="YAML">
<ng-template matTabContent>
<app-trial-yaml [trialJson]="trialDetails"></app-trial-yaml>
</ng-template>
</mat-tab>
</mat-tab-group>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTabsModule } from '@angular/material/tabs';
import { TrialModalOverviewModule } from './overview/trial-modal-overview.module';
import { TrialModalComponent } from './trial-modal.component';
import { TrialYamlModule } from './trial-yaml/trial-yaml.module';

import {
TitleActionsToolbarModule,
Expand All @@ -32,6 +33,7 @@ import {
LoadingSpinnerModule,
PanelModule,
TitleActionsToolbarModule,
TrialYamlModule,
],
exports: [TrialModalComponent],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<lib-monaco-editor
[(text)]="yaml"
[language]="'yaml'"
[readOnly]="true"
[height]="500"
></lib-monaco-editor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
display: block;
overflow: auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { CommonModule } from '@angular/common';

import { EditorModule } from 'kubeflow';
import { TrialYamlComponent } from './trial-yaml.component';

describe('TrialYamlComponent', () => {
let component: TrialYamlComponent;
let fixture: ComponentFixture<TrialYamlComponent>;

beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [CommonModule, NoopAnimationsModule, EditorModule],
declarations: [TrialYamlComponent],
}).compileComponents();
}),
);

beforeEach(() => {
fixture = TestBed.createComponent(TrialYamlComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, Input } from '@angular/core';
import { TrialK8s } from 'src/app/models/trial.k8s.model';
import { dump } from 'js-yaml';

@Component({
selector: 'app-trial-yaml',
templateUrl: './trial-yaml.component.html',
styleUrls: ['./trial-yaml.component.scss'],
})
export class TrialYamlComponent {
public yaml = '';

@Input()
set trialJson(trial: TrialK8s) {
this.yaml = dump(trial);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { TrialYamlComponent } from './trial-yaml.component';
import { EditorModule } from 'kubeflow';

@NgModule({
declarations: [TrialYamlComponent],
imports: [CommonModule, EditorModule],
exports: [TrialYamlComponent],
})
export class TrialYamlModule {}

0 comments on commit 1cbecf3

Please sign in to comment.