-
Notifications
You must be signed in to change notification settings - Fork 2.8k
perf: Optimize some styles #3907
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,7 +280,9 @@ | |
|
|
||
| // el-tag | ||
| .el-tag { | ||
| padding: 0 6px; | ||
| padding: 0 4px; | ||
| height: 20px; | ||
| font-weight: 400; | ||
| } | ||
|
|
||
| // el-input | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,18 +66,26 @@ | |
| </el-form> | ||
|
|
||
| <div> | ||
| <el-button @click="submit(authFormRef, 'test')" :disabled="loading"> | ||
| {{ $t('views.system.test') }}</el-button | ||
| > | ||
| <el-button @click="submit(authFormRef)" type="primary" :disabled="loading" | ||
| <span | ||
| v-hasPermission=" | ||
| new ComplexPermission( | ||
| [RoleConst.ADMIN], | ||
| [PermissionConst.CHAT_USER_AUTH_EDIT], | ||
| [],'OR',)" | ||
| new ComplexPermission( | ||
| [RoleConst.ADMIN], | ||
| [PermissionConst.CHAT_USER_AUTH_EDIT], | ||
| [], | ||
| 'OR', | ||
| ) | ||
| " | ||
| class="mr-12" | ||
| > | ||
| {{ $t('common.save') }} | ||
| </el-button> | ||
| <el-button @click="submit(authFormRef)" type="primary" :disabled="loading"> | ||
| {{ $t('common.save') }} | ||
| </el-button> | ||
| </span> | ||
| <span> | ||
| <el-button @click="submit(authFormRef, 'test')" :disabled="loading"> | ||
| {{ $t('views.system.test') }} | ||
| </el-button> | ||
| </span> | ||
| </div> | ||
| </div> | ||
| </el-scrollbar> | ||
|
|
@@ -101,9 +109,9 @@ const form = ref<any>({ | |
| password: '', | ||
| ou: '', | ||
| ldap_filter: '', | ||
| ldap_mapping: '' | ||
| ldap_mapping: '', | ||
| }, | ||
| is_active: true | ||
| is_active: true, | ||
| }) | ||
|
|
||
| const authFormRef = ref() | ||
|
|
@@ -115,44 +123,44 @@ const rules = reactive<FormRules<any>>({ | |
| { | ||
| required: true, | ||
| message: t('views.system.authentication.ldap.serverPlaceholder'), | ||
| trigger: 'blur' | ||
| } | ||
| trigger: 'blur', | ||
| }, | ||
| ], | ||
| 'config.base_dn': [ | ||
| { | ||
| required: true, | ||
| message: t('views.system.authentication.ldap.bindDNPlaceholder'), | ||
| trigger: 'blur' | ||
| } | ||
| trigger: 'blur', | ||
| }, | ||
| ], | ||
| 'config.password': [ | ||
| { | ||
| required: true, | ||
| message: t('views.login.loginForm.password.placeholder'), | ||
| trigger: 'blur' | ||
| } | ||
| trigger: 'blur', | ||
| }, | ||
| ], | ||
| 'config.ou': [ | ||
| { | ||
| required: true, | ||
| message: t('views.system.authentication.ldap.ouPlaceholder'), | ||
| trigger: 'blur' | ||
| } | ||
| trigger: 'blur', | ||
| }, | ||
| ], | ||
| 'config.ldap_filter': [ | ||
| { | ||
| required: true, | ||
| message: t('views.system.authentication.ldap.ldap_filterPlaceholder'), | ||
| trigger: 'blur' | ||
| } | ||
| trigger: 'blur', | ||
| }, | ||
| ], | ||
| 'config.ldap_mapping': [ | ||
| { | ||
| required: true, | ||
| message: t('views.system.authentication.ldap.ldap_mappingPlaceholder'), | ||
| trigger: 'blur' | ||
| } | ||
| ] | ||
| trigger: 'blur', | ||
| }, | ||
| ], | ||
| }) | ||
|
|
||
| const submit = async (formEl: FormInstance | undefined, test?: string) => { | ||
|
|
@@ -177,9 +185,7 @@ function getDetail() { | |
| if (res.data && JSON.stringify(res.data) !== '{}') { | ||
| form.value = res.data | ||
| if (res.data.config.ldap_mapping) { | ||
| form.value.config.ldap_mapping = JSON.stringify( | ||
| JSON.parse(res.data.config.ldap_mapping) | ||
| ) | ||
| form.value.config.ldap_mapping = JSON.stringify(JSON.parse(res.data.config.ldap_mapping)) | ||
| } | ||
| } | ||
| }) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code appears to be generally well-structured, but there are a few areas that could improve:
Here's an updated version of the code with some of these improvements: <template>
<el-scrollbar style="height: 100%">
<!-- ... (previous content unchanged) -->
<div class="actions">
<span v-if="$hasPermission(new ComplexPermission([RoleConst.ADMIN], [PermissionConst.CHAT_USER_AUTH_EDIT], []))" class="mr-12">
<el-button @click="submit(authFormRef)" type="primary" :disabled="loading">{{ $t('common.save') }}</el-button>
</span>
<span>
<el-button @click="submit(authFormRef, 'test')" :disabled="loading">{{ $t('views.system.test') }}</el-button>
</span>
</div>
<!-- ... (rest of the component unchanged) -->
</el-scrollbar>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { FormInstance, reactive, ref } from 'vue';
// other imports
export default defineComponent({
setup(props, context) {
// ... (setup method unchanged)
const actionsHtml = (
<div class="actions">
<span v-if={this.$hasPermission(new ComplexPermission([RoleConst.ADMIN], [PermissionConst.CHAT_USER_AUTH_EDIT], []))} class="mr-12">
<el-button onClick={() => this.submit(this.authFormRef)} type="primary" disabled={this.loading}>{this.$t('common.save')}</el-button>
</span>
<span>
<el-button onClick={() => this.submit(this.authFormRef, 'test')} disabled={this.loading}>{this.$t('views.system.test')}</el-button>
</span>
</div>
);
return {
authFormRef,
actionsHtml,
// other returns
};
}
});
</script>
<style scoped>
.actions span:not(:last-child) {
margin-right: 12px;
}
</style>These changes help maintain cleaner and more readable code while ensuring proper functionality. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your HTML and TypeScript components appear to be mostly correct but contain minor syntax errors that will cause Vue.js warnings. Here's the revised version with these issues fixed:
Code Changes
<template>Tags: Close every<template>tag properly.Attributes Syntax Error: Replace
placement="right"with justplacement: "right", and similarly for other attributes where you've replaced double quotes with single quotes and vice versa.Type Definitions: Ensure proper type definitions in properties and emits are specified correctly.
Here's the corrected version:
Additional Suggestions
Consistent Variable Naming: Use consistent naming conventions for variables like
filterText,filterList, etc.Documentation Comments: Add TypeScript doc comments inline where appropriate to make the code more readable and understandable.
Code Readability: Consider breaking down longer functions or methods into smaller ones if necessary for maintainability.
These changes should resolve the syntax errors and improve the readability of your component.