Skip to content

Commit cb65b98

Browse files
feat: Applications support setting a description field.
1 parent c29c00f commit cb65b98

4 files changed

Lines changed: 26 additions & 14 deletions

File tree

agent/app/dto/app.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,20 @@ type AppForm struct {
132132
}
133133

134134
type AppFormFields struct {
135-
Type string `json:"type"`
136-
LabelZh string `json:"labelZh"`
137-
LabelEn string `json:"labelEn"`
138-
Label Locale `json:"label"`
139-
Required bool `json:"required"`
140-
Default interface{} `json:"default"`
141-
EnvKey string `json:"envKey"`
142-
Disabled bool `json:"disabled"`
143-
Edit bool `json:"edit"`
144-
Rule string `json:"rule"`
145-
Multiple bool `json:"multiple"`
146-
Child interface{} `json:"child"`
147-
Values []AppFormValue `json:"values"`
135+
Type string `json:"type"`
136+
LabelZh string `json:"labelZh"`
137+
LabelEn string `json:"labelEn"`
138+
Label Locale `json:"label"`
139+
Description Locale `json:"description"`
140+
Required bool `json:"required"`
141+
Default interface{} `json:"default"`
142+
EnvKey string `json:"envKey"`
143+
Disabled bool `json:"disabled"`
144+
Edit bool `json:"edit"`
145+
Rule string `json:"rule"`
146+
Multiple bool `json:"multiple"`
147+
Child interface{} `json:"child"`
148+
Values []AppFormValue `json:"values"`
148149
}
149150

150151
type AppFormValue struct {

frontend/src/api/interface/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export namespace App {
9292
multiple?: boolean;
9393
allowCreate?: boolean;
9494
label: Locale;
95+
description: Locale;
9596
}
9697

9798
export interface FromFieldChild extends FromField {

frontend/src/utils/util.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,15 @@ export function getLabel(row: any) {
666666
}
667667
}
668668

669+
export function getDescription(row: any) {
670+
const language = localStorage.getItem('lang') || 'zh';
671+
let lang = language == 'tw' ? 'zh-Hant' : language;
672+
if (row.description && row.description[lang] != '') {
673+
return row.description[lang];
674+
}
675+
return '';
676+
}
677+
669678
export function emptyLineFilter(str: string, spilt: string) {
670679
let list = str.split(spilt);
671680
let results = [];

frontend/src/views/app-store/detail/params/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
</span>
117117
</el-col>
118118
</el-row>
119+
<span class="input-help" v-if="p.description">{{ getDescription(p) }}</span>
119120
</el-form-item>
120121
</div>
121122
</template>
@@ -125,7 +126,7 @@ import { getRandomStr } from '@/utils/util';
125126
import { getAppService } from '@/api/modules/app';
126127
import { Rules } from '@/global/form-rules';
127128
import { App } from '@/api/interface/app';
128-
import { getDBName, getLabel } from '@/utils/util';
129+
import { getDBName, getLabel, getDescription } from '@/utils/util';
129130
import { getPathByType } from '@/api/modules/files';
130131
131132
interface ParamObj extends App.FromField {

0 commit comments

Comments
 (0)