Skip to content

Commit

Permalink
feat: tuning import esp. for permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Feb 21, 2025
1 parent 28ac2b1 commit 5c6f09e
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<div class="pi pi-question-circle text-3xl danger-action-text"></div>
<div class="flex flex-column row-gap-2">
<div id="bm_delete_message_text" class="font-bold">{{ 'BOOKMARK_DELETE.MESSAGE' | translate }}</div>
<div id="bm_delete_bookmark_display_name" class="px-5 text-center font-bold danger-action-text">
<div
id="bm_delete_bookmark_display_name"
class="px-5 text-center font-bold danger-action-text max-w-25rem text-responsive"
>
{{ bookmark?.displayName }}
</div>
<div class="max-w-28rem px-2 flex flex-column row-gap-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

@include danger-action;
@include word-break-all;
@include displaying-text-responsive;
45 changes: 39 additions & 6 deletions src/app/bookmark/bookmark-import/bookmark-import.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[text]="importError ? (importError.exceptionKey | translate) : ''"
></p-message>

<div class="mt-2 flex flex-column row-gap-4">
<div *ngIf="snapshot !== undefined" class="mt-2 flex flex-column row-gap-4">
<div class="flex flex-column row-gap-1">
<div>{{ 'BOOKMARK_IMPORT.MODE.INFO' | translate }}</div>
<div class="mt-1 flex flex-row justify-content-center align-items-center column-gap-6">
Expand Down Expand Up @@ -63,7 +63,7 @@
</div>
</div>
</div>
<div class="flex flex-column row-gap-2">
<div *ocxIfPermission="'BOOKMARK#ADMIN_EDIT'" class="flex flex-column row-gap-2">
<div>{{ 'BOOKMARK_IMPORT.SCOPE.INFO' | translate }}</div>
<div class="flex flex-row justify-content-center align-items-center column-gap-6">
<p-checkbox
Expand Down Expand Up @@ -95,13 +95,15 @@
</div>
</div>
<p-message
*ocxIfPermission="'BOOKMARK#ADMIN_EDIT'"
id="bm_import_info"
class="my-2 w-full"
class="mt-2"
severity="info"
[text]="'BOOKMARK_IMPORT.INFO' | translate"
></p-message>
</div>
</div>
<div *ocxIfNotPermission="'BOOKMARK#ADMIN_EDIT'" class="my-2"></div>
</p-tabPanel>

<p-tabPanel
Expand All @@ -116,16 +118,47 @@
<input
pInputText
type="text"
id="ps_app_detail_form_field_modification_user"
id="bm_import_snapshot_date"
class="w-full pt-3 pb-2 text-responsive"
[disabled]="true"
[value]="snapshot?.created | date : dateFormat"
[pTooltip]="'INTERNAL.TOOLTIPS.MODIFICATION_USER' | translate"
[pTooltip]="'BOOKMARK_IMPORT.SNAPSHOT.TOOLTIPS.DATE' | translate"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label for="ps_app_detail_form_field_modification_user"> {{ 'INTERNAL.MODIFICATION_USER' | translate }} </label>
<label for="bm_import_snapshot_date">{{ 'BOOKMARK_IMPORT.SNAPSHOT.DATE' | translate }}</label>
</span>
<!-- For ADMINs only: Show both lists in parallel -->
<div
*ocxIfPermission="'BOOKMARK#ADMIN_EDIT'"
class="flex flex-row justify-content-center align-items-start column-gap-5"
>
<div class="flex flex-column">
<div class="font-bold text-sm">{{ 'BOOKMARK.SCOPES.PRIVATE' | translate }}</div>
<div class="m-0 py-1 pl-2 text-sm">
<div class="w-15rem text-responsive" *ngFor="let item of snapshot?.bookmarks?.['PRIVATE']">
{{ item.displayName }}
</div>
</div>
</div>
<div class="flex flex-column">
<div class="font-bold text-sm">{{ 'BOOKMARK.SCOPES.PUBLIC' | translate }}</div>
<div class="m-0 py-1 pl-2 text-sm">
<div class="w-15rem text-responsive" *ngFor="let item of snapshot?.bookmarks?.['PUBLIC']">
{{ item.displayName }}
</div>
</div>
</div>
</div>
<!-- For non-admins: Show both lists in parallel -->
<div *ocxIfNotPermission="'BOOKMARK#ADMIN_EDIT'" class="ml-3 flex flex-column">
<div class="font-bold">{{ 'BOOKMARK_IMPORT.SCOPE.PRIVATE' | translate }}</div>
<div class="m-0 py-1 pl-2">
<div class="w-30rem text-responsive" *ngFor="let item of snapshot?.bookmarks?.['PRIVATE']">
{{ item.displayName }}
</div>
</div>
</div>
</div>
</p-tabPanel>
</p-tabView>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import '/src/app/_bm-mixins.scss';

@include displaying-text-responsive;
@include readable-disabled-form-controls;
@include correct-file-upload;
@include correct-select-button;
@include search-criteria-select-button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@

<ng-template pTemplate="caption">
<div class="flex flex-wrap justify-content-between align-items-center row-gap-1">
<div class="slim-selectbutton align-items-start filter-selectbutton">
<div *ocxIfNotPermission="'BOOKMARK#ADMIN_EDIT'"></div>
<div *ocxIfPermission="'BOOKMARK#ADMIN_EDIT'" class="slim-selectbutton align-items-start filter-selectbutton">
<p-selectButton
inputid="bm_search_table_quick_filter"
styleClass="data-view-control"
Expand Down
5 changes: 4 additions & 1 deletion src/app/bookmark/bookmark-search/bookmark-search.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
BookmarkScope,
BookmarksInternal,
BookmarkExportImport,
BookmarkSearchCriteria,
CreateBookmark,
UpdateBookmark,
EximBookmarkScope,
Expand Down Expand Up @@ -96,7 +97,9 @@ export class BookmarkSearchEffects {
* Bookmark Search in context of current workspace
*/
private performSearch(workspaceName: string) {
return this.bookmarksService.searchBookmarksByCriteria({ workspaceName: workspaceName }).pipe(
let criteria: BookmarkSearchCriteria = { workspaceName: workspaceName }
if (!this.user.hasPermission('BOOKMARK#ADMIN_EDIT')) criteria = { ...criteria, scope: BookmarkScope.Private }
return this.bookmarksService.searchBookmarksByCriteria(criteria).pipe(
map(({ stream, totalElements }) =>
BookmarkSearchActions.bookmarkSearchResultsReceived({
results: stream?.sort(this.sortByPosition) ?? [],
Expand Down
7 changes: 5 additions & 2 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,18 @@
"ERROR": "Import fehlgeschlagen",
"SUCCESS": "Lesezeichen erfolgreich importiert",
"MODE": {
"INFO": "Wie sollen die Lesezeichen importiert werden:",
"INFO": "Wie sollen die Lesezeichen importiert werden?",
"APPEND": "Lesezeichen hinzufügen",
"OVERWRITE": "Bestehende Lesezeichen ersetzen"
},
"SCOPE": {
"INFO": "Welche Lesezeichen sollen importiert werden:",
"INFO": "Welche Lesezeichen sollen importiert werden?",
"PRIVATE": "Eigene Lesezeichen",
"PUBLIC": "Öffentliche Lesezeichen"
},
"SNAPSHOT": {
"DATE": "Erstellt am"
},
"TABS": {
"IMPORT": "Import",
"CONTENT": "Dateiinhalt",
Expand Down
7 changes: 5 additions & 2 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@
"ERROR": "Import failed",
"SUCCESS": "Bookmarks successfully imported",
"MODE": {
"INFO": "How to import the bookmarks:",
"INFO": "How to import the bookmarks?",
"APPEND": "Add Bookmarks",
"OVERWRITE": "Replace existing Bookmarks"
},
"SCOPE": {
"INFO": "Which bookmarks to import:",
"INFO": "Which bookmarks to import?",
"PRIVATE": "My Bookmarks",
"PUBLIC": "Public Bookmarks"
},
Expand All @@ -243,6 +243,9 @@
}
}
},
"SNAPSHOT": {
"DATE": "Created on"
},
"BOOKMARK_SEARCH": {
"HEADER": "Bookmarks",
"SUB_HEADER": "Manage Bookmarks",
Expand Down

0 comments on commit 5c6f09e

Please sign in to comment.