This is an automated email from the ASF dual-hosted git repository.

liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 7fb29a6  SUBMARINE-514. [WEB] Implement experiment information output 
page.
7fb29a6 is described below

commit 7fb29a63b32811edf8f3ac0dd4f797eba7b071c3
Author: kobe860219 <[email protected]>
AuthorDate: Sat May 30 00:45:08 2020 +0800

    SUBMARINE-514. [WEB] Implement experiment information output page.
    
    ### What is this PR for?
    Implement experiment information output page.
    
Reference:https://www.comet.ml/pingsutw/testing/e60b90e9096c4c639502278620064992?experiment-tab=stdout
    
    ### What type of PR is it?
    [ Improvement ]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-514
    
    ### How should this be tested?
    https://travis-ci.org/github/kobe860219/submarine/builds/692466737
    
    ### Screenshots (if appropriate)
    ![螢幕錄製 2020-05-29 
下午3](https://user-images.githubusercontent.com/48027290/83237411-7d3dfe00-a1c7-11ea-9f3d-69de17f4a1bf.gif)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: kobe860219 <[email protected]>
    
    Closes #302 from kobe860219/SUBMARINE-514 and squashes the following 
commits:
    
    527d6b0 [kobe860219] Fix typos
    8db7b8e [kobe860219] SUBMARINE-514. [WEB] Implement experiment information 
output page.
    6f289de [kobe860219] Implement get log from server
---
 .../experiment-info/experiment-info.component.html |  2 +-
 .../experiment-info/outputs/outputs.component.html | 33 +++++++++++++++++++--
 .../experiment-info/outputs/outputs.component.scss | 26 +++++++++++++++++
 .../experiment-info/outputs/outputs.component.ts   | 34 ++++++++++++++++++++--
 .../workbench/experiment/experiment.module.ts      |  3 +-
 .../src/app/services/experiment.service.ts         | 13 +++++++++
 6 files changed, 104 insertions(+), 7 deletions(-)

diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/experiment-info.component.html
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/experiment-info.component.html
index b0b7d70..19ee5ea 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/experiment-info.component.html
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/experiment-info.component.html
@@ -105,7 +105,7 @@
       <submarine-charts *ngSwitchCase="0"></submarine-charts>
       <submarine-hyper-params *ngSwitchCase="1"></submarine-hyper-params>
       <submarine-metrics *ngSwitchCase="2"></submarine-metrics>
-      <submarine-outputs *ngSwitchCase="3"></submarine-outputs>
+      <submarine-outputs *ngSwitchCase="3" 
[experimentOutputID]="experimentID"></submarine-outputs>
     </div>
   </nz-layout>
 </nz-layout>
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.html
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.html
index 0a100ab..60143f6 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.html
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.html
@@ -16,5 +16,34 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
   -->
-
-<p>outputs works!</p>
+<div id="outputDiv">
+  <div *ngIf="!isShowing" id="podListDiv">
+    <nz-table #podArr nzSize="middle" [nzData]="podNameArr">
+      <thead>
+        <tr>
+          <th style="padding: 5px;">Pod Name</th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr *ngFor="let pod of podArr.data; let i = index">
+          <a (click)="show(i)">{{ pod }}</a>
+        </tr>
+      </tbody>
+    </nz-table>
+  </div>
+  <div *ngIf="isShowing">
+    <div id="logActionDiv">
+      <button class="logActionBtn" nz-button nzType="primary" 
(click)="isShowing = false">
+        <i nz-icon nzType="step-backward" nzTheme="outline"></i>
+        Back
+      </button>
+      <button class="logActionBtn" nz-button nzType="primary" 
(click)="export()">
+        <i nz-icon nzType="export" nzTheme="outline"></i>
+        Export
+      </button>
+    </div>
+    <div id="showLogDiv">
+      <p style="white-space: nowrap;" *ngFor="let log of logDetailArr; let j = 
index">[{{ j }}] {{ log }}</p>
+    </div>
+  </div>
+</div>
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.scss
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.scss
index 6c98c1e..57ed087 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.scss
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.scss
@@ -17,4 +17,30 @@
  * under the License.
  */
 
+#outputDiv{
+    background-color: white;
+}
 
+#podListDiv{
+    background-color: white;
+    padding: 10px;
+    height:280px;
+    overflow:auto;
+}
+
+#outputActionDiv{
+    padding: 10px;
+}
+
+.logActionBtn{
+    margin: 5px;
+}
+
+#showLogDiv{
+    background-color: gainsboro;
+    color: red;
+    margin: 5px;
+    padding: 5px;
+    height:280px;
+    overflow:auto;
+}
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.ts
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.ts
index 0f41361..83aa530 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.ts
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment-info/outputs/outputs.component.ts
@@ -17,7 +17,9 @@
  * under the License.
  */
 
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Input } from '@angular/core';
+import { ExperimentService } from '../../../../../services/experiment.service';
+import { NzMessageService } from 'ng-zorro-antd';
 
 @Component({
   selector: 'submarine-outputs',
@@ -25,7 +27,33 @@ import { Component, OnInit } from '@angular/core';
   styleUrls: ['./outputs.component.scss']
 })
 export class OutputsComponent implements OnInit {
-  constructor() {}
+  @Input() experimentOutputID: string;
+  podNameArr;
+  podLogArr;
+  logDetailArr;
+  isShowing = false;
 
-  ngOnInit() {}
+  constructor(private experimentService: ExperimentService, private 
nzMessageService: NzMessageService) {}
+
+  ngOnInit() {
+    this.getExperimentLog();
+  }
+
+  getExperimentLog() {
+    this.experimentService.getExperimentLog(this.experimentOutputID).subscribe(
+      (result) => {
+        this.podNameArr = result.logContent.map((item) => 
Object.values(item)[0]);
+        this.podLogArr = result.logContent.map((item) => 
Object.values(item)[1]);
+      },
+      (err) => {
+        this.nzMessageService.error('Cannot load log of ' + 
this.experimentOutputID);
+        console.log(err);
+      }
+    );
+  }
+
+  show(i: number) {
+    this.isShowing = true;
+    this.logDetailArr = this.podLogArr[i];
+  }
 }
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment.module.ts
 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment.module.ts
index ed5fe8e..774c87a 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment.module.ts
+++ 
b/submarine-workbench/workbench-web-ng/src/app/pages/workbench/experiment/experiment.module.ts
@@ -7,6 +7,7 @@ import { ChartsComponent } from 
'./experiment-info/charts/charts.component';
 import { OutputsComponent } from './experiment-info/outputs/outputs.component';
 import { NgZorroAntdModule } from 'ng-zorro-antd';
 import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -29,7 +30,7 @@ import { CommonModule } from '@angular/common';
 
 @NgModule({
   exports: [ReactiveFormsModule],
-  imports: [NgZorroAntdModule, CommonModule],
+  imports: [NgZorroAntdModule, CommonModule, FormsModule],
   declarations: [ExperimentInfoComponent, HyperParamsComponent, 
MetricsComponent, ChartsComponent, OutputsComponent]
 })
 export class ExperimentModule {}
diff --git 
a/submarine-workbench/workbench-web-ng/src/app/services/experiment.service.ts 
b/submarine-workbench/workbench-web-ng/src/app/services/experiment.service.ts
index d420b46..c0617df 100644
--- 
a/submarine-workbench/workbench-web-ng/src/app/services/experiment.service.ts
+++ 
b/submarine-workbench/workbench-web-ng/src/app/services/experiment.service.ts
@@ -96,4 +96,17 @@ export class ExperimentService {
       })
     );
   }
+
+  getExperimentLog(id: string): Observable<any> {
+    const apiUrl = this.baseApi.getRestApi('/v1/jobs/logs/' + id);
+    return this.httpClient.get<Rest<any>>(apiUrl).pipe(
+      switchMap((res) => {
+        if (res.success) {
+          return of(res.result);
+        } else {
+          throw this.baseApi.createRequestError(res.message, res.code, apiUrl, 
'get', id);
+        }
+      })
+    );
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to