dlab-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgnatys...@apache.org
Subject [incubator-dlab] 01/01: [DLAB-1737]: Fixed all resources disappear after the last endpoint disconnection
Date Wed, 03 Jun 2020 14:27:34 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 5a9b2fad24d94071db48addb48cc8cf9edfda925
Author: Dmytro_Gnatyshyn <di1202@ukr.net>
AuthorDate: Wed Jun 3 17:27:13 2020 +0300

    [DLAB-1737]: Fixed all resources disappear after the last endpoint disconnection
---
 .../bucket-browser/bucket-browser.component.ts     |  3 +-
 .../bucket-browser/bucket-browser.module.ts        | 58 ++++++++++++++++++++++
 .../resources-grid/resources-grid.component.ts     |  6 ++-
 .../webapp/src/app/resources/resources.module.ts   | 15 ++----
 4 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
index b6dcf0d..696835e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts
@@ -101,8 +101,9 @@ export class BucketBrowserComponent implements OnInit {
     this.auth.refreshToken().subscribe(tokens => {
       this.storage.storeTokens(tokens);
       this.isTokenRefreshing = false;
+      this.sendFile();
     });
-    this.sendFile();
+
   }
 
   public showItem(item) {
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts
b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts
new file mode 100644
index 0000000..afec96f
--- /dev/null
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.module.ts
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+
+import { MaterialModule } from '../../shared/material.module';
+import { ResourcesComponent } from '../resources.component';
+import { ResourcesGridModule } from '../resources-grid';
+import { ExploratoryEnvironmentCreateModule } from '../exploratory/create-environment';
+
+import {BucketBrowserComponent} from './bucket-browser.component';
+import {FolderTreeComponent} from './folder-tree/folder-tree.component';
+import {MatTreeModule} from '@angular/material/tree';
+import {BucketDataService} from './bucket-data.service';
+import {BucketConfirmationDialogComponent} from './bucket-confirmation-dialog/bucket-confirmation-dialog.component';
+import {BucketTreeComponent} from './buckets-tree/bucket-tree.component';
+import {ConvertFileSizePipeModule} from '../../core/pipes/convert-file-size';
+
+@NgModule({
+  imports: [
+    CommonModule,
+    FormsModule,
+    ReactiveFormsModule,
+    ResourcesGridModule,
+    ExploratoryEnvironmentCreateModule,
+    MaterialModule,
+    MatTreeModule,
+    ConvertFileSizePipeModule
+  ],
+  declarations: [
+    BucketBrowserComponent,
+    FolderTreeComponent,
+    BucketTreeComponent,
+    BucketConfirmationDialogComponent
+  ],
+  entryComponents: [BucketBrowserComponent, FolderTreeComponent, BucketTreeComponent, BucketConfirmationDialogComponent],
+  providers: [BucketDataService],
+  // exports: [ResourcesComponent]
+})
+export class BucketBrowserModule { }
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 83babee..70cf223 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
@@ -345,6 +345,9 @@ export class ResourcesGridComponent implements OnInit {
   public getBuckets() {
     const bucketsList = this.environments.map(project => {
       return Object.keys(project.projectEndpoints).map(key => {
+        if (project.endpoints.length === 0) {
+          return;
+        }
         const currEndpoint = project.projectEndpoints[key];
         const provider: string =  project.endpoints.filter(endpoint => endpoint['name']
=== key)[0]['cloudProvider'];
         const edgeItem = {name: `${project.project} (${key})`, children: []};
@@ -357,8 +360,9 @@ export class ResourcesGridComponent implements OnInit {
           edgeItem.children.push({name: sharedBucket, endpoint: key});
         }
         return edgeItem;
-      });
+      }).filter(v => v);
     });
+
     this.bucketsList = SortUtils.flatDeep(bucketsList, 1).filter(v => v.children.length);
   }
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
index fa70162..04a412e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
@@ -27,13 +27,10 @@ import { ResourcesGridModule } from './resources-grid';
 import { ExploratoryEnvironmentCreateModule } from './exploratory/create-environment';
 import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
 import { ConfirmDeleteAccountDialog } from './manage-ungit/manage-ungit.component';
-import {BucketBrowserComponent} from './bucket-browser/bucket-browser.component';
-import {FolderTreeComponent} from './bucket-browser/folder-tree/folder-tree.component';
 import {MatTreeModule} from '@angular/material/tree';
 import {BucketDataService} from './bucket-browser/bucket-data.service';
-import {BucketConfirmationDialogComponent} from './bucket-browser/bucket-confirmation-dialog/bucket-confirmation-dialog.component';
-import {BucketTreeComponent} from './bucket-browser/buckets-tree/bucket-tree.component';
 import {ConvertFileSizePipeModule} from '../core/pipes/convert-file-size';
+import {BucketBrowserModule} from './bucket-browser/bucket-browser.module';
 
 @NgModule({
     imports: [
@@ -44,18 +41,16 @@ import {ConvertFileSizePipeModule} from '../core/pipes/convert-file-size';
         ExploratoryEnvironmentCreateModule,
         MaterialModule,
         MatTreeModule,
-        ConvertFileSizePipeModule
+        ConvertFileSizePipeModule,
+        BucketBrowserModule
     ],
   declarations: [
     ResourcesComponent,
     ManageUngitComponent,
     ConfirmDeleteAccountDialog,
-    BucketBrowserComponent,
-    FolderTreeComponent,
-    BucketTreeComponent,
-    BucketConfirmationDialogComponent
+
   ],
-  entryComponents: [ManageUngitComponent, ConfirmDeleteAccountDialog, BucketBrowserComponent,
FolderTreeComponent, BucketTreeComponent, BucketConfirmationDialogComponent],
+  entryComponents: [ManageUngitComponent, ConfirmDeleteAccountDialog],
   providers: [BucketDataService],
   exports: [ResourcesComponent]
 })


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


Mime
View raw message