💄 修改滚动条样式.

This commit is contained in:
lijiahang
2024-07-26 10:18:39 +08:00
parent 305312cc26
commit 3851ead8bb
13 changed files with 91 additions and 89 deletions

View File

@@ -119,11 +119,6 @@
align-items: center; align-items: center;
} }
} }
.exec-host-items {
width: 100%;
height: calc(100% - 38px);
}
} }
:deep(.log-header) { :deep(.log-header) {

View File

@@ -13,23 +13,26 @@
</div> </div>
<!-- 主机列表 --> <!-- 主机列表 -->
<div class="exec-host-items"> <div class="exec-host-items">
<div v-for="item in hosts" <a-scrollbar>
:key="item.id" <div v-for="(item, index) in hosts"
class="exec-host-item" :key="item.id"
:class="[ current === item.id ? 'exec-host-item-selected' : '' ]" class="exec-host-item"
@click="emits('selected', item.id)"> :class="[ current === item.id ? 'exec-host-item-selected' : '' ]"
<!-- 主机名称 --> :style="{ marginBottom: index === hosts.length -1 ? 0 : '8px' }"
<div class="exec-host-item-name"> @click="emits('selected', item.id)">
<span class="host-name">{{ item.hostName }}</span> <!-- 主机名称 -->
<span class="host-address">{{ item.hostAddress }}</span> <div class="exec-host-item-name">
<span class="host-name">{{ item.hostName }}</span>
<span class="host-address">{{ item.hostAddress }}</span>
</div>
<!-- 状态 -->
<div class="exec-host-item-status">
<a-tag :color="getDictValue(execHostStatusKey, item.status, 'execColor')">
{{ getDictValue(execHostStatusKey, item.status) }}
</a-tag>
</div>
</div> </div>
<!-- 状态 --> </a-scrollbar>
<div class="exec-host-item-status">
<a-tag :color="getDictValue(execHostStatusKey, item.status, 'execColor')">
{{ getDictValue(execHostStatusKey, item.status) }}
</a-tag>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -78,13 +81,19 @@
} }
.exec-host-items { .exec-host-items {
position: absolute; position: relative;
width: calc(100% - 32px); width: 100%;
height: calc(100% - 68px); height: calc(100% - 38px);
overflow: auto;
&::-webkit-scrollbar-track { :deep(.arco-scrollbar) {
display: none; position: absolute;
width: 100%;
height: 100%;
&-container {
height: 100%;
overflow-y: auto;
}
} }
} }
@@ -99,7 +108,6 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 8px;
background: var(--color-fill-2); background: var(--color-fill-2);
transition: all .2s; transition: all .2s;
user-select: none; user-select: none;

View File

@@ -1,4 +1,4 @@
import type { CacheState } from './types'; import type { CacheState, CacheType } from './types';
import type { AxiosResponse } from 'axios'; import type { AxiosResponse } from 'axios';
import type { TagType } from '@/api/meta/tag'; import type { TagType } from '@/api/meta/tag';
import { getTagList } from '@/api/meta/tag'; import { getTagList } from '@/api/meta/tag';
@@ -19,14 +19,6 @@ import { getCommandSnippetGroupList } from '@/api/asset/command-snippet-group';
import { getExecJobList } from '@/api/job/exec-job'; import { getExecJobList } from '@/api/job/exec-job';
import { getPathBookmarkGroupList } from '@/api/asset/path-bookmark-group'; import { getPathBookmarkGroupList } from '@/api/asset/path-bookmark-group';
export type CacheType = 'users' | 'menus' | 'roles'
| 'hostGroups' | 'hostKeys' | 'hostIdentities'
| 'dictKeys'
| 'authorizedHostKeys' | 'authorizedHostIdentities'
| 'commandSnippetGroups' | 'pathBookmarkGroups'
| 'execJob'
| string
export default defineStore('cache', { export default defineStore('cache', {
state: (): CacheState => ({}), state: (): CacheState => ({}),

View File

@@ -1,23 +1,12 @@
import type { UserQueryResponse } from '@/api/user/user'; // 缓存类型
import type { MenuQueryResponse } from '@/api/system/menu'; export type CacheType = 'users' | 'menus' | 'roles'
import type { RoleQueryResponse } from '@/api/user/role'; | 'hostGroups' | 'hostKeys' | 'hostIdentities'
import type { HostQueryResponse } from '@/api/asset/host'; | 'dictKeys'
import type { HostGroupQueryResponse } from '@/api/asset/host-group'; | 'authorizedHostKeys' | 'authorizedHostIdentities'
import type { HostKeyQueryResponse } from '@/api/asset/host-key'; | 'commandSnippetGroups' | 'pathBookmarkGroups'
import type { HostIdentityQueryResponse } from '@/api/asset/host-identity'; | 'execJob'
import type { DictKeyQueryResponse } from '@/api/system/dict-key'; | string
export interface CacheState { export interface CacheState {
users?: UserQueryResponse[]; [key: CacheType]: unknown;
menus?: MenuQueryResponse[];
roles?: RoleQueryResponse[];
hosts?: HostQueryResponse[];
hostGroups?: HostGroupQueryResponse[];
hostKeys?: HostKeyQueryResponse[];
hostIdentities?: HostIdentityQueryResponse[];
dictKeys?: DictKeyQueryResponse[];
authorizedHostKeys?: HostKeyQueryResponse[];
authorizedHostIdentities?: HostIdentityQueryResponse[];
[key: string]: unknown;
} }

View File

@@ -1,10 +1,10 @@
import type { RouteMeta, RouteRecordNormalized } from 'vue-router'; import type { RouteMeta, RouteRecordNormalized } from 'vue-router';
import type { MenuState } from './types'; import type { MenuState } from './types';
import type { MenuQueryResponse } from '@/api/system/menu'; import type { MenuQueryResponse } from '@/api/system/menu';
import router from '@/router';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { Notification } from '@arco-design/web-vue'; import { Notification } from '@arco-design/web-vue';
import { getMenuList } from '@/api/user/auth'; import { getMenuList } from '@/api/user/auth';
import router from '@/router';
import { EnabledStatus } from '@/types/const'; import { EnabledStatus } from '@/types/const';
export default defineStore('menu', { export default defineStore('menu', {

View File

@@ -18,9 +18,10 @@
<a-empty description="无执行记录" /> <a-empty description="无执行记录" />
</div> </div>
<!-- 批量执行日志 --> <!-- 批量执行日志 -->
<div v-else class="exec-history-rows"> <a-scrollbar v-else>
<div v-for="record in historyLogs" <div v-for="(record, index) in historyLogs"
:key="record.id" :key="record.id"
:style="{ marginBottom: index === historyLogs.length -1 ? 0 : '8px' }"
class="exec-history" class="exec-history"
@click="emits('selected', record)"> @click="emits('selected', record)">
<!-- 机器数量 --> <!-- 机器数量 -->
@@ -32,7 +33,7 @@
{{ record.description }} {{ record.description }}
</span> </span>
</div> </div>
</div> </a-scrollbar>
</div> </div>
</template> </template>
@@ -110,14 +111,16 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.exec-history-rows { .container {
position: absolute; :deep(.arco-scrollbar) {
width: calc(100% - 32px); position: absolute;
height: calc(100% - 64px); width: calc(100% - 32px);
overflow: auto; height: calc(100% - 64px);
&::-webkit-scrollbar-track { &-container {
display: none; height: 100%;
overflow-y: auto;
}
} }
} }
@@ -127,7 +130,6 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 8px;
background: var(--color-fill-2); background: var(--color-fill-2);
transition: all .2s; transition: all .2s;
user-select: none; user-select: none;

View File

@@ -320,6 +320,18 @@
height: calc(100% - 56px); height: calc(100% - 56px);
overflow: auto; overflow: auto;
padding-bottom: 4px; padding-bottom: 4px;
&::-webkit-scrollbar-track {
display: none;
}
&::-webkit-scrollbar-thumb {
background: transparent;
}
&:hover::-webkit-scrollbar-thumb {
background: var(--color-fill-4);
}
} }
.loading-skeleton { .loading-skeleton {

View File

@@ -75,9 +75,8 @@
import type { HostQueryResponse } from '@/api/asset/host'; import type { HostQueryResponse } from '@/api/asset/host';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useTerminalStore } from '@/store'; import { useTerminalStore } from '@/store';
import { PanelSessionType, TerminalTabs } from '../../types/const'; import { PanelSessionType, TerminalTabs, emptyRecommendCount } from '../../types/const';
const totalCount = 7;
const { tabManager, hosts, openSession } = useTerminalStore(); const { tabManager, hosts, openSession } = useTerminalStore();
const combinedHandlers = ref<Array<CombinedHandlerItem>>([{ const combinedHandlers = ref<Array<CombinedHandlerItem>>([{
@@ -103,7 +102,7 @@
...hosts.hostList.filter(s => s.favorite).map(s => s.id), ...hosts.hostList.filter(s => s.favorite).map(s => s.id),
...hosts.hostList.map(s => s.id) ...hosts.hostList.map(s => s.id)
]) ])
].slice(0, totalCount - 1) ].slice(0, emptyRecommendCount - 1)
.map(s => hosts.hostList.find(t => t.id === s) as HostQueryResponse) .map(s => hosts.hostList.find(t => t.id === s) as HostQueryResponse)
.filter(Boolean) .filter(Boolean)
.map(s => { .map(s => {
@@ -116,10 +115,10 @@
// 插入主机列表 // 插入主机列表
combinedHandlers.value.push(...combinedHosts); combinedHandlers.value.push(...combinedHosts);
// 不足显示的行数用设置补充 // 不足显示的行数用设置补充
if (totalCount - 1 - combinedHosts.length > 0) { if (emptyRecommendCount - 1 - combinedHosts.length > 0) {
const fillTabs = Object.values(TerminalTabs) const fillTabs = Object.values(TerminalTabs)
.filter(s => s.key !== TerminalTabs.NEW_CONNECTION.key) .filter(s => s.key !== TerminalTabs.NEW_CONNECTION.key)
.slice(0, totalCount - 1 - combinedHosts.length) .slice(0, emptyRecommendCount - 1 - combinedHosts.length)
.map(s => { .map(s => {
return { return {
title: s.title, title: s.title,
@@ -147,23 +146,19 @@
.combined-container { .combined-container {
padding: 12px; padding: 12px;
margin: 64px auto 0 auto; margin: 32px auto 0 auto;
width: @container-width; width: @container-width;
height: @container-height; max-height: @container-height;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
box-sizing: content-box; box-sizing: content-box;
overflow: hidden; overflow: hidden;
&:hover {
overflow: auto;
}
} }
.combined-handler { .combined-handler {
width: @container-width - @transform-x; width: @container-width - @transform-x;
height: @handler-height; max-height: @handler-height;
border-radius: 4px; border-radius: 4px;
margin-bottom: 6px; margin-bottom: 6px;
color: var(--color-content-text-1); color: var(--color-content-text-1);

View File

@@ -134,10 +134,4 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.list-view-container {
max-height: 100%;
width: 100%;
overflow: auto;
position: relative;
}
</style> </style>

View File

@@ -320,6 +320,18 @@
height: calc(100% - 56px); height: calc(100% - 56px);
overflow: auto; overflow: auto;
padding-bottom: 4px; padding-bottom: 4px;
&::-webkit-scrollbar-track {
display: none;
}
&::-webkit-scrollbar-thumb {
background: transparent;
}
&:hover::-webkit-scrollbar-thumb {
background: var(--color-fill-4);
}
} }
.loading-skeleton { .loading-skeleton {

View File

@@ -242,7 +242,7 @@
width: 100%; width: 100%;
height: calc(100% - @ssh-header-height); height: calc(100% - @ssh-header-height);
position: relative; position: relative;
padding: 6px 0 0 6px; padding: 8px;
.ssh-inst { .ssh-inst {
width: 100%; width: 100%;

View File

@@ -1,5 +1,8 @@
import type { ShortcutKeyItem } from './define'; import type { ShortcutKeyItem } from './define';
// 首页推荐数量
export const emptyRecommendCount = 7;
// 终端 tab // 终端 tab
export const TerminalTabs = { export const TerminalTabs = {
NEW_CONNECTION: { NEW_CONNECTION: {

View File

@@ -421,7 +421,7 @@
.command-editor { .command-editor {
width: 100%; width: 100%;
height: calc(100vh - 318px); height: calc(100vh - 324px);
} }
:deep(.arco-input-append) { :deep(.arco-input-append) {