Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

8.5 KB
Raw Blame
<!--Start Top Menu-->
<div class="app-top-menu app-top-menu-tool-bar"
     [attr.aria-label]="'Actions' | translate:locale.language"
     role="toolbar">
  <button (click)="openDialog(true)"
          [attr.aria-label]="(guestsView ? 'New guest' : 'New user') | translate:locale.language"
          class="btn btn-default app-top-menu-tool-bar__action--quiet app-top-menu-tool-bar__action--breadcrumb-aligned"
          [tooltip]="(guestsView ? 'New guest' : 'New user') | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.LucideUserRoundPlus"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>New</span>
  </button>
  <button (click)="openDialog()"
          [attr.aria-label]="(guestsView ? 'Edit guest' : 'Edit user') | translate:locale.language"
          [disabled]="!selected"
          class="btn btn-default app-top-menu-tool-bar__action--quiet"
          [tooltip]="(guestsView ? 'Edit guest' : 'Edit user') | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.LucideUserRoundPen"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Edit</span>
  </button>
  <button (click)="impersonateIdentity()"
          [attr.aria-label]="'Impersonate identity' | translate:locale.language"
          [disabled]="!selected"
          class="btn btn-default"
          [tooltip]="'Impersonate identity' | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.LucideVenetianMask"></svg>
  </button>
  <button (click)="loadUsersOrGuests()"
          [attr.aria-label]="'Refresh' | translate:locale.language"
          class="d-none d-md-block btn btn-default"
          [tooltip]="'Refresh' | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.LucideRotateCw" [class]="loading ? 'icon-spin' : ''"></svg>
  </button>
  <div class="d-flex align-items-center ms-auto">
    <!--Start View Switch-->
    <div class="view-switch" role="group" aria-label="Select user type">
      <button
        type="button"
        class="view-switch__option"
        [class.active]="!guestsView"
        [attr.aria-pressed]="!guestsView"
        (click)="onGuestsView(false)"
        l10nTranslate
      >
        Members
      </button>
      <button
        type="button"
        class="view-switch__option"
        [class.active]="guestsView"
        [attr.aria-pressed]="guestsView"
        (click)="onGuestsView(true)"
        l10nTranslate
      >
        Guests
      </button>
    </div>
    <!--End View Switch-->
  </div>
</div>
<!--End Top Menu-->
<!--Start Table Files Content-->
<table class="app-table">
  <thead>
  <tr>
    @for (th of tableHeaders | keyvalue: originalOrderKeyValue; track th.key) {
      @if (th.value.show) {
        <th (click)="sortBy(th.key)"
            [style.width.%]="th.value.width"
            [class.text-align-center]="th.value.textCenter"
            [class.cursor-pointer]="th.value.sortable"
            class="{{th.value.class}}"
            l10nTranslate>
          {{ th.value.label }}
          @if (sortTable.sortParam.column === th.key) {
            <svg [lucideIcon]="sortTable.sortParam.asc ? icons.LucideArrowDown : icons.LucideArrowUp"></svg>
          }
        </th>
      }
    }
  </tr>
  </thead>
</table>
<app-virtual-scroll (contextmenu)="onContextMenu($event)"
                    [bufferAmount]="5"
                    [items]="users | searchFilter:navbarSearch.viewFilter()">
  <table class="app-table">
    <tbody tabindex="-1">
      @for (u of scrollView?.viewPortItems; track u.id) {
        <tr (click)="onSelect(u)"
            (contextmenu)="onTargetContextMenu($event, u)"
            (appTap)="openDialog()"
            [class.disabled]="!u.isActive"
            [class.selected]="u.id === selected?.id">
          @for (th of tableHeaders | keyvalue: originalOrderKeyValue; track th.key) {
            @if (th.value.show) {
              <td [style.width.%]="th.value.width"
                  [class.text-align-center]="th.value.textCenter"
                  class="{{th.value.class}}">
                @switch (th.key) {
                  @case ('login') {
                    <div class="d-flex align-items-center avatar">
                      <img class="avatar-img" [src]="u.avatarUrl" alt="">
                      <div class="d-flex flex-column text-truncate">
                        <span class="no-pointer-events" draggable="false">
                          {{ u.login }}
                          @if (u.isAdmin) {
                            <svg class="m-0" [lucideIcon]="icons.LucideKeyRound"></svg>
                          }
                        </span>
                        <span class="no-pointer-events text-muted fs-xs" draggable="false">{{ u.email }}</span>
                      </div>
                    </div>
                  }
                  @case ('fullName') {
                    <div class="d-flex flex-column">
                      <span class="no-pointer-events" draggable="false">{{ u.fullName }}</span>
                      @if (u.isAdmin) {
                        <span class="no-pointer-events text-muted" draggable="false" l10nTranslate>{{ u.userRoleText }}</span>
                      }
                    </div>
                  }
                  @case ('managers') {
                    <app-user-avatar-stack [users]="u.managers" [isMember]="true"></app-user-avatar-stack>
                  }
                  @case ('storage') {
                    @if (u.storageUsage || u.storageQuota) {
                      <app-storage-usage [item]="u"></app-storage-usage>
                    }
                  }
                  @case ('currentIp') {
                    <div class="d-flex flex-column">
                      <div>{{ u.currentIp }}</div>
                      <div>{{ u.lastIp }}</div>
                    </div>
                  }
                  @case ('isActive') {
                    <span class="{{u.isActive && !u.isTemporarilyLocked ? 'text-success' : 'text-danger'}}" l10nTranslate>
                      {{ u.userIsActiveText }}
                    </span>
                  }
                  @case ('currentAccess') {
                    @if (u.currentAccess) {
                      <span class="d-flex justify-content-center {{th.value.newly && u[th.value.newly] ? 'badge prop-newly-' + u[th.value.newly] : ''}}"
                           (mouseover)="u.currentAccessHover = true"
                           (focus)="u.currentAccessHover = true"
                           (mouseleave)="u.currentAccessHover = false">
                        @if (u.currentAccessHover) {
                          <span class="d-flex flex-column fs-xs">
                            <span>{{ u.currentAccess | amDateFormat }}</span>
                            <span>{{ u.lastAccess | amDateFormat }}</span>
                          </span>
                        } @else {
                          <span>{{ u.hTimeAgo }}</span>
                        }
                      </span>
                    } @else {
                      <span class="{{th.value.newly && u[th.value.newly] ? 'badge prop-newly-' + u[th.value.newly] : ''}}" l10nTranslate>never</span>
                    }
                  }
                }
              </td>
            }
          }
        </tr>
      }
    </tbody>
  </table>
</app-virtual-scroll>
<!--End Table Files Content-->
<!--Start Foot Content-->
<div class="app-foot-menu">
  <div>{{ users.length }} {{ (guestsView ? 'guests' : 'users') | translate:locale.language }}</div>
  <div class="ms-auto">{{ storageUsage | toBytes }}</div>
</div>
<!--End Foot Content-->
<!--Start Context Menu -->
<context-menu #MainContextMenu>
  <ng-template (execute)="openDialog(true)" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideUserRoundPlus"></svg>New {{ guestsView ? 'guest' : 'user' }}</span>
  </ng-template>
  <ng-template [divider]="true" contextMenuItem></ng-template>
  <ng-template (execute)="loadUsersOrGuests()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideRotateCw"></svg>Refresh</span>
  </ng-template>
</context-menu>
<context-menu #TargetContextMenu>
  <ng-template (execute)="openDialog()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideUserRoundPen"></svg>Edit {{ guestsView ? 'guest' : 'user' }}</span>
  </ng-template>
  <ng-template [divider]="true" contextMenuItem></ng-template>
  <ng-template (execute)="impersonateIdentity()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideVenetianMask"></svg>Impersonate identity</span>
  </ng-template>
</context-menu>
<!--End Context Menu-->