Skip to content

Commit 66d4b6c

Browse files
committed
refactor: application add show_exec
1 parent 8ab4456 commit 66d4b6c

File tree

3 files changed

+65
-55
lines changed

3 files changed

+65
-55
lines changed

apps/application/models/application_access_token.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ApplicationAccessToken(AppModelMixin):
2626
base_field=models.CharField(max_length=128, blank=True)
2727
, default=list)
2828
show_source = models.BooleanField(default=False, verbose_name="是否显示知识来源")
29+
show_exec = models.BooleanField(default=False, verbose_name="是否显示执行详情")
2930

3031
language = models.CharField(max_length=10, verbose_name="语言", default=None, null=True)
3132

ui/src/views/application-overview/component/DisplaySettingDialog.vue

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<el-form label-position="top" ref="displayFormRef" :model="form">
1010
<el-form-item>
1111
<span>{{
12-
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
13-
}}</span>
12+
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
13+
}}</span>
1414
<el-select v-model="form.language" clearable>
1515
<el-option
1616
v-for="item in langList"
@@ -24,11 +24,15 @@
2424
<el-space direction="vertical" alignment="start">
2525
<el-checkbox
2626
v-model="form.show_source"
27-
:label="
28-
isWorkFlow(detail.type)
29-
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
30-
: $t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')
31-
"
27+
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
28+
/>
29+
</el-space>
30+
</el-form-item>
31+
<el-form-item>
32+
<el-space direction="vertical" alignment="start">
33+
<el-checkbox
34+
v-model="form.show_exec"
35+
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
3236
/>
3337
</el-space>
3438
</el-form-item>
@@ -44,23 +48,24 @@
4448
</el-dialog>
4549
</template>
4650
<script setup lang="ts">
47-
import { ref, watch } from 'vue'
48-
import { useRoute } from 'vue-router'
49-
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
51+
import {ref, watch} from 'vue'
52+
import {useRoute} from 'vue-router'
53+
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
5054
import applicationApi from '@/api/application/application'
51-
import { isWorkFlow } from '@/utils/application'
52-
import { MsgSuccess, MsgError } from '@/utils/message'
53-
import { getBrowserLang, langList, t } from '@/locales'
55+
import {MsgSuccess, MsgError} from '@/utils/message'
56+
import {getBrowserLang, langList, t} from '@/locales'
57+
5458
const route = useRoute()
5559
const {
56-
params: { id }
60+
params: {id}
5761
} = route
5862
5963
const emit = defineEmits(['refresh'])
6064
6165
const displayFormRef = ref()
6266
const form = ref<any>({
6367
show_source: false,
68+
show_exec: false,
6469
language: ''
6570
})
6671
@@ -73,13 +78,15 @@ watch(dialogVisible, (bool) => {
7378
if (!bool) {
7479
form.value = {
7580
show_source: false,
81+
show_exec: false,
7682
language: ''
7783
}
7884
}
7985
})
8086
const open = (data: any, content: any) => {
8187
detail.value = content
8288
form.value.show_source = data.show_source
89+
form.value.show_exec = data.show_exec
8390
form.value.language = data.language
8491
dialogVisible.value = true
8592
}
@@ -98,6 +105,6 @@ const submit = async (formEl: FormInstance | undefined) => {
98105
})
99106
}
100107
101-
defineExpose({ open })
108+
defineExpose({open})
102109
</script>
103110
<style lang="scss" scoped></style>

ui/src/views/application-overview/component/XPackDisplaySettingDialog.vue

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<div class="flex align-center">
1818
<el-button type="primary" @click.prevent="resetForm" link>
1919
<el-icon class="mr-4">
20-
<Refresh />
20+
<Refresh/>
2121
</el-icon>
2222
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.restoreDefault') }}
2323
</el-button>
24-
<el-divider direction="vertical" />
24+
<el-divider direction="vertical"/>
2525
</div>
2626
</div>
2727
</template>
@@ -39,7 +39,7 @@
3939
:size="32"
4040
style="background: none"
4141
>
42-
<img :src="detail?.icon" alt="" />
42+
<img :src="detail?.icon" alt=""/>
4343
</el-avatar>
4444
<el-avatar
4545
v-else-if="detail?.name"
@@ -72,7 +72,7 @@
7272
color: xpackForm.custom_theme?.header_font_color
7373
}"
7474
>
75-
<Close />
75+
<Close/>
7676
</el-icon>
7777
</el-button>
7878
</div>
@@ -134,7 +134,7 @@
134134
style="width: 28px; height: 28px; display: block"
135135
/>
136136
<el-avatar v-else>
137-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
137+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
138138
</el-avatar>
139139
</div>
140140
</div>
@@ -143,7 +143,7 @@
143143
style="position: absolute; bottom: 0; padding-bottom: 8px; box-sizing: border-box"
144144
class="p-16 text-center w-full"
145145
>
146-
<img src="@/assets/display-bg1.png" alt="" class="w-full" />
146+
<img src="@/assets/display-bg1.png" alt="" class="w-full"/>
147147
<el-text type="info" v-if="xpackForm.disclaimer" class="mt-8" style="font-size: 12px">
148148
<auto-tooltip :content="xpackForm.disclaimer_value">
149149
{{ xpackForm.disclaimer_value }}
@@ -177,7 +177,7 @@
177177
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.customThemeColor') }}
178178
</h5>
179179
<div>
180-
<el-color-picker v-model="xpackForm.custom_theme.theme_color" />
180+
<el-color-picker v-model="xpackForm.custom_theme.theme_color"/>
181181
{{
182182
!xpackForm.custom_theme.theme_color
183183
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.default')
@@ -191,7 +191,7 @@
191191
$t('views.applicationOverview.appInfo.SettingDisplayDialog.headerTitleFontColor')
192192
}}
193193
</h5>
194-
<el-color-picker v-model="xpackForm.custom_theme.header_font_color" />
194+
<el-color-picker v-model="xpackForm.custom_theme.header_font_color"/>
195195
</el-col>
196196
</el-row>
197197
<el-row class="w-full mb-8">
@@ -210,12 +210,12 @@
210210
<el-card shadow="never" class="mb-8">
211211
<div class="flex-between mb-8">
212212
<span class="lighter">{{
213-
$t('views.applicationOverview.appInfo.SettingDisplayDialog.AIAvatar')
214-
}}</span>
213+
$t('views.applicationOverview.appInfo.SettingDisplayDialog.AIAvatar')
214+
}}</span>
215215
<span class="flex align-center">
216216
<el-checkbox v-model="xpackForm.show_avatar">{{
217-
$t('views.applicationOverview.appInfo.SettingDisplayDialog.display')
218-
}}</el-checkbox>
217+
$t('views.applicationOverview.appInfo.SettingDisplayDialog.display')
218+
}}</el-checkbox>
219219
<el-upload
220220
class="ml-8"
221221
ref="uploadRef"
@@ -238,8 +238,8 @@
238238
<el-card shadow="never" class="mb-8">
239239
<div class="flex-between mb-8">
240240
<span class="lighter">{{
241-
$t('views.applicationOverview.appInfo.SettingDisplayDialog.askUserAvatar')
242-
}}</span>
241+
$t('views.applicationOverview.appInfo.SettingDisplayDialog.askUserAvatar')
242+
}}</span>
243243
<span class="flex align-center">
244244
<el-checkbox v-model="xpackForm.show_user_avatar">
245245
{{
@@ -262,14 +262,14 @@
262262
</span>
263263
</div>
264264
<el-text type="info" size="small"
265-
>{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.imageMessage') }}
265+
>{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.imageMessage') }}
266266
</el-text>
267267
</el-card>
268268
<el-card shadow="never" class="mb-8">
269269
<div class="flex-between mb-8">
270270
<span class="lighter">{{
271-
$t('views.applicationOverview.appInfo.SettingDisplayDialog.floatIcon')
272-
}}</span>
271+
$t('views.applicationOverview.appInfo.SettingDisplayDialog.floatIcon')
272+
}}</span>
273273
<el-upload
274274
ref="uploadRef"
275275
action="#"
@@ -289,8 +289,8 @@
289289
<div class="border-t mt-8">
290290
<div class="flex-between mb-8">
291291
<span class="lighter">{{
292-
$t('views.applicationOverview.appInfo.SettingDisplayDialog.iconDefaultPosition')
293-
}}</span>
292+
$t('views.applicationOverview.appInfo.SettingDisplayDialog.iconDefaultPosition')
293+
}}</span>
294294
<el-checkbox
295295
v-model="xpackForm.draggable"
296296
:label="
@@ -370,11 +370,11 @@
370370
<el-space direction="vertical" alignment="start" :size="2">
371371
<el-checkbox
372372
v-model="xpackForm.show_source"
373-
:label="
374-
isWorkFlow(detail.type)
375-
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
376-
: $t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')
377-
"
373+
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
374+
/>
375+
<el-checkbox
376+
v-model="xpackForm.show_exec"
377+
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
378378
/>
379379
<el-checkbox
380380
v-model="xpackForm.show_history"
@@ -390,7 +390,7 @@
390390
@change="changeDisclaimer"
391391
/>
392392
<span v-if="xpackForm.disclaimer"
393-
><el-tooltip :content="xpackForm.disclaimer_value" placement="top">
393+
><el-tooltip :content="xpackForm.disclaimer_value" placement="top">
394394
<el-input
395395
v-model="xpackForm.disclaimer_value"
396396
style="width: 422px; margin-bottom: 10px"
@@ -413,28 +413,28 @@
413413
</el-dialog>
414414
</template>
415415
<script setup lang="ts">
416-
import { computed, ref, watch } from 'vue'
417-
import { useRoute } from 'vue-router'
418-
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
419-
import { isWorkFlow } from '@/utils/application'
420-
import { isAppIcon } from '@/utils/common'
416+
import {computed, ref, watch} from 'vue'
417+
import {useRoute} from 'vue-router'
418+
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
419+
import {isAppIcon} from '@/utils/common'
421420
import applicationXpackApi from '@/api/application/application-xpack'
422-
import { MsgSuccess, MsgError } from '@/utils/message'
423-
import { langList, t } from '@/locales'
421+
import {MsgSuccess, MsgError} from '@/utils/message'
422+
import {langList, t} from '@/locales'
424423
import useStore from '@/stores'
425-
import { cloneDeep } from 'lodash'
424+
import {cloneDeep} from 'lodash'
426425
427-
const { user } = useStore()
426+
const {user} = useStore()
428427
429428
const route = useRoute()
430429
const {
431-
params: { id }
430+
params: {id}
432431
} = route
433432
434433
const emit = defineEmits(['refresh'])
435434
436435
const defaultSetting = {
437436
show_source: false,
437+
show_exec: false,
438438
language: '',
439439
show_history: true,
440440
draggable: true,
@@ -452,8 +452,8 @@ const defaultSetting = {
452452
header_font_color: '#1f2329'
453453
},
454454
float_location: {
455-
y: { type: 'bottom', value: 30 },
456-
x: { type: 'right', value: 0 }
455+
y: {type: 'bottom', value: 30},
456+
x: {type: 'right', value: 0}
457457
},
458458
show_avatar: true,
459459
show_user_avatar: false
@@ -463,6 +463,7 @@ const displayFormRef = ref()
463463
464464
const xpackForm = ref<any>({
465465
show_source: false,
466+
show_exec: false,
466467
language: '',
467468
show_history: false,
468469
draggable: false,
@@ -480,8 +481,8 @@ const xpackForm = ref<any>({
480481
header_font_color: '#1f2329'
481482
},
482483
float_location: {
483-
y: { type: 'bottom', value: 30 },
484-
x: { type: 'right', value: 0 }
484+
y: {type: 'bottom', value: 30},
485+
x: {type: 'right', value: 0}
485486
},
486487
show_avatar: true,
487488
show_user_avatar: false
@@ -531,6 +532,7 @@ const onChange = (file: any, fileList: UploadFiles, attr: string) => {
531532
const open = (data: any, content: any) => {
532533
detail.value = content
533534
xpackForm.value.show_source = data.show_source
535+
xpackForm.value.show_exec = data.show_exec
534536
xpackForm.value.show_history = data.show_history
535537
xpackForm.value.language = data.language
536538
xpackForm.value.draggable = data.draggable
@@ -591,7 +593,7 @@ const submit = async (formEl: FormInstance | undefined) => {
591593
})
592594
}
593595
594-
defineExpose({ open })
596+
defineExpose({open})
595597
</script>
596598
<style lang="scss">
597599
.setting-preview {

0 commit comments

Comments
 (0)