整理了代码结构
This commit is contained in:
5
out/panels/types/CommonTypes.js
Normal file
5
out/panels/types/CommonTypes.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
// src/panels/types/CommonTypes.ts
|
||||||
|
// 统一的核心类型定义
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=CommonTypes.js.map
|
||||||
1
out/panels/types/CommonTypes.js.map
Normal file
1
out/panels/types/CommonTypes.js.map
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"CommonTypes.js","sourceRoot":"","sources":["../../../src/panels/types/CommonTypes.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,YAAY"}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
// src/types/DataTypes.ts
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
//# sourceMappingURL=DataTypes.js.map
|
//# sourceMappingURL=DataTypes.js.map
|
||||||
@@ -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":""}
|
||||||
@@ -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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsER,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4KnB,CAAC;IACL,CAAC;CACJ;AA9QD,oCA8QC"}
|
||||||
@@ -7,7 +7,7 @@ import { ProjectView } from './views/ProjectView';
|
|||||||
import { AircraftView } from './views/AircraftView';
|
import { AircraftView } from './views/AircraftView';
|
||||||
import { ContainerView } from './views/ContainerView';
|
import { ContainerView } from './views/ContainerView';
|
||||||
import { ConfigView } from './views/ConfigView';
|
import { ConfigView } from './views/ConfigView';
|
||||||
import { ModuleFolder } from './types/DataTypes';
|
import { ModuleFolder } from './types/CommonTypes';
|
||||||
|
|
||||||
// 数据模型接口
|
// 数据模型接口
|
||||||
interface Project {
|
interface Project {
|
||||||
@@ -1911,4 +1911,4 @@ export class ConfigPanel {
|
|||||||
const folderName = pathParts[pathParts.length - 1];
|
const folderName = pathParts[pathParts.length - 1];
|
||||||
return path.join(projectPath, aircraft.name, container.name, folderName);
|
return path.join(projectPath, aircraft.name, container.name, folderName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
src/panels/types/CommonTypes.ts
Normal file
54
src/panels/types/CommonTypes.ts
Normal 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[];
|
||||||
|
}
|
||||||
@@ -1,37 +1,15 @@
|
|||||||
export interface Project {
|
import { Project, Aircraft, Container, Config, ModuleFolder } from './CommonTypes';
|
||||||
id: string;
|
|
||||||
name: string;
|
// 扩展基础接口以包含关联数据
|
||||||
|
export interface ProjectWithAssociations extends Project {
|
||||||
aircrafts: Aircraft[];
|
aircrafts: Aircraft[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Aircraft {
|
export interface AircraftWithAssociations extends Aircraft {
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
projectId: string;
|
|
||||||
containers: Container[];
|
containers: Container[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Container {
|
export interface ContainerWithAssociations extends Container {
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
aircraftId: string;
|
|
||||||
configs: Config[];
|
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;
|
|
||||||
}
|
|
||||||
@@ -1,45 +1,3 @@
|
|||||||
// src/types/DataTypes.ts
|
// src/panels/types/DataTypes.ts
|
||||||
|
// 此文件已过时,请使用 CommonTypes.ts 中的统一类型定义
|
||||||
// 统一的模块文件夹接口
|
export { ProjectData } from './CommonTypes';
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// src/panels/types/ViewTypes.ts
|
// src/panels/types/ViewTypes.ts
|
||||||
|
import { ModuleFolder, GitFileTree } from './CommonTypes';
|
||||||
|
|
||||||
export interface ProjectViewData {
|
export interface ProjectViewData {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -39,18 +41,5 @@ export interface ContainerConfigData {
|
|||||||
configs: ConfigViewData[];
|
configs: ConfigViewData[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增模块文件夹相关类型
|
// 使用统一的 ModuleFolder 接口,不再需要 ModuleFolderData
|
||||||
export interface ModuleFolderData {
|
export { ModuleFolder, GitFileTree };
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
type: 'git' | 'local';
|
|
||||||
localPath: string;
|
|
||||||
containerId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GitFileTree {
|
|
||||||
name: string;
|
|
||||||
type: 'file' | 'folder';
|
|
||||||
path: string;
|
|
||||||
children?: GitFileTree[];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
// src/panels/views/AircraftView.ts
|
// src/panels/views/AircraftView.ts
|
||||||
import { BaseView } from './BaseView';
|
import { BaseView } from './BaseView';
|
||||||
|
import { AircraftViewData } from '../types/ViewTypes';
|
||||||
interface AircraftViewData {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
projectId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AircraftView extends BaseView {
|
export class AircraftView extends BaseView {
|
||||||
render(data?: { aircrafts: AircraftViewData[] }): string {
|
render(data?: { aircrafts: AircraftViewData[] }): string {
|
||||||
@@ -277,4 +272,4 @@ export class AircraftView extends BaseView {
|
|||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { BaseView } from './BaseView';
|
import { BaseView } from './BaseView';
|
||||||
import { ContainerConfigData, ConfigViewData } from '../types/ViewTypes';
|
import { ContainerConfigData, ConfigViewData } from '../types/ViewTypes';
|
||||||
import { ModuleFolder } from '../types/DataTypes';
|
import { ModuleFolder } from '../types/CommonTypes';
|
||||||
|
|
||||||
// Git 分支接口
|
// Git 分支接口
|
||||||
interface GitBranch {
|
interface GitBranch {
|
||||||
@@ -992,4 +992,4 @@ export class ConfigView extends BaseView {
|
|||||||
});
|
});
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user