diff --git a/out/panels/types/CommonTypes.js b/out/panels/types/CommonTypes.js new file mode 100644 index 0000000..21a11d7 --- /dev/null +++ b/out/panels/types/CommonTypes.js @@ -0,0 +1,5 @@ +"use strict"; +// src/panels/types/CommonTypes.ts +// 统一的核心类型定义 +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=CommonTypes.js.map \ No newline at end of file diff --git a/out/panels/types/CommonTypes.js.map b/out/panels/types/CommonTypes.js.map new file mode 100644 index 0000000..dac1343 --- /dev/null +++ b/out/panels/types/CommonTypes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"CommonTypes.js","sourceRoot":"","sources":["../../../src/panels/types/CommonTypes.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,YAAY"} \ No newline at end of file diff --git a/out/panels/types/DataTypes.js b/out/panels/types/DataTypes.js index 01df013..9ba55e2 100644 --- a/out/panels/types/DataTypes.js +++ b/out/panels/types/DataTypes.js @@ -1,4 +1,3 @@ "use strict"; -// src/types/DataTypes.ts Object.defineProperty(exports, "__esModule", { value: true }); //# sourceMappingURL=DataTypes.js.map \ No newline at end of file diff --git a/out/panels/types/DataTypes.js.map b/out/panels/types/DataTypes.js.map index cc7a8b5..475d9d9 100644 --- a/out/panels/types/DataTypes.js.map +++ b/out/panels/types/DataTypes.js.map @@ -1 +1 @@ -{"version":3,"file":"DataTypes.js","sourceRoot":"","sources":["../../../src/panels/types/DataTypes.ts"],"names":[],"mappings":";AAAA,yBAAyB"} \ No newline at end of file +{"version":3,"file":"DataTypes.js","sourceRoot":"","sources":["../../../src/panels/types/DataTypes.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/out/panels/views/AircraftView.js.map b/out/panels/views/AircraftView.js.map index d8b7f3f..b6945da 100644 --- a/out/panels/views/AircraftView.js.map +++ b/out/panels/views/AircraftView.js.map @@ -1 +1 @@ -{"version":3,"file":"AircraftView.js","sourceRoot":"","sources":["../../../src/panels/views/AircraftView.ts"],"names":[],"mappings":";;;AAAA,m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AC,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;;;;;;MAMT,IAAI,CAAC,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsER,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4KnB,CAAC;IACL,CAAC;CACJ;AA9QD,oCA8QC"} \ No newline at end of file diff --git a/src/panels/ConfigPanel.ts b/src/panels/ConfigPanel.ts index 3bfa805..a01f99f 100755 --- a/src/panels/ConfigPanel.ts +++ b/src/panels/ConfigPanel.ts @@ -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); } -} \ No newline at end of file +} diff --git a/src/panels/types/CommonTypes.ts b/src/panels/types/CommonTypes.ts new file mode 100644 index 0000000..708f9da --- /dev/null +++ b/src/panels/types/CommonTypes.ts @@ -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[]; +} diff --git a/src/panels/types/DataModel.ts b/src/panels/types/DataModel.ts index 8d0d2c8..922c653 100755 --- a/src/panels/types/DataModel.ts +++ b/src/panels/types/DataModel.ts @@ -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; -} \ No newline at end of file diff --git a/src/panels/types/DataTypes.ts b/src/panels/types/DataTypes.ts index ec5b96d..a6727fc 100755 --- a/src/panels/types/DataTypes.ts +++ b/src/panels/types/DataTypes.ts @@ -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; -} \ No newline at end of file +// src/panels/types/DataTypes.ts +// 此文件已过时,请使用 CommonTypes.ts 中的统一类型定义 +export { ProjectData } from './CommonTypes'; diff --git a/src/panels/types/ViewTypes.ts b/src/panels/types/ViewTypes.ts index db7f875..fcd72af 100755 --- a/src/panels/types/ViewTypes.ts +++ b/src/panels/types/ViewTypes.ts @@ -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[]; -} \ No newline at end of file +// 使用统一的 ModuleFolder 接口,不再需要 ModuleFolderData +export { ModuleFolder, GitFileTree }; diff --git a/src/panels/views/AircraftView.ts b/src/panels/views/AircraftView.ts index 6d886e5..31c07a4 100644 --- a/src/panels/views/AircraftView.ts +++ b/src/panels/views/AircraftView.ts @@ -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 { `; } -} \ No newline at end of file +} diff --git a/src/panels/views/ConfigView.ts b/src/panels/views/ConfigView.ts index 1885715..97b3ece 100755 --- a/src/panels/views/ConfigView.ts +++ b/src/panels/views/ConfigView.ts @@ -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; } -} \ No newline at end of file +}