Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[DLAB-1466]: Fixed set of minor issues (#553)
Browse files Browse the repository at this point in the history
* [DLAB-1466]: Fixed set of minor issues

* [DLAB-1466]: Fixed set of minor issues
  • Loading branch information
DG1202 committed Jan 24, 2020
1 parent 52ebeef commit 5eed52f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
Expand Up @@ -18,17 +18,17 @@
*/

import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject, of } from 'rxjs';
import { mergeMap} from 'rxjs/operators';

import { ProjectService } from '../../core/services';
import { ProjectService, EndpointService } from '../../core/services';
import { Project } from './project.component';

@Injectable()
export class ProjectDataService {

_projects = new BehaviorSubject<any>(null);

constructor(private projectService: ProjectService) {
constructor(private projectService: ProjectService, private endpointService: EndpointService) {
this.getProjectsList();
}

Expand All @@ -37,7 +37,26 @@ export class ProjectDataService {
}

private getProjectsList() {
this.projectService.getProjectsList().subscribe(
(response: Project[]) => this._projects.next(response));
this.projectService.getProjectsList()
.pipe(
mergeMap ((response: Project[]) => {
this.endpointService.getEndpointsData().subscribe((endpoints: any) => {
if(response) {
response.forEach(project => project.endpoints.forEach(endpoint => {
const filtredEndpoints = endpoints.filter(v => v.name === endpoint.name);
if(filtredEndpoints.length){
endpoint.endpointStatus = endpoints.filter(v => v.name === endpoint.name)[0].status;
}else{
endpoint.endpointStatus = "N/A"
}
}));
}
});
return of(response);
}))
.subscribe(
(response: Project[]) => {
return this._projects.next(response);
});
}
}
}
Expand Up @@ -70,18 +70,6 @@ export class ProjectListComponent implements OnInit, OnDestroy {
setTimeout(() => {this.progressBarService.startProgressBar()} , 0);
this.subscriptions.add(this.projectDataService._projects.subscribe((value: Project[]) => {
this.projectList = value;
this.endpointService.getEndpointsData().subscribe((endpoints: any) => {
if(this.projectList){
this.projectList.forEach(project => project.endpoints.forEach(endpoint => {
const filtredEndpoints = endpoints.filter(v => v.name === endpoint.name);
if(filtredEndpoints.length){
endpoint.endpointStatus = endpoints.filter(v => v.name === endpoint.name)[0].status;
}else{
endpoint.endpointStatus = "N/A"
}
}))
}
});
if (value) this.dataSource = new MatTableDataSource(value);
this.progressBarService.stopProgressBar();
}, () => this.progressBarService.stopProgressBar()));
Expand Down
Expand Up @@ -124,7 +124,7 @@ <h4 class="modal-title">Add computational resources</h4>
<label class="label">Slave instance size</label>
<div class="control selector-wrapper">
<mat-form-field>
<mat-label>Select {{ DICTIONARY.notebook_instance_size }}</mat-label>
<mat-label>Select instance size</mat-label>
<mat-select formControlName="shape_slave" disableOptionCentering>
<mat-optgroup *ngFor="let item of (selectedImage.computation_resources_shapes | keys)"
[label]="item.key | underscoreless">
Expand Down
Expand Up @@ -139,9 +139,9 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
private initFormModel(): void {
this.resourceForm = this._fb.group({
template_name: ['', [Validators.required]],
version: [''],
version: ['', Validators.required],
shape_master: ['', Validators.required],
shape_slave: ['', Validators.required],
shape_slave: ['', Validators.required],
cluster_alias_name: ['', [Validators.required, Validators.pattern(PATTERNS.namePattern), Validators.maxLength(DICTIONARY[this.PROVIDER].max_cluster_name_length),
this.checkDuplication.bind(this)]],
instance_number: ['', [Validators.required, Validators.pattern(PATTERNS.nodeCountPattern), this.validInstanceNumberRange.bind(this)]],
Expand All @@ -158,8 +158,10 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
this.resourceForm.get('template_name').valueChanges.subscribe(val => {
if (val === 'AWS EMR cluster') {
this.resourceForm.addControl('shape_slave', new FormControl('', [ Validators.required ]));
this.resourceForm.addControl('version', new FormControl('', [ Validators.required ]));
} else {
this.resourceForm.removeControl('shape_slave');
this.resourceForm.removeControl('version');
}
this.resourceForm.updateValueAndValidity();
});
Expand Down
Expand Up @@ -125,7 +125,7 @@ <h4 class="modal-title">Manage Git Credentials</h4>
<input type="password" formControlName="password" placeholder="Enter Password">
</div>
<span class="danger_color"
*ngIf="!updateAccountCredentialsForm.controls['password'].valid && updateAccountCredentialsForm.controls['password'].touched && updateAccountCredentialsForm.value.password === updateAccountCredentialsForm.value.confirmPassword">
*ngIf="!updateAccountCredentialsForm.controls['password'].valid && updateAccountCredentialsForm.controls['password'].touched">
Field is required. Password must be at least 6 characters
</span>
</div>
Expand Down
Expand Up @@ -86,7 +86,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
</label>
</div>
<p class="confirm-message">
<span *ngIf="!willNotTerminate">All connected computational resources will be terminated as well</span>
<span *ngIf="!willNotTerminate">All connected computational resources will be terminated as well.</span>
</p>
</div>
<mat-list *ngIf="data.item.endpoints?.length">
Expand Down

0 comments on commit 5eed52f

Please sign in to comment.