0
0

整理了代码结构

This commit is contained in:
xubing
2025-11-28 14:58:18 +08:00
parent 2fd84439b7
commit 5075a5f5cc
12 changed files with 82 additions and 103 deletions

View File

@@ -0,0 +1,5 @@
"use strict";
// src/panels/types/CommonTypes.ts
// 统一的核心类型定义
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=CommonTypes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CommonTypes.js","sourceRoot":"","sources":["../../../src/panels/types/CommonTypes.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,YAAY"}

View File

@@ -1,4 +1,3 @@
"use strict";
// src/types/DataTypes.ts
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=DataTypes.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"DataTypes.js","sourceRoot":"","sources":["../../../src/panels/types/DataTypes.ts"],"names":[],"mappings":";AAAA,yBAAyB"}
{"version":3,"file":"DataTypes.js","sourceRoot":"","sources":["../../../src/panels/types/DataTypes.ts"],"names":[],"mappings":""}

View File

@@ -1 +1 @@
{"version":3,"file":"AircraftView.js","sourceRoot":"","sources":["../../../src/panels/views/AircraftView.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,yCAAsC;AAQtC,MAAa,YAAa,SAAQ,mBAAQ;IACtC,MAAM,CAAC,IAAwC;QAC3C,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;QAExC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;QAE7C,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;;;oEAGY,QAAQ,CAAC,EAAE,QAAQ,QAAQ,CAAC,IAAI;;;2EAGzB,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,SAAS;;;0EAGrC,QAAQ,CAAC,EAAE;;;SAG5E,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4KnB,CAAC;IACL,CAAC;CACJ;AA9QD,oCA8QC"}

View File

@@ -7,7 +7,7 @@ import { ProjectView } from './views/ProjectView';
import { AircraftView } from './views/AircraftView';
import { ContainerView } from './views/ContainerView';
import { ConfigView } from './views/ConfigView';
import { ModuleFolder } from './types/DataTypes';
import { ModuleFolder } from './types/CommonTypes';
// 数据模型接口
interface Project {
@@ -1911,4 +1911,4 @@ export class ConfigPanel {
const folderName = pathParts[pathParts.length - 1];
return path.join(projectPath, aircraft.name, container.name, folderName);
}
}
}

View File

@@ -0,0 +1,54 @@
// src/panels/types/CommonTypes.ts
// 统一的核心类型定义
// 基础实体接口
export interface Project {
id: string;
name: string;
}
export interface Aircraft {
id: string;
name: string;
projectId: string;
}
export interface Container {
id: string;
name: string;
aircraftId: string;
}
export interface Config {
id: string;
name: string;
fileName: string;
content: string;
containerId: string;
}
// 统一的模块文件夹接口
export interface ModuleFolder {
id: string;
name: string;
type: 'git' | 'local';
localPath: string;
containerId: string;
}
// 完整数据模型接口
export interface ProjectData {
projects: Project[];
aircrafts: Aircraft[];
containers: Container[];
configs: Config[];
moduleFolders: ModuleFolder[];
}
// Git文件树结构
export interface GitFileTree {
name: string;
type: 'file' | 'folder';
path: string;
children?: GitFileTree[];
}

View File

@@ -1,37 +1,15 @@
export interface Project {
id: string;
name: string;
import { Project, Aircraft, Container, Config, ModuleFolder } from './CommonTypes';
// 扩展基础接口以包含关联数据
export interface ProjectWithAssociations extends Project {
aircrafts: Aircraft[];
}
export interface Aircraft {
id: string;
name: string;
projectId: string;
export interface AircraftWithAssociations extends Aircraft {
containers: Container[];
}
export interface Container {
id: string;
name: string;
aircraftId: string;
export interface ContainerWithAssociations extends Container {
configs: Config[];
moduleFolders: ModuleFolder[]; // 新增:模块文件夹列表
moduleFolders: ModuleFolder[];
}
export interface Config {
id: string;
name: string;
fileName: string;
content: string;
containerId: string;
}
// 新增:统一的模块文件夹接口
export interface ModuleFolder {
id: string;
name: string;
type: 'git' | 'local'; // 类型标识
localPath: string; // 相对路径,如 "/项目1/飞行器1/容器1/test-code"
containerId: string;
}

View File

@@ -1,45 +1,3 @@
// src/types/DataTypes.ts
// 统一的模块文件夹接口
export interface ModuleFolder {
id: string;
name: string;
type: 'git' | 'local'; // 类型标识
localPath: string; // 相对路径,如 "/项目1/飞行器1/容器1/test-code"
containerId: string;
}
// 项目数据接口
export interface ProjectData {
projects: Project[];
aircrafts: Aircraft[];
containers: Container[];
configs: Config[];
moduleFolders: ModuleFolder[]; // 统一的模块文件夹数据
}
// 基础数据接口
export interface Project {
id: string;
name: string;
}
export interface Aircraft {
id: string;
name: string;
projectId: string;
}
export interface Container {
id: string;
name: string;
aircraftId: string;
}
export interface Config {
id: string;
name: string;
fileName: string;
content: string;
containerId: string;
}
// src/panels/types/DataTypes.ts
// 此文件已过时,请使用 CommonTypes.ts 中的统一类型定义
export { ProjectData } from './CommonTypes';

View File

@@ -1,4 +1,6 @@
// src/panels/types/ViewTypes.ts
import { ModuleFolder, GitFileTree } from './CommonTypes';
export interface ProjectViewData {
id: string;
name: string;
@@ -39,18 +41,5 @@ export interface ContainerConfigData {
configs: ConfigViewData[];
}
// 新增模块文件夹相关类型
export interface ModuleFolderData {
id: string;
name: string;
type: 'git' | 'local';
localPath: string;
containerId: string;
}
export interface GitFileTree {
name: string;
type: 'file' | 'folder';
path: string;
children?: GitFileTree[];
}
// 使用统一的 ModuleFolder 接口,不再需要 ModuleFolderData
export { ModuleFolder, GitFileTree };

View File

@@ -1,11 +1,6 @@
// src/panels/views/AircraftView.ts
import { BaseView } from './BaseView';
interface AircraftViewData {
id: string;
name: string;
projectId: string;
}
import { AircraftViewData } from '../types/ViewTypes';
export class AircraftView extends BaseView {
render(data?: { aircrafts: AircraftViewData[] }): string {
@@ -277,4 +272,4 @@ export class AircraftView extends BaseView {
</body>
</html>`;
}
}
}

View File

@@ -1,6 +1,6 @@
import { BaseView } from './BaseView';
import { ContainerConfigData, ConfigViewData } from '../types/ViewTypes';
import { ModuleFolder } from '../types/DataTypes';
import { ModuleFolder } from '../types/CommonTypes';
// Git 分支接口
interface GitBranch {
@@ -992,4 +992,4 @@ export class ConfigView extends BaseView {
});
return count;
}
}
}