You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/02/07 12:34:05 UTC

[incubator-dlab] branch develop updated: [DLAB-22]: Added hint about failed computational resource in show active mode (#590)

This is an automated email from the ASF dual-hosted git repository.

dgnatyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8471546  [DLAB-22]: Added hint about failed computational resource in show active mode (#590)
8471546 is described below

commit 84715463d119129e03884c9499eb81dc8095c6ae
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Fri Feb 7 14:33:56 2020 +0200

    [DLAB-22]: Added hint about failed computational resource in show active mode (#590)
---
 .../computational-resource-create.model.ts         |  2 +-
 .../computational/computational-resource.model.ts  | 44 ++++++++++++++++++++++
 .../resources-grid/resources-grid.component.ts     | 24 ++++++++++--
 3 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create.model.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create.model.ts
index a64857d..ce80c52 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create.model.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create.model.ts
@@ -47,7 +47,7 @@ export class ComputationalResourceModel {
         project: env.project,
         custom_tag: parameters.custom_tag
       }, provider);
-    } else if (provider=== 'gcp' && image.image === 'docker.dlab-dataengine-service') {
+    } else if (provider === 'gcp' && image.image === 'docker.dlab-dataengine-service') {
       return this.userResourceService.createComputationalResource_DataengineService({
         template_name: image.template_name,
         image: image.image,
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource.model.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource.model.ts
new file mode 100644
index 0000000..681f4fd
--- /dev/null
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource.model.ts
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+/* tslint:disable:no-empty */
+
+
+import {Injectable} from '@angular/core';
+
+@Injectable()
+
+export class ComputationModel {
+  constructor(
+    public project: string,
+    public exploratory: string,
+    public resource: Array<any>,
+    public status: string,
+  ) { }
+
+  public static computationRes(data) {
+    if (data) {
+      return data.map(value => value.exploratory.map(el => el.resources.map( resource => new ComputationModel(
+        value.project,
+        el.name,
+        resource.computational_name,
+        resource.status,
+      ))));
+    }
+  }
+}
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 21545d0..b78e2aa 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
@@ -40,6 +40,10 @@ import { SchedulerComponent } from '../scheduler';
 
 import { DICTIONARY } from '../../../dictionary/global.dictionary';
 import {ProgressBarService} from '../../core/services/progress-bar.service';
+import {ComputationModel} from '../computational/computational-resource.model';
+
+
+
 
 @Component({
   selector: 'resources-grid',
@@ -129,7 +133,8 @@ export class ResourcesGridComponent implements OnInit {
     if (notebook_name && this.environments && this.environments.length ) {
       const currentProj = this.environments.filter(project => project.project === project_name);
       if (currentProj.length) {
-        return currentProj[0].exploratory.some(item => CheckUtils.delimitersFiltering(notebook_name) === CheckUtils.delimitersFiltering(item.name));
+        return currentProj[0].exploratory
+          .some(item => CheckUtils.delimitersFiltering(notebook_name) === CheckUtils.delimitersFiltering(item.name));
       }
       return false;
     }
@@ -186,7 +191,8 @@ export class ResourcesGridComponent implements OnInit {
       this.dialog.open(ConfirmationDialogComponent, { data: { notebook: data, type: ConfirmationDialogType.StopExploratory }, panelClass: 'modal-sm' })
         .afterClosed().subscribe(() => this.buildGrid());
     } else if (action === 'terminate') {
-      this.dialog.open(ConfirmationDialogComponent, { data: { notebook: data, type: ConfirmationDialogType.TerminateExploratory }, panelClass: 'modal-sm' })
+      this.dialog.open(ConfirmationDialogComponent, { data:
+          { notebook: data, type: ConfirmationDialogType.TerminateExploratory }, panelClass: 'modal-sm' })
         .afterClosed().subscribe(() => this.buildGrid());
     } else if (action === 'install') {
       this.dialog.open(InstallLibrariesComponent, { data: data, panelClass: 'modal-fullscreen' })
@@ -206,7 +212,7 @@ export class ResourcesGridComponent implements OnInit {
   private getResourceByName(notebook_name: string) {
     return this.getEnvironmentsListCopy()
       .map(env => env.exploratory.find(({ name }) => name === notebook_name))
-      .filter(notebook_name => !!notebook_name)[0];
+      .filter(name => !!name)[0];
   }
 
   private getEnvironmentsListCopy() {
@@ -232,6 +238,7 @@ export class ResourcesGridComponent implements OnInit {
   }
 
   private applyFilter_btnClick(config: FilterConfigurationModel) {
+
     let filteredData = this.getEnvironmentsListCopy();
 
     const containsStatus = (list, selectedItems) => {
@@ -270,6 +277,17 @@ export class ResourcesGridComponent implements OnInit {
       this.updateUserPreferences(config);
     }
 
+    const failedResource = ComputationModel.computationRes(this.getEnvironmentsListCopy()).flat(3).filter(resourse => resourse.status === 'failed');
+
+    if (this.filteredEnvironments.length && this.activeFiltering) {
+      const creatingResource = ComputationModel.computationRes(this.filteredEnvironments).flat(3).filter(resourse => resourse.status === 'creating');
+      const fail = failedResource
+        .filter(v => creatingResource
+          .some(create => create.project === v.project && create.exploratory === v.exploratory && create.resource === v.resource));
+      if (fail.length) {
+        this.toastr.error('Creating computation resource failed!', 'Oops!');
+      }
+    }
     this.filteredEnvironments = filteredData;
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org