mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-26 17:28:48 +08:00
feat: Applications support setting a description field. (#8437)
Refs https://github.com/1Panel-dev/1Panel/issues/7065
This commit is contained in:
parent
0d857d2f0c
commit
9ee8cc86aa
4 changed files with 26 additions and 14 deletions
|
|
@ -132,19 +132,20 @@ type AppForm struct {
|
|||
}
|
||||
|
||||
type AppFormFields struct {
|
||||
Type string `json:"type"`
|
||||
LabelZh string `json:"labelZh"`
|
||||
LabelEn string `json:"labelEn"`
|
||||
Label Locale `json:"label"`
|
||||
Required bool `json:"required"`
|
||||
Default interface{} `json:"default"`
|
||||
EnvKey string `json:"envKey"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Edit bool `json:"edit"`
|
||||
Rule string `json:"rule"`
|
||||
Multiple bool `json:"multiple"`
|
||||
Child interface{} `json:"child"`
|
||||
Values []AppFormValue `json:"values"`
|
||||
Type string `json:"type"`
|
||||
LabelZh string `json:"labelZh"`
|
||||
LabelEn string `json:"labelEn"`
|
||||
Label Locale `json:"label"`
|
||||
Description Locale `json:"description"`
|
||||
Required bool `json:"required"`
|
||||
Default interface{} `json:"default"`
|
||||
EnvKey string `json:"envKey"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Edit bool `json:"edit"`
|
||||
Rule string `json:"rule"`
|
||||
Multiple bool `json:"multiple"`
|
||||
Child interface{} `json:"child"`
|
||||
Values []AppFormValue `json:"values"`
|
||||
}
|
||||
|
||||
type AppFormValue struct {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ export namespace App {
|
|||
multiple?: boolean;
|
||||
allowCreate?: boolean;
|
||||
label: Locale;
|
||||
description: Locale;
|
||||
}
|
||||
|
||||
export interface FromFieldChild extends FromField {
|
||||
|
|
|
|||
|
|
@ -666,6 +666,15 @@ export function getLabel(row: any) {
|
|||
}
|
||||
}
|
||||
|
||||
export function getDescription(row: any) {
|
||||
const language = localStorage.getItem('lang') || 'zh';
|
||||
let lang = language == 'tw' ? 'zh-Hant' : language;
|
||||
if (row.description && row.description[lang] != '') {
|
||||
return row.description[lang];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
export function emptyLineFilter(str: string, spilt: string) {
|
||||
let list = str.split(spilt);
|
||||
let results = [];
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span class="input-help" v-if="p.description">{{ getDescription(p) }}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -125,7 +126,7 @@ import { getRandomStr } from '@/utils/util';
|
|||
import { getAppService } from '@/api/modules/app';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { App } from '@/api/interface/app';
|
||||
import { getDBName, getLabel } from '@/utils/util';
|
||||
import { getDBName, getLabel, getDescription } from '@/utils/util';
|
||||
import { getPathByType } from '@/api/modules/files';
|
||||
|
||||
interface ParamObj extends App.FromField {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue