This is an automated email from the ASF dual-hosted git repository.
dgnatyshyn pushed a commit to branch DLAB-1546
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-1546 by this push:
new 21e893b Made cluster name unique per project
new 3819859 Merge remote-tracking branch 'origin/DLAB-1546' into DLAB-1546
21e893b is described below
commit 21e893bde70245da1c834256d05d0fc9cd892eb2
Author: Dmytro Gnatyshyn <[email protected]>
AuthorDate: Thu Mar 5 16:49:35 2020 +0200
Made cluster name unique per project
---
.../services/applicationServiceFacade.service.ts | 9 +++++++
.../src/app/core/services/userResource.service.ts | 6 ++---
.../reporting-grid/reporting-grid.component.html | 2 +-
...utational-resource-create-dialog.component.html | 9 ++++---
...mputational-resource-create-dialog.component.ts | 30 ++++++++++++++--------
5 files changed, 38 insertions(+), 18 deletions(-)
diff --git
a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
index a8fbdc0..ac698a7 100644
---
a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
+++
b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
@@ -47,6 +47,7 @@ export class ApplicationServiceFacade {
private static readonly IMAGE = 'image';
private static readonly SCHEDULER = 'scheduler';
private static readonly TEMPLATES = 'templates';
+ private static readonly COMPUTATION_TEMPLATES = 'computation_templates';
private static readonly COMPUTATIONAL_RESOURCES_TEMLATES =
'computational_templates';
private static readonly COMPUTATIONAL_RESOURCES = 'computational_resources';
private static readonly COMPUTATIONAL_RESOURCES_DATAENGINE =
'computational_resources_dataengine';
@@ -181,6 +182,12 @@ export class ApplicationServiceFacade {
null);
}
+ public buildGetComputationTemplatesRequest(params, provider):
Observable<any> {
+ return this.buildRequest(HTTPMethod.GET,
+ '/api/' + provider +
this.requestRegistry.Item(ApplicationServiceFacade.COMPUTATION_TEMPLATES) +
params,
+ null);
+ }
+
public buildCreateExploratoryEnvironmentRequest(data): Observable<any> {
return this.buildRequest(HTTPMethod.PUT,
this.requestRegistry.Item(ApplicationServiceFacade.EXPLORATORY_ENVIRONMENT),
@@ -631,6 +638,8 @@ export class ApplicationServiceFacade {
'/api/infrastructure_provision/exploratory_environment');
this.requestRegistry.Add(ApplicationServiceFacade.TEMPLATES,
'/api/infrastructure_templates');
+ this.requestRegistry.Add(ApplicationServiceFacade.COMPUTATION_TEMPLATES,
+ '/infrastructure_provision/computational_resources');
this.requestRegistry.Add(ApplicationServiceFacade.IMAGE,
'/api/infrastructure_provision/exploratory_environment/image');
this.requestRegistry.Add(ApplicationServiceFacade.SCHEDULER,
diff --git
a/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts
b/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts
index a41bd29..340e216 100644
---
a/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts
+++
b/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts
@@ -37,10 +37,10 @@ export class UserResourceService {
catchError(ErrorUtils.handleServiceError));
}
- public getComputationalTemplates(project, endpoint): Observable<any> {
- const url = `/${project}/${endpoint}/computational_templates`;
+ public getComputationalTemplates(project, endpoint, provider):
Observable<any> {
+ const url = `/${project}/${endpoint}/templates`;
return this.applicationServiceFacade
- .buildGetTemplatesRequest(url)
+ .buildGetComputationTemplatesRequest(url, provider)
.pipe(
map(response => response),
catchError(ErrorUtils.handleServiceError));
diff --git
a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
index 4a92bc6..010dd77 100644
---
a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
+++
b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
@@ -135,7 +135,7 @@
</th>
<td mat-cell *matCellDef="let element">
- {{ element[DICTIONARY[PROVIDER].billing.cost].toFixed(2) }} {{
element[DICTIONARY[PROVIDER].billing.currencyCode] }}
+ {{ element[DICTIONARY[PROVIDER].billing.cost] }} {{
element[DICTIONARY[PROVIDER].billing.currencyCode] }}
</td>
<td mat-footer-cell *matFooterCellDef class="table-footer">
Total <span *ngIf="reportData?.length"> {{ fullReport['cost_total'] }}
diff --git
a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
index aab4e24..ec3c3ac 100644
---
a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
+++
b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
@@ -69,15 +69,16 @@
<label class="label">Cluster alias</label>
<div class="control">
<input
- [class.danger_field]="computationalResourceExist ||
!resourceForm?.controls['cluster_alias_name'].valid
+
[class.danger_field]="!resourceForm?.controls['cluster_alias_name'].valid
&& resourceForm?.controls['cluster_alias_name'].dirty
&& resourceForm?.controls['cluster_alias_name'].hasError('duplication')"
type="text" class="form-control" placeholder="Enter cluster
alias"
formControlName="cluster_alias_name" />
- <span class="error"
*ngIf="resourceForm?.controls['cluster_alias_name'].hasError('duplication')">This
- cluster name already exists.</span>
+ <span class="error"
*ngIf="resourceForm?.controls['cluster_alias_name'].hasError('user-duplication')">You
have cluster with this name in current project.</span>
+ <span class="error"
*ngIf="resourceForm?.controls['cluster_alias_name'].hasError('other-user-duplication')">Other
user has cluster with this name in current project.</span>
<span class="error"
*ngIf="!resourceForm?.controls.cluster_alias_name.valid
&&
resourceForm?.controls['cluster_alias_name'].dirty
- &&
!resourceForm?.controls['cluster_alias_name'].hasError('duplication')">
+ &&
!resourceForm?.controls['cluster_alias_name'].hasError('user-duplication')
+ &&
!resourceForm?.controls['cluster_alias_name'].hasError('other-user-duplication')">
Cluster name cannot be longer than
{{DICTIONARY[PROVIDER].max_cluster_name_length}} characters
and can only contain letters, numbers, hyphens and '_' but
can not end with special
characters
diff --git
a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
index 29ef7d4..0c867f9 100644
---
a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
+++
b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
@@ -44,6 +44,8 @@ export class ComputationalResourceCreateDialogComponent
implements OnInit {
notebook_instance: any;
resourcesList: any;
clusterTypes = [];
+ userComputations = [];
+ projectComputations = [];
selectedImage: any;
spotInstance: boolean = true;
@@ -76,7 +78,7 @@ export class ComputationalResourceCreateDialogComponent
implements OnInit {
this.notebook_instance = this.data.notebook;
this.resourcesList = this.data.full_list;
this.initFormModel();
- this.getTemplates(this.notebook_instance.project,
this.notebook_instance.endpoint);
+ this.getTemplates(this.notebook_instance.project,
this.notebook_instance.endpoint, this.notebook_instance.cloud_provider);
}
public selectImage($event) {
@@ -229,16 +231,24 @@ export class ComputationalResourceCreateDialogComponent
implements OnInit {
}
private checkDuplication(control) {
- if (this.containsComputationalResource(control.value))
- return { duplication: true };
+ if (this.containsComputationalResource(control.value,
this.userComputations)){
+ return { 'user-duplication': true };
+ }
+
+ if (this.containsComputationalResource(control.value,
this.projectComputations)){
+ return { 'other-user-duplication': true };
+ }
}
- private getTemplates(project, endpoint) {
- this.userResourceService.getComputationalTemplates(project,
endpoint).subscribe(
+ private getTemplates(project, endpoint, provider) {
+ this.userResourceService.getComputationalTemplates(project, endpoint,
provider).subscribe(
clusterTypes => {
- this.clusterTypes = clusterTypes;
+ this.clusterTypes = clusterTypes.templates;
+ this.userComputations = clusterTypes.user_computations;
+ this.projectComputations = clusterTypes.project_computations;
+
this.clusterTypes.forEach((cluster, index) =>
this.clusterTypes[index].computation_resources_shapes =
SortUtils.shapesSort(cluster.computation_resources_shapes));
- this.selectedImage = clusterTypes[0];
+ this.selectedImage = clusterTypes.templates[0];
if (this.selectedImage) {
this._ref.detectChanges();
@@ -284,10 +294,10 @@ export class ComputationalResourceCreateDialogComponent
implements OnInit {
return filtered;
}
- private containsComputationalResource(conputational_resource_name: string):
boolean {
+ private containsComputationalResource(conputational_resource_name: string,
existNames: Array<string>): boolean {
if (conputational_resource_name) {
- return this.notebook_instance.resources.some(resource =>
- CheckUtils.delimitersFiltering(conputational_resource_name) ===
CheckUtils.delimitersFiltering(resource.computational_name));
+ return existNames.some(resource =>
+ CheckUtils.delimitersFiltering(conputational_resource_name) ===
CheckUtils.delimitersFiltering(resource));
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]