update
This commit is contained in:
@@ -102,7 +102,6 @@ export const getSidebarConfig = async (): Promise<SidebarConfig> => {
|
|||||||
try {
|
try {
|
||||||
const config = JSON.parse(jsonString);
|
const config = JSON.parse(jsonString);
|
||||||
if (config && Array.isArray(config.left) && Array.isArray(config.right)) {
|
if (config && Array.isArray(config.left) && Array.isArray(config.right)) {
|
||||||
// TODO: 如果需要,添加更深入的验证(例如,检查项目是否为有效的 PaneName)
|
|
||||||
return config as SidebarConfig;
|
return config as SidebarConfig;
|
||||||
}
|
}
|
||||||
console.warn(`[设置仓库] 在数据库中发现无效的 sidebarConfig 格式: ${jsonString}。返回默认值。`);
|
console.warn(`[设置仓库] 在数据库中发现无效的 sidebarConfig 格式: ${jsonString}。返回默认值。`);
|
||||||
@@ -124,7 +123,6 @@ export const setSidebarConfig = async (config: SidebarConfig): Promise<void> =>
|
|||||||
if (!config || typeof config !== 'object' || !Array.isArray(config.left) || !Array.isArray(config.right)) {
|
if (!config || typeof config !== 'object' || !Array.isArray(config.left) || !Array.isArray(config.right)) {
|
||||||
throw new Error('提供了无效的侧边栏配置对象。');
|
throw new Error('提供了无效的侧边栏配置对象。');
|
||||||
}
|
}
|
||||||
// TODO: 如果需要,添加更深入的验证(例如,检查 PaneName 的有效性)
|
|
||||||
const jsonString = JSON.stringify(config);
|
const jsonString = JSON.stringify(config);
|
||||||
await settingsRepository.setSetting(SIDEBAR_CONFIG_KEY, jsonString);
|
await settingsRepository.setSetting(SIDEBAR_CONFIG_KEY, jsonString);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -576,10 +576,6 @@ export const addTagToConnections = async (connectionIds: number[], tagId: number
|
|||||||
export const updateConnectionTags = async (connectionId: number, tagIds: number[]): Promise<boolean> => {
|
export const updateConnectionTags = async (connectionId: number, tagIds: number[]): Promise<boolean> => {
|
||||||
try {
|
try {
|
||||||
const updated = await ConnectionRepository.updateConnectionTags(connectionId, tagIds);
|
const updated = await ConnectionRepository.updateConnectionTags(connectionId, tagIds);
|
||||||
// if (updated) {
|
|
||||||
// // TODO: 定义 'CONNECTION_TAGS_UPDATED' 审计日志类型
|
|
||||||
// // auditLogService.logAction('CONNECTION_TAGS_UPDATED', { connectionId, tagIds });
|
|
||||||
// }
|
|
||||||
return updated;
|
return updated;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error(`Service: 更新连接 ${connectionId} 的标签时发生错误:`, error);
|
console.error(`Service: 更新连接 ${connectionId} 的标签时发生错误:`, error);
|
||||||
|
|||||||
@@ -619,9 +619,6 @@ export class SftpService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement file upload/download logic with progress reporting
|
|
||||||
// async uploadFile(...)
|
|
||||||
// async downloadFile(...)
|
|
||||||
|
|
||||||
/** 获取路径的绝对表示 */
|
/** 获取路径的绝对表示 */
|
||||||
async realpath(sessionId: string, path: string, requestId: string): Promise<void> {
|
async realpath(sessionId: string, path: string, requestId: string): Promise<void> {
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ const getConnectionTagNames = (conn: ConnectionInfo): string[] => {
|
|||||||
// 辅助函数:格式化时间戳
|
// 辅助函数:格式化时间戳
|
||||||
const formatTimestamp = (timestamp: number | null): string => {
|
const formatTimestamp = (timestamp: number | null): string => {
|
||||||
if (!timestamp) return t('connections.status.never'); // 使用 i18n
|
if (!timestamp) return t('connections.status.never'); // 使用 i18n
|
||||||
// TODO: 可以考虑使用更专业的日期格式化库 (如 date-fns 或 dayjs) 并结合 i18n locale
|
|
||||||
return new Date(timestamp * 1000).toLocaleString(); // 乘以 1000 转换为毫秒
|
return new Date(timestamp * 1000).toLocaleString(); // 乘以 1000 转换为毫秒
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user