-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Website list supports filtering by type. #8414
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 |
|---|---|---|
|
|
@@ -2,32 +2,7 @@ | |
| <DrawerPro v-model="open" :header="$t('website.create')" size="large" @close="handleClose"> | ||
| <template #buttons> | ||
| <span class="drawer-header-button"> | ||
| <template | ||
| v-for="item in [ | ||
| { | ||
| label: i18n.global.t('website.deployment'), | ||
| value: 'deployment', | ||
| }, | ||
| { | ||
| label: i18n.global.t('runtime.runtime'), | ||
| value: 'runtime', | ||
| }, | ||
|
|
||
| { | ||
| label: i18n.global.t('website.proxy'), | ||
| value: 'proxy', | ||
| }, | ||
| { | ||
| label: i18n.global.t('website.static'), | ||
| value: 'static', | ||
| }, | ||
| { | ||
| label: i18n.global.t('website.subsite'), | ||
| value: 'subsite', | ||
| }, | ||
| ]" | ||
| :key="item.value" | ||
| > | ||
| <template v-for="item in WebsiteTypes" :key="item.value"> | ||
| <el-button | ||
| :class="website.type === item.value ? 'active-button' : ''" | ||
| @click="changeType(item.value)" | ||
|
|
@@ -572,6 +547,7 @@ import { dateFormatSimple, getProvider, getAccountName } from '@/utils/util'; | |
| import { Website } from '@/api/interface/website'; | ||
| import DomainCreate from '@/views/website/website/domain-create/index.vue'; | ||
| import { getPathByType } from '@/api/modules/files'; | ||
| import { WebsiteTypes } from '@/global/mimetype'; | ||
|
|
||
| const websiteForm = ref<FormInstance>(); | ||
|
|
||
|
Member
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 provided code snippet contains some stylistic choices that could be improved for readability and maintainability, particularly regarding comments, formatting, and type imports. Here are a few recommendations: Improvements
Here’s the slightly cleaned-up version of your code: @@ -2,32 +2,7 @@
<DrawerPro v-model="open" :header="$t('website.create')" size="large" @close="handleClose">
<template #buttons>
<span class="drawer-header-button">
- <template
- v-for="(item) in (
- [
- {
- label: $t('website.deployment'),
- value: 'deployment'
- },
- {
- label: $t('runtime.runtime'),
- value: 'runtime'
- },
- {
- label: $t('website.proxy'),
- value: 'proxy'
- },
- {
- label: $t('website.static'),
- value: 'static'
- },
- {
- label: $t('website.subsite'),
- value: 'subsite'
- }
- ]
- )"
- :key="item.value"
- >
+ <template v-for="(item) in WebsiteTypes" :key="item.value">
<el-button
:class="
`${website.type === item.value ? 'active-button' : ''}`
"
@click="changeType(item.value)"
/>
</template>
</span>
@@ -572,7 +549,8 @@ import { dateFormatSimple, getProvider, getAccountName } from '@/utils/util';
import { FormInstance } from "element-plus"; // Replace with correct import statement if needed
import DomainCreate from "@/views/website/website/domain-create/index.vue";
import { getPathByType } from '@/api/modules/files';
-import { WebsiteTypes } from '@/global/mimetype'; // Assuming WebsiteTypes is globally accessible
const websiteForm = ref<FormInstance>();These changes improve overall clarity and maintainability while adhering to best practices in JavaScript programming. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,16 @@ | |
| </el-button> | ||
| </template> | ||
| <template v-if="!openNginxConfig && nginxIsExist" #rightToolBar> | ||
| <el-select class="p-w-200" v-model="req.type" @change="search()" :disabled="nginxStatus != 'Running'"> | ||
| <template #prefix>{{ $t('commons.table.type') }}</template> | ||
| <el-option :label="$t('commons.table.all')" :value="''"></el-option> | ||
| <el-option | ||
| v-for="item in WebsiteTypes" | ||
| :label="item.label" | ||
| :value="item.value" | ||
| :key="item.value" | ||
| ></el-option> | ||
| </el-select> | ||
| <el-select | ||
| v-model="req.websiteGroupId" | ||
| @change="search()" | ||
|
|
@@ -265,6 +275,7 @@ import { useI18n } from 'vue-i18n'; | |
| import { getAgentGroupList } from '@/api/modules/group'; | ||
| import { Group } from '@/api/interface/group'; | ||
| import { GlobalStore } from '@/store'; | ||
| import { WebsiteTypes } from '@/global/mimetype'; | ||
| const globalStore = GlobalStore(); | ||
|
|
||
| const shortcuts = [ | ||
|
|
@@ -317,6 +328,7 @@ let req = reactive({ | |
| orderBy: 'createdAt', | ||
| order: 'null', | ||
| websiteGroupId: 0, | ||
| type: '', | ||
| }); | ||
| const mobile = computed(() => { | ||
| return globalStore.isMobile(); | ||
|
Member
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. There appear to be minor formatting changes and an addition to the code snippet. Here are my observations:
Considering further improvement points based on best practices:
Overall, this code looks functional and well-documented for Vue.js development with typescript support, making use of Vuex for state management. |
||
|
|
||
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.
The code appears clean and well structured with appropriate comments. The changes made to
WebsiteTypesare consistent with existing patterns used in the other arrays. No significant errors or performance optimizations seem necessary here.