This commit is contained in:
Baobhan Sith
2025-05-16 14:12:31 +08:00
parent 162eb0cc91
commit 98600c8961
8 changed files with 46 additions and 13 deletions
-1
View File
@@ -190,7 +190,6 @@ CREATE TABLE IF NOT EXISTS quick_command_tag_associations (
);
`;
// --- End Quick Command Tags ---
// 从 database.ts 移动过来的,保持一致性
@@ -216,4 +216,4 @@ export class NotificationController {
res.status(500).json({ message: i18next.t('notificationController.errorTriggerTest'), error: error.message });
}
};
} // End of class NotificationController
}
@@ -39,7 +39,7 @@ export function createWebSocketConnectionManager(
let reconnectTimeoutId: ReturnType<typeof setTimeout> | null = null; // 重连定时器 ID
let lastUrl = ''; // 保存上次连接的 URL
let intentionalDisconnect = false; // 标记是否为用户主动断开
// --- End Instance State ---
/**
* 安全地获取状态文本的辅助函数
@@ -42,7 +42,6 @@ export const defaultUiTheme: Record<string, string> = {
'--button-bg-color': '#A06CD5', // 现代紫色 - 激活 (基础)
'--button-text-color': '#ffffff',
'--button-hover-bg-color': '#8E44AD', // 现代紫色 - 悬停 (稍暗)
// Added new variables
'--icon-color': 'var(--text-color-secondary)', // 图标颜色
'--icon-hover-color': 'var(--link-hover-color)', // 图标悬停颜色 (自动更新)
'--split-line-color': 'var(--border-color)', /* 分割线颜色 */
@@ -50,7 +49,6 @@ export const defaultUiTheme: Record<string, string> = {
'--input-focus-border-color': 'var(--link-active-color)', /* 输入框聚焦边框颜色 (自动更新) */
'--input-focus-glow': 'var(--link-active-color)', /* 输入框聚焦光晕值 (自动更新) */
'--overlay-bg-color': 'rgba(0, 0, 0, 0.6)', /* Added Overlay Background - 恢复 rgba 以支持透明度 */
// End added variables
'--font-family-sans-serif': 'sans-serif',
'--base-padding': '1rem',
'--base-margin': '0.5rem',
@@ -96,7 +96,7 @@ const decodeRawContent = (rawContentBase64: string, encoding: string): string =>
return `// Error decoding content: ${error.message}`; // 返回错误信息
}
};
// --- End Helper Functions ---
export const useFileEditorStore = defineStore('fileEditor', () => {
const { t } = useI18n();
@@ -462,7 +462,6 @@ export const useQuickCommandsStore = defineStore('quickCommands', () => {
}
});
console.log(`[Store] Manually updated tagIds for ${updatedCount} commands in local state.`);
// --- End manual state update ---
// Optionally, still fetch for full consistency, but UI should update based on manual change first.
// clearQuickCommandsCache();
@@ -72,7 +72,8 @@ const filteredAndSortedConnections = computed(() => {
const usernameMatch = conn.username?.toLowerCase().includes(query);
const hostMatch = conn.host?.toLowerCase().includes(query);
const portMatch = conn.port?.toString().includes(query);
return nameMatch || usernameMatch || hostMatch || portMatch;
const notesMatch = conn.notes?.toLowerCase().includes(query); // 添加对备注的搜索
return nameMatch || usernameMatch || hostMatch || portMatch || notesMatch;
});
}
@@ -267,7 +268,6 @@ const handleBatchEditSaved = async () => {
const handleBatchEditFormClose = () => {
showBatchEditForm.value = false;
};
// --- End Batch Edit Functions ---
// --- Test Connection Logic ---
interface ConnectionTestState {
@@ -408,7 +408,37 @@ const getTruncatedNotes = (notes: string | null | undefined): string => {
return notes.substring(0, maxLength) + '...';
};
// --- End Test Connection Logic ---
// --- Connect All Filtered Connections ---
const isConnectingAll = ref(false);
const handleConnectAllFilteredConnections = async () => {
if (isConnectingAll.value || isLoadingConnections.value) return;
const sshConnectionsToConnect = filteredAndSortedConnections.value.filter(conn => conn.type === 'SSH');
if (sshConnectionsToConnect.length === 0) {
console.warn(t('connections.messages.noSshConnectionsToConnectAll', '没有可连接的 SSH 筛选结果。'));
// Optionally, use a UI notification if available in your project
// e.g., uiNotificationsStore.addNotification({ message: t('connections.messages.noSshConnectionsToConnectAll'), type: 'info' });
return;
}
isConnectingAll.value = true;
try {
for (const conn of sshConnectionsToConnect) {
connectTo(conn);
// Consider a small delay if you want to visually see connections initiating one by one,
// or if connectTo triggers operations that might benefit from not being fired too rapidly.
// await new Promise(resolve => setTimeout(resolve, 200)); // Example delay
}
} catch (error) {
console.error("Error connecting to all filtered SSH connections:", error);
// uiNotificationsStore.addNotification({ message: t('connections.errors.connectAllSshFailed', '连接全部 SSH 操作失败。'), type: 'error' });
} finally {
isConnectingAll.value = false;
}
};
</script>
@@ -499,6 +529,16 @@ const getTruncatedNotes = (notes: string | null | undefined): string => {
<i v-else class="fas fa-check-double mr-1 sm:mr-2"></i>
<span class="hidden sm:inline">{{ t('connections.actions.testAllFiltered') }}</span>
</button>
<!-- Connect All Filtered Connections Button -->
<button
@click="handleConnectAllFilteredConnections"
:disabled="isConnectingAll || isLoadingConnections || !filteredAndSortedConnections.some(c => c.type === 'SSH')"
class="h-8 px-3 py-1.5 text-sm bg-button text-button-text rounded-md shadow-sm hover:bg-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out flex items-center justify-center flex-shrink-0 ml-2 sm:ml-0"
>
<i v-if="isConnectingAll" class="fas fa-spinner fa-spin mr-1 sm:mr-2"></i>
<i v-else class="fas fa-network-wired mr-1 sm:mr-2"></i>
<span class="hidden sm:inline">{{ t('workspaceConnectionList.connectAllSshInGroupMenu', '连接全部') }}</span>
</button>
</div>
</div>
@@ -51,7 +51,6 @@ const resetCaptchaWidget = () => {
// Reset reCAPTCHA v2 if it exists
recaptchaWidget.value?.reset();
};
// --- End CAPTCHA Event Handlers ---
// 2FA
@@ -67,8 +66,6 @@ const handleSubmit = async () => {
return; // Stop submission if CAPTCHA is required but not completed
}
}
// --- End CAPTCHA Check ---
// --- End CAPTCHA Check ---
try {
if (loginRequires2FA.value) {