You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by hs...@apache.org on 2022/09/12 11:20:35 UTC
[incubator-datalab] 01/01: implemented unshare with user
This is an automated email from the ASF dual-hosted git repository.
hshpak pushed a commit to branch feat/DATALAB-2996/sharing-confirmation
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 92609c824b787968797cf1b9e6e5c35e8bb7e469
Author: Hennadii_Shpak <bo...@gmail.com>
AuthorDate: Mon Sep 12 14:20:11 2022 +0300
implemented unshare with user
---
.../share-dialog/share-dialog.component.html | 2 +-
.../share-dialog/share-dialog.component.ts | 28 ++++++++++++++++++----
.../share-user-data/share-user-data.component.scss | 4 ++--
3 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.html
index 3b527305c..526404984 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.html
@@ -109,7 +109,7 @@
<div class="user-list__wrapper scrolling">
<ul class="user-list">
<li *ngFor="let entity of userDataList" class="user-list__item">
- <datalab-share-user-data (removeUserData)="onRemoveUserData($event)" [userData]="entity"></datalab-share-user-data>
+ <datalab-share-user-data (removeUserData)="unShare($event)" [userData]="entity"></datalab-share-user-data>
</li>
</ul>
</div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.ts
index 8d8d375e7..2d98c41e5 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-dialog/share-dialog.component.ts
@@ -24,7 +24,7 @@ import { NgModel } from '@angular/forms';
import { ImagesService } from '../../../images/images.service';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ImageActionModalData } from '../../../images';
-import { tap } from 'rxjs/operators';
+import { switchMap, take, tap } from 'rxjs/operators';
import { Observable } from 'rxjs';
@Component({
@@ -58,7 +58,7 @@ export class ShareDialogComponent implements OnInit {
}
ngOnInit(): void {
- this.getSharingUserList();
+ this.initUserList();
}
onAddUser(): void {
@@ -82,16 +82,36 @@ export class ShareDialogComponent implements OnInit {
onRemoveUserData(userName: string): void {
this.temporaryUserDataList = this.temporaryUserDataList.filter(({value}) => value !== userName);
+ const imageInfo = this.imagesService.createImageRequestInfo(this.data.image, this.temporaryUserDataList);
+ this.$getUserListData = this.imagesService.shareImageAllUsers(imageInfo).pipe(
+ take(1),
+ switchMap(() => this.imagesService.getImageShareInfo(imageInfo).pipe(
+ tap(userListData => this.userDataList = userListData)
+ ))
+ );
+ }
+
+ unShare(userName: string): void {
+ this.userDataList = this.userDataList.filter(({value}) => value !== userName);
+ const imageInfo = this.imagesService.createImageRequestInfo(this.data.image, this.userDataList);
+ this.$getUserListData = this.imagesService.shareImageAllUsers(imageInfo).pipe(
+ take(1),
+ switchMap(() => this.getSharingUserList())
+ );
+ }
+
+ private initUserList(): void {
+ this.$getUserListData = this.getSharingUserList();
}
- private getSharingUserList(): void {
+ private getSharingUserList(): Observable<UserData[]> {
const { name, project, endpoint} = this.data.image;
const imageParams = {
imageName: name,
projectName: project,
endpoint
};
- this.$getUserListData = this.imagesService.getImageShareInfo(imageParams).pipe(
+ return this.imagesService.getImageShareInfo(imageParams).pipe(
tap(userListData => this.userDataList = userListData)
);
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-user-data/share-user-data.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-user-data/share-user-data.component.scss
index 3f939f09e..8b776b342 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-user-data/share-user-data.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/image-action-dialog/share-user-data/share-user-data.component.scss
@@ -20,7 +20,7 @@
.user-data {
&__name {
position: relative;
- padding: 2px 20px 2px 10px;
+ padding: 2px 25px 2px 10px;
font-size: 13px;
font-weight: 400;
border-radius: 5px;
@@ -54,7 +54,7 @@
.close-btn {
position: absolute;
top: 2px;
- right: 4px;
+ right: 8px;
background-color: transparent;
border: none;
outline: none;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org