Compare commits

...
Author SHA1 Message Date
Logic 821c62ba60 Merge branch 'master' into copy-token 2025-01-18 20:55:10 +08:00
Logic fbc1c0a29a Merge branch 'master' into copy-token 2025-01-17 23:25:58 +08:00
Logic 648064227f refactor(web-app): update alert integration modal button layout
- Swap OK and Cancel button positions in alert integration modal- Improve user experience by aligning with common UI practices
2025-01-17 23:05:53 +08:00
Logic a08fdd210c feat(alert): add copy button for alert integration token
- Add a copy button below the token display
- Implement copyToken() method to copy the token to clipboard
- Show a success notification after copying
2025-01-17 22:38:49 +08:00
2 changed files with 22 additions and 5 deletions
@@ -45,7 +45,7 @@
<ng-container *ngIf="selectedSource">
<div style="display: flex; justify-content: space-between">
<h2>{{ selectedSource.name }}</h2>
<button [nzLoading]="generateLoading" nz-button (click)="generateToken()" style="margin-right: 16px">{{
<button [nzLoading]="generateLoading" nz-button nzType="primary" (click)="generateToken()" style="margin-right: 16px">{{
'alert.integration.token.new' | i18n
}}</button>
</div>
@@ -61,17 +61,24 @@
[nzTitle]="'alert.integration.token.title' | i18n"
(nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()"
[nzOkText]="null"
[nzCancelText]="'common.button.confirm' | i18n"
[nzOkText]="'common.button.confirm' | i18n"
[nzCancelText]="null"
>
<div *nzModalContent class="-inner-content">
<div>
<p>{{ 'alert.integration.token.desc' | i18n }}</p>
</div>
<div style="width: 100%">
<textarea rows="6" style="width: 100%; border-radius: 4px">{{ token }}</textarea>
<div style="display: flex; justify-content: flex-end; margin-bottom: 8px">
<button nz-button nzType="primary" (click)="copyToken()">
{{ 'common.button.copy' | i18n }}
</button>
</div>
<div style="padding: 12px; border: 1px solid #d9d9d9; border-radius: 4px; background-color: #f5f5f5; word-wrap: break-word">
{{ token }}
</div>
</div>
<div style="text-align: center; font-weight: lighter">
<div style="text-align: center; font-weight: lighter; margin-top: 16px">
<p>{{ 'alert.integration.token.notice' | i18n }}</p>
</div>
</div>
@@ -154,4 +154,14 @@ export class AlertIntegrationComponent implements OnInit {
}
});
}
copyToken() {
const el = document.createElement('textarea');
el.value = this.token;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
this.notifySvc.success(this.i18nSvc.fanyi('common.notify.copy-success'), this.i18nSvc.fanyi('alert.integration.token.notice'));
}
}