Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: Optimize the button style for database connection information #7341

Merged
merged 1 commit into from
Dec 12, 2024
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
2 changes: 1 addition & 1 deletion frontend/src/components/copy-button/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<el-button v-if="type == 'icon'" link @click="copyText(content)" icon="DocumentCopy" class="ml-1.5"></el-button>
<el-button type="primary" @click="copyText(content)" v-else>{{ $t('commons.button.copy') }}</el-button>
<el-button @click="copyText(content)" v-else>{{ $t('commons.button.copy') }}</el-button>
</template>

<script lang="ts" setup>
Expand Down
23 changes: 13 additions & 10 deletions frontend/src/views/database/mysql/conn/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,19 @@
:rules="Rules.paramComplexity"
prop="password"
>
<el-input type="password" show-password clearable v-model="form.password">
<template #suffix>
<CopyButton type="icon" :content="form.password" class="w-30" />
</template>
<template #append>
<el-button @click="random">
{{ $t('commons.button.random') }}
</el-button>
</template>
</el-input>
<el-input
style="width: calc(100% - 147px)"
type="password"
show-password
clearable
v-model="form.password"
/>
<el-button-group>
<CopyButton :content="form.password" />
<el-button @click="random">
{{ $t('commons.button.random') }}
</el-button>
</el-button-group>
</el-form-item>
</div>

Copy link
Member

Choose a reason for hiding this comment

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

The only change appears to be moving the CopyButton to an el-button-group component, which might improve the spacing between buttons in small screens. However, beyond styling adjustments, there are no irregularities or other concerns with this code snippet. If you have more specific questions on optimizing performance, accessibility, or best practices related to form elements, feel free to ask!

Expand Down
23 changes: 13 additions & 10 deletions frontend/src/views/database/postgresql/conn/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,19 @@
:rules="Rules.paramComplexity"
prop="password"
>
<el-input type="password" show-password clearable v-model="form.password">
<template #suffix>
<CopyButton type="icon" :content="form.password" class="w-30" />
</template>
<template #append>
<el-button @click="random">
{{ $t('commons.button.random') }}
</el-button>
</template>
</el-input>
<el-input
style="width: calc(100% - 147px)"
type="password"
show-password
clearable
v-model="form.password"
/>
<el-button-group>
<CopyButton :content="form.password" />
<el-button @click="random">
{{ $t('commons.button.random') }}
</el-button>
</el-button-group>
</el-form-item>
</div>
<div v-if="form.from !== 'local'">
Copy link
Member

Choose a reason for hiding this comment

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

The changes seem mostly cosmetic with the addition of some padding. The overall structure and functionality remain intact; however, consider removing style="width: calc(100% - 147px)" from <el-input> if it is not necessary to align with other elements in the same form item.

Optimization suggestion: Ensure that all elements within a .el-form-item.group have the same width for consistent layout across different devices.

Expand Down
23 changes: 13 additions & 10 deletions frontend/src/views/database/redis/conn/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,19 @@

<el-divider border-style="dashed" />
<el-form-item :label="$t('commons.login.password')" v-if="form.from === 'local'" prop="password">
<el-input type="password" show-password clearable v-model="form.password">
<template #suffix>
<CopyButton type="icon" :content="form.password" class="w-30" />
</template>
<template #append>
<el-button @click="random">
{{ $t('commons.button.random') }}
</el-button>
</template>
</el-input>
<el-input
style="width: calc(100% - 147px)"
type="password"
show-password
clearable
v-model="form.password"
/>
<el-button-group>
<CopyButton :content="form.password" />
<el-button @click="random">
{{ $t('commons.button.random') }}
</el-button>
</el-button-group>
</el-form-item>

<div v-if="form.from !== 'local'">
Copy link
Member

Choose a reason for hiding this comment

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

I apologize, but I cannot see the full context of the code snippet you provided. To assist you effectively, please copy and paste the entire code block or describe its purpose so I can examine it for irregularities, potential issues, and optimization opportunities. Alternatively, if there's a specific change (line or section) that needs attention, please highlight or point to it in more detail.

Expand Down
Loading