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/07/14 15:10:25 UTC

[incubator-dlab] 01/01: [DLAB-1749] Fixed set of UI tasks in audit(Part3)

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

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

commit 2b8d50274b477496d5c675ce23c9ea038ab8fafe
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Tue Jul 14 18:09:55 2020 +0300

    [DLAB-1749] Fixed set of UI tasks in audit(Part3)
---
 .../service/impl/UserGroupServiceImpl.java         |  8 +++----
 .../audit/audit-grid/audit-grid.component.ts       |  2 +-
 .../cluster-details/cluster-details.component.html | 20 +++++++++++++----
 .../cluster-details/cluster-details.component.scss | 11 +++++++++
 .../cluster-details/cluster-details.component.ts   | 22 ++++++++++++++++--
 .../detail-dialog/detail-dialog.component.html     | 26 ++++++++++++++++------
 .../detail-dialog/detail-dialog.component.scss     |  6 +++++
 .../detail-dialog/detail-dialog.component.ts       | 18 ++++++++++-----
 .../webapp/src/assets/styles/_dialogs.scss         |  7 ++++--
 .../resources/webapp/src/assets/styles/_theme.scss |  3 +++
 10 files changed, 97 insertions(+), 26 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java
index c646a53..5b5b7e5 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java
@@ -58,10 +58,10 @@ import static com.epam.dlab.backendapi.domain.AuditResourceTypeEnum.GROUP;
 @Singleton
 @Slf4j
 public class UserGroupServiceImpl implements UserGroupService {
-	private static final String AUDIT_ADD_ROLE_MESSAGE = "Add role(s): %s.\n";
-	private static final String AUDIT_REMOVE_ROLE_MESSAGE = "Remove role(s): %s.\n";
-	private static final String AUDIT_ADD_USER_MESSAGE = "Add user(s): %s.\n";
-	private static final String AUDIT_REMOVE_USER_MESSAGE = "Remove user(s): %s.\n";
+	private static final String AUDIT_ADD_ROLE_MESSAGE = "Add role(s): %s\n";
+	private static final String AUDIT_REMOVE_ROLE_MESSAGE = "Remove role(s): %s\n";
+	private static final String AUDIT_ADD_USER_MESSAGE = "Add user(s): %s\n";
+	private static final String AUDIT_REMOVE_USER_MESSAGE = "Remove user(s): %s\n";
 	private static final String ROLE_NOT_FOUND_MSG = "Any of role : %s were not found";
 	private static final String ADMIN = "admin";
 	private static final String PROJECT_ADMIN = "projectAdmin";
diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts
index 7b112ee..4dc5aae 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts
@@ -240,7 +240,7 @@ export class AuditGridComponent implements OnInit {
                   <p *ngIf="data.element.info.indexOf('Scheduled') !== -1;else notScheduled"> {{data.element.action | titlecase}} by scheduler, requested for notebook <span class="strong">{{data.element.info.split(' ')[data.element.info.split(' ').length - 1] }}</span>.</p>
                   <ng-template #notScheduled>
                     <p>
-                      <span *ngIf="data.element.action === 'FOLLOW_LINK'">Follow compute <span class="strong">{{info.cluster}}</span>&nbsp;<span>{{info.clusterType}}</span> link, requested for notebook <span class="strong">{{info.notebook}}</span>.</span>
+                      <span *ngIf="data.element.action === 'FOLLOW_LINK'">{{info.action | titlecase}} compute <span class="strong">{{info.cluster}}</span>&nbsp;<span>{{info.clusterType}}</span> link, requested for notebook <span class="strong">{{info.notebook}}</span>.</span>
                       <span *ngIf="data.element.action !== 'FOLLOW_LINK'">{{data.element.action | titlecase}} compute <span class="strong">{{data.element.resourceName}}</span>, requested for notebook <span class="strong">{{data.element.info.split(' ')[data.element.info.split(' ').length - 1] }}</span>.</span>
                     </p>
                     </ng-template>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html
index 70d583b..2d7fd60 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html
@@ -101,10 +101,22 @@
             <p class="time_info">Up time {{upTimeInHours}} hour(s) since {{upTimeSince || "not specified."}}</p>
           </div>
           <div class="m-top-10">
-            <p *ngFor="let item of resource.computational_url" class="ellipsis flex">
-              <span class="strong">{{ item.description }}:</span>&nbsp;
-              <a (click)="logAction(resource, environment)" href="{{item.url}}" target="_blank" matTooltip="{{item.url}}"
-                matTooltipPosition="above">{{ item.url }}</a>
+            <p *ngFor="let item of resource.computational_url" class="ellipsis flex" (mouseleave)="hideCopyIcon()">
+              <span class="strong spark-url-desc">{{ item.description }}:</span>&nbsp;
+              <a (click)="logAction(resource, environment, 'follow')"
+                 href="{{item.url}}"
+                 target="_blank"
+                 matTooltip="{{item.url}}"
+                 matTooltipPosition="above"
+                 (mouseover)="showCopyIcon(item.description)"
+                 class="spark-url none-select"
+                 (contextmenu)="false"
+              >{{ item.url }}</a>
+              <span (click)="logAction(resource, environment, 'copy');$event.stopPropagation()" *ngIf="isCopyIconVissible[item.description]" [matTooltip]="isCopied ? 'Copy bucket name' : 'Copied'" matTooltipPosition="above" class="copy-icon-wrapper">
+                  <span  class="link-icon" (click)="copyBucketName(item.url)" >
+                    <span _ngcontent-xpv-c19="" class="material-icons" (click)="this.isCopied = false">content_copy</span>
+                   </span>
+              </span>
             </p>
           </div>
         </div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.scss
index 0c26eaf..e5c5647 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.scss
@@ -68,3 +68,14 @@
     }
   }
 }
+
+.spark-url{
+  max-width: 250px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+.copy-icon-wrapper{
+  margin-top: -2px;
+  margin-left: 5px;
+}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts
index 1ed7bc4..46198bc 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts
@@ -27,6 +27,7 @@ import { DataengineConfigurationService } from '../../../core/services';
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { CLUSTER_CONFIGURATION } from '../computational-resource-create-dialog/cluster-configuration-templates';
 import {AuditService} from '../../../core/services/audit.service';
+import {CopyPathUtils} from '../../../core/util/copyPathUtils';
 
 @Component({
   selector: 'dlab-cluster-details',
@@ -47,6 +48,8 @@ export class DetailComputationalResourcesComponent implements OnInit {
   tooltip: boolean = false;
   config: Array<{}> = [];
   public configurationForm: FormGroup;
+  isCopyIconVissible: any = {};
+  isCopied: boolean;
 
   constructor(
     @Inject(MAT_DIALOG_DATA) public data: any,
@@ -118,13 +121,28 @@ export class DetailComputationalResourcesComponent implements OnInit {
         : null;
   }
 
-  private logAction(resource: any, environment) {
+  private logAction(resource: any, environment, copy?: string) {
     const clusterInfo = {
+      action: copy,
       cluster: resource.computational_name,
       notebook: environment.name,
       clusterType: resource.dataEngineType === 'dataengine-service' ? 'Hadoop' : 'Master'
-    }
+    };
 
     this.auditService.sendDataToAudit({resource_name: resource.computational_name, info: JSON.stringify(clusterInfo), type: 'COMPUTE'}).subscribe();
   }
+
+  copyBucketName(url: string) {
+    CopyPathUtils.copyPath(url);
+  }
+
+  protected showCopyIcon(element) {
+    this.isCopyIconVissible[element] = true;
+  }
+  protected hideCopyIcon() {
+    for (const key in this.isCopyIconVissible) {
+      this.isCopyIconVissible[key] = false;
+    }
+    this.isCopied = true;
+  }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html
index 2095926..7aa8a50 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.html
@@ -17,6 +17,7 @@
   ~ under the License.
   -->
 
+<script src="detail-dialog.component.ts"></script>
 <div class="detail-dialog" id="dialog-box">
   <header class="dialog-header header-white">
     <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
@@ -58,12 +59,23 @@
               {{upTimeSince || "not specified."}}</p>
             <p *ngIf="notebook.url?.length">Open following URL(s) in your browser to access this box:</p>
             <div class="links_block">
-              <p *ngFor="let item of notebook.url">
+              <p *ngFor="let item of notebook.url" (mouseleave)="hideCopyIcon()">
                 <span class="description">{{item.description}}: &nbsp;</span>
-                <a  (click)="logAction(notebook.name, item.description)" class="ellipsis" matTooltip="{{item.url}}" matTooltipPosition="above" href="{{item.url}}"
-                  target="_blank">
+                <a (mouseover)="showCopyIcon(item.description)"
+                   (click)="logAction(notebook.name, item.description)"
+                   class="ellipsis none-select" matTooltip="{{item.url}}"
+                   matTooltipPosition="above"
+                   href="{{item.url}}"
+                  target="_blank"
+                   (contextmenu)="false"
+                >
                   &nbsp;{{item.url}}
                 </a>
+                <span (click)="logAction(notebook.name, item.description, 'Copy');$event.stopPropagation()" *ngIf="isCopyIconVissible[item.description]" [matTooltip]="isCopied ? 'Copy bucket name' : 'Copied'" matTooltipPosition="above" class="copy-icon-wrapper">
+                  <span  class="link-icon" (click)="copyBucketName(item.url)" >
+                    <span _ngcontent-xpv-c19="" class="material-icons" (click)="this.isCopied = false">content_copy</span>
+                   </span>
+                </span>
               </p>
             </div>
             <p class="flex" *ngIf="notebook.username">Node User: &nbsp;<span
@@ -77,7 +89,7 @@
                 <p *ngIf="PROVIDER === 'azure' && notebook.account_name">
                   <span
                     class="bucket-info"
-                    (mouseover)="showCopyIcon()"
+                    (mouseover)="showCopyIcon('bucket')"
                     [matTooltip]="notebook.bucket_name + '@' + notebook.account_name + '.blob.core.windows.net'"
                     matTooltipPosition="above"
                     [matTooltipClass]="'bucket-item-tooltip'"
@@ -86,7 +98,7 @@
 <!--                    rc-22-projecta-conteiner@1ebobsvx7t.blob.core.windows.net-->
                   </span>
 
-                  <span  *ngIf="isCopyIconVissible" [matTooltip]="isCopied ? 'Copy bucket name' : 'Copied'" matTooltipPosition="above">
+                  <span  *ngIf="isCopyIconVissible.bucket" [matTooltip]="isCopied ? 'Copy bucket name' : 'Copied'" matTooltipPosition="above">
                     <span  class="link-icon" (click)="copyBucketName(notebook.bucket_name + '@' + notebook.account_name + '.blob.core.windows.net');$event.stopPropagation()" >
                     <span _ngcontent-xpv-c19="" class="material-icons" (click)="this.isCopied = false">content_copy</span>
                   </span>
@@ -95,11 +107,11 @@
                 <p *ngIf="notebook.bucket_name && PROVIDER !== 'azure'">{{ DICTIONARY[PROVIDER].container }}
                   <span
                     class="bucket-info"
-                    (mouseover)="showCopyIcon()"
+                    (mouseover)="showCopyIcon('bucket')"
                   >
                     {{ notebook.bucket_name }}
                 </span>
-                  <span  *ngIf="isCopyIconVissible" [matTooltip]="isCopied ? 'Copy bucket name' : 'Copied'" matTooltipPosition="above">
+                  <span  *ngIf="isCopyIconVissible.bucket" [matTooltip]="isCopied ? 'Copy bucket name' : 'Copied'" matTooltipPosition="above">
                     <span  class="link-icon" (click)="copyBucketName(notebook.bucket_name);$event.stopPropagation()" >
                     <span _ngcontent-xpv-c19="" class="material-icons" (click)="this.isCopied = false">content_copy</span>
                   </span>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.scss
index c6722ef..b61b214 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/detail-dialog/detail-dialog.component.scss
@@ -102,4 +102,10 @@
   }
 }
 
+.copy-icon-wrapper{
+  width: 20px;
+  margin-left: 5px;
+  margin-right: 5px;
+}
+
 
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 89a4e29..bf55dc6 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
@@ -47,7 +47,7 @@ export class DetailDialogComponent implements OnInit {
   config: Array<{}> = [];
   bucketStatus: object = {};
   isBucketAllowed = true;
-  isCopyIconVissible = false;
+  isCopyIconVissible: {bucket} = {bucket: false};
 
   public configurationForm: FormGroup;
 
@@ -148,11 +148,13 @@ export class DetailDialogComponent implements OnInit {
     .afterClosed().subscribe();
   }
 
-  protected showCopyIcon() {
-    this.isCopyIconVissible = true;
+  protected showCopyIcon(element) {
+    this.isCopyIconVissible[element] = true;
   }
   protected hideCopyIcon() {
-    this.isCopyIconVissible = false;
+    for (const key in this.isCopyIconVissible) {
+      this.isCopyIconVissible[key] = false;
+    }
     this.isCopied = true;
   }
 
@@ -160,7 +162,11 @@ export class DetailDialogComponent implements OnInit {
     CopyPathUtils.copyPath(copyValue);
   }
 
-  private logAction(name: any, description: string) {
-    this.auditService.sendDataToAudit({resource_name: name, info: `Follow ${description} link`, type: 'NOTEBOOK'}).subscribe();
+  private logAction(name: any, description: string, copy?: string) {
+    if (copy) {
+      this.auditService.sendDataToAudit({resource_name: name, info: `Copy ${description} link`, type: 'NOTEBOOK'}).subscribe();
+    } else {
+      this.auditService.sendDataToAudit({resource_name: name, info: `Follow ${description} link`, type: 'NOTEBOOK'}).subscribe();
+    }
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
index 91b3ed4..91881da 100644
--- a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
+++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
@@ -146,6 +146,9 @@ mat-dialog-container {
         text-decoration: none;
         transition: all .45s ease-in-out;
         line-height: 19px;
+        &.spark-url{
+          line-height: 16px;
+        }
 
         &:hover {
           color: #5faec7;
@@ -276,7 +279,7 @@ mat-dialog-container {
     }
   }
 
-  span:not(.description) {
+  span:not(.description),{
     font-size: 14px;
     overflow: hidden;
     text-overflow: ellipsis;
@@ -286,7 +289,7 @@ mat-dialog-container {
     &.link-icon{
       //margin-left: 10px;
       cursor: pointer;
-      padding-top: 3px;
+      padding-top: 2px;
     }
   }
 
diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
index 70b0e56..2500caf 100644
--- a/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
+++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
@@ -484,6 +484,9 @@ span.mat-slide-toggle-content {
     transform: rotate(45deg);
   }
 }
+.none-select{
+  user-select: none;
+}
 
 .action-select-wrapper{
   position: relative;


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