All files / app/page/settings/backup backup.component.html

41.17% Statements 56/136
42.85% Branches 6/14
0% Functions 0/9
47.43% Lines 37/78

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 111 112 113 114 115 116 117 1183x 1x 1x   1x 1x   3x   3x 3x   3x     1x   1x 1x         1x   1x 3x         1x       1x     3x 1x 3x     1x       1x         3x         1x   1x   3x         3x     1x     1x       1x       1x       1x       1x       1x               1x             1x           1x        
<form class="form" [formGroup]="originForm">
  <span></span>
  <h2>Backup & Restore</h2>
 
  <label>Origin:</label>
  <select #originSelect
          formControlName="origin"
          [value]="origin"
          (input)="selectOrigin(originSelect.value)">
    @if (!backupOrigins.includes(origin)) {
      <option [value]="origin">{{ origin || 'default' }}</option>
    }
    @for (origin of backupOrigins; track origin) {
      <option [value]="origin">{{ origin || 'default' }}</option>
    }
  </select>
 
  <label>Older than:</label>
  <input type="datetime-local" step="1" formControlName="olderThan">
 
  <span><!-- Buttons --></span>
  <span class="buttons right">
  </span>
</form>
 
<div class="backup buttons">
  @if (store.account.admin) {
    <button #backupButton
            type="button"
            [disabled]="!originForm.valid"
            (click)="showBackupOptions()"
            i18n-title title="Create Backup" i18n>+ backup</button>
    <button type="button"
            [disabled]="!originForm.valid"
            (click)="deleteOrigin()"
            i18n-title title="Delete all from origin" i18n>&ndash; delete</button>
  }
 
  @if (!uploading) {
    <button type="button"
            [disabled]="!originForm.valid"
            (click)="uploadFile.click()"
            i18n-title
            title="Upload Backup" i18n>+ upload</button>
  } @else {
    <app-loading></app-loading>
  }
  <input #uploadFile
         type="file"
         class="upload"
         (change)="upload(uploadFile?.files!)">
 
  @if (store.account.mod) {
    <button type="button"
            [disabled]="!originForm.valid"
            (click)="regen()"
            i18n-title
            title="Regenerate Metadata" i18n>♻️ regen</button>
  }
</div>
 
@for (e of serverError; track e) {
  <span><!-- Unexpected Error --></span>
  <div class="error">{{ e }}</div>
}
 
<app-backup-list [list]="list"
                 [origin]="origin"></app-backup-list>
 
<ng-template #backupOptions>
  <div class="popup bubble" (click)="$event.stopPropagation()" [formGroup]="backupOptionsForm">
    <div class="form">
      <label for="backupCache" i18n>Cache</label>
      <div>
        <input id="backupCache" type="checkbox" formControlName="cache">
      </div>
      <label for="backupRefs" i18n>Refs</label>
      <div>
        <input id="backupRefs" type="checkbox" formControlName="ref">
      </div>
      <label for="backupExts" i18n>Exts</label>
      <div>
        <input id="backupExts" type="checkbox" formControlName="ext">
      </div>
      <label for="backupUsers" i18n>Users</label>
      <div>
        <input id="backupUsers" type="checkbox" formControlName="user">
      </div>
      <label for="backupPlugins" i18n>Plugins</label>
      <div>
        <input id="backupPlugins" type="checkbox" formControlName="plugin">
      </div>
      <label for="backupTemplates" i18n>Templates</label>
      <div>
        <input id="backupTemplates" type="checkbox" formControlName="template">
      </div>
    </div>
    <hr>
    <div class="form">
      <div>
        <label for="newerThan" i18n>Newer than:</label>
        <div class="form-array">
          <input type="datetime-local"
                 id="newerThan"
                 step="1"
                 formControlName="newerThan"
                 class="grow">
          <button type="button" (click)="backupOptionsForm.get('newerThan')!.setValue('')" i18n-title title="Clear" i18n>🆑️</button>
        </div>
      </div>
    </div>
 
    <div class="buttons right">
      <button type="button" (click)="confirmBackup()" i18n>+ backup</button>
    </div>
  </div>
</ng-template>