2022-05-20 15:02:30 +03:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2022-05-20 15:02:30 +03:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
-->
|
2023-03-10 15:56:22 +02:00
|
|
|
<div style="height: min-content; max-height: 80vh;">
|
|
|
|
|
<mat-card appearance="outlined" class="repository-settings"
|
|
|
|
|
[ngClass]="{'settings-card': !detailsMode}"
|
|
|
|
|
[ngStyle]="popoverComponent ? {boxShadow: 'none', maxWidth: '100%', minWidth: '100%', width: '800px'} : {}">
|
2023-02-21 19:18:04 +02:00
|
|
|
<mat-card-header>
|
|
|
|
|
<mat-card-title>
|
2023-02-17 19:24:01 +02:00
|
|
|
<span class="mat-headline-5" translate>admin.repository-settings</span>
|
2023-02-21 19:18:04 +02:00
|
|
|
</mat-card-title>
|
|
|
|
|
<span fxFlex></span>
|
|
|
|
|
<div tb-help="repositorySettings"></div>
|
|
|
|
|
</mat-card-header>
|
2024-01-23 11:20:36 +02:00
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="!hideLoadingBar && isLoading$ | async">
|
2022-05-20 15:02:30 +03:00
|
|
|
</mat-progress-bar>
|
2024-02-06 11:23:00 +02:00
|
|
|
<div style="height: 4px;" *ngIf="hideLoadingBar || !(isLoading$ | async)"></div>
|
2022-05-20 15:02:30 +03:00
|
|
|
<mat-card-content style="padding-top: 16px;">
|
2022-05-31 16:16:24 +03:00
|
|
|
<form [formGroup]="repositorySettingsForm" #formDirective="ngForm" (ngSubmit)="save()">
|
2022-05-20 15:02:30 +03:00
|
|
|
<fieldset [disabled]="isLoading$ | async">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.repository-url</mat-label>
|
|
|
|
|
<input matInput required formControlName="repositoryUri">
|
2022-05-31 16:16:24 +03:00
|
|
|
<mat-error translate *ngIf="repositorySettingsForm.get('repositoryUri').hasError('required')">
|
2022-05-20 15:02:30 +03:00
|
|
|
admin.repository-url-required
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.default-branch</mat-label>
|
|
|
|
|
<input matInput formControlName="defaultBranch">
|
|
|
|
|
</mat-form-field>
|
2023-03-07 16:03:14 +02:00
|
|
|
<div fxLayout="column">
|
|
|
|
|
<mat-checkbox formControlName="readOnly">
|
|
|
|
|
{{ 'admin.repository-read-only' | translate }}
|
|
|
|
|
</mat-checkbox>
|
2022-12-09 18:29:57 +02:00
|
|
|
<mat-checkbox formControlName="showMergeCommits">
|
|
|
|
|
{{ 'admin.show-merge-commits' | translate }}
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
</div>
|
2022-05-20 15:02:30 +03:00
|
|
|
<fieldset [disabled]="isLoading$ | async" class="fields-group">
|
|
|
|
|
<legend class="group-title" translate>admin.authentication-settings</legend>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.auth-method</mat-label>
|
|
|
|
|
<mat-select required formControlName="authMethod">
|
2022-05-31 16:16:24 +03:00
|
|
|
<mat-option *ngFor="let method of repositoryAuthMethods" [value]="method">
|
|
|
|
|
{{repositoryAuthMethodTranslations.get(method) | translate}}
|
2022-05-20 15:02:30 +03:00
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
2022-05-31 16:16:24 +03:00
|
|
|
<section [fxShow]="repositorySettingsForm.get('authMethod').value === repositoryAuthMethod.USERNAME_PASSWORD" fxLayout="column">
|
2022-05-20 15:02:30 +03:00
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>common.username</mat-label>
|
|
|
|
|
<input matInput formControlName="username" placeholder="{{ 'common.enter-username' | translate }}"
|
|
|
|
|
autocomplete="new-username"/>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-checkbox *ngIf="showChangePassword" (change)="changePasswordChanged()"
|
2022-10-17 16:12:34 +03:00
|
|
|
[(ngModel)]="changePassword" [ngModelOptions]="{ standalone: true }">
|
2022-05-20 15:02:30 +03:00
|
|
|
{{ 'admin.change-password-access-token' | translate }}
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
<mat-form-field class="mat-block" *ngIf="changePassword || !showChangePassword">
|
|
|
|
|
<mat-label translate>admin.password-access-token</mat-label>
|
|
|
|
|
<input matInput formControlName="password" type="password"
|
|
|
|
|
placeholder="{{ 'common.enter-password' | translate }}" autocomplete="new-password"/>
|
|
|
|
|
<tb-toggle-password matSuffix></tb-toggle-password>
|
2023-03-03 16:27:20 +02:00
|
|
|
<mat-hint [innerHTML] = "'admin.auth-method-username-password-hint' | translate"></mat-hint>
|
2022-05-20 15:02:30 +03:00
|
|
|
</mat-form-field>
|
|
|
|
|
</section>
|
2022-05-31 16:16:24 +03:00
|
|
|
<section [fxShow]="repositorySettingsForm.get('authMethod').value === repositoryAuthMethod.PRIVATE_KEY" fxLayout="column">
|
2023-12-22 15:13:18 +02:00
|
|
|
<tb-file-input [existingFileName]="repositorySettingsForm.get('privateKeyFileName').value"
|
2022-05-20 15:02:30 +03:00
|
|
|
required
|
|
|
|
|
formControlName="privateKey"
|
|
|
|
|
dropLabel="{{ 'admin.drop-private-key-file-or' | translate }}"
|
|
|
|
|
[label]="'admin.private-key' | translate"
|
2022-05-31 16:16:24 +03:00
|
|
|
(fileNameChanged)="repositorySettingsForm.get('privateKeyFileName').patchValue($event)">
|
2022-05-20 15:02:30 +03:00
|
|
|
</tb-file-input>
|
|
|
|
|
<mat-checkbox *ngIf="showChangePrivateKeyPassword" (change)="changePrivateKeyPasswordChanged()"
|
2022-10-17 16:12:34 +03:00
|
|
|
[(ngModel)]="changePrivateKeyPassword" [ngModelOptions]="{ standalone: true }">
|
2022-05-20 15:02:30 +03:00
|
|
|
{{ 'admin.change-passphrase' | translate }}
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
<mat-form-field class="mat-block" *ngIf="changePrivateKeyPassword || !showChangePrivateKeyPassword">
|
|
|
|
|
<mat-label translate>admin.passphrase</mat-label>
|
|
|
|
|
<input matInput formControlName="privateKeyPassword" type="password"
|
|
|
|
|
placeholder="{{ 'admin.enter-passphrase' | translate }}" autocomplete="new-password"/>
|
|
|
|
|
<tb-toggle-password matSuffix></tb-toggle-password>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</section>
|
|
|
|
|
</fieldset>
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayout.xs="column" fxLayoutAlign.xs="end" fxLayoutGap="16px">
|
|
|
|
|
<button mat-raised-button color="warn" type="button" [fxShow]="settings !== null"
|
|
|
|
|
[disabled]="(isLoading$ | async)" (click)="delete(formDirective)">
|
|
|
|
|
{{'action.delete' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
<span fxFlex></span>
|
|
|
|
|
<button mat-raised-button type="button"
|
2022-05-31 16:16:24 +03:00
|
|
|
[disabled]="(isLoading$ | async) || repositorySettingsForm.invalid" (click)="checkAccess()">
|
2022-05-20 15:02:30 +03:00
|
|
|
{{'admin.check-access' | translate}}
|
|
|
|
|
</button>
|
2022-05-31 16:16:24 +03:00
|
|
|
<button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || repositorySettingsForm.invalid || !repositorySettingsForm.dirty"
|
2022-05-20 15:02:30 +03:00
|
|
|
type="submit">{{'action.save' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</form>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</mat-card>
|
|
|
|
|
</div>
|