This is an automated email from the ASF dual-hosted git repository.
pingsutw 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 3fed340 SUBMARINE-1098. Show information in the model version
information page
3fed340 is described below
commit 3fed340a35fb224cdf0baa8a17f1e79beba23c93
Author: Ray02250418 <[email protected]>
AuthorDate: Thu Dec 9 23:48:33 2021 +0800
SUBMARINE-1098. Show information in the model version information page
### What is this PR for?
Use REST API to get the information of the model in the model version page.
### What type of PR is it?
Feature
### Todos
* [ ] - Add tags component.
### What is the Jira issue?
https://issues.apache.org/jira/browse/SUBMARINE-1098
### How should this be tested?
Save a model and checkout the model version page.
### Screenshots (if appropriate)

### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: Ray02250418 <[email protected]>
Signed-off-by: Kevin <[email protected]>
Closes #827 from Ray02250418/SUBMARINE-1098 and squashes the following
commits:
9f142886 [Ray02250418] SUBMARINE-1098. Remove static tags
9fb45e04 [Ray02250418] SUBMARINE-1098. Add model version page Experiment id
hyperlink.
d844773b [Ray02250418] SUBMARINE-1098. Static model version page
d38ceaf6 [Ray02250418] SUBMARINE-1098. Model version page
57e78fe6 [Ray02250418] SUBMARINE-1098. Model version page
---
.../model-version-info.ts} | 35 +++++---------
.../model-version/model-version.component.html | 18 +++----
.../model/model-version/model-version.component.ts | 16 ++++++-
.../src/app/services/model-version.service.ts | 55 ++++++++++++++++++++++
4 files changed, 92 insertions(+), 32 deletions(-)
diff --git
a/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
b/submarine-workbench/workbench-web/src/app/interfaces/model-version-info.ts
similarity index 51%
copy from
submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
copy to
submarine-workbench/workbench-web/src/app/interfaces/model-version-info.ts
index 04c8dfe..5af65b6 100644
---
a/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
+++ b/submarine-workbench/workbench-web/src/app/interfaces/model-version-info.ts
@@ -17,25 +17,16 @@
* under the License.
*/
-import { Component, OnInit, ViewChild } from '@angular/core';
-import { ActivatedRoute, Router } from '@angular/router';
-import { ExperimentService } from '@submarine/services/experiment.service';
-
-@Component({
- selector: 'submarine-model-version',
- templateUrl: './model-version.component.html',
- styleUrls: ['./model-version.component.scss'],
-})
-export class ModelVersionComponent implements OnInit {
- isLoading = true;
- modelName;
- modelVersion;
-
- constructor(private router: Router, private route: ActivatedRoute, private
experimentService: ExperimentService) {}
-
- ngOnInit() {
- this.modelName = this.route.snapshot.params.name;
- this.modelVersion = this.route.snapshot.params.version;
- this.experimentService.emitInfo(this.modelName);
- }
-}
+export interface ModelVersionInfo {
+ name: string,
+ version: number,
+ source: string,
+ userId: string,
+ experimentId: string,
+ currentStage: string,
+ creationTime: string,
+ lastUpdatedTime: string,
+ dataset: string,
+ description: string,
+ tags: Array<string>
+}
\ No newline at end of file
diff --git
a/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.html
b/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.html
index e5bed30..548b164 100644
---
a/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.html
+++
b/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.html
@@ -19,17 +19,17 @@
<div style="margin: 15px; padding: 15px; background-color: white">
<p>Version: {{ modelVersion }}</p>
- <p>Description: Resnet152</p>
- <p>Tags:</p>
- <p>Stage:</p>
+ <p>Description: {{ modelVersionInfo.description }}</p>
+ <p>Tags: {{ modelVersionInfo.tags }}</p>
+ <p>Stage: {{ modelVersionInfo.currentStage }}</p>
<h3>Model version info</h3>
- <p>User id: abcdef</p>
+ <p>User id: {{ modelVersionInfo.userId }}</p>
<p>
Experiment id:
- <a href="#">123456789</a>
+ <a href="/workbench/experiment/info/{{modelVersionInfo.experimentId}}">{{
modelVersionInfo.experimentId }}</a>
</p>
- <p>Dataset: mnist</p>
- <p>Created: 2021-09-01 07:57</p>
- <p>Updated: 2021-09-21 03:00</p>
- <p>Source: s3:/example/model</p>
+ <p>Dataset: {{ modelVersionInfo.dataset }}</p>
+ <p>Created: {{ modelVersionInfo.creationTime }}</p>
+ <p>Updated: {{ modelVersionInfo.lastUpdatedTime }}</p>
+ <p>Source: {{ modelVersionInfo.source }}</p>
</div>
diff --git
a/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
b/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
index 04c8dfe..df1b0dd 100644
---
a/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
+++
b/submarine-workbench/workbench-web/src/app/pages/workbench/model/model-version/model-version.component.ts
@@ -20,6 +20,9 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ExperimentService } from '@submarine/services/experiment.service';
+import { ModelVersionInfo } from '@submarine/interfaces/model-version-info';
+import { ModelVersionService } from
'@submarine/services/model-version.service';
+import { isThisSecond } from 'date-fns';
@Component({
selector: 'submarine-model-version',
@@ -30,12 +33,23 @@ export class ModelVersionComponent implements OnInit {
isLoading = true;
modelName;
modelVersion;
+ modelVersionInfo: ModelVersionInfo;
- constructor(private router: Router, private route: ActivatedRoute, private
experimentService: ExperimentService) {}
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private experimentService: ExperimentService,
+ private modelVersionService: ModelVersionService
+ ) {}
ngOnInit() {
this.modelName = this.route.snapshot.params.name;
this.modelVersion = this.route.snapshot.params.version;
this.experimentService.emitInfo(this.modelName);
+ this.modelVersionService.querySpecificModel(this.modelName,
this.modelVersion).subscribe(
+ (item) => {
+ this.modelVersionInfo = item;
+ }
+ );
}
}
diff --git
a/submarine-workbench/workbench-web/src/app/services/model-version.service.ts
b/submarine-workbench/workbench-web/src/app/services/model-version.service.ts
new file mode 100644
index 0000000..d4ae587
--- /dev/null
+++
b/submarine-workbench/workbench-web/src/app/services/model-version.service.ts
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { of, throwError, Observable, Subject } from 'rxjs';
+import { BaseApiService } from '@submarine/services/base-api.service';
+import { Rest } from '@submarine/interfaces';
+import { ModelVersionInfo } from '@submarine/interfaces/model-version-info';
+import { switchMap } from 'rxjs/operators';
+
+@Injectable({
+ providedIn: 'root',
+})
+
+export class ModelVersionService {
+
+ private emitInfoSource = new Subject<string>();
+ infoEmitted$ = this.emitInfoSource.asObservable();
+
+ constructor(private baseApi: BaseApiService, private httpClient: HttpClient)
{}
+
+ emitInfo(id: string) {
+ this.emitInfoSource.next(id);
+ }
+
+ querySpecificModel(name: string, version: string) :
Observable<ModelVersionInfo> {
+ const apiUrl = this.baseApi.getRestApi('/v1/model-version/' + name + '/'
+ version + '/');
+ return this.httpClient.get<Rest<ModelVersionInfo>>(apiUrl).pipe(
+ switchMap((res) => {
+ if (res.success) {
+ return of(res.result);
+ } else {
+ throw this.baseApi.createRequestError(res.message, res.code,
apiUrl, 'get');
+ }
+ })
+ );
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]