Skip to content

Commit 6a82654

Browse files
committed
fix: improve error handling and styles in certificate components #1442
1 parent 3355d7d commit 6a82654

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

app/src/views/certificate/components/AutoCertManagement.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,5 @@ function handleRenewed() {
9898
</template>
9999

100100
<style scoped lang="less">
101-
.auto-cert-management {
102-
margin-bottom: 24px;
103-
}
101+
104102
</style>

app/src/views/certificate/components/CertificateBasicInfo.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function copyToClipboard(text: string, label: string) {
4343
<AFormItem
4444
:label="$gettext('Name')"
4545
:validate-status="errors?.name ? 'error' : ''"
46-
:help="errors?.name === 'required'
46+
:help="errors?.name?.includes('required')
4747
? $gettext('This field is required')
4848
: ''"
4949
>
@@ -77,8 +77,8 @@ async function copyToClipboard(text: string, label: string) {
7777
<AFormItem
7878
:label="$gettext('SSL Certificate Path')"
7979
:validate-status="errors?.ssl_certificate_path ? 'error' : ''"
80-
:help="errors?.ssl_certificate_path === 'required' ? $gettext('This field is required')
81-
: errors?.ssl_certificate_path === 'certificate_path'
80+
:help="errors?.ssl_certificate_path?.includes('required') ? $gettext('This field is required')
81+
: errors?.ssl_certificate_path?.includes('certificate_path')
8282
? $gettext('The path exists, but the file is not a certificate') : ''"
8383
>
8484
<div v-if="isManaged" class="copy-container">
@@ -111,8 +111,8 @@ async function copyToClipboard(text: string, label: string) {
111111
<AFormItem
112112
:label="$gettext('SSL Certificate Key Path')"
113113
:validate-status="errors?.ssl_certificate_key_path ? 'error' : ''"
114-
:help="errors?.ssl_certificate_key_path === 'required' ? $gettext('This field is required')
115-
: errors?.ssl_certificate_key_path === 'privatekey_path'
114+
:help="errors?.ssl_certificate_key_path?.includes('required') ? $gettext('This field is required')
115+
: errors?.ssl_certificate_key_path?.includes('privatekey_path')
116116
? $gettext('The path exists, but the file is not a private key') : ''"
117117
>
118118
<div v-if="isManaged" class="copy-container">

app/src/views/certificate/components/CertificateContentEditor.vue

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ function handleDrop(e: DragEvent, type: 'certificate' | 'key') {
241241
width: 100%;
242242
243243
.label-text {
244-
font-weight: 500;
245244
color: rgba(0, 0, 0, 0.85);
246245
}
247246
}
@@ -282,4 +281,30 @@ function handleDrop(e: DragEvent, type: 'certificate' | 'key') {
282281
}
283282
}
284283
}
284+
285+
// 暗夜模式适配
286+
.dark {
287+
.certificate-content-editor {
288+
.label-with-copy {
289+
.label-text {
290+
color: rgba(255, 255, 255, 0.85);
291+
}
292+
}
293+
294+
.code-editor-container {
295+
.drag-overlay {
296+
background-color: rgba(64, 169, 255, 0.15);
297+
border-color: #177ddc;
298+
299+
.drag-content {
300+
color: #40a9ff;
301+
302+
p {
303+
color: #40a9ff;
304+
}
305+
}
306+
}
307+
}
308+
}
309+
}
285310
</style>

app/src/views/certificate/components/CertificateFileUpload.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const uploadText = computed(() => {
143143
</template>
144144
{{ uploadText }}
145145
</AButton>
146-
<span class="ml-2 text-gray-500 text-sm">
146+
<span class="ml-2 text-gray-500 text-sm hint-text">
147147
{{ $gettext('or drag file to editor below') }}
148148
</span>
149149
</div>
@@ -152,5 +152,18 @@ const uploadText = computed(() => {
152152
<style scoped lang="less">
153153
.certificate-file-upload {
154154
margin-bottom: 12px;
155+
156+
.hint-text {
157+
color: rgba(0, 0, 0, 0.45);
158+
}
159+
}
160+
161+
// 暗夜模式适配
162+
.dark {
163+
.certificate-file-upload {
164+
.hint-text {
165+
color: rgba(255, 255, 255, 0.45);
166+
}
167+
}
155168
}
156169
</style>

0 commit comments

Comments
 (0)