From 0d7474d4afb32d1794ffc8916f6643a98a63cd59 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:28:08 -0800 Subject: [PATCH] Update Angular control flow --- src-ui/angular.json | 6 +- src-ui/src/app/app.component.html | 52 +- .../components/admin/logs/logs.component.html | 42 +- .../admin/settings/settings.component.html | 346 ++++++------ .../admin/tasks/tasks.component.html | 266 +++++---- .../users-groups/users-groups.component.html | 169 +++--- .../app-frame/app-frame.component.html | 529 +++++++++--------- .../clearable-badge.component.html | 18 +- .../confirm-dialog.component.html | 52 +- .../date-dropdown.component.html | 82 +-- ...mption-template-edit-dialog.component.html | 154 ++--- .../correspondent-edit-dialog.component.html | 8 +- .../custom-field-edit-dialog.component.html | 4 +- .../document-type-edit-dialog.component.html | 46 +- .../mail-account-edit-dialog.component.html | 8 +- .../mail-rule-edit-dialog.component.html | 12 +- .../storage-path-edit-dialog.component.html | 8 +- .../tag-edit-dialog.component.html | 52 +- .../filterable-dropdown.component.html | 76 +-- .../toggleable-dropdown-button.component.html | 23 +- .../common/input/check/check.component.html | 36 +- .../common/input/color/color.component.html | 40 +- .../common/input/date/date.component.html | 68 ++- .../document-link.component.html | 62 +- .../common/input/number/number.component.html | 34 +- .../input/password/password.component.html | 16 +- .../permissions-form.component.html | 106 ++-- .../common/input/select/select.component.html | 112 ++-- .../common/input/select/select.component.ts | 2 +- .../common/input/tags/tags.component.html | 50 +- .../common/input/text/text.component.html | 28 +- .../common/input/url/url.component.html | 18 +- .../page-header/page-header.component.html | 4 +- .../permissions-dialog.component.html | 38 +- ...permissions-filter-dropdown.component.html | 168 +++--- .../permissions-select.component.html | 32 +- .../profile-edit-dialog.component.html | 92 +-- .../share-links-dropdown.component.html | 124 ++-- .../components/common/tag/tag.component.html | 24 +- .../common/toasts/toasts.component.html | 99 ++-- .../common/toasts/toasts.component.ts | 2 +- .../dashboard/dashboard.component.html | 38 +- .../saved-view-widget.component.html | 101 ++-- .../statistics-widget.component.html | 104 ++-- .../upload-file-widget.component.html | 78 ++- .../widget-frame/widget-frame.component.html | 16 +- .../document-detail.component.html | 487 ++++++++-------- .../metadata-collapse.component.html | 28 +- .../bulk-editor/bulk-editor.component.html | 254 ++++----- .../document-card-large.component.html | 202 ++++--- .../document-card-small.component.html | 96 ++-- .../document-list.component.html | 368 ++++++------ .../filter-editor.component.html | 46 +- .../save-view-config-dialog.component.html | 12 +- .../document-notes.component.html | 42 +- .../consumption-templates.component.html | 76 +-- .../custom-fields.component.html | 72 +-- .../manage/mail/mail.component.html | 184 +++--- .../management-list.component.html | 217 +++---- 59 files changed, 3028 insertions(+), 2501 deletions(-) diff --git a/src-ui/angular.json b/src-ui/angular.json index 9a73922c7..ad328c072 100644 --- a/src-ui/angular.json +++ b/src-ui/angular.json @@ -125,18 +125,18 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "paperless-ui:build:en-US" + "buildTarget": "paperless-ui:build:en-US" }, "configurations": { "production": { - "browserTarget": "paperless-ui:build:production" + "buildTarget": "paperless-ui:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "paperless-ui:build" + "buildTarget": "paperless-ui:build" } }, "test": { diff --git a/src-ui/src/app/app.component.html b/src-ui/src/app/app.component.html index ef2addf2c..5ffe4aebe 100644 --- a/src-ui/src/app/app.component.html +++ b/src-ui/src/app/app.component.html @@ -1,32 +1,36 @@ - - - + + + - -

-
-
- {{ tourService.steps?.indexOf(step) + 1 }} / {{ tourService.steps?.length }} - + +

+
+
+ {{ tourService.steps?.indexOf(step) + 1 }} / {{ tourService.steps?.length }} + +
+
diff --git a/src-ui/src/app/components/admin/logs/logs.component.html b/src-ui/src/app/components/admin/logs/logs.component.html index 628886c62..bf100b19c 100644 --- a/src-ui/src/app/components/admin/logs/logs.component.html +++ b/src-ui/src/app/components/admin/logs/logs.component.html @@ -6,25 +6,35 @@
-
-
- Loading... -
-

{{log}}

+ @if (isLoading && logFiles.length) { +
+
+ Loading... +
+ } + @for (log of logs; track log) { +

{{log}}

+ }
diff --git a/src-ui/src/app/components/admin/settings/settings.component.html b/src-ui/src/app/components/admin/settings/settings.component.html index 7d09a8b61..07b062a00 100644 --- a/src-ui/src/app/components/admin/settings/settings.component.html +++ b/src-ui/src/app/components/admin/settings/settings.component.html @@ -1,10 +1,10 @@ - Open Django Admin - - - + Open Django Admin + + + @@ -24,10 +24,16 @@
- You need to reload the page after applying a new language. + @if (displayLanguageIsDirty) { + You need to reload the page after applying a new language. + }
@@ -39,7 +45,11 @@
@@ -127,198 +137,202 @@ + Reset + + - -

Update checking

+

Update checking

-
-
-

+

+
+

Update checking works by pinging the public GitHub API for the latest release to determine whether a new version is available.
Actual updating of the app must still be performed manually.

-

+

No tracking data is collected by the app in any way.

- + +
-
-

Bulk editing

+

Bulk editing

-
-
- - +
+
+ + +
-
-

Notes

+

Notes

-
-
- +
+
+ +
-
- - + + -
  • - Permissions - +
  • + Permissions + -

    Default Permissions

    +

    Default Permissions

    -
    -
    -

    +

    +
    +

    Settings apply to this user account for objects (Tags, Mail Rules, etc.) created via the web UI

    -
    -
    -
    -
    - Default Owner -
    -
    - - Objects without an owner can be viewed and edited by all users -
    -
    -
    -
    - Default View Permissions -
    -
    -
    -
    - Users: -
    -
    - - - -
    -
    -
    -
    - Groups: -
    -
    - - - -
    -
    -
    -
    - Default Edit Permissions -
    -
    -
    -
    - Users: -
    -
    - - - -
    +
    +
    + Default Owner
    -
    -
    - Groups: -
    -
    - - - -
    -
    -
    - Edit permissions also grant viewing permissions +
    + + Objects without an owner can be viewed and edited by all users
    -
    - -
  • - -
  • - Notifications - - -

    Document processing

    - -
    -
    - - - - -
    -
    - -
    -
  • - -
  • - Saved views - - -

    Settings

    -
    -
    - -
    -
    - -

    Views

    -
    - -
    -
    - - -
    - -
    - -
    - - +
    +
    + Default View Permissions +
    +
    +
    +
    + Users:
    -
    - - +
    + + +
    - -
    - - +
    +
    + Groups: +
    +
    + + + +
    - -
    No saved views defined.
    - -
    -
    -
    Loading...
    +
    +
    +
    + Default Edit Permissions
    +
    +
    +
    + Users: +
    +
    + + + +
    +
    +
    +
    + Groups: +
    +
    + + + +
    +
    +
    + Edit permissions also grant viewing permissions +
    +
    +
    + +
  • -
    +
  • + Notifications + - -
  • - +

    Document processing

    -
    +
    +
    + + + + +
    +
    - - + + + +
  • + Saved views + + +

    Settings

    +
    +
    + +
    +
    + +

    Views

    +
    + + @for (view of savedViews; track view) { +
    +
    + + +
    +
    + +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + } + + @if (savedViews && savedViews.length === 0) { +
    No saved views defined.
    + } + + @if (!savedViews) { +
    +
    +
    Loading...
    +
    + } + +
    + +
    +
  • + + +
    + + + diff --git a/src-ui/src/app/components/admin/tasks/tasks.component.html b/src-ui/src/app/components/admin/tasks/tasks.component.html index 7e0ac4cae..6531f146a 100644 --- a/src-ui/src/app/components/admin/tasks/tasks.component.html +++ b/src-ui/src/app/components/admin/tasks/tasks.component.html @@ -3,127 +3,153 @@ - -
    - - -
    -
    - +  Clear selection + + +
    + + +
    +
    + - -
    -
    Loading...
    -
    + @if (!tasksService.completedFileTasks && tasksService.loading) { +
    +
    Loading...
    + } - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -
    NameCreatedResultsInfoActions
    -
    - - -
    -
    {{ task.task_file_name }}{{ task.date_created | customDate:'short' }} -
    - {{ task.result | slice:0:50 }}… -
    - {{ task.result }} - -
    {{ task.result | slice:0:300 }}
    -
    (click for full output)
    -
    -
    - - -
    - - - - -
    -
    -
    {{ task.result }}
    -
    + + + + + + + + @if (activeTab !== 'started' && activeTab !== 'queued') { + + } + + + + + + @for (task of tasks | slice: (page-1) * pageSize : page * pageSize; track task) { + + + + + @if (activeTab !== 'started' && activeTab !== 'queued') { + + } + + + + + + + } + +
    +
    + + +
    +
    NameCreatedResultsInfoActions
    +
    + + +
    +
    {{ task.task_file_name }}{{ task.date_created | customDate:'short' }} + @if (task.result?.length > 50) { +
    + {{ task.result | slice:0:50 }}… +
    + } + @if (task.result?.length <= 50) { + {{ task.result }} + } + +
    {{ task.result | slice:0:300 }}@if (task.result.length > 300) {
    +                      …
    +                    }
    + @if (task.result?.length > 300) { +
    (click for full output) + } +
    +
    + + +
    + + + @if (task.related_document) { + + } + +
    +
    +
    {{ task.result }}
    +
    -
    -
    {tasks.length, plural, =1 {One {{this.activeTabLocalized}} task} other {{{tasks.length || 0}} total {{this.activeTabLocalized}} tasks}}
    - -
    -
    +
    + @if (tasks.length > 0) { +
    {tasks.length, plural, =1 {One {{this.activeTabLocalized}} task} other {{{tasks.length || 0}} total {{this.activeTabLocalized}} tasks}}
    + } + @if (tasks.length > pageSize) { + + } +
    +
    - -
    + +
    diff --git a/src-ui/src/app/components/admin/users-groups/users-groups.component.html b/src-ui/src/app/components/admin/users-groups/users-groups.component.html index 66dc35d89..ce794f873 100644 --- a/src-ui/src/app/components/admin/users-groups/users-groups.component.html +++ b/src-ui/src/app/components/admin/users-groups/users-groups.component.html @@ -1,97 +1,104 @@ - -

    - Users - -

    -
      -
    • +@if (users) { +

      + Users + +

      +
        +
      • +
        +
        Username
        +
        Name
        +
        Groups
        +
        Actions
        +
        +
      • + @for (user of users; track user) { +
      • -
        Username
        -
        Name
        -
        Groups
        -
        Actions
        -
        -
      • - -
      • -
        -
        -
        {{user.first_name}} {{user.last_name}}
        -
        {{user.groups?.map(getGroupName, this).join(', ')}}
        -
        +
        +
        {{user.first_name}} {{user.last_name}}
        +
        {{user.groups?.map(getGroupName, this).join(', ')}}
        +
        - + +
        +
        -
        - -
      • -
      - +
    • + } +
    + } - -

    + @if (groups) { +

    Groups -

    -
      -
    • -
      -
      Name
      -
      -
      -
      Actions
      -
      -
    • - -
    • -
      -
      -
      -
      -
      -
      -
      +
      +
      +
      +
      + - -
      -
      -
      -
    • -
    • No groups defined
    • -
    +  Edit + + + + + + + } + @if (groups.length === 0) { +
  • No groups defined
  • + } + + } + } -
    - -
    -
    -
    Loading...
    -
    + @if (!users || !groups) { +
    +
    +
    Loading...
    +
    + } diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html index 556252670..dc34fef8c 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.html +++ b/src-ui/src/app/components/app-frame/app-frame.component.html @@ -17,11 +17,13 @@ - + @if (!searchFieldEmpty) { + + } - - -
    -
    - + +
    +
    + +

    + + @if (settingsService.updateCheckingIsSet) { + @if (appRemoteVersion.update_available) { + + + + + @if (appRemoteVersion?.update_available) { + Update available + } + + } + } @else { + + + + + + } +
    + } +
    + + +
    + -
    - -
    -
    - +
    + +
    + + diff --git a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html index 57b3ba39a..6425c63e5 100644 --- a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html +++ b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html @@ -1,9 +1,15 @@ - + +} diff --git a/src-ui/src/app/components/common/confirm-dialog/confirm-dialog.component.html b/src-ui/src/app/components/common/confirm-dialog/confirm-dialog.component.html index 2b60ff9de..bb5577061 100644 --- a/src-ui/src/app/components/common/confirm-dialog/confirm-dialog.component.html +++ b/src-ui/src/app/components/common/confirm-dialog/confirm-dialog.component.html @@ -1,24 +1,32 @@ - - - + + + + @if (alternativeBtnCaption) { + + } + diff --git a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html index 2b5804829..f3ac1ed77 100644 --- a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html +++ b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html @@ -1,15 +1,18 @@ -
    +
    +
    + + } + @if (mailRules.length === 0) { +
  • No mail rules defined.
  • + } + - + -
    -
    -
    Loading...
    -
    + @if (!mailAccounts || !mailRules) { +
    +
    +
    Loading...
    +
    + } diff --git a/src-ui/src/app/components/manage/management-list/management-list.component.html b/src-ui/src/app/components/manage/management-list/management-list.component.html index 3592c9cfa..ca9ec4750 100644 --- a/src-ui/src/app/components/manage/management-list/management-list.component.html +++ b/src-ui/src/app/components/manage/management-list/management-list.component.html @@ -2,112 +2,131 @@ - - + + - + -
    -
    -
    - - +
    +
    +
    + + +
    +
    + +
    -
    - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -
    NameMatchingDocument count{{column.name}}Actions
    -
    - Loading... -
    -
    - - -
    -
    {{ getMatching(object) }}{{ object.document_count }} -
    - {{ column.valueFn.call(null, object) }} -
    -
    -
    - -
    - - - -
    +
    + + + + + + + + @for (column of extraColumns; track column) { + + } + + + + + @if (isLoading) { + + + + } + @for (object of data; track object) { + + + + + + @for (column of extraColumns; track column) { + + } + + + } + +
    +
    + + +
    +
    NameMatchingDocument count{{column.name}}Actions
    +
    + Loading... +
    +
    + + +
    +
    {{ getMatching(object) }}{{ object.document_count }} + @if (column.rendersHtml) { +
    + } @else { + {{ column.valueFn.call(null, object) }} + } +
    +
    +
    + +
    + + + +
    +
    +
    +
    + + + +
    +
    -
    -
    - - - -
    -
    -
    -
    -
    - {collectionSize, plural, =1 {One {{typeName}}} other {{{collectionSize || 0}} total {{typeNamePlural}}}} -  ({{selectedObjects.size}} selected) -
    - -
    + @if (!isLoading) { +
    + @if (collectionSize > 0) { +
    + {collectionSize, plural, =1 {One {{typeName}}} other {{{collectionSize || 0}} total {{typeNamePlural}}}} + @if (selectedObjects.size > 0) { +  ({{selectedObjects.size}} selected) + } +
    + } + @if (collectionSize > 20) { + + } +
    + }