mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-02 07:27:01 +00:00
perf: form help tip style
This commit is contained in:
parent
274d14d905
commit
9315dab053
@ -317,11 +317,16 @@ td .el-button.el-button--mini {
|
|||||||
|
|
||||||
.el-tooltip__popper.is-light {
|
.el-tooltip__popper.is-light {
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
|
max-width: 500px;
|
||||||
border: 1px solid #e7eaec;
|
border: 1px solid #e7eaec;
|
||||||
|
box-shadow: 0 1.6px 3.6px 0 rgba(0, 0, 0, .132), 0 .3px .9px 0 rgba(0, 0, 0, .108);
|
||||||
|
line-height: 1.5;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-tooltip__popper.is-light .popper__arrow {
|
.el-tooltip__popper.is-light .popper__arrow {
|
||||||
border-bottom-color: #e7eaec !important;
|
border-bottom-color: #c2d1e1 !important;
|
||||||
|
border-top-color: #c2d1e1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dialog__headerbtn .el-dialog__close {
|
.el-dialog__headerbtn .el-dialog__close {
|
||||||
|
@ -160,6 +160,18 @@ export class FormFieldGenerator {
|
|||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
|
|
||||||
|
afterGenerateField(field) {
|
||||||
|
field.label = toSentenceCase(field.label)
|
||||||
|
if (field.helpText) {
|
||||||
|
field.helpText = toSentenceCase(field.helpText)
|
||||||
|
}
|
||||||
|
if ((!field.helpTip && field.helpText && field.helpTextAsTip) || field.component === Switcher) {
|
||||||
|
field.helpTip = field.helpText
|
||||||
|
field.helpText = ''
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
generateField(name, fieldsMeta, remoteFieldsMeta) {
|
generateField(name, fieldsMeta, remoteFieldsMeta) {
|
||||||
let field = { id: name, prop: name, el: {}, attrs: {}, rules: [] }
|
let field = { id: name, prop: name, el: {}, attrs: {}, rules: [] }
|
||||||
const remoteFieldMeta = remoteFieldsMeta[name] || {}
|
const remoteFieldMeta = remoteFieldsMeta[name] || {}
|
||||||
@ -174,11 +186,8 @@ export class FormFieldGenerator {
|
|||||||
field = Object.assign(field, fieldMeta)
|
field = Object.assign(field, fieldMeta)
|
||||||
field.el = el
|
field.el = el
|
||||||
field.rules = rules
|
field.rules = rules
|
||||||
field.label = toSentenceCase(field.label)
|
|
||||||
if (field.helpText) {
|
|
||||||
field.helpText = toSentenceCase(field.helpText)
|
|
||||||
}
|
|
||||||
field = this.setPlaceholder(field, remoteFieldMeta)
|
field = this.setPlaceholder(field, remoteFieldMeta)
|
||||||
|
field = this.afterGenerateField(field)
|
||||||
_.set(field, 'attrs.error', '')
|
_.set(field, 'attrs.error', '')
|
||||||
Vue.$log.debug('Generate field: ', name, field)
|
Vue.$log.debug('Generate field: ', name, field)
|
||||||
return field
|
return field
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
v-bind="data.attrs"
|
v-bind="data.attrs"
|
||||||
>
|
>
|
||||||
<template v-if="data.label" #label>
|
<template v-if="data.label" #label>
|
||||||
<span>{{ data.label }}</span>
|
<el-tooltip v-if="data.helpTip" effect="light" placement="top" popper-class="help-tips">
|
||||||
<el-tooltip v-if="data.helpTips" effect="light" placement="top" popper-class="help-tips">
|
<div slot="content" v-html="data.helpTip" />
|
||||||
<div slot="content" v-html="data.helpTips" />
|
<i class="el-icon-warning-outline help-tip-icon" />
|
||||||
<i class="fa fa-question-circle-o" />
|
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<span>{{ data.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="readonly && hasReadonlyContent">
|
<template v-if="readonly && hasReadonlyContent">
|
||||||
<div
|
<div
|
||||||
@ -282,3 +282,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang='scss'>
|
||||||
|
.help-tip-icon {
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -187,16 +187,16 @@ export default {
|
|||||||
// this.$log.debug('Field: ', type, col.prop, col)
|
// this.$log.debug('Field: ', type, col.prop, col)
|
||||||
return col
|
return col
|
||||||
},
|
},
|
||||||
addHelpTipsIfNeed(col) {
|
addHelpTipIfNeed(col) {
|
||||||
const helpTips = col.helpTips
|
const helpTip = col.helpTip
|
||||||
if (!helpTips) {
|
if (!helpTip) {
|
||||||
return col
|
return col
|
||||||
}
|
}
|
||||||
col.renderHeader = (h, { column, $index }) => {
|
col.renderHeader = (h, { column, $index }) => {
|
||||||
return (
|
return (
|
||||||
<span>{column.label}
|
<span>{column.label}
|
||||||
<el-tooltip placement='bottom' effect='light' popperClass='help-tips'>
|
<el-tooltip placement='bottom' effect='light' popperClass='help-tips'>
|
||||||
<div slot='content' domPropsInnerHTML={helpTips}/>
|
<div slot='content' domPropsInnerHTML={helpTip}/>
|
||||||
<el-button style='padding: 0'>
|
<el-button style='padding: 0'>
|
||||||
<i class='fa fa-info-circle'/>
|
<i class='fa fa-info-circle'/>
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -282,7 +282,7 @@ export default {
|
|||||||
col = this.generateColumnByName(name, col)
|
col = this.generateColumnByName(name, col)
|
||||||
col = this.setDefaultFormatterIfNeed(col)
|
col = this.setDefaultFormatterIfNeed(col)
|
||||||
col = Object.assign(col, customMeta)
|
col = Object.assign(col, customMeta)
|
||||||
col = this.addHelpTipsIfNeed(col)
|
col = this.addHelpTipIfNeed(col)
|
||||||
col = this.addFilterIfNeed(col)
|
col = this.addFilterIfNeed(col)
|
||||||
col = this.addOrderingIfNeed(col)
|
col = this.addOrderingIfNeed(col)
|
||||||
col = this.updateLabelIfNeed(col)
|
col = this.updateLabelIfNeed(col)
|
||||||
|
@ -18,8 +18,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
url: '/api/v1/accounts/account-backup-plans/',
|
url: '/api/v1/accounts/account-backup-plans/',
|
||||||
fields: [
|
fields: [
|
||||||
[this.$t('Basic'), ['name']],
|
[this.$t('Basic'), ['name', 'types']],
|
||||||
[this.$t('Types'), ['types']],
|
|
||||||
[this.$t('Backup'),
|
[this.$t('Backup'),
|
||||||
[
|
[
|
||||||
'backup_type',
|
'backup_type',
|
||||||
|
@ -53,7 +53,8 @@ export const templateFieldsMeta = (vm) => {
|
|||||||
secret_strategy: {
|
secret_strategy: {
|
||||||
hidden: (formValue) => {
|
hidden: (formValue) => {
|
||||||
return !canRandomSecretTypes.includes(formValue.secret_type)
|
return !canRandomSecretTypes.includes(formValue.secret_type)
|
||||||
}
|
},
|
||||||
|
helpTextAsTip: true
|
||||||
},
|
},
|
||||||
secret: {
|
secret: {
|
||||||
label: vm.$t('Password'),
|
label: vm.$t('Password'),
|
||||||
|
@ -27,7 +27,7 @@ export default {
|
|||||||
},
|
},
|
||||||
rule_relation: {
|
rule_relation: {
|
||||||
label: this.$t('RuleRelation'),
|
label: this.$t('RuleRelation'),
|
||||||
helpTips: this.$t('RuleRelationHelpTips')
|
helpTip: this.$t('RuleRelationhelpTip')
|
||||||
},
|
},
|
||||||
strategy_rules: {
|
strategy_rules: {
|
||||||
component: RuleInput
|
component: RuleInput
|
||||||
|
@ -56,17 +56,17 @@ export default {
|
|||||||
},
|
},
|
||||||
hostname_strategy: {
|
hostname_strategy: {
|
||||||
rules: [rules.RequiredChange],
|
rules: [rules.RequiredChange],
|
||||||
helpTips: this.$t('HostnameStrategy')
|
helpTip: this.$t('HostnameStrategy')
|
||||||
},
|
},
|
||||||
is_always_update: {
|
is_always_update: {
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
label: this.$t('IsAlwaysUpdate'),
|
label: this.$t('IsAlwaysUpdate'),
|
||||||
helpTips: this.$t('IsAlwaysUpdateHelpTips')
|
helpTip: this.$t('IsAlwaysUpdateHelpTip')
|
||||||
},
|
},
|
||||||
fully_synchronous: {
|
fully_synchronous: {
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
label: this.$t('FullySynchronous'),
|
label: this.$t('FullySynchronous'),
|
||||||
helpTips: this.$t('FullySynchronousHelpTips')
|
helpTip: this.$t('FullySynchronousHelpTip')
|
||||||
},
|
},
|
||||||
regions: {
|
regions: {
|
||||||
component: Select2,
|
component: Select2,
|
||||||
@ -105,7 +105,7 @@ export default {
|
|||||||
strategy: {
|
strategy: {
|
||||||
label: this.$t('Strategy'),
|
label: this.$t('Strategy'),
|
||||||
component: SyncInstanceTaskStrategy,
|
component: SyncInstanceTaskStrategy,
|
||||||
helpTips: this.$t('StrategyHelpTips')
|
helpTip: this.$t('StrategyHelpTip')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateSuccessNextRoute: { name: 'CloudCenter' },
|
updateSuccessNextRoute: { name: 'CloudCenter' },
|
||||||
|
@ -45,7 +45,7 @@ export default {
|
|||||||
fieldsMeta: {
|
fieldsMeta: {
|
||||||
rule_relation: {
|
rule_relation: {
|
||||||
label: this.$t('RuleRelation'),
|
label: this.$t('RuleRelation'),
|
||||||
helpTips: this.$t('RuleRelationHelpTips')
|
helpTip: this.$t('RuleRelationHelpTip')
|
||||||
},
|
},
|
||||||
strategy_rules: {
|
strategy_rules: {
|
||||||
label: this.$t('Rule'),
|
label: this.$t('Rule'),
|
||||||
|
@ -202,7 +202,7 @@ export default {
|
|||||||
fieldsToUpdate.forEach(field => {
|
fieldsToUpdate.forEach(field => {
|
||||||
const msg = this.$t('disallowSelfUpdateFields', { attr: this.fieldsMeta[field]['label'] })
|
const msg = this.$t('disallowSelfUpdateFields', { attr: this.fieldsMeta[field]['label'] })
|
||||||
this.fieldsMeta[field].el.disabled = true
|
this.fieldsMeta[field].el.disabled = true
|
||||||
this.fieldsMeta[field].helpTips = msg
|
this.fieldsMeta[field].helpTip = msg
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.fieldsMeta.password.el.userIsOrgAdmin = user['is_org_admin']
|
this.fieldsMeta.password.el.userIsOrgAdmin = user['is_org_admin']
|
||||||
|
Loading…
Reference in New Issue
Block a user