You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/05/20 14:35:32 UTC
[incubator-dlab] 05/06: added material controllers into scheduler
This is an automated email from the ASF dual-hosted git repository.
ankovalyshyn pushed a commit to branch project_grid
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 381793a0a68b2916ba8d0b17a894bc6a1020bdc7
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Mon May 20 17:34:17 2019 +0300
added material controllers into scheduler
---
.../computational-resources-list.component.html | 2 +-
.../computational-resources-list.component.ts | 5 ++-
.../detail-dialog/detail-dialog.component.ts | 2 +-
.../resources-grid/resources-grid.component.html | 4 +-
.../resources-grid/resources-grid.component.ts | 12 ++++--
.../webapp/src/app/resources/scheduler/index.ts | 1 +
.../resources/scheduler/scheduler.component.html | 14 +++----
.../app/resources/scheduler/scheduler.component.ts | 45 ++++++++++++----------
8 files changed, 49 insertions(+), 36 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.html
index a495e61..75f19fb 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.html
@@ -57,4 +57,4 @@
</div>
<!-- <dlab-cluster-details #detailComputationalResource (buildGrid)="rebuildGrid()"></dlab-cluster-details> -->
- <dlab-scheduler #clusterScheduler (buildGrid)="rebuildGrid()"></dlab-scheduler>
+ <!-- <dlab-scheduler #clusterScheduler (buildGrid)="rebuildGrid()"></dlab-scheduler> -->
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.ts
index 55650ee..713b5ce 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resources-list/computational-resources-list.component.ts
@@ -23,6 +23,7 @@ import { ToastrService } from 'ngx-toastr';
import { UserResourceService } from '../../../core/services';
import { DetailComputationalResourcesComponent } from '../cluster-details';
+import { SchedulerComponent } from '../../scheduler';
@Component({
selector: 'computational-resources-list',
@@ -86,7 +87,9 @@ export class ComputationalResourcesListComponent {
};
openScheduleDialog(resource) {
- this.clusterScheduler.open({ isFooter: false }, this.environment, 'СOMPUTATIONAL', resource);
+ // this.clusterScheduler.open({ isFooter: false }, this.environment, 'СOMPUTATIONAL', resource);
+ this.dialog.open(SchedulerComponent, { data: {notebook: this.environment, type: 'СOMPUTATIONAL', resource} })
+ .afterClosed().subscribe(() => this.rebuildGrid());
}
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.ts
index 897aba4..8f75eea 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { Component, ViewChild, OnInit, Output, EventEmitter, Inject } from '@angular/core';
+import { Component, ViewChild, OnInit, Inject } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
index 8958fe9..2297b6c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
@@ -157,7 +157,7 @@
<!-- <computational-resource-create-dialog #computationalResourceModal (buildGrid)="buildGrid()"></computational-resource-create-dialog> -->
<confirmation-dialog #confirmationDialog (buildGrid)="buildGrid()"></confirmation-dialog>
-<cost-details-dialog #costDetailsDialog></cost-details-dialog>
+<!-- <cost-details-dialog #costDetailsDialog></cost-details-dialog> -->
<!-- <install-libraries #installLibs (buildGrid)="buildGrid()"></install-libraries> -->
-<dlab-scheduler #envScheduler (buildGrid)="buildGrid()"></dlab-scheduler>
+<!-- <dlab-scheduler #envScheduler (buildGrid)="buildGrid()"></dlab-scheduler> -->
<!-- <dlab-ami-create-dialog #createAmi (buildGrid)="buildGrid()"></dlab-ami-create-dialog> -->
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 7e06ea5..1ef10e6 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -33,6 +33,8 @@ import { DetailDialogComponent } from '../exploratory/detail-dialog';
import { AmiCreateDialogComponent } from '../exploratory/ami-create-dialog';
import { InstallLibrariesComponent } from '../exploratory/install-libraries';
import { ComputationalResourceCreateDialogComponent } from '../computational/computational-resource-create-dialog/computational-resource-create-dialog.component';
+import { CostDetailsDialogComponent } from '../billing/cost-details-dialog';
+import { SchedulerComponent } from '../scheduler';
import { DICTIONARY } from '../../../dictionary/global.dictionary';
@@ -62,7 +64,7 @@ export class ResourcesGridComponent implements OnInit {
@ViewChild('confirmationDialog') confirmationDialog;
@ViewChild('detailDialog') detailDialog;
@ViewChild('costDetailsDialog') costDetailsDialog;
- @ViewChild('envScheduler') scheduler;
+ // @ViewChild('envScheduler') scheduler;
public filteringColumns: Array<any> = [
{ title: 'Environment name', name: 'name', className: 'th_name', filtering: {} },
@@ -285,7 +287,9 @@ export class ResourcesGridComponent implements OnInit {
}
printCostDetails(data): void {
- this.costDetailsDialog.open({ isFooter: false }, data);
+ // this.costDetailsDialog.open({ isFooter: false }, data);
+ this.dialog.open(CostDetailsDialogComponent, { data: data })
+ .afterClosed().subscribe(() => this.buildGrid());
}
exploratoryAction(data, action: string) {
@@ -309,7 +313,9 @@ export class ResourcesGridComponent implements OnInit {
this.dialog.open(InstallLibrariesComponent, { data: data })
.afterClosed().subscribe(() => this.buildGrid());
} else if (action === 'schedule') {
- this.scheduler.open({ isFooter: false }, data, 'EXPLORATORY');
+ // this.scheduler.open({ isFooter: false }, data, 'EXPLORATORY');
+ this.dialog.open(SchedulerComponent, { data: {notebook: data, type: 'EXPLORATORY'} })
+ .afterClosed().subscribe(() => this.buildGrid());
} else if (action === 'ami') {
this.dialog.open(AmiCreateDialogComponent, { data: data })
.afterClosed().subscribe(() => this.buildGrid());
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/index.ts b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/index.ts
index f407368..b2d7683 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/index.ts
@@ -42,6 +42,7 @@ export * from './scheduler.model';
TimePickerModule
],
declarations: [SchedulerComponent],
+ entryComponents: [SchedulerComponent],
exports: [SchedulerComponent]
})
export class SchedulerModule {}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html
index 83d55d6..8d6ad16 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.html
@@ -17,16 +17,16 @@
~ under the License.
-->
-<modal-dialog #bindDialog modalClass="scheduler-dialog modal-xl-s">
- <modal-header>
+<div modalClass="scheduler-dialog modal-xl-s">
+ <header>
<h4 class="modal-title">Scheduler
<span *ngIf="destination">for
<b *ngIf="destination.type === 'EXPLORATORY'; else resource">{{ destination.name }}</b>
<ng-template #resource><b>{{ destination.computational_name }}</b></ng-template>
</span>
</h4>
- </modal-header>
- <modal-content>
+ </header>
+ <div class="modal-content">
<div *ngIf="destination" class="content-box">
<form [formGroup]="schedulerForm">
<div class="enable-schedule">
@@ -203,10 +203,10 @@
</form>
<div class="text-center m-top-30">
- <button mat-raised-button type="button" class="butt action" (click)="close()">Cancel</button>
+ <button mat-raised-button type="button" class="butt action" (click)="dialogRef.close()">Cancel</button>
<button mat-raised-button type="button" class="butt butt-success action" [disabled]="enableIdleTime && !schedulerForm.controls.inactivityTime.valid"
(click)="scheduleInstance_btnClick()">Save</button>
</div>
</div>
- </modal-content>
-</modal-dialog>
\ No newline at end of file
+ </div>
+</div>
\ No newline at end of file
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts
index 3582b11..1837e41 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts
@@ -17,8 +17,9 @@
* under the License.
*/
-import { Component, OnInit, ViewChild, Output, EventEmitter, ViewEncapsulation, ChangeDetectorRef } from '@angular/core';
+import { Component, OnInit, ViewChild, Output, EventEmitter, ViewEncapsulation, ChangeDetectorRef, Inject } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { ToastrService } from 'ngx-toastr';
import * as _moment from 'moment';
@@ -67,37 +68,39 @@ export class SchedulerComponent implements OnInit {
public inactivityLimits = { min: 120, max: 10080 };
public integerRegex: string = '^[0-9]*$';
- @ViewChild('bindDialog') bindDialog;
+ // @ViewChild('bindDialog') bindDialog;
@ViewChild('resourceSelect') resource_select;
- @Output() buildGrid: EventEmitter<{}> = new EventEmitter();
+ // @Output() buildGrid: EventEmitter<{}> = new EventEmitter();
constructor(
+ @Inject(MAT_DIALOG_DATA) public data: any,
+ public toastr: ToastrService,
+ public dialogRef: MatDialogRef<SchedulerComponent>,
private formBuilder: FormBuilder,
private schedulerService: SchedulerService,
- private changeDetector: ChangeDetectorRef,
- public toastr: ToastrService
+ private changeDetector: ChangeDetectorRef
) {}
ngOnInit() {
- this.bindDialog.onClosing = () => {
- this.resetDialog();
- this.buildGrid.emit();
- };
+ // this.bindDialog.onClosing = () => {
+ // this.resetDialog();
+ // this.buildGrid.emit();
+ // };
+ this.open(this.data.notebook, this.data.type, this.data.resource);
}
- public open(param, notebook, type, resource?): void {
+ public open(notebook, type, resource?): void {
this.notebook = notebook;
this.zones = _moment.tz.names()
.map(el => _moment.tz(el).format('Z'))
.filter((item, pos, ar) => ar.indexOf(item) === pos)
.sort();
- if (!this.bindDialog.isOpened)
this.model = new SchedulerModel(
response => {
if (response.status === HTTP_STATUS_CODES.OK) {
this.toastr.success('Schedule data were successfully saved', 'Success!');
- this.close();
+ this.dialogRef.close();
}
},
error => this.toastr.error(error.message || 'Scheduler configuration failed!', 'Oops!'),
@@ -118,7 +121,7 @@ export class SchedulerComponent implements OnInit {
this.allowInheritView = this.checkIsActiveSpark();
this.getExploratorySchedule(this.notebook.name);
}
- this.bindDialog.open(param);
+ // this.bindDialog.open(param);
},
this.schedulerService
);
@@ -179,7 +182,7 @@ export class SchedulerComponent implements OnInit {
this.model.setInactivityTime(params).subscribe((response: any) => {
if (response.status === HTTP_STATUS_CODES.OK) {
this.toastr.success('Schedule data were successfully saved', 'Success!');
- this.close();
+ this.dialogRef.close();
}
},
error => this.toastr.error(error.message || 'Scheduler configuration failed!', 'Oops!'));
@@ -206,7 +209,7 @@ export class SchedulerComponent implements OnInit {
.subscribe(() => {
this.resetDialog();
this.toastr.success('Schedule data were successfully deleted', 'Success!');
- this.close();
+ this.dialogRef.close();
});
}
@@ -259,13 +262,13 @@ export class SchedulerComponent implements OnInit {
: this.setInactivity(this.notebook.name, {...data, consider_inactivity: this.considerInactivity});
}
- public close(): void {
- if (this.bindDialog.isOpened) {
- this.bindDialog.close();
- }
+ // public close(): void {
+ // if (this.bindDialog.isOpened) {
+ // this.bindDialog.close();
+ // }
- this.resetDialog();
- }
+ // this.resetDialog();
+ // }
private formInit(start?: string, end?: string, terminate?: string) {
this.schedulerForm = this.formBuilder.group({
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org