Skip to content

Commit 4ed529b

Browse files
fit2botibulergithub-actions[bot]
authored
perf: remove sub mod (#5254)
* perf: remove sub mod * perf: Update Dockerfile with new base image tag --------- Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ca5350c commit 4ed529b

File tree

12 files changed

+3663
-3465
lines changed

12 files changed

+3663
-3465
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jumpserver/lina-base:20251030_055624 AS stage-build
1+
FROM jumpserver/lina-base:20251030_071727 AS stage-build
22

33
ARG VERSION
44
ENV VERSION=$VERSION

src/components/Apps/UserConfirmDialog/index.vue

Lines changed: 100 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,12 @@
1313
v-on="$listeners"
1414
>
1515
<div v-if="confirmTypeRequired === 'relogin'">
16-
<el-row :gutter="24" style="margin: 0 auto;">
16+
<el-row :gutter="24" style="margin: 0 auto">
1717
<el-col :md="24" :sm="24">
18-
<el-alert
19-
:title="$tc('ReLoginTitle')"
20-
center
21-
style="margin-bottom: 20px;"
22-
type="error"
23-
/>
18+
<el-alert :title="$tc('ReLoginTitle')" center style="margin-bottom: 20px" type="error" />
2419
</el-col>
2520
</el-row>
26-
<el-row :gutter="24" style="margin: 0 auto;">
21+
<el-row :gutter="24" style="margin: 0 auto">
2722
<el-col :md="24" :sm="24">
2823
<el-button class="confirm-btn" size="mini" type="primary" @click="logout">
2924
{{ this.$t('ReLogin') }}
@@ -32,11 +27,11 @@
3227
</el-row>
3328
</div>
3429
<div v-else>
35-
<el-row :gutter="24" style="margin: 0 auto;">
30+
<el-row :gutter="24" style="margin: 0 auto">
3631
<el-col :md="24" :sm="24" :span="24" class="add">
3732
<el-select
3833
v-model="subTypeSelected"
39-
style="width: 100%; margin-bottom: 20px;"
34+
style="width: 100%; margin-bottom: 20px"
4035
@change="handleSubTypeChange"
4136
>
4237
<el-option
@@ -49,19 +44,22 @@
4944
</el-select>
5045
</el-col>
5146
</el-row>
52-
<el-row v-if="!noCodeMFA.includes(subTypeSelected)" :gutter="24" style="margin: 0 auto;">
53-
<el-col :md="24" :sm="24" style="display: flex; align-items: center; ">
47+
<el-row v-if="!noCodeMFA.includes(subTypeSelected)" :gutter="24" style="margin: 0 auto">
48+
<el-col :md="24" :sm="24" style="display: flex; align-items: center">
5449
<el-input
5550
v-model="secretValue"
5651
:placeholder="inputPlaceholder"
5752
:show-password="showPassword"
5853
@keyup.enter.native="handleConfirm"
5954
/>
60-
<span v-if="subTypeSelected === 'sms' || subTypeSelected === 'email'" style="margin: -1px 0 0 20px;">
55+
<span
56+
v-if="subTypeSelected === 'sms' || subTypeSelected === 'email'"
57+
style="margin: -1px 0 0 20px"
58+
>
6159
<el-button
6260
:disabled="smsBtnDisabled"
6361
size="mini"
64-
style="line-height: 14px; float: right;"
62+
style="line-height: 14px; float: right"
6563
type="primary"
6664
@click="sendCode"
6765
>
@@ -72,21 +70,17 @@
7270
</el-row>
7371
<el-row>
7472
<el-col>
73+
<iframe v-if="passkeyVisible" :src="passkeyUrl" style="display: none" />
7574
<iframe
76-
v-if="passkeyVisible"
77-
:src="passkeyUrl"
78-
style="display: none"
79-
/>
80-
<iframe
81-
v-if="isFaceCaptureVisible && subTypeSelected ==='face' && faceCaptureUrl"
75+
v-if="isFaceCaptureVisible && subTypeSelected === 'face' && faceCaptureUrl"
8276
:src="faceCaptureUrl"
8377
allow="camera"
8478
sandbox="allow-scripts allow-same-origin"
85-
style="width: 100%; height: 600px;border: none;"
79+
style="width: 100%; height: 600px; border: none"
8680
/>
8781
</el-col>
8882
</el-row>
89-
<el-row :gutter="24" style="margin: 20px auto 10px;">
83+
<el-row :gutter="24" style="margin: 20px auto 10px">
9084
<el-col :md="24" :sm="24">
9185
<el-button
9286
v-if="!noCodeMFA.includes(subTypeSelected)"
@@ -195,55 +189,65 @@ export default {
195189
this.$log.debug('perform confirm action')
196190
const confirmType = response.data?.code
197191
const confirmUrl = '/api/v1/authentication/confirm/'
198-
this.$axios.get(confirmUrl, { params: { confirm_type: confirmType } }).then((data) => {
199-
this.confirmTypeRequired = data.confirm_type
192+
this.$axios
193+
.get(confirmUrl, { params: { confirm_type: confirmType } })
194+
.then(data => {
195+
this.confirmTypeRequired = data.confirm_type
200196
201-
if (this.confirmTypeRequired === 'relogin') {
202-
this.$axios.post(confirmUrl, { 'confirm_type': 'relogin', 'secret_key': 'x' }).then(() => {
203-
this.callback()
204-
this.visible = false
205-
}).catch(() => {
206-
this.title = this.$t('NeedReLogin')
207-
this.visible = true
208-
})
209-
return
210-
}
211-
this.subTypeChoices = data.content
212-
const defaultSubType = this.subTypeChoices.filter(item => !item.disabled)[0]
213-
this.subTypeSelected = defaultSubType.name
214-
this.inputPlaceholder = defaultSubType.placeholder
215-
this.visible = true
216-
}).catch((err) => {
217-
const data = err.response?.data
218-
const msg = data?.error || data?.detail || data?.msg || this.$t('GetConfirmTypeFailed')
219-
this.$message.error(msg)
220-
this.cancel(err)
221-
}).finally(() => {
222-
this.processing = false
223-
})
197+
if (this.confirmTypeRequired === 'relogin') {
198+
this.$axios
199+
.post(confirmUrl, { confirm_type: 'relogin', secret_key: 'x' })
200+
.then(() => {
201+
this.callback()
202+
this.visible = false
203+
})
204+
.catch(() => {
205+
this.title = this.$t('NeedReLogin')
206+
this.visible = true
207+
})
208+
return
209+
}
210+
this.subTypeChoices = data.content
211+
const defaultSubType = this.subTypeChoices.filter(item => !item.disabled)[0]
212+
this.subTypeSelected = defaultSubType.name
213+
this.inputPlaceholder = defaultSubType.placeholder
214+
this.visible = true
215+
})
216+
.catch(err => {
217+
const data = err.response?.data
218+
const msg = data?.error || data?.detail || data?.msg || this.$t('GetConfirmTypeFailed')
219+
this.$message.error(msg)
220+
this.cancel(err)
221+
})
222+
.finally(() => {
223+
this.processing = false
224+
})
224225
}, 500),
225226
logout() {
226227
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
227228
},
228229
sendCode() {
229-
this.$axios.post(`/api/v1/authentication/mfa/select/`, { type: this.subTypeSelected }).then(res => {
230-
this.$message.success(this.$tc('VerificationCodeSent'))
231-
let time = 60
232-
this.smsBtnDisabled = true
230+
this.$axios
231+
.post(`/api/v1/authentication/mfa/select/`, { type: this.subTypeSelected })
232+
.then(res => {
233+
this.$message.success(this.$tc('VerificationCodeSent'))
234+
let time = 60
235+
this.smsBtnDisabled = true
233236
234-
const interval = setInterval(() => {
235-
time -= 1
236-
this.smsBtnText = `${this.$t('Pending')}: ${time}`
237+
const interval = setInterval(() => {
238+
time -= 1
239+
this.smsBtnText = `${this.$t('Pending')}: ${time}`
237240
238-
if (time <= 0) {
239-
clearInterval(interval)
240-
this.smsBtnText = this.$t('SendVerificationCode')
241-
this.smsBtnDisabled = false
242-
}
243-
}, 1000)
244-
}).catch(() => {
245-
this.$message.error(this.$tc('FailedToSendVerificationCode'))
246-
})
241+
if (time <= 0) {
242+
clearInterval(interval)
243+
this.smsBtnText = this.$t('SendVerificationCode')
244+
this.smsBtnDisabled = false
245+
}
246+
}, 1000)
247+
})
248+
.catch(() => {
249+
this.$message.error(this.$tc('FailedToSendVerificationCode'))
250+
})
247251
},
248252
handlePasskeyVerify() {
249253
this.passkeyVisible = true
@@ -267,23 +271,26 @@ export default {
267271
},
268272
startFaceCapture() {
269273
const url = '/api/v1/authentication/face/context/'
270-
this.$axios.post(url).then(data => {
271-
const token = data['token']
272-
this.faceCaptureUrl = '/facelive/capture?token=' + token
273-
this.isFaceCaptureVisible = true
274+
this.$axios
275+
.post(url)
276+
.then(data => {
277+
const token = data['token']
278+
this.faceCaptureUrl = '/facelive/capture?token=' + token
279+
this.isFaceCaptureVisible = true
274280
275-
const timer = setInterval(() => {
276-
this.$axios.get(url + `?token=${token}`).then(data => {
277-
if (data['is_finished']) {
278-
clearInterval(timer)
279-
this.isFaceCaptureVisible = false
280-
this.handleConfirm()
281-
}
282-
})
283-
}, 1000)
284-
}).catch(() => {
285-
this.$message.error(this.$tc('FailedToStartFaceCapture'))
286-
})
281+
const timer = setInterval(() => {
282+
this.$axios.get(url + `?token=${token}`).then(data => {
283+
if (data['is_finished']) {
284+
clearInterval(timer)
285+
this.isFaceCaptureVisible = false
286+
this.handleConfirm()
287+
}
288+
})
289+
}, 1000)
290+
})
291+
.catch(() => {
292+
this.$message.error(this.$tc('FailedToStartFaceCapture'))
293+
})
287294
},
288295
handleFaceCapture() {
289296
this.startFaceCapture()
@@ -306,16 +313,22 @@ export default {
306313
const data = {
307314
confirm_type: this.confirmTypeRequired,
308315
mfa_type: this.confirmTypeRequired === 'mfa' ? this.subTypeSelected : '',
309-
secret_key: this.confirmTypeRequired === 'password' ? encryptPassword(this.secretValue) : this.secretValue
316+
secret_key:
317+
this.confirmTypeRequired === 'password'
318+
? encryptPassword(this.secretValue)
319+
: this.secretValue
310320
}
311321
312-
this.$axios.post(`/api/v1/authentication/confirm/`, data).then(() => {
313-
this.onSuccess()
314-
}).catch((err) => {
315-
this.$message.error(err.message || this.$tc('ConfirmFailed'))
316-
this.faceCaptureUrl = null
317-
this.isFaceCaptureVisible = false
318-
})
322+
this.$axios
323+
.post(`/api/v1/authentication/confirm/`, data)
324+
.then(() => {
325+
this.onSuccess()
326+
})
327+
.catch(err => {
328+
this.$message.error(err.message || this.$tc('ConfirmFailed'))
329+
this.faceCaptureUrl = null
330+
this.isFaceCaptureVisible = false
331+
})
319332
}
320333
}
321334
}

src/components/Form/DataForm/components/el-form-renderer/components/render-form-item.vue

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,16 @@
2020
placement="right"
2121
popper-class="help-tips"
2222
>
23-
<div slot="content" v-sanitize="data.helpTip" class="help-tip-content" /> <!-- Noncompliant -->
23+
<div slot="content" v-sanitize="data.helpTip" class="help-tip-content" />
24+
<!-- Noncompliant -->
2425
<i class="fa fa-question-circle-o help-tip-icon" />
2526
</el-tooltip>
2627
</span>
2728
</template>
2829
<template v-if="readonly && hasReadonlyContent">
2930
<div
3031
v-if="data.type === 'input'"
31-
:style="
32-
componentProps.type === 'textarea'
33-
? {padding: '10px 0', lineHeight: 1.5}
34-
: ''
35-
"
32+
:style="componentProps.type === 'textarea' ? { padding: '10px 0', lineHeight: 1.5 } : ''"
3633
>
3734
{{ itemValue }}
3835
</div>
@@ -51,11 +48,7 @@
5148
v-on="listeners"
5249
>
5350
<template v-for="opt in options">
54-
<el-option
55-
v-if="data.type === 'select'"
56-
:key="opt.label"
57-
v-bind="opt"
58-
/>
51+
<el-option v-if="data.type === 'select'" :key="opt.label" v-bind="opt" />
5952
<el-checkbox-button
6053
v-else-if="data.type === 'checkbox-group' && data.style === 'button'"
6154
:key="opt.value"
@@ -112,10 +105,10 @@
112105
<script>
113106
import getEnableWhenStatus from '../util/enable-when'
114107
import { noop } from '../util/utils'
115-
import _get from 'lodash.get'
116-
import _includes from 'lodash.includes'
117-
import _topairs from 'lodash.topairs'
118-
import _frompairs from 'lodash.frompairs'
108+
import _get from 'lodash/get'
109+
import _includes from 'lodash/includes'
110+
import _topairs from 'lodash/toPairs'
111+
import _frompairs from 'lodash/fromPairs'
119112
120113
function validator(data) {
121114
if (!data) {
@@ -175,7 +168,8 @@ export default {
175168
data() {
176169
return {
177170
propsInner: {},
178-
isBlurTrigger: this.data.rules &&
171+
isBlurTrigger:
172+
this.data.rules &&
179173
this.data.rules.some(rule => {
180174
return rule.required && rule.trigger === 'blur'
181175
})
@@ -214,10 +208,7 @@ export default {
214208
} = this
215209
return {
216210
..._frompairs(
217-
_topairs(on).map(([eName, handler]) => [
218-
eName,
219-
(...args) => handler(args, updateForm)
220-
]),
211+
_topairs(on).map(([eName, handler]) => [eName, (...args) => handler(args, updateForm)])
221212
),
222213
// 手动更新表单数据
223214
input: (value, ...rest) => {
@@ -242,9 +233,7 @@ export default {
242233
243234
multipleValue: ({ data, itemValue, options = [] }) => {
244235
const multipleSelectValue =
245-
_get(data, 'el.multiple') && Array.isArray(itemValue)
246-
? itemValue
247-
: [itemValue]
236+
_get(data, 'el.multiple') && Array.isArray(itemValue) ? itemValue : [itemValue]
248237
return multipleSelectValue
249238
.map(val => (options.find(op => op.value === val) || {}).label)
250239
.join()
@@ -264,8 +253,7 @@ export default {
264253
if (v.url === oldV.url || v.request === oldV.request) return
265254
}
266255
const isOptionsCase =
267-
['select', 'checkbox-group', 'radio-group'].indexOf(this.data.type) >
268-
-1
256+
['select', 'checkbox-group', 'radio-group'].indexOf(this.data.type) > -1
269257
const {
270258
url,
271259
request = () => this.$axios.get(url).then(resp => resp.data),
@@ -333,7 +321,7 @@ export default {
333321
}
334322
}
335323
</script>
336-
<style lang='scss' scoped>
324+
<style lang="scss" scoped>
337325
.help-tips {
338326
opacity: 0.8;
339327
line-height: 2;
@@ -342,7 +330,7 @@ export default {
342330
343331
.help-block {
344332
::v-deep .el-alert__icon {
345-
font-size: 16px
333+
font-size: 16px;
346334
}
347335
348336
&.checkbox {

0 commit comments

Comments
 (0)