You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2021/08/31 03:11:58 UTC
[submarine] branch master updated: SUBMARINE-998. NanoID for
experiment name
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 9244def SUBMARINE-998. NanoID for experiment name
9244def is described below
commit 9244defe205786d2af703ef5711ffee4dc89ac65
Author: noidname01 <ti...@gmail.com>
AuthorDate: Sat Aug 28 21:04:35 2021 +0800
SUBMARINE-998. NanoID for experiment name
### What is this PR for?
Nano id uses URL-friendly symbols (A-Za-z0-9_-), but experiment name didn't accept "_".
So its character set need to be modify with [nano-dictionary](https://github.com/CyberAP/nanoid-dictionary)
### What type of PR is it?
[Bug Fix]
### Todos
None
### What is the Jira issue?
https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-998
### How should this be tested?
Just clone a experiment and check its name
### Screenshots (if appropriate)
![2021-08-28 21-08-37 的螢幕擷圖](https://user-images.githubusercontent.com/55401762/131218993-6f2bd989-e8ea-4784-aee2-19c7708cd28a.png)
### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: noidname01 <ti...@gmail.com>
Signed-off-by: Kevin <pi...@apache.org>
Closes #728 from noidname01/SUBMARINE-998 and squashes the following commits:
80af60e9 [noidname01] fix nanoid
---
submarine-workbench/workbench-web/package.json | 1 +
.../experiment-customized-form.component.ts | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/submarine-workbench/workbench-web/package.json b/submarine-workbench/workbench-web/package.json
index 35827fa..3239d3e 100644
--- a/submarine-workbench/workbench-web/package.json
+++ b/submarine-workbench/workbench-web/package.json
@@ -27,6 +27,7 @@
"lodash": "^4.17.19",
"md5": "^2.2.1",
"nanoid": "^3.1.12",
+ "nanoid-dictionary": "^4.3.0",
"ng-zorro-antd": "8.5.2",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
diff --git a/submarine-workbench/workbench-web/src/app/pages/workbench/experiment/experiment-home/experiment-form/experiment-customized-form/experiment-customized-form.component.ts b/submarine-workbench/workbench-web/src/app/pages/workbench/experiment/experiment-home/experiment-form/experiment-customized-form/experiment-customized-form.component.ts
index 317ab40..a42d905 100644
--- a/submarine-workbench/workbench-web/src/app/pages/workbench/experiment/experiment-home/experiment-form/experiment-customized-form/experiment-customized-form.component.ts
+++ b/submarine-workbench/workbench-web/src/app/pages/workbench/experiment/experiment-home/experiment-form/experiment-customized-form/experiment-customized-form.component.ts
@@ -29,7 +29,8 @@ import {
import { ExperimentFormService } from '@submarine/services/experiment.form.service';
import { ExperimentService } from '@submarine/services/experiment.service';
import { ExperimentValidatorService } from '@submarine/services/experiment.validator.service';
-import { nanoid } from 'nanoid';
+import { customAlphabet } from 'nanoid';
+import { alphanumeric } from 'nanoid-dictionary';
import { NzMessageService } from 'ng-zorro-antd';
import { Subscription } from 'rxjs';
@@ -397,7 +398,7 @@ export class ExperimentCustomizedFormComponent implements OnInit, OnDestroy {
// Enable user from modifying the name
this.experimentName.enable();
// Put value back
- const id: string = nanoid(8);
+ const id: string = customAlphabet(alphanumeric, 8)();
const cloneExperimentName = spec.meta.name + '-' + id;
this.experimentName.setValue(cloneExperimentName.toLocaleLowerCase());
this.cloneExperiment(spec);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org