Skip to content
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
4 changes: 2 additions & 2 deletions agent/app/service/device_clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func doSystemClean(taskItem *task.Task) func(t *task.Task) error {
}
}

dropWithExclude(path.Join(global.Dir.BaseDir, uploadPath), []string{"theme"}, taskItem, &size, &fileCount)
dropWithExclude(path.Join(global.Dir.BaseDir, uploadPath), []string{"theme", "skills-hub"}, taskItem, &size, &fileCount)
dropWithTask(path.Join(global.Dir.BaseDir, downloadPath), taskItem, &size, &fileCount)

logFiles, _ := os.ReadDir(global.Dir.LogDir)
Expand Down Expand Up @@ -863,7 +863,7 @@ func loadTreeWithAllFile(isCheck bool, originalPath, treeType, pathItem string,
return lists
}
for _, file := range files {
if treeType == "upload" && (file.Name() == "theme" && file.IsDir()) {
if treeType == "upload" && ((file.Name() == "theme" || file.Name() == "skills-hub") && file.IsDir()) {
continue
}
if treeType == "system_log" && (file.Name() == "1Panel-Core.log" || file.Name() == "1Panel.log" || file.IsDir()) {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/api/interface/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,14 @@ export namespace Setting {
}
export interface NodeItem {
id: number;
groupID?: number;
groupBelong?: string;
addr: string;
status: string;
version: string;
isXpack: boolean;
isBound: boolean;
isFavorite?: boolean;
name: string;
}
export interface SimpleNodeItem {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/api/modules/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const loadLicenseOptions = () => {
export const listNodeOptions = (type: string) => {
return http.post<Array<Setting.NodeItem>>(`/core/nodes/list`, { type: type });
};
export const updateNodeFavorite = (id: number, isFavorite: boolean) => {
return http.post(`/core/xpack/nodes/favorite`, { id, isFavorite });
};
export const listAllSimpleNodes = () => {
return http.get<Array<Setting.SimpleNodeItem>>(`/core/nodes/simple/all`);
};
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5131,6 +5131,8 @@ const message = {
memTotal: 'Total Memory',
nodeManagement: 'Multi-Machine Management',
multiOverview: 'Multi-Machine',
commonNodes: 'Frequently Used Nodes',
searchNodePlaceholder: 'Search node name, group, or address',
nodeItem: 'Node Management',
panelItem: 'Panel Management',
addPanel: 'Add Panel',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/es-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5182,6 +5182,8 @@ const message = {
memTotal: 'Memoria Total',
nodeManagement: 'Gestión Multi-Máquina',
multiOverview: 'Multimáquina',
commonNodes: 'Nodos frecuentes',
searchNodePlaceholder: 'Buscar nombre, grupo o dirección del nodo',
nodeItem: 'Gestión de Nodos',
panelItem: 'Gestión de Paneles',
addNode: 'Añadir Nodo',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5151,6 +5151,8 @@ const message = {
memTotal: '総メモリ',
nodeManagement: 'マルチマシン管理',
multiOverview: 'マルチマシン',
commonNodes: 'よく使うノード',
searchNodePlaceholder: 'ノード名、グループ、アドレスを検索',
nodeItem: 'ノード管理',
panelItem: 'パネル管理',
addPanel: 'パネル追加',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5041,6 +5041,8 @@ const message = {
memTotal: '총 메모리',
nodeManagement: '다중 머신 관리',
multiOverview: '다중 머신',
commonNodes: '자주 사용하는 노드',
searchNodePlaceholder: '노드 이름, 그룹 또는 주소 검색',
nodeItem: '노드 관리',
panelItem: '패널 관리',
addPanel: '패널 추가',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/ms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5209,6 +5209,8 @@ const message = {
memTotal: 'Jumlah Memori',
nodeManagement: 'Pengurusan Multi-Mesin',
multiOverview: 'Multi-Mesin',
commonNodes: 'Nod Kerap Digunakan',
searchNodePlaceholder: 'Cari nama nod, kumpulan atau alamat',
nodeItem: 'Pengurusan Nod',
panelItem: 'Pengurusan Panel',
addPanel: 'Tambah Panel',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/pt-br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5357,6 +5357,8 @@ const message = {
memTotal: 'Memória Total',
nodeManagement: 'Gerenciamento Multi-Máquina',
multiOverview: 'Multi-Máquina',
commonNodes: 'Nós frequentes',
searchNodePlaceholder: 'Pesquise nome, grupo ou endereço do nó',
nodeItem: 'Gerenciamento de Nós',
panelItem: 'Gerenciamento de Painéis',
addPanel: 'Adicionar Painel',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5212,6 +5212,8 @@ const message = {
memTotal: 'Общая память',
nodeManagement: 'Управление Несколькими Машинами',
multiOverview: 'Несколько Машин',
commonNodes: 'Часто используемые узлы',
searchNodePlaceholder: 'Поиск по имени узла, группе или адресу',
nodeItem: 'Управление Узлами',
panelItem: 'Управление Панелями',
addPanel: 'Добавить Панель',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5199,6 +5199,8 @@ const message = {
memTotal: 'Toplam Bellek',
nodeManagement: 'Çoklu Makine Yönetimi',
multiOverview: 'Çoklu Makine',
commonNodes: 'Sık Kullanılan Düğümler',
searchNodePlaceholder: 'Düğüm adı, grup veya adres ara',
nodeItem: 'Düğüm Yönetimi',
panelItem: 'Panel Yönetimi',
addPanel: 'Panel Ekle',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4773,6 +4773,8 @@ const message = {
memTotal: '記憶體總計',
nodeManagement: '多機管理',
multiOverview: '多機概覽',
commonNodes: '常用節點',
searchNodePlaceholder: '搜尋節點名稱、群組或地址',
nodeItem: '節點管理',
panelItem: '面板管理',
addPanel: '添加面板',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4224,6 +4224,8 @@ const message = {
memTotal: '内存总计',
nodeManagement: '多机管理',
multiOverview: '多机概览',
commonNodes: '常用节点',
searchNodePlaceholder: '搜索节点名称、分组或地址',
nodeItem: '节点管理',
panelItem: '面板管理',
addPanel: '添加面板',
Expand Down
92 changes: 61 additions & 31 deletions frontend/src/layout/components/Sidebar/components/Collapse.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<div>
<el-popover
v-model:visible="popoverVisible"
placement="right-end"
:show-arrow="false"
:offset="0"
Expand Down Expand Up @@ -44,16 +45,16 @@
<el-divider v-if="isXpackOrEE" class="divider" />

<div v-if="showNodes()">
<el-scrollbar max-height="168px" :noresize="true">
<el-scrollbar max-height="288px" :noresize="true">
<div
class="dropdown-item"
@click="changeNode(item.name)"
:disabled="item.status !== 'Healthy'"
v-for="item in nodeOptions"
v-for="item in visibleNodeOptions"
:key="item.name"
>
<SvgIcon class="icon" iconName="p-zhuji" />
{{ item.name === 'local' ? globalStore.getMasterAlias() : item.name }}
<span class="node-name">{{ displayNodeName(item) }}</span>
<el-tooltip
v-if="item.status !== 'Healthy' || !item.isBound"
:content="item.isBound ? $t('xpack.node.nodeUnhealthy') : $t('xpack.node.nodeUnbind')"
Expand All @@ -65,23 +66,25 @@
</el-tooltip>
</div>
</el-scrollbar>
<div v-if="showMoreNodes" class="dropdown-item more-node-button" @click.stop="openNodeDrawer">
<span>{{ $t('tabs.more') }}...</span>
<span class="more-node-count">{{ nodeOptions.length - defaultNodeLimit }}</span>
</div>
</div>
<el-input
v-if="showNodes() && nodes?.length > 5"
suffix-icon="Search"
v-model="filter"
@input="changeFilter"
class="w-full filter-input"
size="small"
clearable
/>
<el-divider class="divider" />
<div class="dropdown-item" @click="logout">
<SvgIcon class="icon" iconName="p-tuichudenglu3" />
{{ $t('commons.login.logout') }}
</div>
</div>
</el-popover>
<NodeDrawer
v-model="nodeDrawerVisible"
:nodes="nodeOptions"
:master-alias="globalStore.getMasterAlias()"
@change="changeNode"
@favorite-change="handleFavoriteChange"
/>
<UserInfo ref="userInfoRef" :currentUser="currentUser" @search="loadCurrentUser()" />
</div>
</template>
Expand All @@ -92,7 +95,7 @@ import { countExecutingTask } from '@/api/modules/log';
import { MsgError, MsgSuccess } from '@/utils/message';
import i18n from '@/lang';
import { getAgentSettingInfo } from '@/api/modules/setting';
import { onMounted, ref } from 'vue';
import { computed, onMounted, ref } from 'vue';
import bus from '@/global/bus';
import { logOutApi } from '@/api/modules/auth';
import router from '@/routers';
Expand All @@ -102,9 +105,9 @@ import { changeToLocal, listNodes, setDefaultNodeInfo } from '@/utils/node';
import { Login } from '@/api/interface/auth';
import { syncAuthInfo } from '@/utils/rbac';
import UserInfo from './user-info/index.vue';
import NodeDrawer from './node-drawer/index.vue';
import { useGlobalStore } from '@/composables/useGlobalStore';

const filter = ref();
const currentUser = ref<Login.AuthInfo>();
const { globalStore, currentNode, currentNodeAddr, defaultNetwork, entrance, isEnterprise, isXpackOrEE } =
useGlobalStore();
Expand All @@ -113,11 +116,15 @@ const nodes = ref([]);
const nodeOptions = ref([]);
const loading = ref();
const switchingNode = ref(false);
const popoverVisible = ref(false);
const nodeDrawerVisible = ref(false);
const userInfoRef = ref();
const props = defineProps({
version: String,
});

const defaultNodeLimit = 8;

const emit = defineEmits(['openTask', 'refresh']);
bus.on('refreshTask', () => {
checkTask();
Expand All @@ -133,19 +140,28 @@ const loadCurrentName = () => {
return globalStore.getMasterAlias();
};

const visibleNodeOptions = computed(() => {
return nodeOptions.value.slice(0, defaultNodeLimit);
});
const showMoreNodes = computed(() => {
return nodeOptions.value.length > defaultNodeLimit;
});

const showPopover = async () => {
filter.value = '';
await loadNodes();
changeFilter();
};

const changeFilter = () => {
nodeOptions.value = [];
for (const item of nodes.value) {
if (item.name.indexOf(filter.value) !== -1) {
nodeOptions.value.push(item);
}
}
const displayNodeName = (item) => {
return item.name === 'local' ? globalStore.getMasterAlias() : item.name;
};

const openNodeDrawer = () => {
nodeDrawerVisible.value = true;
popoverVisible.value = false;
};

const handleFavoriteChange = async () => {
await loadNodes();
};

const loadNodes = async () => {
Expand All @@ -162,11 +178,6 @@ const loadNodes = async () => {
if (nodes.value.length === 0) {
setDefaultNodeInfo();
}
nodes.value.sort((a, b) => {
if (a.name === 'local') return -1;
if (b.name === 'local') return 1;
return 0;
});
nodeOptions.value = nodes.value || [];
loading.value = false;
})
Expand Down Expand Up @@ -362,9 +373,28 @@ onMounted(() => {
}
}
}
.filter-input {
padding: 0 8px;
margin-bottom: 4px;
.node-name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.more-node-button {
padding-left: 34px;
color: var(--el-color-primary);
}
.more-node-count {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 20px;
height: 18px;
padding: 0 6px;
border-radius: 9px;
color: var(--el-color-primary);
background: var(--el-color-primary-light-9);
line-height: 18px;
}
.dropdown-item:hover {
background: var(--el-menu-item-bg-color-active);
Expand Down
Loading
Loading