Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions ui/src/components/ai-chat/ExecutionDetailDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -720,14 +720,9 @@ defineExpose({ open })
</script>
<style lang="scss">
.execution-details-dialog {
padding: 0;

.el-dialog__header {
padding: 24px 24px 0 24px;
}

.el-dialog__body {
padding: 8px !important;
padding-bottom: 16px;
}

.execution-details {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
}}:{{ getAcceptList().replace(/\./g, '').replace(/,/g, '、').toUpperCase() }}
</div>
</template>
<el-button text :disabled="checkMaxFilesLimit()" class="mt-4">
<el-button text :disabled="checkMaxFilesLimit() || loading" class="mt-4">
<el-icon><Paperclip /></el-icon>
</el-button>
</el-tooltip>
Expand Down
9 changes: 9 additions & 0 deletions ui/src/components/card-checkbox/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
<AppAvatar v-if="data.type === '1'" class="mr-8 avatar-purple" shape="square" :size="32">
<img src="@/assets/icon_web.svg" style="width: 58%" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="data.type === '2'"
class="mr-8 avatar-purple"
shape="square"
:size="32"
style="background: none"
>
<img src="@/assets/logo_lark.svg" style="width: 100%" alt="" />
</AppAvatar>

<AppAvatar v-else class="mr-12 avatar-blue" shape="square" :size="32">
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
Expand Down
23 changes: 21 additions & 2 deletions ui/src/layout/components/breadcrumb/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,19 @@
>
<img src="@/assets/icon_web.svg" style="width: 58%" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="isDataset && current?.type === '2'"
class="mr-8 avatar-purple"
shape="square"
:size="24"
style="background: none"
>
<img src="@/assets/logo_lark.svg" style="width: 100%" alt="" />
</AppAvatar>
<AppAvatar v-else class="mr-8 avatar-blue" shape="square" :size="24">
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
</AppAvatar>
<div class="ellipsis">{{ current?.name }}</div>
<div class="ellipsis" :title="current?.name">{{ current?.name }}</div>
</div>

<el-button text>
Expand All @@ -63,6 +72,7 @@
>
<img :src="item?.icon" alt="" />
</AppAvatar>

<AppAvatar
v-else-if="isApplication"
:name="item.name"
Expand All @@ -79,10 +89,19 @@
>
<img src="@/assets/icon_web.svg" style="width: 58%" alt="" />
</AppAvatar>
<AppAvatar
v-else-if="isDataset && item.type === '2'"
class="mr-8 avatar-purple"
shape="square"
:size="24"
style="background: none"
>
<img src="@/assets/logo_lark.svg" style="width: 100%" alt="" />
</AppAvatar>
<AppAvatar v-else class="mr-12 avatar-blue" shape="square" :size="24">
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
</AppAvatar>
<span class="ellipsis"> {{ item?.name }}</span>
<span class="ellipsis" :title="item?.name"> {{ item?.name }}</span>
</div>
</el-dropdown-item>
</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To review this code for irregularities and potential issues:

Issues:

  1. Repeating Code: There is a lot of repeated code (v-if, AppAvatar, etc.) within loops, which can be simplified.
  2. Duplicated alt Text: The <app-avatar> components have duplicate alt attributes ("").
  3. Title Attribute Usage: Using <span class="ellipsis" :title="item?.name"> {{ item?.name }}</span> seems unnecessary, as the ellipsis styling should already handle truncation.

Optimization Suggestions:

  • Template Refactoring:

    <template>
      <div class="avatar-section">
        // Existing code...
        
        <el-dropdown trigger="click" split-btn @command="handleCommand">
          <template #suffix><i class="el-icon-arrow-down"></i></template>
          
          <el-dropdown-menu slot-scope="{ command }" v-bind="$attrs">
            <!-- ...existing content... -->
    
            <el-dropdown-item 
              v-for="(item, index) in items" 
              :key="index"
              :name="item.id || command.data.index"
              :data-index="index"
              :command="item.command ?? { data: { name: command.data.name }, value: null }"
              :disabled="isCommandDisabled(command)"
            >
              <div class="avatar-row">
                <el-popover placement="right" width="auto" popper-class="dropdown-popper">
                  <template #reference>
                    <component
                      :is="getAvatarComponent(item)"
                      style="{ background: !isSelected(index) ? 'transparent' : '' }"
                    ></component>
                  </template>
    
                  <!-- Content (e.g., description or actions) -->
                </el-popover>
    
                <span>{{ getItemName(item) }}</span> <!-- Avoiding span with title if already handled by ellipsis -->
                <small>{{ selectedItemDescription(index) }}<!-- Provide an appropriate function to get this description --></small>
              </div>
            
              <!-- Commands here... -->
            </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      
      </div>
    </template>
  • Computed Properties:
    Use computed properties like:

    computed:{
      selectedItems(){ return /* Logic to determine currently selected items */ }
    },
    methods:{
      isSelected(i){ return this.selectedItems.includes(i); }
    }
  • Common Method for Avatar Component Selection:
    For example, instead of repeating v-if checks for different cases, use:

    <component
      :is="selected ? 'div' : 'AppAvatar'"
      class="ml-4"
      shape="circle"
    	// Other props
    ></component>

Expand Down
14 changes: 2 additions & 12 deletions ui/src/styles/element-plus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
.el-dialog__header {
padding-bottom: 24px;
font-weight: 500;
margin-top: -5px;
}
.el-dialog__footer {
padding-top: 0;
Expand Down Expand Up @@ -378,18 +379,7 @@

// radio 一行一个样式
.radio-block {
width: 100%;
display: block;
.el-radio {
align-items: flex-start;
height: 100%;
width: 100%;
}
.el-radio__label {
width: 100%;
margin-top: -8px;
line-height: 30px;
}
display: inline-grid;
}

// 提示横幅
Expand Down
19 changes: 17 additions & 2 deletions ui/src/views/application-overview/component/EditAvatarDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-radio-group v-model="radioType" class="radio-block mb-16">
<el-radio-group v-model="radioType" class="radio-block-avatar mb-16">
<div>
<el-radio value="default">
<p>{{ $t('views.applicationOverview.appInfo.EditAvatarDialog.default') }}</p>
Expand Down Expand Up @@ -139,4 +139,19 @@ function submit() {
defineExpose({ open })
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.radio-block-avatar {
width: 100%;
display: block;
.el-radio {
align-items: flex-start;
height: 100%;
width: 100%;
}
.el-radio__label {
width: 100%;
margin-top: -8px;
line-height: 30px;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ const submit = async (formEl: FormInstance | undefined) => {

defineExpose({ open })
</script>
<style lang="scss" scoped>
<style lang="scss">
.setting-preview {
background: #f5f6f7;
height: 570px;
Expand Down Expand Up @@ -621,11 +621,11 @@ defineExpose({ open })

.display-setting-dialog {
.el-dialog__header {
padding-right: 16px;
padding-right: 8px;
}

.el-dialog__headerbtn {
top: 13px;
top: 8px;
}
}
</style>
10 changes: 9 additions & 1 deletion ui/src/views/application/ApplicationSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,15 @@
>
<img src="@/assets/icon_web.svg" style="width: 58%" alt="" />
</AppAvatar>

<AppAvatar
v-if="relatedObject(datasetList, item, 'id')?.type === '2'"
class="mr-8 avatar-purple"
shape="square"
:size="32"
style="background: none"
>
<img src="@/assets/logo_lark.svg" style="width: 100%" alt="" />
</AppAvatar>
<AppAvatar v-else class="mr-8 avatar-blue" shape="square" :size="32">
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
</AppAvatar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<el-dialog
align-center
:title="$t('common.paramSetting')"
class="param-dialog"
v-model="dialogVisible"
style="width: 550px"
append-to-body
Expand All @@ -21,7 +20,7 @@
</DynamicsForm>

<template #footer>
<span class="dialog-footer p-16">
<span class="dialog-footer">
<el-button @click.prevent="dialogVisible = false">
{{ $t('common.cancel') }}
</el-button>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/application/component/AddDatasetDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ defineExpose({ open })
}
.el-dialog__headerbtn {
top: 13px;
top: 9px;
}
.max-height {
max-height: calc(100vh - 260px);
Expand Down
3 changes: 1 addition & 2 deletions ui/src/views/application/component/McpServersDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<el-dialog
align-center
:title="$t('common.setting')"
class="param-dialog"
v-model="dialogVisible"
style="width: 550px"
append-to-body
Expand Down Expand Up @@ -34,7 +33,7 @@
</el-form>

<template #footer>
<span class="dialog-footer p-16">
<span class="dialog-footer">
<el-button @click.prevent="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="submit()" :loading="loading">
{{ $t('common.save') }}
Expand Down
Loading