enhance: optimize the experience on small devices

This commit is contained in:
Jacky 2025-01-31 13:29:06 +08:00
parent cc4d7af85f
commit 9e66c355bf
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
19 changed files with 108 additions and 65 deletions

View file

@ -8,12 +8,24 @@ import FooterLayout from './FooterLayout.vue'
import HeaderLayout from './HeaderLayout.vue' import HeaderLayout from './HeaderLayout.vue'
import SideBar from './SideBar.vue' import SideBar from './SideBar.vue'
const drawer_visible = ref(false) const drawerVisible = ref(false)
const collapsed = ref(collapse()) const collapsed = ref(collapse())
const hideLayoutSidebar = ref(false)
addEventListener('resize', _.throttle(() => { function _init() {
collapsed.value = collapse() collapsed.value = collapse()
}, 50)) hideLayoutSidebar.value = getClientWidth() < 600
}
const init = _.throttle(_init, 50)
onMounted(init)
addEventListener('resize', init)
onUnmounted(() => {
removeEventListener('resize', init)
})
function getClientWidth() { function getClientWidth() {
return document.body.clientWidth return document.body.clientWidth
@ -38,17 +50,18 @@ provide('breadList', breadList)
<ALayout class="full-screen-wrapper min-h-screen"> <ALayout class="full-screen-wrapper min-h-screen">
<div class="drawer-sidebar"> <div class="drawer-sidebar">
<ADrawer <ADrawer
v-model:open="drawer_visible" v-model:open="drawerVisible"
:closable="false" :closable="false"
placement="left" placement="left"
width="256" width="256"
@close="drawer_visible = false" @close="drawerVisible = false"
> >
<SideBar /> <SideBar />
</ADrawer> </ADrawer>
</div> </div>
<ALayoutSider <ALayoutSider
v-if="!hideLayoutSidebar"
v-model:collapsed="collapsed" v-model:collapsed="collapsed"
collapsible collapsible
:style="{ zIndex: 11 }" :style="{ zIndex: 11 }"
@ -60,7 +73,7 @@ provide('breadList', breadList)
<ALayout class="main-container"> <ALayout class="main-container">
<ALayoutHeader :style="{ position: 'sticky', top: '0', zIndex: 10, width: '100%' }"> <ALayoutHeader :style="{ position: 'sticky', top: '0', zIndex: 10, width: '100%' }">
<HeaderLayout @click-un-fold="drawer_visible = true" /> <HeaderLayout @click-un-fold="drawerVisible = true" />
</ALayoutHeader> </ALayoutHeader>
<ALayoutContent> <ALayoutContent>

View file

@ -227,11 +227,11 @@ export const routes: RouteRecordRaw[] = [
}], }],
}, },
{ {
path: 'environment', path: 'environments',
name: 'Environment', name: 'Environments',
component: () => import('@/views/environment/Environment.vue'), component: () => import('@/views/environment/Environment.vue'),
meta: { meta: {
name: () => $gettext('Environment'), name: () => $gettext('Environments'),
icon: DatabaseOutlined, icon: DatabaseOutlined,
hiddenInSidebar: (): boolean => { hiddenInSidebar: (): boolean => {
const settings = useSettingsStore() const settings = useSettingsStore()

View file

@ -94,6 +94,7 @@ const columns: Column[] = [
{ {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
}, },
] ]

View file

@ -33,6 +33,7 @@ const refTable = ref()
:api="cert" :api="cert"
:columns="certColumns" :columns="certColumns"
disable-view disable-view
:scroll-x="1000"
@click-edit="id => $router.push(`/certificates/${id}`)" @click-edit="id => $router.push(`/certificates/${id}`)"
/> />
<WildcardCertificate <WildcardCertificate

View file

@ -96,6 +96,7 @@ const columns: Column[] = [{
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
}] }]
export default columns export default columns

View file

@ -135,6 +135,7 @@ const refRename = useTemplateRef('refRename')
:get-params="getParams" :get-params="getParams"
disable-query-params disable-query-params
disable-modify disable-modify
:scroll-x="880"
> >
<template #actions="{ record }"> <template #actions="{ record }">
<AButton <AButton

View file

@ -1,8 +1,7 @@
import type { CustomRender } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer' import type { CustomRender } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
import type { JSXElements } from '@/components/StdDesign/types'
import { datetime } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer' import { datetime } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
import { input } from '@/components/StdDesign/StdDataEntry' import { input } from '@/components/StdDesign/StdDataEntry'
import { h } from 'vue' import { FileFilled, FolderFilled } from '@ant-design/icons-vue'
const configColumns = [{ const configColumns = [{
title: () => $gettext('Name'), title: () => $gettext('Name'),
@ -12,21 +11,25 @@ const configColumns = [{
search: { search: {
type: input, type: input,
}, },
}, {
title: () => $gettext('Type'),
dataIndex: 'is_dir',
customRender: (args: CustomRender) => { customRender: (args: CustomRender) => {
const template: JSXElements = [] function renderIcon(isDir: boolean) {
const { text } = args return (
if (text === true || text > 0) <div class="mr-2 text-truegray-5">
template.push($gettext('Directory')) {isDir
else ? <FolderFilled />
template.push($gettext('File')) : <FileFilled />}
</div>
)
}
return h('div', template) return (
<div class="flex">
{renderIcon(args.record.is_dir)}
{args.text}
</div>
)
}, },
sorter: true, width: 500,
pithy: true,
}, { }, {
title: () => $gettext('Updated at'), title: () => $gettext('Updated at'),
dataIndex: 'modified_at', dataIndex: 'modified_at',
@ -34,9 +37,12 @@ const configColumns = [{
datetime: true, datetime: true,
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 200,
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
width: 180,
}] }]
export default configColumns export default configColumns

View file

@ -28,13 +28,16 @@ function batchUpgrade() {
ref="curd" ref="curd"
v-model:selected-row-keys="selectedNodeIds" v-model:selected-row-keys="selectedNodeIds"
v-model:selected-rows="selectedNodes" v-model:selected-rows="selectedNodes"
:scroll-x="1000"
selection-type="checkbox" selection-type="checkbox"
:title="$gettext('Environment')" :title="$gettext('Environments')"
:api="environment" :api="environment"
:columns="envColumns" :columns="envColumns"
> >
<template #beforeAdd> <template #beforeAdd>
<a @click="loadFromSettings">{{ $gettext('Load from settings') }}</a> <AButton size="small" type="link" @click="loadFromSettings">
{{ $gettext('Load from settings') }}
</AButton>
</template> </template>
</StdCurd> </StdCurd>

View file

@ -14,6 +14,7 @@ const columns: Column[] = [{
type: input, type: input,
}, },
search: true, search: true,
width: 200,
}, { }, {
title: () => $gettext('URL'), title: () => $gettext('URL'),
dataIndex: 'url', dataIndex: 'url',
@ -25,10 +26,12 @@ const columns: Column[] = [{
placeholder: () => 'https://10.0.0.1:9000', placeholder: () => 'https://10.0.0.1:9000',
}, },
}, },
width: 300,
}, { }, {
title: () => $gettext('Version'), title: () => $gettext('Version'),
dataIndex: 'version', dataIndex: 'version',
pithy: true, pithy: true,
width: 150,
}, { }, {
title: () => 'NodeSecret', title: () => 'NodeSecret',
dataIndex: 'token', dataIndex: 'token',
@ -37,41 +40,7 @@ const columns: Column[] = [{
edit: { edit: {
type: input, type: input,
}, },
}, }, {
// {
// title: () => $gettext('OperationSync'),
// dataIndex: 'operation_sync',
// sorter: true,
// pithy: true,
// edit: {
// type: antSwitch
// },
// extra: $gettext('Whether config api regex that will redo on this environment'),
// customRender: (args: customRender) => {
// const {operation_sync} = args.record
// if (operation_sync) {
// return h(Tag, {color: 'success'}, {default: ()=> h('span', $gettext('Yes'))})
// } else {
// return h(Tag, {color: 'default'}, {default: ()=> h('span', $gettext('No'))})
// }
// },
// }, {
// title: () => $gettext('SyncApiRegex'),
// dataIndex: 'sync_api_regex',
// sorter: true,
// pithy: true,
// display: false,
// edit: {
// type: textarea,
// show: (data) => {
// const {operation_sync} = data
// return operation_sync
// }
// },
// extra: $gettext('Such as Reload and Configs, regex can configure as `/api/nginx/reload|/api/nginx/test|/api/config/.+`, please see system api'),
// },
{
title: () => $gettext('Status'), title: () => $gettext('Status'),
dataIndex: 'status', dataIndex: 'status',
customRender: (args: CustomRender) => { customRender: (args: CustomRender) => {
@ -96,6 +65,7 @@ const columns: Column[] = [{
}, },
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 200,
}, { }, {
title: () => $gettext('Enabled'), title: () => $gettext('Enabled'),
dataIndex: 'enabled', dataIndex: 'enabled',
@ -115,15 +85,19 @@ const columns: Column[] = [{
}, },
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 150,
}, { }, {
title: () => $gettext('Updated at'), title: () => $gettext('Updated at'),
dataIndex: 'updated_at', dataIndex: 'updated_at',
customRender: datetime, customRender: datetime,
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 150,
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
width: 200,
}] }]
export default columns export default columns

View file

@ -24,6 +24,7 @@ watch(unreadCount, () => {
<template> <template>
<StdCurd <StdCurd
ref="curd" ref="curd"
:scroll-x="1000"
:title="$gettext('Notification')" :title="$gettext('Notification')"
:columns="notificationColumns" :columns="notificationColumns"
:api="notification" :api="notification"

View file

@ -47,20 +47,24 @@ const columns: Column[] = [{
return h('span', $gettext(args.text)) return h('span', $gettext(args.text))
}, },
pithy: true, pithy: true,
width: 250,
}, { }, {
title: () => $gettext('Details'), title: () => $gettext('Details'),
dataIndex: 'details', dataIndex: 'details',
customRender: detailRender, customRender: detailRender,
pithy: true, pithy: true,
width: 300,
}, { }, {
title: () => $gettext('Created at'), title: () => $gettext('Created at'),
dataIndex: 'created_at', dataIndex: 'created_at',
sorter: true, sorter: true,
customRender: datetime, customRender: datetime,
pithy: true, pithy: true,
width: 180,
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
}] }]
export default columns export default columns

View file

@ -10,6 +10,7 @@ import columns from '@/views/site/site_category/columns'
:title="$gettext('Site Categories')" :title="$gettext('Site Categories')"
:api="site_category" :api="site_category"
:columns="columns" :columns="columns"
:scroll-x="600"
> >
<template #edit="{ data }"> <template #edit="{ data }">
<div class="mb-2"> <div class="mb-2">

View file

@ -10,21 +10,26 @@ const columns: Column[] = [{
type: input, type: input,
}, },
pithy: true, pithy: true,
width: 120,
}, { }, {
title: () => $gettext('Created at'), title: () => $gettext('Created at'),
dataIndex: 'created_at', dataIndex: 'created_at',
customRender: datetime, customRender: datetime,
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 150,
}, { }, {
title: () => $gettext('Updated at'), title: () => $gettext('Updated at'),
dataIndex: 'updated_at', dataIndex: 'updated_at',
customRender: datetime, customRender: datetime,
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 150,
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
width: 150,
}] }]
export default columns export default columns

View file

@ -109,6 +109,7 @@ function handleBatchUpdated() {
:get-params="{ :get-params="{
site_category_id: siteCategoryId, site_category_id: siteCategoryId,
}" }"
:scroll-x="1200"
@click-edit="(r: string) => router.push({ @click-edit="(r: string) => router.push({
path: `/sites/${r}`, path: `/sites/${r}`,
})" })"

View file

@ -20,7 +20,7 @@ const columns: Column[] = [{
type: input, type: input,
}, },
search: true, search: true,
minWidth: 400, width: 120,
}, { }, {
title: () => $gettext('Category'), title: () => $gettext('Category'),
dataIndex: 'site_category_id', dataIndex: 'site_category_id',
@ -37,7 +37,7 @@ const columns: Column[] = [{
sorter: true, sorter: true,
pithy: true, pithy: true,
batch: true, batch: true,
minWidth: 200, width: 100,
}, { }, {
title: () => $gettext('Status'), title: () => $gettext('Status'),
dataIndex: 'enabled', dataIndex: 'enabled',
@ -64,18 +64,19 @@ const columns: Column[] = [{
}, },
sorter: true, sorter: true,
pithy: true, pithy: true,
minWidth: 100, width: 80,
}, { }, {
title: () => $gettext('Updated at'), title: () => $gettext('Updated at'),
dataIndex: 'modified_at', dataIndex: 'modified_at',
customRender: datetime, customRender: datetime,
sorter: true, sorter: true,
pithy: true, pithy: true,
minWidth: 200, width: 150,
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
minWidth: 300, width: 80,
fixed: 'right',
}] }]
export default columns export default columns

View file

@ -18,6 +18,7 @@ const columns: Column[] = [{
type: input, type: input,
}, },
search: true, search: true,
width: 200,
}, { }, {
title: () => $gettext('Status'), title: () => $gettext('Status'),
dataIndex: 'enabled', dataIndex: 'enabled',
@ -37,6 +38,7 @@ const columns: Column[] = [{
}, },
sorter: true, sorter: true,
pithy: true, pithy: true,
width: 100,
}, { }, {
title: () => $gettext('Updated at'), title: () => $gettext('Updated at'),
dataIndex: 'modified_at', dataIndex: 'modified_at',
@ -46,6 +48,8 @@ const columns: Column[] = [{
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
width: 120,
fixed: 'right',
}] }]
const table = ref() const table = ref()
@ -126,6 +130,7 @@ function handleAddStream() {
row-key="name" row-key="name"
disable-delete disable-delete
disable-view disable-view
:scroll-x="800"
@click-edit="r => $router.push({ @click-edit="r => $router.push({
path: `/stream/${r}`, path: `/stream/${r}`,
})" })"

View file

@ -6,6 +6,7 @@ import userColumns from '@/views/user/userColumns'
<template> <template>
<StdCurd <StdCurd
:scroll-x="1000"
:title="$gettext('Manage Users')" :title="$gettext('Manage Users')"
:columns="userColumns" :columns="userColumns"
:api="user" :api="user"

View file

@ -59,6 +59,7 @@ const columns: Column[] = [{
}, { }, {
title: () => $gettext('Action'), title: () => $gettext('Action'),
dataIndex: 'action', dataIndex: 'action',
fixed: 'right',
}] }]
export default columns export default columns

View file

@ -0,0 +1,23 @@
Name = "myaddr.{tools,dev,io}"
Description = ''''''
URL = "https://myaddr.tools/"
Code = "myaddr"
Since = "v4.22.0"
Example = '''
MYADDR_PRIVATE_KEYS_MAPPING="example:123,test:456" \
lego --email you@example.com --dns myaddr -d '*.example.com' -d example.com run
'''
[Configuration]
[Configuration.Credentials]
MYADDR_PRIVATE_KEYS_MAPPING = "Mapping between subdomains and private keys. The format is: `<subdomain1>:<private_key1>,<subdomain2>:<private_key2>,<subdomain3>:<private_key3>`"
[Configuration.Additional]
MYADDR_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)"
MYADDR_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)"
MYADDR_SEQUENCE_INTERVAL = "Time between sequential requests in seconds (Default: 2)"
MYADDR_TTL = "The TTL of the TXT record used for the DNS challenge in seconds (Default: 120)"
MYADDR_HTTP_TIMEOUT = "API request timeout in seconds (Default: 30)"
[Links]
API = "https://myaddr.tools/"