mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
fix UI bug for Webhooks
Signed-off-by: 方彬 <fang_bingo@163.com>
This commit is contained in:
parent
e3d8fa845d
commit
088f805753
@ -1,4 +1,5 @@
|
||||
<div class="align-center">
|
||||
<inline-alert class="modal-title"></inline-alert>
|
||||
<form #webhookForm="ngForm">
|
||||
<section class="form-block webhook-section">
|
||||
<!-- endpoint URL -->
|
||||
@ -39,7 +40,7 @@
|
||||
<button type="button" [clrLoading]="checkBtnState" class="btn btn-outline" (click)="onTestEndpoint()" [disabled]="checking || enpointURL.errors">{{'WEBHOOK.TEST_ENDPOINT_BUTTON' | translate}}</button>
|
||||
</div>
|
||||
<div *ngIf="isModify">
|
||||
<button type="button" [clrLoading]="checkBtnState" class="btn btn-outline" (click)="onTestEndpoint()" [disabled]="checking || enpointURL.errors">{{'WEBHOOK.TEST_ENDPOINT_BUTTON' | translate}}</button>
|
||||
<button type="button" class="btn btn-outline" (click)="onTestEndpoint()" [disabled]="checking || enpointURL.errors">{{'WEBHOOK.TEST_ENDPOINT_BUTTON' | translate}}</button>
|
||||
<button type="button" class="btn btn-outline" (click)="onCancel()">{{'BUTTON.CANCEL' | translate}}</button>
|
||||
<button type="button" class="btn btn-primary" [disabled]="!isValid" (click)="onSubmit()">{{'BUTTON.SAVE' | translate}}</button>
|
||||
</div>
|
||||
|
@ -14,6 +14,7 @@ import {ClrLoadingState} from "@clr/angular";
|
||||
import { finalize } from "rxjs/operators";
|
||||
import { WebhookService } from "../webhook.service";
|
||||
import { WebhookEventTypes } from '../../../shared/shared.const';
|
||||
import { InlineAlertComponent } from "../../../shared/inline-alert/inline-alert.component";
|
||||
import { MessageHandlerService } from "../../../shared/message-handler/message-handler.service";
|
||||
|
||||
@Component({
|
||||
@ -37,6 +38,7 @@ export class AddWebhookFormComponent implements OnInit, OnChanges {
|
||||
@Output() edit = new EventEmitter<boolean>();
|
||||
@Output() close = new EventEmitter<boolean>();
|
||||
@ViewChild("webhookForm") currentForm: NgForm;
|
||||
@ViewChild(InlineAlertComponent) inlineAlert: InlineAlertComponent;
|
||||
|
||||
|
||||
constructor(
|
||||
@ -64,12 +66,22 @@ export class AddWebhookFormComponent implements OnInit, OnChanges {
|
||||
.pipe(finalize(() => (this.checking = false)))
|
||||
.subscribe(
|
||||
response => {
|
||||
if (this.isModify) {
|
||||
this.inlineAlert.showInlineSuccess({
|
||||
message: "WEBHOOK.TEST_ENDPOINT_SUCCESS"
|
||||
});
|
||||
} else {
|
||||
this.checkBtnState = ClrLoadingState.SUCCESS;
|
||||
}
|
||||
},
|
||||
error => {
|
||||
if (this.isModify) {
|
||||
this.inlineAlert.showInlineError("WEBHOOK.TEST_ENDPOINT_FAILURE");
|
||||
} else {
|
||||
this.checkBtnState = ClrLoadingState.DEFAULT;
|
||||
this.messageHandlerService.handleError(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -92,7 +104,9 @@ export class AddWebhookFormComponent implements OnInit, OnChanges {
|
||||
this.edit.emit(this.isModify);
|
||||
},
|
||||
error => {
|
||||
this.messageHandlerService.handleError(error);
|
||||
this.isModify
|
||||
? this.inlineAlert.showInlineError(error)
|
||||
: this.messageHandlerService.handleError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -362,6 +362,8 @@
|
||||
"TEST_ENDPOINT_BUTTON": "TEST ENDPOINT",
|
||||
"CANCEL_BUTTON": "CANCEL",
|
||||
"SAVE_BUTTON": "SAVE",
|
||||
"TEST_ENDPOINT_SUCCESS": "Connection tested successfully.",
|
||||
"TEST_ENDPOINT_FAILURE": "Failed to ping endpoint.",
|
||||
"ENABLED_WEBHOOK_TITLE": "Enable Project Webhooks",
|
||||
"ENABLED_WEBHOOK_SUMMARY": "Do you want to enable webhooks for project ",
|
||||
"DISABLED_WEBHOOK_TITLE": "Disable Project Webhooks",
|
||||
|
@ -363,6 +363,8 @@
|
||||
"TEST_ENDPOINT_BUTTON": "TEST ENDPOINT",
|
||||
"CANCEL_BUTTON": "CANCEL",
|
||||
"SAVE_BUTTON": "SAVE",
|
||||
"TEST_ENDPOINT_SUCCESS": "Connection tested successfully.",
|
||||
"TEST_ENDPOINT_FAILURE": "Failed to ping endpoint.",
|
||||
"ENABLED_WEBHOOK_TITLE": "Enable Project Webhooks",
|
||||
"ENABLED_WEBHOOK_SUMMARY": "Do you want to enable webhooks for project ",
|
||||
"DISABLED_WEBHOOK_TITLE": "Disable Project Webhooks",
|
||||
|
@ -355,6 +355,8 @@
|
||||
"TEST_ENDPOINT_BUTTON": "TEST ENDPOINT",
|
||||
"CANCEL_BUTTON": "CANCEL",
|
||||
"SAVE_BUTTON": "SAVE",
|
||||
"TEST_ENDPOINT_SUCCESS": "Connection tested successfully.",
|
||||
"TEST_ENDPOINT_FAILURE": "Failed to ping endpoint.",
|
||||
"ENABLED_WEBHOOK_TITLE": "Enable Project Webhooks",
|
||||
"ENABLED_WEBHOOK_SUMMARY": "Do you want to enable webhooks for project ",
|
||||
"DISABLED_WEBHOOK_TITLE": "Disable Project Webhooks",
|
||||
|
@ -389,6 +389,8 @@
|
||||
"TEST_ENDPOINT_BUTTON": "TEST ENDPOINT",
|
||||
"CANCEL_BUTTON": "CANCEL",
|
||||
"SAVE_BUTTON": "SAVE",
|
||||
"TEST_ENDPOINT_SUCCESS": "Connection tested successfully.",
|
||||
"TEST_ENDPOINT_FAILURE": "Failed to ping endpoint.",
|
||||
"ENABLED_WEBHOOK_TITLE": "Enable Project Webhooks",
|
||||
"ENABLED_WEBHOOK_SUMMARY": "Do you want to enable webhooks for project ",
|
||||
"DISABLED_WEBHOOK_TITLE": "Disable Project Webhooks",
|
||||
|
@ -362,6 +362,8 @@
|
||||
"TEST_ENDPOINT_BUTTON": "UÇ NOKTAYI DOĞRULA",
|
||||
"CANCEL_BUTTON": "İPTAL ET",
|
||||
"SAVE_BUTTON": "KAYDET",
|
||||
"TEST_ENDPOINT_SUCCESS": "Connection tested successfully.",
|
||||
"TEST_ENDPOINT_FAILURE": "Failed to ping endpoint.",
|
||||
"ENABLED_WEBHOOK_TITLE": "Proje Ağ Kancalarını Etkinleştir",
|
||||
"ENABLED_WEBHOOK_SUMMARY": "Proje için ağ kancalarını etkinleştirmek istiyor musunuz?",
|
||||
"DISABLED_WEBHOOK_TITLE": "Proje Ağ kancalarını Devre Dışı Bırak",
|
||||
|
@ -361,6 +361,8 @@
|
||||
"TEST_ENDPOINT_BUTTON": "测试 ENDPOINT",
|
||||
"CANCEL_BUTTON": "取消",
|
||||
"SAVE_BUTTON": "保存",
|
||||
"TEST_ENDPOINT_SUCCESS": "测试连接成功。",
|
||||
"TEST_ENDPOINT_FAILURE": "测试连接失败。",
|
||||
"ENABLED_WEBHOOK_TITLE": "启用项目的 Webhooks",
|
||||
"ENABLED_WEBHOOK_SUMMARY": "你希望开启项目的 Webhooks 吗?",
|
||||
"DISABLED_WEBHOOK_TITLE": "停用项目的 Webhooks",
|
||||
|
Loading…
Reference in New Issue
Block a user