All files / src/components/dashboard-toolbar si-dashboard-toolbar.component.html

53.22% Statements 33/62
19.44% Branches 7/36
75% Functions 3/4
50.98% Lines 26/51

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 1115x   25x 5x 12x 10x 5x     10x       10x     1x   10x     5x     13x                 3x 13x                                                                                                       3x   3x       13x 1x   13x 3x 3x     13x   1x   13x 3x     5x    
<div class="row mb-3" siResponsiveContainer>
  <div class="col-12 d-flex justify-content-between">
    @if (!editable()) {
      <ng-content select="[filters-slot]" />
      @if (!hideEditButton()) {
        @let showEditButtonLabelDesktop = this.showEditButtonLabelDesktop();
        <button
          type="button"
          class="btn ms-auto"
          [class]="
            showEditButtonLabelDesktop ? 'btn-secondary' : 'btn-icon btn-tertiary element-edit'
          "
          [attr.aria-label]="labelEdit | translate"
          [siTooltip]="labelEdit"
          [isDisabled]="showEditButtonLabelDesktop"
          [disabled]="disabled()"
          (click)="onEdit()"
        >
          @if (showEditButtonLabelDesktop) {
            {{ labelEdit | translate }}
          }
        </button>
      }
    } @else {
      @if (showContentActionBar()) {
        <si-content-action-bar
          toggleItemLabel="toggle"
          viewType="expanded"
          [disabled]="disabled()"
          [primaryActions]="primaryEditActionsComputed()"
          [secondaryActions]="secondaryEditActionsComputed()"
        />
      } @else {
        <div>
          @for (action of editActions(); track $index) {
            @if (isToolbarItem(action)) {
              @if (disabled()) {
                <!-- Links do not support disabled, so we need to render a button instead in this case. -->
                <button type="button" class="btn btn-secondary me-4" disabled>
                  {{ action.label! | translate }}
                </button>
              } @else {
                @switch (action.type) {
                  @case ('action') {
                    <button
                      type="button"
                      class="btn btn-secondary me-4"
                      (click)="action.action(grid())"
                    >
                      {{ action.label! | translate }}
                    </button>
                  }
                  @case ('router-link') {
                    <a
                      class="btn btn-secondary me-4"
                      [routerLink]="action.routerLink"
                      [queryParams]="action.extras?.queryParams"
                      [queryParamsHandling]="action.extras?.queryParamsHandling"
                      [fragment]="action.extras?.fragment"
                      [state]="action.extras?.state"
                      [relativeTo]="action.extras?.relativeTo ?? activatedRoute"
                      [preserveFragment]="action.extras?.preserveFragment"
                      [skipLocationChange]="action.extras?.skipLocationChange"
                      [replaceUrl]="action.extras?.replaceUrl"
                    >
                      {{ action.label! | translate }}
                    </a>
                  }
                  @case ('link') {
                    <a class="btn btn-secondary me-4" [href]="action.href" [target]="action.target">
                      {{ action.label! | translate }}
                    </a>
                  }
                }
              }
            } @else {
              <button
                type="button"
                class="btn btn-secondary me-4"
                [disabled]="disabled()"
                [siLink]="action"
              >
                {{ action.title! | translate }}
              </button>
            }
          }
        </div>
      }
      <div>
        <button
          type="button"
          class="btn btn-secondary me-4"
          [disabled]="disabled()"
          (click)="onCancel()"
        >
          {{ labelCancel | translate }}
        </button>
        <si-loading-button
          class="align-top"
          buttonClass="btn btn-primary"
          [disabled]="disableSaveButton()"
          [loading]="disabled()"
          (click)="onSave()"
        >
          {{ labelSave | translate }}
        </si-loading-button>
      </div>
    }
  </div>
</div>