Skip to content

Commit 39b6621

Browse files
committed
style: set default protocol rustfs/rustfs#1641
1 parent d103075 commit 39b6621

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

components/replication/new-form.vue

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ import { Icon } from '#components'
166166
import { Field, FieldContent, FieldLabel } from '@/components/ui/field'
167167
import { Switch } from '@/components/ui/switch'
168168
import { getBytes } from '@/utils/functions'
169-
import { computed, reactive, ref } from 'vue'
169+
import { computed, reactive, ref, watch } from 'vue'
170170
import { useI18n } from 'vue-i18n'
171171
import Modal from '~/components/modal.vue'
172172
import Selector from '~/components/selector.vue'
@@ -188,7 +188,7 @@ const submitting = ref(false)
188188
189189
const formData = reactive({
190190
level: '1',
191-
endpoint: '',
191+
endpoint: 'http://',
192192
tls: false,
193193
accesskey: '',
194194
secrretkey: '',
@@ -205,6 +205,25 @@ const formData = reactive({
205205
expiredDeleteMark: true,
206206
})
207207
208+
watch(
209+
() => formData.tls,
210+
val => {
211+
if (val) {
212+
if (formData.endpoint.startsWith('http://')) {
213+
formData.endpoint = formData.endpoint.replace('http://', 'https://')
214+
} else if (!formData.endpoint.startsWith('https://')) {
215+
formData.endpoint = 'https://' + formData.endpoint
216+
}
217+
} else {
218+
if (formData.endpoint.startsWith('https://')) {
219+
formData.endpoint = formData.endpoint.replace('https://', 'http://')
220+
} else if (!formData.endpoint.startsWith('http://')) {
221+
formData.endpoint = 'http://' + formData.endpoint
222+
}
223+
}
224+
}
225+
)
226+
208227
const modeOptions = computed(() => [
209228
{ label: t('Asynchronous'), value: 'async' },
210229
{ label: t('Synchronous'), value: 'sync' },
@@ -227,7 +246,7 @@ const removeTag = (index: number) => {
227246
228247
const resetForm = () => {
229248
formData.level = '1'
230-
formData.endpoint = ''
249+
formData.endpoint = 'http://'
231250
formData.tls = false
232251
formData.accesskey = ''
233252
formData.secrretkey = ''

0 commit comments

Comments
 (0)