From f99dd4f89a79565b1ed86b7b2b5db583125e4b2a Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Wed, 8 Jan 2025 19:37:57 +0800 Subject: [PATCH 1/6] test: improve example --- .../providers/aliyun-alb/aliyun_alb_test.go | 2 +- .../providers/aliyun-cdn/aliyun_cdn_test.go | 2 +- .../providers/aliyun-clb/aliyun_clb_test.go | 2 +- .../providers/aliyun-dcdn/aliyun_dcdn_test.go | 2 +- .../providers/aliyun-nlb/aliyun_nlb_test.go | 2 +- .../providers/aliyun-oss/aliyun_oss_test.go | 2 +- .../baiducloud-cdn/baiducloud_cdn_test.go | 2 +- .../providers/byteplus-cdn/byteplus_cdn_test.go | 2 +- .../dogecloud-cdn/dogecloud_cdn_test.go | 2 +- .../huaweicloud-cdn/huaweicloud_cdn_test.go | 2 +- .../huaweicloud-elb/huaweicloud_elb_test.go | 2 +- .../providers/k8s-secret/k8s_secret_test.go | 2 +- .../core/deployer/providers/local/local_test.go | 2 +- .../providers/qiniu-cdn/qiniu_cdn_test.go | 2 +- .../pkg/core/deployer/providers/ssh/ssh_test.go | 2 +- .../tencentcloud-cdn/tencentcloud_cdn_test.go | 2 +- .../tencentcloud-clb/tencentcloud_clb_test.go | 2 +- .../tencentcloud-cos/tencentcloud_cos_test.go | 2 +- .../tencentcloud-ecdn/tencentcloud_ecdn_test.go | 2 +- .../tencentcloud-eo/tencentcloud_eo_test.go | 16 ++++++++-------- .../volcengine-cdn/volcengine_cdn_test.go | 2 +- .../volcengine-live/volcengine_live_test.go | 2 +- .../deployer/providers/webhook/webhook_test.go | 2 +- internal/pkg/core/logger/logger_test.go | 2 +- .../core/notifier/providers/bark/bark_test.go | 2 +- .../notifier/providers/dingtalk/dingtalk_test.go | 2 +- .../core/notifier/providers/email/email_test.go | 2 +- .../core/notifier/providers/lark/lark_test.go | 2 +- .../providers/serverchan/serverchan_test.go | 2 +- .../notifier/providers/telegram/telegram_test.go | 2 +- .../notifier/providers/webhook/webhook_test.go | 2 +- .../core/notifier/providers/wecom/wecom_test.go | 2 +- 32 files changed, 39 insertions(+), 39 deletions(-) diff --git a/internal/pkg/core/deployer/providers/aliyun-alb/aliyun_alb_test.go b/internal/pkg/core/deployer/providers/aliyun-alb/aliyun_alb_test.go index 143b65b4..fddf7ff2 100644 --- a/internal/pkg/core/deployer/providers/aliyun-alb/aliyun_alb_test.go +++ b/internal/pkg/core/deployer/providers/aliyun-alb/aliyun_alb_test.go @@ -36,7 +36,7 @@ func init() { /* Shell command to run this test: - go test -v aliyun_alb_test.go -args \ + go test -v ./aliyun_alb_test.go -args \ --CERTIMATE_DEPLOYER_ALIYUNALB_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_ALIYUNALB_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_ALIYUNALB_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/aliyun-cdn/aliyun_cdn_test.go b/internal/pkg/core/deployer/providers/aliyun-cdn/aliyun_cdn_test.go index 66464aa1..da4d1d74 100644 --- a/internal/pkg/core/deployer/providers/aliyun-cdn/aliyun_cdn_test.go +++ b/internal/pkg/core/deployer/providers/aliyun-cdn/aliyun_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v aliyun_cdn_test.go -args \ + go test -v ./aliyun_cdn_test.go -args \ --CERTIMATE_DEPLOYER_ALIYUNCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_ALIYUNCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_ALIYUNCDN_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/aliyun-clb/aliyun_clb_test.go b/internal/pkg/core/deployer/providers/aliyun-clb/aliyun_clb_test.go index f9aa800d..761cbb38 100644 --- a/internal/pkg/core/deployer/providers/aliyun-clb/aliyun_clb_test.go +++ b/internal/pkg/core/deployer/providers/aliyun-clb/aliyun_clb_test.go @@ -36,7 +36,7 @@ func init() { /* Shell command to run this test: - go test -v aliyun_clb_test.go -args \ + go test -v ./aliyun_clb_test.go -args \ --CERTIMATE_DEPLOYER_ALIYUNCLB_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_ALIYUNCLB_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_ALIYUNCLB_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/aliyun-dcdn/aliyun_dcdn_test.go b/internal/pkg/core/deployer/providers/aliyun-dcdn/aliyun_dcdn_test.go index 8fdddf80..ffbfcd1f 100644 --- a/internal/pkg/core/deployer/providers/aliyun-dcdn/aliyun_dcdn_test.go +++ b/internal/pkg/core/deployer/providers/aliyun-dcdn/aliyun_dcdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v aliyun_dcdn_test.go -args \ + go test -v ./aliyun_dcdn_test.go -args \ --CERTIMATE_DEPLOYER_ALIYUNDCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_ALIYUNDCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_ALIYUNDCDN_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/aliyun-nlb/aliyun_nlb_test.go b/internal/pkg/core/deployer/providers/aliyun-nlb/aliyun_nlb_test.go index 9c976dd9..45abd932 100644 --- a/internal/pkg/core/deployer/providers/aliyun-nlb/aliyun_nlb_test.go +++ b/internal/pkg/core/deployer/providers/aliyun-nlb/aliyun_nlb_test.go @@ -36,7 +36,7 @@ func init() { /* Shell command to run this test: - go test -v aliyun_nlb_test.go -args \ + go test -v ./aliyun_nlb_test.go -args \ --CERTIMATE_DEPLOYER_ALIYUNNLB_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_ALIYUNNLB_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_ALIYUNNLB_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/aliyun-oss/aliyun_oss_test.go b/internal/pkg/core/deployer/providers/aliyun-oss/aliyun_oss_test.go index afb31853..e25f8156 100644 --- a/internal/pkg/core/deployer/providers/aliyun-oss/aliyun_oss_test.go +++ b/internal/pkg/core/deployer/providers/aliyun-oss/aliyun_oss_test.go @@ -36,7 +36,7 @@ func init() { /* Shell command to run this test: - go test -v aliyun_oss_test.go -args \ + go test -v ./aliyun_oss_test.go -args \ --CERTIMATE_DEPLOYER_ALIYUNOSS_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_ALIYUNOSS_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_ALIYUNOSS_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/baiducloud-cdn/baiducloud_cdn_test.go b/internal/pkg/core/deployer/providers/baiducloud-cdn/baiducloud_cdn_test.go index e3398505..817600b6 100644 --- a/internal/pkg/core/deployer/providers/baiducloud-cdn/baiducloud_cdn_test.go +++ b/internal/pkg/core/deployer/providers/baiducloud-cdn/baiducloud_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v baiducloud_cdn_test.go -args \ + go test -v ./baiducloud_cdn_test.go -args \ --CERTIMATE_DEPLOYER_BAIDUCLOUDCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_BAIDUCLOUDCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_BAIDUCLOUDCDN_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/byteplus-cdn/byteplus_cdn_test.go b/internal/pkg/core/deployer/providers/byteplus-cdn/byteplus_cdn_test.go index 0c411062..9de97be6 100644 --- a/internal/pkg/core/deployer/providers/byteplus-cdn/byteplus_cdn_test.go +++ b/internal/pkg/core/deployer/providers/byteplus-cdn/byteplus_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v byteplus_cdn_test.go -args \ + go test -v ./byteplus_cdn_test.go -args \ --CERTIMATE_DEPLOYER_BYTEPLUSCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_BYTEPLUSCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_BYTEPLUSCDN_ACCESSKEY="your-access-key" \ diff --git a/internal/pkg/core/deployer/providers/dogecloud-cdn/dogecloud_cdn_test.go b/internal/pkg/core/deployer/providers/dogecloud-cdn/dogecloud_cdn_test.go index 2375e372..8d066484 100644 --- a/internal/pkg/core/deployer/providers/dogecloud-cdn/dogecloud_cdn_test.go +++ b/internal/pkg/core/deployer/providers/dogecloud-cdn/dogecloud_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v dogecloud_cdn_test.go -args \ + go test -v ./dogecloud_cdn_test.go -args \ --CERTIMATE_DEPLOYER_DOGECLOUDCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_DOGECLOUDCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_DOGECLOUDCDN_ACCESSKEY="your-access-key" \ diff --git a/internal/pkg/core/deployer/providers/huaweicloud-cdn/huaweicloud_cdn_test.go b/internal/pkg/core/deployer/providers/huaweicloud-cdn/huaweicloud_cdn_test.go index d50e3ea5..d31b2a68 100644 --- a/internal/pkg/core/deployer/providers/huaweicloud-cdn/huaweicloud_cdn_test.go +++ b/internal/pkg/core/deployer/providers/huaweicloud-cdn/huaweicloud_cdn_test.go @@ -34,7 +34,7 @@ func init() { /* Shell command to run this test: - go test -v huaweicloud_cdn_test.go -args \ + go test -v ./huaweicloud_cdn_test.go -args \ --CERTIMATE_DEPLOYER_HUAWEICLOUDCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_HUAWEICLOUDCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_HUAWEICLOUDCDN_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/huaweicloud-elb/huaweicloud_elb_test.go b/internal/pkg/core/deployer/providers/huaweicloud-elb/huaweicloud_elb_test.go index f2e573ca..32582800 100644 --- a/internal/pkg/core/deployer/providers/huaweicloud-elb/huaweicloud_elb_test.go +++ b/internal/pkg/core/deployer/providers/huaweicloud-elb/huaweicloud_elb_test.go @@ -38,7 +38,7 @@ func init() { /* Shell command to run this test: - go test -v huaweicloud_elb_test.go -args \ + go test -v ./huaweicloud_elb_test.go -args \ --CERTIMATE_DEPLOYER_HUAWEICLOUDELB_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_HUAWEICLOUDELB_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_HUAWEICLOUDELB_ACCESSKEYID="your-access-key-id" \ diff --git a/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret_test.go b/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret_test.go index ac47deba..913099ec 100644 --- a/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret_test.go +++ b/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret_test.go @@ -34,7 +34,7 @@ func init() { /* Shell command to run this test: - go test -v k8s_secret_test.go -args \ + go test -v ./k8s_secret_test.go -args \ --CERTIMATE_DEPLOYER_K8SSECRET_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_K8SSECRET_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_K8SSECRET_NAMESPACE="default" \ diff --git a/internal/pkg/core/deployer/providers/local/local_test.go b/internal/pkg/core/deployer/providers/local/local_test.go index 18838c63..33ff4def 100644 --- a/internal/pkg/core/deployer/providers/local/local_test.go +++ b/internal/pkg/core/deployer/providers/local/local_test.go @@ -38,7 +38,7 @@ func init() { /* Shell command to run this test: - go test -v local_test.go -args \ + go test -v ./local_test.go -args \ --CERTIMATE_DEPLOYER_LOCAL_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_LOCAL_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_LOCAL_OUTPUTCERTPATH="/path/to/your-output-cert" \ diff --git a/internal/pkg/core/deployer/providers/qiniu-cdn/qiniu_cdn_test.go b/internal/pkg/core/deployer/providers/qiniu-cdn/qiniu_cdn_test.go index df4ee008..85ca8316 100644 --- a/internal/pkg/core/deployer/providers/qiniu-cdn/qiniu_cdn_test.go +++ b/internal/pkg/core/deployer/providers/qiniu-cdn/qiniu_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v qiniu_cdn_test.go -args \ + go test -v ./qiniu_cdn_test.go -args \ --CERTIMATE_DEPLOYER_QINIUCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_QINIUCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_QINIUCDN_ACCESSKEY="your-access-key" \ diff --git a/internal/pkg/core/deployer/providers/ssh/ssh_test.go b/internal/pkg/core/deployer/providers/ssh/ssh_test.go index 0dd58358..f83a539d 100644 --- a/internal/pkg/core/deployer/providers/ssh/ssh_test.go +++ b/internal/pkg/core/deployer/providers/ssh/ssh_test.go @@ -38,7 +38,7 @@ func init() { /* Shell command to run this test: - go test -v ssh_test.go -args \ + go test -v ./ssh_test.go -args \ --CERTIMATE_DEPLOYER_SSH_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_SSH_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_SSH_SSHHOST="localhost" \ diff --git a/internal/pkg/core/deployer/providers/tencentcloud-cdn/tencentcloud_cdn_test.go b/internal/pkg/core/deployer/providers/tencentcloud-cdn/tencentcloud_cdn_test.go index 70b3c59d..088251b1 100644 --- a/internal/pkg/core/deployer/providers/tencentcloud-cdn/tencentcloud_cdn_test.go +++ b/internal/pkg/core/deployer/providers/tencentcloud-cdn/tencentcloud_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v tencentcloud_cdn_test.go -args \ + go test -v ./tencentcloud_cdn_test.go -args \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCDN_SECRETID="your-secret-id" \ diff --git a/internal/pkg/core/deployer/providers/tencentcloud-clb/tencentcloud_clb_test.go b/internal/pkg/core/deployer/providers/tencentcloud-clb/tencentcloud_clb_test.go index fe0cf023..0af11dff 100644 --- a/internal/pkg/core/deployer/providers/tencentcloud-clb/tencentcloud_clb_test.go +++ b/internal/pkg/core/deployer/providers/tencentcloud-clb/tencentcloud_clb_test.go @@ -38,7 +38,7 @@ func init() { /* Shell command to run this test: - go test -v tencentcloud_clb_test.go -args \ + go test -v ./tencentcloud_clb_test.go -args \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCLB_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCLB_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCLB_SECRETID="your-secret-id" \ diff --git a/internal/pkg/core/deployer/providers/tencentcloud-cos/tencentcloud_cos_test.go b/internal/pkg/core/deployer/providers/tencentcloud-cos/tencentcloud_cos_test.go index 5f105efe..d58e4f50 100644 --- a/internal/pkg/core/deployer/providers/tencentcloud-cos/tencentcloud_cos_test.go +++ b/internal/pkg/core/deployer/providers/tencentcloud-cos/tencentcloud_cos_test.go @@ -36,7 +36,7 @@ func init() { /* Shell command to run this test: - go test -v tencentcloud_cos_test.go -args \ + go test -v ./tencentcloud_cos_test.go -args \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCOS_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCOS_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDCOS_SECRETID="your-secret-id" \ diff --git a/internal/pkg/core/deployer/providers/tencentcloud-ecdn/tencentcloud_ecdn_test.go b/internal/pkg/core/deployer/providers/tencentcloud-ecdn/tencentcloud_ecdn_test.go index 95d617cf..764aa5fb 100644 --- a/internal/pkg/core/deployer/providers/tencentcloud-ecdn/tencentcloud_ecdn_test.go +++ b/internal/pkg/core/deployer/providers/tencentcloud-ecdn/tencentcloud_ecdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v tencentcloud_ecdn_test.go -args \ + go test -v ./tencentcloud_ecdn_test.go -args \ --CERTIMATE_DEPLOYER_TENCENTCLOUDECDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDECDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_TENCENTCLOUDECDN_SECRETID="your-secret-id" \ diff --git a/internal/pkg/core/deployer/providers/tencentcloud-eo/tencentcloud_eo_test.go b/internal/pkg/core/deployer/providers/tencentcloud-eo/tencentcloud_eo_test.go index a45706ae..bc5280f7 100644 --- a/internal/pkg/core/deployer/providers/tencentcloud-eo/tencentcloud_eo_test.go +++ b/internal/pkg/core/deployer/providers/tencentcloud-eo/tencentcloud_eo_test.go @@ -21,7 +21,7 @@ var ( ) func init() { - argsPrefix := "CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_" + argsPrefix := "CERTIMATE_DEPLOYER_TENCENTCLOUDEO_" flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "") flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "") @@ -34,13 +34,13 @@ func init() { /* Shell command to run this test: - go test -v tencentcloud_cdn_test.go -args \ - --CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_INPUTCERTPATH="/path/to/your-input-cert.pem" \ - --CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_INPUTKEYPATH="/path/to/your-input-key.pem" \ - --CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_SECRETID="your-secret-id" \ - --CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_SECRETKEY="your-secret-key" \ - --CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_ZONEID="your-zone-id" \ - --CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_DOMAIN="example.com" + go test -v ./tencentcloud_eo_test.go -args \ + --CERTIMATE_DEPLOYER_TENCENTCLOUDEO_INPUTCERTPATH="/path/to/your-input-cert.pem" \ + --CERTIMATE_DEPLOYER_TENCENTCLOUDEO_INPUTKEYPATH="/path/to/your-input-key.pem" \ + --CERTIMATE_DEPLOYER_TENCENTCLOUDEO_SECRETID="your-secret-id" \ + --CERTIMATE_DEPLOYER_TENCENTCLOUDEO_SECRETKEY="your-secret-key" \ + --CERTIMATE_DEPLOYER_TENCENTCLOUDEO_ZONEID="your-zone-id" \ + --CERTIMATE_DEPLOYER_TENCENTCLOUDEO_DOMAIN="example.com" */ func TestDeploy(t *testing.T) { flag.Parse() diff --git a/internal/pkg/core/deployer/providers/volcengine-cdn/volcengine_cdn_test.go b/internal/pkg/core/deployer/providers/volcengine-cdn/volcengine_cdn_test.go index e24740be..639a41c1 100644 --- a/internal/pkg/core/deployer/providers/volcengine-cdn/volcengine_cdn_test.go +++ b/internal/pkg/core/deployer/providers/volcengine-cdn/volcengine_cdn_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v volcengine_cdn_test.go -args \ + go test -v ./volcengine_cdn_test.go -args \ --CERTIMATE_DEPLOYER_VOLCENGINECDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_VOLCENGINECDN_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_VOLCENGINECDN_ACCESSKEY="your-access-key" \ diff --git a/internal/pkg/core/deployer/providers/volcengine-live/volcengine_live_test.go b/internal/pkg/core/deployer/providers/volcengine-live/volcengine_live_test.go index 0ad66385..6d9da282 100644 --- a/internal/pkg/core/deployer/providers/volcengine-live/volcengine_live_test.go +++ b/internal/pkg/core/deployer/providers/volcengine-live/volcengine_live_test.go @@ -32,7 +32,7 @@ func init() { /* Shell command to run this test: - go test -v volcengine_live_test.go -args \ + go test -v ./volcengine_live_test.go -args \ --CERTIMATE_DEPLOYER_VOLCENGINELIVE_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_VOLCENGINELIVE_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_VOLCENGINELIVE_ACCESSKEY="your-access-key" \ diff --git a/internal/pkg/core/deployer/providers/webhook/webhook_test.go b/internal/pkg/core/deployer/providers/webhook/webhook_test.go index ddb719c4..92b57e56 100644 --- a/internal/pkg/core/deployer/providers/webhook/webhook_test.go +++ b/internal/pkg/core/deployer/providers/webhook/webhook_test.go @@ -30,7 +30,7 @@ func init() { /* Shell command to run this test: - go test -v webhook_test.go -args \ + go test -v ./webhook_test.go -args \ --CERTIMATE_DEPLOYER_WEBHOOK_INPUTCERTPATH="/path/to/your-input-cert.pem" \ --CERTIMATE_DEPLOYER_WEBHOOK_INPUTKEYPATH="/path/to/your-input-key.pem" \ --CERTIMATE_DEPLOYER_WEBHOOK_URL="https://example.com/your-webhook-url" \ diff --git a/internal/pkg/core/logger/logger_test.go b/internal/pkg/core/logger/logger_test.go index 29308a83..e131a7b1 100644 --- a/internal/pkg/core/logger/logger_test.go +++ b/internal/pkg/core/logger/logger_test.go @@ -9,7 +9,7 @@ import ( /* Shell command to run this test: - go test -v logger_test.go + go test -v ./logger_test.go */ func TestLogger(t *testing.T) { t.Run("Logger_Appendt", func(t *testing.T) { diff --git a/internal/pkg/core/notifier/providers/bark/bark_test.go b/internal/pkg/core/notifier/providers/bark/bark_test.go index 3b9bef2d..e3045cae 100644 --- a/internal/pkg/core/notifier/providers/bark/bark_test.go +++ b/internal/pkg/core/notifier/providers/bark/bark_test.go @@ -30,7 +30,7 @@ func init() { /* Shell command to run this test: - go test -v bark_test.go -args \ + go test -v ./bark_test.go -args \ --CERTIMATE_NOTIFIER_BARK_SERVERURL="https://example.com/your-server-url" \ --CERTIMATE_NOTIFIER_BARK_DEVICEKEY="your-device-key" */ diff --git a/internal/pkg/core/notifier/providers/dingtalk/dingtalk_test.go b/internal/pkg/core/notifier/providers/dingtalk/dingtalk_test.go index ea2c9bc8..621a57ca 100644 --- a/internal/pkg/core/notifier/providers/dingtalk/dingtalk_test.go +++ b/internal/pkg/core/notifier/providers/dingtalk/dingtalk_test.go @@ -30,7 +30,7 @@ func init() { /* Shell command to run this test: - go test -v dingtalk_test.go -args \ + go test -v ./dingtalk_test.go -args \ --CERTIMATE_NOTIFIER_DINGTALK_URL="https://example.com/your-webhook-url" */ func TestNotify(t *testing.T) { diff --git a/internal/pkg/core/notifier/providers/email/email_test.go b/internal/pkg/core/notifier/providers/email/email_test.go index 34303d06..1c52d4de 100644 --- a/internal/pkg/core/notifier/providers/email/email_test.go +++ b/internal/pkg/core/notifier/providers/email/email_test.go @@ -40,7 +40,7 @@ func init() { /* Shell command to run this test: - go test -v email_test.go -args \ + go test -v ./email_test.go -args \ --CERTIMATE_NOTIFIER_EMAIL_SMTPHOST="smtp.example.com" \ --CERTIMATE_NOTIFIER_EMAIL_SMTPPORT=465 \ --CERTIMATE_NOTIFIER_EMAIL_SMTPTLS=true \ diff --git a/internal/pkg/core/notifier/providers/lark/lark_test.go b/internal/pkg/core/notifier/providers/lark/lark_test.go index b93d3606..0b91ebd7 100644 --- a/internal/pkg/core/notifier/providers/lark/lark_test.go +++ b/internal/pkg/core/notifier/providers/lark/lark_test.go @@ -26,7 +26,7 @@ func init() { /* Shell command to run this test: - go test -v lark_test.go -args \ + go test -v ./lark_test.go -args \ --CERTIMATE_NOTIFIER_LARK_WEBHOOKURL="https://example.com/your-webhook-url" */ func TestNotify(t *testing.T) { diff --git a/internal/pkg/core/notifier/providers/serverchan/serverchan_test.go b/internal/pkg/core/notifier/providers/serverchan/serverchan_test.go index 63407379..db2a4946 100644 --- a/internal/pkg/core/notifier/providers/serverchan/serverchan_test.go +++ b/internal/pkg/core/notifier/providers/serverchan/serverchan_test.go @@ -26,7 +26,7 @@ func init() { /* Shell command to run this test: - go test -v serverchan_test.go -args \ + go test -v ./serverchan_test.go -args \ --CERTIMATE_NOTIFIER_SERVERCHAN_URL="https://example.com/your-webhook-url" \ */ func TestNotify(t *testing.T) { diff --git a/internal/pkg/core/notifier/providers/telegram/telegram_test.go b/internal/pkg/core/notifier/providers/telegram/telegram_test.go index 062e2642..fca71e8a 100644 --- a/internal/pkg/core/notifier/providers/telegram/telegram_test.go +++ b/internal/pkg/core/notifier/providers/telegram/telegram_test.go @@ -30,7 +30,7 @@ func init() { /* Shell command to run this test: - go test -v telegram_test.go -args \ + go test -v ./telegram_test.go -args \ --CERTIMATE_NOTIFIER_TELEGRAM_APITOKEN="your-api-token" \ --CERTIMATE_NOTIFIER_TELEGRAM_CHATID=123456 */ diff --git a/internal/pkg/core/notifier/providers/webhook/webhook_test.go b/internal/pkg/core/notifier/providers/webhook/webhook_test.go index 2f83f8e0..14e2adf6 100644 --- a/internal/pkg/core/notifier/providers/webhook/webhook_test.go +++ b/internal/pkg/core/notifier/providers/webhook/webhook_test.go @@ -26,7 +26,7 @@ func init() { /* Shell command to run this test: - go test -v webhook_test.go -args \ + go test -v ./webhook_test.go -args \ --CERTIMATE_NOTIFIER_WEBHOOK_URL="https://example.com/your-webhook-url" */ func TestNotify(t *testing.T) { diff --git a/internal/pkg/core/notifier/providers/wecom/wecom_test.go b/internal/pkg/core/notifier/providers/wecom/wecom_test.go index a9ac9d16..e1378849 100644 --- a/internal/pkg/core/notifier/providers/wecom/wecom_test.go +++ b/internal/pkg/core/notifier/providers/wecom/wecom_test.go @@ -26,7 +26,7 @@ func init() { /* Shell command to run this test: - go test -v serverchan_test.go -args \ + go test -v ./wecom_test.go -args \ --CERTIMATE_NOTIFIER_WECOM_WEBHOOKURL="https://example.com/your-webhook-url" \ */ func TestNotify(t *testing.T) { From 8ed2b2475c8923550b1ce41a53d7b266bca90e44 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Fri, 10 Jan 2025 21:22:22 +0800 Subject: [PATCH 2/6] refactor: clean code --- .../providers/k8s-secret/k8s_secret.go | 3 ++ ui/src/api/workflow.ts | 11 +++-- ui/src/hooks/useZustandShallowSelector.ts | 4 +- ui/src/pages/workflows/WorkflowDetail.tsx | 40 ++++++++++--------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret.go b/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret.go index f09e8331..9e74e794 100644 --- a/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret.go +++ b/internal/pkg/core/deployer/providers/k8s-secret/k8s_secret.go @@ -65,6 +65,9 @@ func (d *K8sSecretDeployer) Deploy(ctx context.Context, certPem string, privkeyP if d.config.SecretName == "" { return nil, errors.New("config `secretName` is required") } + if d.config.SecretType == "" { + return nil, errors.New("config `secretType` is required") + } if d.config.SecretDataKeyForCrt == "" { return nil, errors.New("config `secretDataKeyForCrt` is required") } diff --git a/ui/src/api/workflow.ts b/ui/src/api/workflow.ts index d545b94e..c40fcce8 100644 --- a/ui/src/api/workflow.ts +++ b/ui/src/api/workflow.ts @@ -1,7 +1,6 @@ -import type { RecordModel, RecordSubscription } from "pocketbase"; -import { ClientResponseError } from "pocketbase"; +import { ClientResponseError, type RecordSubscription } from "pocketbase"; -import { WORKFLOW_TRIGGERS } from "@/domain/workflow"; +import { WORKFLOW_TRIGGERS, type WorkflowModel } from "@/domain/workflow"; import { getPocketBase } from "@/repository/pocketbase"; export const run = async (id: string) => { @@ -25,14 +24,14 @@ export const run = async (id: string) => { return resp; }; -export const subscribe = async (id: string, cb: (e: RecordSubscription) => void) => { +export const subscribe = async (id: string, cb: (e: RecordSubscription) => void) => { const pb = getPocketBase(); - pb.collection("workflow").subscribe(id, cb); + return pb.collection("workflow").subscribe(id, cb); }; export const unsubscribe = async (id: string) => { const pb = getPocketBase(); - pb.collection("workflow").unsubscribe(id); + return pb.collection("workflow").unsubscribe(id); }; diff --git a/ui/src/hooks/useZustandShallowSelector.ts b/ui/src/hooks/useZustandShallowSelector.ts index 724cdf2c..23b23666 100644 --- a/ui/src/hooks/useZustandShallowSelector.ts +++ b/ui/src/hooks/useZustandShallowSelector.ts @@ -18,11 +18,11 @@ export type UseZustandShallowSelectorReturns ({ + * const { foo, bar, baz } = useStore(useShallow((state) => ({ * foo: state.foo, * bar: state.bar, * baz: state.baz, - * })); + * }))); * ``` */ const useZustandShallowSelector = (paths: MaybeMany): UseZustandShallowSelectorReturns => { diff --git a/ui/src/pages/workflows/WorkflowDetail.tsx b/ui/src/pages/workflows/WorkflowDetail.tsx index 0d89ac2a..cc5fba5b 100644 --- a/ui/src/pages/workflows/WorkflowDetail.tsx +++ b/ui/src/pages/workflows/WorkflowDetail.tsx @@ -13,16 +13,16 @@ import { import { PageHeader } from "@ant-design/pro-components"; import { Alert, Button, Card, Dropdown, Form, Input, Modal, Space, Tabs, Typography, message, notification } from "antd"; import { createSchemaFieldRule } from "antd-zod"; -import { ClientResponseError } from "pocketbase"; import { isEqual } from "radash"; import { z } from "zod"; -import { run as runWorkflow, subscribe, unsubscribe } from "@/api/workflow"; +import { run as runWorkflow, subscribe as subscribeWorkflow, unsubscribe as unsubscribeWorkflow } from "@/api/workflow"; import ModalForm from "@/components/ModalForm"; import Show from "@/components/Show"; import WorkflowElements from "@/components/workflow/WorkflowElements"; import WorkflowRuns from "@/components/workflow/WorkflowRuns"; import { isAllNodesValidated } from "@/domain/workflow"; +import { WORKFLOW_RUN_STATUSES } from "@/domain/workflowRun"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { remove as removeWorkflow } from "@/repository/workflow"; import { useWorkflowStore } from "@/stores/workflow"; @@ -63,21 +63,21 @@ const WorkflowDetail = () => { }, [workflow]); useEffect(() => { - if (lastRunStatus && lastRunStatus == "running") { - setIsRunning(true); - } else { - setIsRunning(false); - } + setIsRunning(lastRunStatus == WORKFLOW_RUN_STATUSES.RUNNING); }, [lastRunStatus]); useEffect(() => { - if (isRunning && workflowId) { - subscribe(workflowId, (e) => { - if (e.record.lastRunStatus !== "running") { + if (!!workflowId && isRunning) { + subscribeWorkflow(workflowId, (e) => { + if (e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.RUNNING) { setIsRunning(false); - unsubscribe(workflowId); + unsubscribeWorkflow(workflowId); } }); + + return () => { + unsubscribeWorkflow(workflowId); + }; } }, [workflowId, isRunning]); @@ -174,26 +174,28 @@ const WorkflowDetail = () => { } promise.then(async () => { + let unsubscribeFn: Awaited> | undefined = undefined; + try { + setIsRunning(true); + // subscribe before running workflow - subscribe(workflowId!, (e) => { - if (e.record.lastRunStatus !== "running") { + unsubscribeFn = await subscribeWorkflow(workflowId!, (e) => { + if (e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.RUNNING) { setIsRunning(false); - unsubscribe(workflowId!); + unsubscribeFn?.(); } }); + await runWorkflow(workflowId!); - setIsRunning(true); messageApi.success(t("common.text.operation_succeeded")); } catch (err) { - if (err instanceof ClientResponseError && err.isAbort) { - return; - } + setIsRunning(false); + unsubscribeFn?.(); console.error(err); messageApi.warning(t("common.text.operation_failed")); - setIsRunning(false); } }); }; From a0c08e841d299a43b8a34aeedc6c22785cfcbf25 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Fri, 10 Jan 2025 22:41:39 +0800 Subject: [PATCH 3/6] feat: separate access providers and dns providers --- internal/applicant/applicant.go | 3 +- internal/applicant/providers.go | 24 ++--- internal/domain/provider.go | 34 ++++++- .../provider/ApplyDNSProviderPicker.tsx | 67 +++++++++++++ .../provider/ApplyDNSProviderSelect.tsx | 51 ++++++++++ .../provider/DeployProviderPicker.tsx | 5 +- ui/src/components/workflow/node/ApplyNode.tsx | 2 - .../workflow/node/ApplyNodeConfigForm.tsx | 45 ++++++++- .../workflow/node/DeployNodeConfigForm.tsx | 5 +- ui/src/domain/provider.ts | 99 +++++++++++++++---- ui/src/i18n/locales/en/nls.common.json | 5 + .../i18n/locales/en/nls.workflow.nodes.json | 2 + ui/src/i18n/locales/zh/nls.common.json | 5 + .../i18n/locales/zh/nls.workflow.nodes.json | 2 + 14 files changed, 307 insertions(+), 42 deletions(-) create mode 100644 ui/src/components/provider/ApplyDNSProviderPicker.tsx create mode 100644 ui/src/components/provider/ApplyDNSProviderSelect.tsx diff --git a/internal/applicant/applicant.go b/internal/applicant/applicant.go index 2f2f411f..8f38f4a4 100644 --- a/internal/applicant/applicant.go +++ b/internal/applicant/applicant.go @@ -53,6 +53,7 @@ func NewWithApplyNode(node *domain.WorkflowNode) (Applicant, error) { return nil, fmt.Errorf("failed to get access #%s record: %w", accessId, err) } + applyProvider := node.GetConfigString("provider") applyConfig := &applyConfig{ Domains: node.GetConfigString("domains"), ContactEmail: node.GetConfigString("contactEmail"), @@ -63,7 +64,7 @@ func NewWithApplyNode(node *domain.WorkflowNode) (Applicant, error) { DisableFollowCNAME: node.GetConfigBool("disableFollowCNAME"), } - challengeProvider, err := createChallengeProvider(domain.AccessProviderType(access.Provider), access.Config, applyConfig) + challengeProvider, err := createChallengeProvider(domain.ApplyDNSProviderType(applyProvider), access.Config, applyConfig) if err != nil { return nil, err } diff --git a/internal/applicant/providers.go b/internal/applicant/providers.go index c8800093..147fbc72 100644 --- a/internal/applicant/providers.go +++ b/internal/applicant/providers.go @@ -20,13 +20,13 @@ import ( providerVolcEngine "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/volcengine" ) -func createChallengeProvider(provider domain.AccessProviderType, accessConfig string, applyConfig *applyConfig) (challenge.Provider, error) { +func createChallengeProvider(provider domain.ApplyDNSProviderType, accessConfig string, applyConfig *applyConfig) (challenge.Provider, error) { /* 注意:如果追加新的常量值,请保持以 ASCII 排序。 NOTICE: If you add new constant, please keep ASCII order. */ switch provider { - case domain.AccessProviderTypeACMEHttpReq: + case domain.ApplyDNSProviderTypeACMEHttpReq: { access := &domain.AccessConfigForACMEHttpReq{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -43,7 +43,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeAliyun: + case domain.ApplyDNSProviderTypeAliyun, domain.ApplyDNSProviderTypeAliyunDNS: { access := &domain.AccessConfigForAliyun{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -58,7 +58,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeAWS: + case domain.ApplyDNSProviderTypeAWS, domain.ApplyDNSProviderTypeAWSRoute53: { access := &domain.AccessConfigForAWS{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -75,7 +75,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeCloudflare: + case domain.ApplyDNSProviderTypeCloudflare: { access := &domain.AccessConfigForCloudflare{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -89,7 +89,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeGoDaddy: + case domain.ApplyDNSProviderTypeGoDaddy: { access := &domain.AccessConfigForGoDaddy{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -104,7 +104,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeHuaweiCloud: + case domain.ApplyDNSProviderTypeHuaweiCloud, domain.ApplyDNSProviderTypeHuaweiCloudDNS: { access := &domain.AccessConfigForHuaweiCloud{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -120,7 +120,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeNameDotCom: + case domain.ApplyDNSProviderTypeNameDotCom: { access := &domain.AccessConfigForNameDotCom{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -135,7 +135,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeNameSilo: + case domain.ApplyDNSProviderTypeNameSilo: { access := &domain.AccessConfigForNameSilo{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -149,7 +149,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypePowerDNS: + case domain.ApplyDNSProviderTypePowerDNS: { access := &domain.AccessConfigForPowerDNS{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -164,7 +164,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeTencentCloud: + case domain.ApplyDNSProviderTypeTencentCloud, domain.ApplyDNSProviderTypeTencentCloudDNS: { access := &domain.AccessConfigForTencentCloud{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { @@ -179,7 +179,7 @@ func createChallengeProvider(provider domain.AccessProviderType, accessConfig st return applicant, err } - case domain.AccessProviderTypeVolcEngine: + case domain.ApplyDNSProviderTypeVolcEngine, domain.ApplyDNSProviderTypeVolcEngineDNS: { access := &domain.AccessConfigForVolcEngine{} if err := json.Unmarshal([]byte(accessConfig), access); err != nil { diff --git a/internal/domain/provider.go b/internal/domain/provider.go index b0f9c05b..0c07e458 100644 --- a/internal/domain/provider.go +++ b/internal/domain/provider.go @@ -3,7 +3,7 @@ type AccessProviderType string /* -提供商类型常量值。 +授权提供商类型常量值。 注意:如果追加新的常量值,请保持以 ASCII 排序。 NOTICE: If you add new constant, please keep ASCII order. @@ -30,11 +30,39 @@ const ( AccessProviderTypeWebhook = AccessProviderType("webhook") ) +type ApplyDNSProviderType string + +/* +申请证书 DNS 提供商常量值。 +短横线前的部分始终等于授权提供商类型。 + + 注意:如果追加新的常量值,请保持以 ASCII 排序。 + NOTICE: If you add new constant, please keep ASCII order. +*/ +const ( + ApplyDNSProviderTypeACMEHttpReq = ApplyDNSProviderType("acmehttpreq") + ApplyDNSProviderTypeAliyun = ApplyDNSProviderType("aliyun") // 兼容旧值,等同于 [ApplyDNSProviderTypeAliyunDNS] + ApplyDNSProviderTypeAliyunDNS = ApplyDNSProviderType("aliyun-dns") + ApplyDNSProviderTypeAWS = ApplyDNSProviderType("aws") // 兼容旧值,等同于 [ApplyDNSProviderTypeAWSRoute53] + ApplyDNSProviderTypeAWSRoute53 = ApplyDNSProviderType("aws-route53") + ApplyDNSProviderTypeCloudflare = ApplyDNSProviderType("cloudflare") + ApplyDNSProviderTypeGoDaddy = ApplyDNSProviderType("godaddy") + ApplyDNSProviderTypeHuaweiCloud = ApplyDNSProviderType("huaweicloud") // 兼容旧值,等同于 [ApplyDNSProviderTypeHuaweiCloudDNS] + ApplyDNSProviderTypeHuaweiCloudDNS = ApplyDNSProviderType("huaweicloud-dns") + ApplyDNSProviderTypeNameDotCom = ApplyDNSProviderType("namedotcom") + ApplyDNSProviderTypeNameSilo = ApplyDNSProviderType("namesilo") + ApplyDNSProviderTypePowerDNS = ApplyDNSProviderType("powerdns") + ApplyDNSProviderTypeTencentCloud = ApplyDNSProviderType("tencentcloud") // 兼容旧值,等同于 [ApplyDNSProviderTypeTencentCloudDNS] + ApplyDNSProviderTypeTencentCloudDNS = ApplyDNSProviderType("tencentcloud-dns") + ApplyDNSProviderTypeVolcEngine = ApplyDNSProviderType("volcengine") // 兼容旧值,等同于 [ApplyDNSProviderTypeVolcEngineDNS] + ApplyDNSProviderTypeVolcEngineDNS = ApplyDNSProviderType("volcengine-dns") +) + type DeployProviderType string /* -提供商部署目标常量值。 -短横线前的部分始终等于提供商类型。 +部署目标提供商常量值。 +短横线前的部分始终等于授权提供商类型。 注意:如果追加新的常量值,请保持以 ASCII 排序。 NOTICE: If you add new constant, please keep ASCII order. diff --git a/ui/src/components/provider/ApplyDNSProviderPicker.tsx b/ui/src/components/provider/ApplyDNSProviderPicker.tsx new file mode 100644 index 00000000..e72935cc --- /dev/null +++ b/ui/src/components/provider/ApplyDNSProviderPicker.tsx @@ -0,0 +1,67 @@ +import { memo, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { Avatar, Card, Col, Empty, Flex, Input, Row, Typography } from "antd"; + +import Show from "@/components/Show"; +import { applyDNSProvidersMap } from "@/domain/provider"; + +export type ApplyDNSProviderPickerProps = { + className?: string; + style?: React.CSSProperties; + placeholder?: string; + onSelect?: (value: string) => void; +}; + +const ApplyDNSProviderPicker = ({ className, style, placeholder, onSelect }: ApplyDNSProviderPickerProps) => { + const { t } = useTranslation(); + + const [keyword, setKeyword] = useState(); + + const providers = Array.from(applyDNSProvidersMap.values()); + const filteredProviders = providers.filter((provider) => { + if (keyword) { + const value = keyword.toLowerCase(); + return provider.type.toLowerCase().includes(value) || provider.name.toLowerCase().includes(value); + } + + return true; + }); + + const handleProviderTypeSelect = (value: string) => { + onSelect?.(value); + }; + + return ( +
+ setKeyword(e.target.value.trim())} /> + +
+ 0} fallback={}> + + {filteredProviders.map((provider, index) => { + return ( + + { + handleProviderTypeSelect(provider.type); + }} + > + + + {t(provider.name)} + + + + ); + })} + + +
+
+ ); +}; + +export default memo(ApplyDNSProviderPicker); diff --git a/ui/src/components/provider/ApplyDNSProviderSelect.tsx b/ui/src/components/provider/ApplyDNSProviderSelect.tsx new file mode 100644 index 00000000..3b76feff --- /dev/null +++ b/ui/src/components/provider/ApplyDNSProviderSelect.tsx @@ -0,0 +1,51 @@ +import { memo } from "react"; +import { useTranslation } from "react-i18next"; +import { Avatar, Select, type SelectProps, Space, Typography } from "antd"; + +import { applyDNSProvidersMap } from "@/domain/provider"; + +export type ApplyDNSProviderSelectProps = Omit< + SelectProps, + "filterOption" | "filterSort" | "labelRender" | "options" | "optionFilterProp" | "optionLabelProp" | "optionRender" +>; + +const ApplyDNSProviderSelect = (props: ApplyDNSProviderSelectProps) => { + const { t } = useTranslation(); + + const options = Array.from(applyDNSProvidersMap.values()).map((item) => ({ + key: item.type, + value: item.type, + label: t(item.name), + })); + + const renderOption = (key: string) => { + const provider = applyDNSProvidersMap.get(key); + return ( + + + + {t(provider?.name ?? "")} + + + ); + }; + + return ( + - - - } - > - - ); }; diff --git a/ui/src/components/access/AccessFormHuaweiCloudConfig.tsx b/ui/src/components/access/AccessFormHuaweiCloudConfig.tsx index d4765e81..f1d56ff0 100644 --- a/ui/src/components/access/AccessFormHuaweiCloudConfig.tsx +++ b/ui/src/components/access/AccessFormHuaweiCloudConfig.tsx @@ -19,7 +19,6 @@ const initFormModel = (): AccessFormHuaweiCloudConfigFieldValues => { return { accessKeyId: "", secretAccessKey: "", - region: "cn-north-1", }; }; @@ -37,12 +36,6 @@ const AccessFormHuaweiCloudConfig = ({ form: formInst, formName, disabled, initi .min(1, t("access.form.huaweicloud_secret_access_key.placeholder")) .max(64, t("common.errmsg.string_max", { max: 64 })) .trim(), - // TODO: 该字段仅用于申请证书,后续迁移到工作流表单中 - region: z - .string() - .max(64, t("common.errmsg.string_max", { max: 64 })) - .trim() - .nullish(), }); const formRule = createSchemaFieldRule(formSchema); @@ -76,15 +69,6 @@ const AccessFormHuaweiCloudConfig = ({ form: formInst, formName, disabled, initi > - - } - > - - ); }; diff --git a/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx b/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx index d59e7fd4..672d8621 100644 --- a/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx +++ b/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx @@ -1,4 +1,4 @@ -import { forwardRef, memo, useEffect, useImperativeHandle, useState } from "react"; +import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { FormOutlined as FormOutlinedIcon, PlusOutlined as PlusOutlinedIcon, QuestionCircleOutlined as QuestionCircleOutlinedIcon } from "@ant-design/icons"; import { useControllableValue } from "ahooks"; @@ -11,13 +11,16 @@ import MultipleInput from "@/components/MultipleInput"; import AccessEditModal from "@/components/access/AccessEditModal"; import AccessSelect from "@/components/access/AccessSelect"; import ApplyDNSProviderSelect from "@/components/provider/ApplyDNSProviderSelect"; -import { ACCESS_USAGES, accessProvidersMap, applyDNSProvidersMap } from "@/domain/provider"; +import { ACCESS_PROVIDERS, ACCESS_USAGES, APPLY_DNS_PROVIDERS, accessProvidersMap, applyDNSProvidersMap } from "@/domain/provider"; import { type WorkflowNodeConfigForApply } from "@/domain/workflow"; -import { useAntdForm, useZustandShallowSelector } from "@/hooks"; +import { useAntdForm, useAntdFormName, useZustandShallowSelector } from "@/hooks"; import { useAccessesStore } from "@/stores/access"; import { useContactEmailsStore } from "@/stores/contact"; import { validDomainName, validIPv4Address, validIPv6Address } from "@/utils/validators"; +import ApplyNodeConfigFormAWSRoute53Config from "./ApplyNodeConfigFormAWSRoute53Config"; +import ApplyNodeConfigFormHuaweiCloudDNSConfig from "./ApplyNodeConfigFormHuaweiCloudDNSConfig"; + type ApplyNodeConfigFormFieldValues = Partial; export type ApplyNodeConfigFormProps = { @@ -61,6 +64,7 @@ const ApplyNodeConfigForm = forwardRef("domains", formInst); const fieldNameservers = Form.useWatch("nameservers", formInst); + const [nestedFormInst] = Form.useForm(); + const nestedFormName = useAntdFormName({ form: nestedFormInst, name: "workflowNodeApplyConfigFormProviderConfigForm" }); + const nestedFormEl = useMemo(() => { + const nestedFormProps = { + form: nestedFormInst, + formName: nestedFormName, + disabled: disabled, + initialValues: initialValues?.providerConfig, + }; + + /* + 注意:如果追加新的子组件,请保持以 ASCII 排序。 + NOTICE: If you add new child component, please keep ASCII order. + */ + switch (fieldProvider) { + case ACCESS_PROVIDERS.AWS: + case APPLY_DNS_PROVIDERS.AWS_ROUTE53: + return ; + case ACCESS_PROVIDERS.HUAWEICLOUD: + case APPLY_DNS_PROVIDERS.HUAWEICLOUD_DNS: + return ; + } + }, [disabled, initialValues?.providerConfig, fieldProvider, nestedFormInst, nestedFormName]); + const handleProviderSelect = (value: string) => { if (fieldProvider === value) return; @@ -115,6 +143,13 @@ const ApplyNodeConfigForm = forwardRef { + if (name === nestedFormName) { + formInst.setFieldValue("providerConfig", nestedFormInst.getFieldsValue()); + onValuesChange?.(formInst.getFieldsValue(true)); + } + }; + const handleFormChange = (_: unknown, values: z.infer) => { onValuesChange?.(values as ApplyNodeConfigFormFieldValues); }; @@ -122,101 +157,113 @@ const ApplyNodeConfigForm = forwardRef { return { getFieldsValue: () => { - return formInst.getFieldsValue(true); + const values = formInst.getFieldsValue(true); + values.providerConfig = nestedFormInst.getFieldsValue(); + return values; }, resetFields: (fields) => { - return formInst.resetFields(fields); + formInst.resetFields(fields); + + if (!!fields && fields.includes("providerConfig")) { + nestedFormInst.resetFields(fields); + } }, validateFields: (nameList, config) => { - return formInst.validateFields(nameList, config); + const t1 = formInst.validateFields(nameList, config); + const t2 = nestedFormInst.validateFields(undefined, config); + return Promise.all([t1, t2]).then(() => t1); }, } as ApplyNodeConfigFormInstance; }); return ( -
- } - > - - - - - - - - } - onChange={(v) => { - formInst.setFieldValue("domains", v); - }} - /> - - + + + } + > + + + + + + + + } + onChange={(v) => { + formInst.setFieldValue("domains", v); + }} + /> + + - } - > - - + } + > + + - - - - - - { - const provider = accessProvidersMap.get(record.provider); - return ACCESS_USAGES.ALL === provider?.usage || ACCESS_USAGES.APPLY === provider?.usage; - }} - onChange={handleProviderAccessSelect} + - + + + + + { + const provider = accessProvidersMap.get(record.provider); + return ACCESS_USAGES.ALL === provider?.usage || ACCESS_USAGES.APPLY === provider?.usage; + }} + onChange={handleProviderAccessSelect} + /> + + + + + {nestedFormEl} @@ -224,71 +271,73 @@ const ApplyNodeConfigForm = forwardRef - - ({ + label: e, + value: e, + }))} + placeholder={t("workflow_node.apply.form.key_algorithm.placeholder")} + /> + - } - > - - - } + > + + + { + formInst.setFieldValue("nameservers", e.target.value); + }} + /> + + { - formInst.setFieldValue("nameservers", e.target.value); + trigger={ + + } + onChange={(value) => { + formInst.setFieldValue("nameservers", value); }} /> - - - - - } - onChange={(value) => { - formInst.setFieldValue("nameservers", value); - }} + + + + } + > + - - + - } - > - - - - } - > - - - + } + > + + + +
); } ); diff --git a/ui/src/components/workflow/node/ApplyNodeConfigFormAWSRoute53Config.tsx b/ui/src/components/workflow/node/ApplyNodeConfigFormAWSRoute53Config.tsx new file mode 100644 index 00000000..a14a7057 --- /dev/null +++ b/ui/src/components/workflow/node/ApplyNodeConfigFormAWSRoute53Config.tsx @@ -0,0 +1,81 @@ +import { useTranslation } from "react-i18next"; +import { Form, type FormInstance, Input } from "antd"; +import { createSchemaFieldRule } from "antd-zod"; +import { z } from "zod"; + +type ApplyNodeConfigFormAWSRoute53ConfigFieldValues = Nullish<{ + region: string; + hostedZoneId: string; +}>; + +export type ApplyNodeConfigFormAWSRoute53ConfigProps = { + form: FormInstance; + formName: string; + disabled?: boolean; + initialValues?: ApplyNodeConfigFormAWSRoute53ConfigFieldValues; + onValuesChange?: (values: ApplyNodeConfigFormAWSRoute53ConfigFieldValues) => void; +}; + +const initFormModel = (): ApplyNodeConfigFormAWSRoute53ConfigFieldValues => { + return { + region: "us-east-1", + hostedZoneId: "", + }; +}; + +const ApplyNodeConfigFormAWSRoute53Config = ({ + form: formInst, + formName, + disabled, + initialValues, + onValuesChange, +}: ApplyNodeConfigFormAWSRoute53ConfigProps) => { + const { t } = useTranslation(); + + const formSchema = z.object({ + region: z + .string({ message: t("workflow_node.apply.form.aws_route53_region.placeholder") }) + .nonempty(t("workflow_node.apply.form.aws_route53_region.placeholder")) + .trim(), + hostedZoneId: z + .string({ message: t("workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder") }) + .nonempty(t("workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder")) + .trim(), + }); + const formRule = createSchemaFieldRule(formSchema); + + const handleFormChange = (_: unknown, values: z.infer) => { + onValuesChange?.(values); + }; + + return ( +
+ } + > + + + + } + > + + +
+ ); +}; + +export default ApplyNodeConfigFormAWSRoute53Config; diff --git a/ui/src/components/workflow/node/ApplyNodeConfigFormHuaweiCloudDNSConfig.tsx b/ui/src/components/workflow/node/ApplyNodeConfigFormHuaweiCloudDNSConfig.tsx new file mode 100644 index 00000000..dcde7c75 --- /dev/null +++ b/ui/src/components/workflow/node/ApplyNodeConfigFormHuaweiCloudDNSConfig.tsx @@ -0,0 +1,66 @@ +import { useTranslation } from "react-i18next"; +import { Form, type FormInstance, Input } from "antd"; +import { createSchemaFieldRule } from "antd-zod"; +import { z } from "zod"; + +type ApplyNodeConfigFormHuaweiCloudDNSConfigFieldValues = Nullish<{ + region: string; +}>; + +export type ApplyNodeConfigFormHuaweiCloudDNSConfigProps = { + form: FormInstance; + formName: string; + disabled?: boolean; + initialValues?: ApplyNodeConfigFormHuaweiCloudDNSConfigFieldValues; + onValuesChange?: (values: ApplyNodeConfigFormHuaweiCloudDNSConfigFieldValues) => void; +}; + +const initFormModel = (): ApplyNodeConfigFormHuaweiCloudDNSConfigFieldValues => { + return { + region: "cn-north-1", + }; +}; + +const ApplyNodeConfigFormHuaweiCloudDNSConfig = ({ + form: formInst, + formName, + disabled, + initialValues, + onValuesChange, +}: ApplyNodeConfigFormHuaweiCloudDNSConfigProps) => { + const { t } = useTranslation(); + + const formSchema = z.object({ + region: z + .string({ message: t("workflow_node.apply.form.huaweicloud_dns_region.placeholder") }) + .nonempty(t("workflow_node.apply.form.huaweicloud_dns_region.placeholder")) + .trim(), + }); + const formRule = createSchemaFieldRule(formSchema); + + const handleFormChange = (_: unknown, values: z.infer) => { + onValuesChange?.(values); + }; + + return ( +
+ } + > + + +
+ ); +}; + +export default ApplyNodeConfigFormHuaweiCloudDNSConfig; diff --git a/ui/src/components/workflow/node/DeployNodeConfigForm.tsx b/ui/src/components/workflow/node/DeployNodeConfigForm.tsx index 798d6a7f..272e5f18 100644 --- a/ui/src/components/workflow/node/DeployNodeConfigForm.tsx +++ b/ui/src/components/workflow/node/DeployNodeConfigForm.tsx @@ -80,7 +80,8 @@ const DeployNodeConfigForm = forwardRef !!formInst.getFieldValue("provider"), t("workflow_node.deploy.form.provider.placeholder")), providerConfig: z.any(), }); const formRule = createSchemaFieldRule(formSchema); @@ -200,10 +201,16 @@ const DeployNodeConfigForm = forwardRef { return { getFieldsValue: () => { - return formInst.getFieldsValue(true); + const values = formInst.getFieldsValue(true); + values.providerConfig = nestedFormInst.getFieldsValue(); + return values; }, resetFields: (fields) => { - return formInst.resetFields(fields); + formInst.resetFields(fields); + + if (!!fields && fields.includes("providerConfig")) { + nestedFormInst.resetFields(fields); + } }, validateFields: (nameList, config) => { const t1 = formInst.validateFields(nameList, config); @@ -297,16 +304,18 @@ const DeployNodeConfigForm = forwardRef - - - - {t("workflow_node.deploy.form.params_config.label")} - - - {nestedFormEl} + + + + {t("workflow_node.deploy.form.params_config.label")} + + + + {nestedFormEl} + ); } diff --git a/ui/src/domain/workflow.ts b/ui/src/domain/workflow.ts index 01d7b8b2..c86078ac 100644 --- a/ui/src/domain/workflow.ts +++ b/ui/src/domain/workflow.ts @@ -105,6 +105,7 @@ export type WorkflowNodeConfigForApply = { contactEmail: string; provider: string; providerAccessId: string; + providerConfig?: Record; keyAlgorithm: string; nameservers?: string; propagationTimeout?: number; diff --git a/ui/src/i18n/locales/en/nls.access.json b/ui/src/i18n/locales/en/nls.access.json index 0da23efb..94ca5979 100644 --- a/ui/src/i18n/locales/en/nls.access.json +++ b/ui/src/i18n/locales/en/nls.access.json @@ -45,12 +45,6 @@ "access.form.aws_secret_access_key.label": "AWS SecretAccessKey", "access.form.aws_secret_access_key.placeholder": "Please enter AWS SecretAccessKey", "access.form.aws_secret_access_key.tooltip": "For more information, see https://docs.aws.amazon.com/en_us/IAM/latest/UserGuide/id_credentials_access-keys.html", - "access.form.aws_region.label": "AWS Region", - "access.form.aws_region.placeholder": "Please enter AWS region (e.g. us-east-1)", - "access.form.aws_region.tooltip": "For more information, see https://docs.aws.amazon.com/en_us/general/latest/gr/rande.html#regional-endpoints", - "access.form.aws_hosted_zone_id.label": "AWS hosted zone ID", - "access.form.aws_hosted_zone_id.placeholder": "Please enter AWS hosted zone ID", - "access.form.aws_hosted_zone_id.tooltip": "For more information, see https://docs.aws.amazon.com/en_us/Route53/latest/DeveloperGuide/hosted-zones-working-with.html", "access.form.baiducloud_access_key_id.label": "Baidu Cloud AccessKeyID", "access.form.baiducloud_access_key_id.placeholder": "Please enter Baidu Cloud AccessKeyID", "access.form.baiducloud_access_key_id.tooltip": "For more information, see https://intl.cloud.baidu.com/doc/Reference/s/jjwvz2e3p-en", @@ -84,9 +78,6 @@ "access.form.huaweicloud_secret_access_key.label": "Huawei Cloud SecretAccessKey", "access.form.huaweicloud_secret_access_key.placeholder": "Please enter Huawei Cloud SecretAccessKey", "access.form.huaweicloud_secret_access_key.tooltip": "For more information, see https://support.huaweicloud.com/intl/en-us/usermanual-ca/ca_01_0003.html", - "access.form.huaweicloud_region.label": "Huawei Cloud region", - "access.form.huaweicloud_region.placeholder": "Please enter Huawei Cloud region (e.g. cn-north-1)", - "access.form.huaweicloud_region.tooltip": "For more information, see https://console-intl.huaweicloud.com/apiexplorer/#/endpoint", "access.form.k8s_kubeconfig.label": "KubeConfig", "access.form.k8s_kubeconfig.placeholder": "Please enter KubeConfig file", "access.form.k8s_kubeconfig.upload": "Choose File ...", diff --git a/ui/src/i18n/locales/en/nls.workflow.nodes.json b/ui/src/i18n/locales/en/nls.workflow.nodes.json index b7de2fbe..2095445e 100644 --- a/ui/src/i18n/locales/en/nls.workflow.nodes.json +++ b/ui/src/i18n/locales/en/nls.workflow.nodes.json @@ -37,6 +37,15 @@ "workflow_node.apply.form.provider_access.placeholder": "Please select an authorization of DNS provider", "workflow_node.apply.form.provider_access.tooltip": "Used to manage DNS records during ACME DNS-01 authentication.", "workflow_node.apply.form.provider_access.button": "Create", + "workflow_node.apply.form.aws_route53_region.label": "AWS Route53 Region", + "workflow_node.apply.form.aws_route53_region.placeholder": "Please enter AWS Route53 region (e.g. us-east-1)", + "workflow_node.apply.form.aws_route53_region.tooltip": "For more information, see https://docs.aws.amazon.com/en_us/general/latest/gr/rande.html#regional-endpoints", + "workflow_node.apply.form.aws_route53_hosted_zone_id.label": "AWS Route53 hosted zone ID", + "workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder": "Please enter AWS Route53 hosted zone ID", + "workflow_node.apply.form.aws_route53_hosted_zone_id.tooltip": "For more information, see https://docs.aws.amazon.com/en_us/Route53/latest/DeveloperGuide/hosted-zones-working-with.html", + "workflow_node.apply.form.huaweicloud_dns_region.label": "Huawei Cloud DNS region", + "workflow_node.apply.form.huaweicloud_dns_region.placeholder": "Please enter Huawei Cloud DNS region (e.g. cn-north-1)", + "workflow_node.apply.form.huaweicloud_dns_region.tooltip": "For more information, see https://console-intl.huaweicloud.com/apiexplorer/#/endpoint", "workflow_node.apply.form.advanced_config.label": "Advanced settings", "workflow_node.apply.form.key_algorithm.label": "Certificate key algorithm", "workflow_node.apply.form.key_algorithm.placeholder": "Please select certificate key algorithm", diff --git a/ui/src/i18n/locales/zh/nls.access.json b/ui/src/i18n/locales/zh/nls.access.json index 37645e5b..b908f33e 100644 --- a/ui/src/i18n/locales/zh/nls.access.json +++ b/ui/src/i18n/locales/zh/nls.access.json @@ -45,12 +45,6 @@ "access.form.aws_secret_access_key.label": "AWS SecretAccessKey", "access.form.aws_secret_access_key.placeholder": "请输入 AWS SecretAccessKey", "access.form.aws_secret_access_key.tooltip": "这是什么?请参阅 https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/id_credentials_access-keys.html", - "access.form.aws_region.label": "AWS 区域", - "access.form.aws_region.placeholder": "请输入 AWS 区域(例如:us-east-1)", - "access.form.aws_region.tooltip": "这是什么?请参阅 https://docs.aws.amazon.com/zh_cn/general/latest/gr/rande.html#regional-endpoints", - "access.form.aws_hosted_zone_id.label": "AWS 托管区域 ID", - "access.form.aws_hosted_zone_id.placeholder": "请输入 AWS 托管区域 ID", - "access.form.aws_hosted_zone_id.tooltip": "这是什么?请参阅 https://docs.aws.amazon.com/zh_cn/Route53/latest/DeveloperGuide/hosted-zones-working-with.html", "access.form.baiducloud_access_key_id.label": "百度智能云 AccessKeyID", "access.form.baiducloud_access_key_id.placeholder": "请输入百度智能云 AccessKeyID", "access.form.baiducloud_access_key_id.tooltip": "这是什么?请参阅 https://cloud.baidu.com/doc/Reference/s/jjwvz2e3p", @@ -84,9 +78,6 @@ "access.form.huaweicloud_secret_access_key.label": "华为云 SecretAccessKey", "access.form.huaweicloud_secret_access_key.placeholder": "请输入华为云 SecretAccessKey", "access.form.huaweicloud_secret_access_key.tooltip": "这是什么?请参阅 https://support.huaweicloud.com/usermanual-ca/ca_01_0003.html", - "access.form.huaweicloud_region.label": "华为云区域", - "access.form.huaweicloud_region.placeholder": "请输入华为云区域(例如:cn-north-1)", - "access.form.huaweicloud_region.tooltip": "这是什么?请参阅 https://console.huaweicloud.com/apiexplorer/#/endpoint", "access.form.k8s_kubeconfig.label": "KubeConfig", "access.form.k8s_kubeconfig.placeholder": "请选择 KubeConfig 文件", "access.form.k8s_kubeconfig.upload": "选择文件", diff --git a/ui/src/i18n/locales/zh/nls.workflow.json b/ui/src/i18n/locales/zh/nls.workflow.json index fe2644cb..87482988 100644 --- a/ui/src/i18n/locales/zh/nls.workflow.json +++ b/ui/src/i18n/locales/zh/nls.workflow.json @@ -9,7 +9,7 @@ "workflow.action.delete.confirm": "确定要删除此工作流吗?", "workflow.action.enable": "启用", "workflow.action.enable.failed.uncompleted": "请先完成流程编排并发布更改", - "workflow.action.disable": "禁用", + "workflow.action.disable": "停用", "workflow.props.name": "名称", "workflow.props.description": "描述", diff --git a/ui/src/i18n/locales/zh/nls.workflow.nodes.json b/ui/src/i18n/locales/zh/nls.workflow.nodes.json index 83739848..6ede2b58 100644 --- a/ui/src/i18n/locales/zh/nls.workflow.nodes.json +++ b/ui/src/i18n/locales/zh/nls.workflow.nodes.json @@ -37,6 +37,15 @@ "workflow_node.apply.form.provider_access.placeholder": "请选择 DNS 提供商授权", "workflow_node.apply.form.provider_access.tooltip": "用于 ACME DNS-01 认证时操作域名解析记录,注意与部署阶段所需的主机提供商相区分。", "workflow_node.apply.form.provider_access.button": "新建", + "workflow_node.apply.form.aws_route53_region.label": "AWS Route53 区域", + "workflow_node.apply.form.aws_route53_region.placeholder": "请输入 AWS Route53 区域(例如:us-east-1)", + "workflow_node.apply.form.aws_route53_region.tooltip": "这是什么?请参阅 https://docs.aws.amazon.com/zh_cn/general/latest/gr/rande.html#regional-endpoints", + "workflow_node.apply.form.aws_route53_hosted_zone_id.label": "AWS Route53 托管区域 ID", + "workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder": "请输入 AWS Route53 托管区域 ID", + "workflow_node.apply.form.aws_route53_hosted_zone_id.tooltip": "这是什么?请参阅 https://docs.aws.amazon.com/zh_cn/Route53/latest/DeveloperGuide/hosted-zones-working-with.html", + "workflow_node.apply.form.huaweicloud_dns_region.label": "华为云 DNS 服务区域", + "workflow_node.apply.form.huaweicloud_dns_region.placeholder": "请输入华为云 DNS 服务区域(例如:cn-north-1)", + "workflow_node.apply.form.huaweicloud_dns_region.tooltip": "这是什么?请参阅 https://console.huaweicloud.com/apiexplorer/#/endpoint", "workflow_node.apply.form.advanced_config.label": "高级设置", "workflow_node.apply.form.key_algorithm.label": "数字证书算法", "workflow_node.apply.form.key_algorithm.placeholder": "请选择数字证书算法", From d9f38c38a6cc510b580a9e40d3e2a09d98c56b7f Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Sat, 11 Jan 2025 16:51:21 +0800 Subject: [PATCH 5/6] feat(ui): add prompt message during workflow running --- ui/src/i18n/locales/en/nls.workflow.json | 1 + ui/src/i18n/locales/zh/nls.workflow.json | 1 + ui/src/pages/workflows/WorkflowDetail.tsx | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/i18n/locales/en/nls.workflow.json b/ui/src/i18n/locales/en/nls.workflow.json index d59fb3ae..465923d1 100644 --- a/ui/src/i18n/locales/en/nls.workflow.json +++ b/ui/src/i18n/locales/en/nls.workflow.json @@ -50,5 +50,6 @@ "workflow.detail.orchestration.action.release.failed.uncompleted": "Please complete the orchestration first", "workflow.detail.orchestration.action.run": "Run", "workflow.detail.orchestration.action.run.confirm": "You have unreleased changes. Do you really want to run this workflow based on the latest released version?", + "workflow.detail.orchestration.action.run.prompt": "Running... Please check the history later", "workflow.detail.runs.tab": "History runs" } diff --git a/ui/src/i18n/locales/zh/nls.workflow.json b/ui/src/i18n/locales/zh/nls.workflow.json index 87482988..46058991 100644 --- a/ui/src/i18n/locales/zh/nls.workflow.json +++ b/ui/src/i18n/locales/zh/nls.workflow.json @@ -50,5 +50,6 @@ "workflow.detail.orchestration.action.release.failed.uncompleted": "流程编排未完成,请检查是否有节点未配置", "workflow.detail.orchestration.action.run": "执行", "workflow.detail.orchestration.action.run.confirm": "你有尚未发布的更改。你确定要以最近一次发布的版本继续执行吗?", + "workflow.detail.orchestration.action.run.prompt": "执行中……请稍后查看执行历史", "workflow.detail.runs.tab": "执行历史" } diff --git a/ui/src/pages/workflows/WorkflowDetail.tsx b/ui/src/pages/workflows/WorkflowDetail.tsx index cc5fba5b..97eeda2d 100644 --- a/ui/src/pages/workflows/WorkflowDetail.tsx +++ b/ui/src/pages/workflows/WorkflowDetail.tsx @@ -189,7 +189,7 @@ const WorkflowDetail = () => { await runWorkflow(workflowId!); - messageApi.success(t("common.text.operation_succeeded")); + messageApi.info(t("workflow.detail.orchestration.action.run.prompt")); } catch (err) { setIsRunning(false); unsubscribeFn?.(); From 8c4a239631647d680f8e308056e10654e8693c36 Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Sun, 12 Jan 2025 20:44:51 +0800 Subject: [PATCH 6/6] fix build error --- ui/src/components/workflow/node/ApplyNode.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/src/components/workflow/node/ApplyNode.tsx b/ui/src/components/workflow/node/ApplyNode.tsx index 9cb45aa4..556188d9 100644 --- a/ui/src/components/workflow/node/ApplyNode.tsx +++ b/ui/src/components/workflow/node/ApplyNode.tsx @@ -5,7 +5,6 @@ import { produce } from "immer"; import { type WorkflowNodeConfigForApply, WorkflowNodeType } from "@/domain/workflow"; import { useZustandShallowSelector } from "@/hooks"; -import { useAccessesStore } from "@/stores/access"; import { useContactEmailsStore } from "@/stores/contact"; import { useWorkflowStore } from "@/stores/workflow";