不再提供模板
This commit is contained in:
@@ -1,52 +1,53 @@
|
||||
// src/panels/views/ProjectListView.ts
|
||||
// src/panels/views/AircraftView.ts
|
||||
import { BaseView } from './BaseView';
|
||||
import { ProjectListData, ProjectViewData } from '../types/ViewTypes';
|
||||
|
||||
export class ProjectListView extends BaseView {
|
||||
render(data?: ProjectListData): string {
|
||||
const projects = data?.projects || [];
|
||||
export class AircraftView extends BaseView {
|
||||
render(data?: { aircrafts: any[] }): string {
|
||||
const aircrafts = data?.aircrafts || [];
|
||||
|
||||
// 生成项目列表的 HTML
|
||||
const projectsHtml = projects.map((project: ProjectViewData) => `
|
||||
// 生成飞行器列表的 HTML
|
||||
const aircraftsHtml = aircrafts.map((aircraft: any) => {
|
||||
return `
|
||||
<tr>
|
||||
<td>
|
||||
<span class="editable" onclick="editProjectName('${project.id}', '${project.name}')">🛸 ${project.name}</span>
|
||||
<span class="editable" onclick="editAircraftName('${aircraft.id}', '${aircraft.name}')">🛸 ${aircraft.name}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="clickable" onclick="openAircraftConfig('${project.id}')">配置</span>
|
||||
<span class="clickable" onclick="openAircraftConfig('${aircraft.id}')">配置</span>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn-delete" onclick="deleteProject('${project.id}')">删除</button>
|
||||
<button class="btn-delete" onclick="deleteAircraft('${aircraft.id}')">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
`;
|
||||
}).join('');
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>飞行器项目管理</title>
|
||||
<title>飞行器管理</title>
|
||||
${this.getStyles()}
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h2>🚀 飞行器项目管理</h2>
|
||||
<button class="back-btn" onclick="goBackToManagement()">← 返回项目管理</button>
|
||||
<h2>🚀 飞行器管理</h2>
|
||||
<button class="back-btn" onclick="goBackToProjects()">← 返回项目管理</button>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="40%">项目</th>
|
||||
<th width="40%">飞行器</th>
|
||||
<th width="40%">配置</th>
|
||||
<th width="20%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${projectsHtml}
|
||||
${aircraftsHtml}
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center; padding: 20px;">
|
||||
<button class="btn-new" onclick="createNewProject()">+ 新建项目</button>
|
||||
<button class="btn-new" onclick="createNewAircraft()">+ 新建飞行器</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -55,16 +56,16 @@ export class ProjectListView extends BaseView {
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi();
|
||||
|
||||
function editProjectName(projectId, currentName) {
|
||||
function editAircraftName(aircraftId, currentName) {
|
||||
showPromptDialog(
|
||||
'修改项目名称',
|
||||
'请输入新的项目名称:',
|
||||
'修改飞行器名称',
|
||||
'请输入新的飞行器名称:',
|
||||
currentName,
|
||||
function(newName) {
|
||||
if (newName && newName !== currentName) {
|
||||
vscode.postMessage({
|
||||
type: 'updateProjectName',
|
||||
projectId: projectId,
|
||||
type: 'updateAircraftName',
|
||||
aircraftId: aircraftId,
|
||||
name: newName
|
||||
});
|
||||
}
|
||||
@@ -72,22 +73,22 @@ export class ProjectListView extends BaseView {
|
||||
);
|
||||
}
|
||||
|
||||
function openAircraftConfig(projectId) {
|
||||
function openAircraftConfig(aircraftId) {
|
||||
vscode.postMessage({
|
||||
type: 'openAircraftConfig',
|
||||
projectId: projectId
|
||||
aircraftId: aircraftId
|
||||
});
|
||||
}
|
||||
|
||||
function createNewProject() {
|
||||
function createNewAircraft() {
|
||||
showPromptDialog(
|
||||
'新建项目',
|
||||
'请输入项目名称:',
|
||||
'新建飞行器',
|
||||
'请输入飞行器名称:',
|
||||
'',
|
||||
function(name) {
|
||||
if (name) {
|
||||
vscode.postMessage({
|
||||
type: 'createProject',
|
||||
type: 'createAircraft',
|
||||
name: name
|
||||
});
|
||||
}
|
||||
@@ -95,14 +96,14 @@ export class ProjectListView extends BaseView {
|
||||
);
|
||||
}
|
||||
|
||||
function deleteProject(projectId) {
|
||||
function deleteAircraft(aircraftId) {
|
||||
showConfirmDialog(
|
||||
'确认删除',
|
||||
'确定删除这个项目吗?',
|
||||
'确定删除这个飞行器吗?',
|
||||
function() {
|
||||
vscode.postMessage({
|
||||
type: 'deleteProject',
|
||||
projectId: projectId
|
||||
type: 'deleteAircraft',
|
||||
aircraftId: aircraftId
|
||||
});
|
||||
},
|
||||
function() {
|
||||
@@ -111,11 +112,11 @@ export class ProjectListView extends BaseView {
|
||||
);
|
||||
}
|
||||
|
||||
function goBackToManagement() {
|
||||
vscode.postMessage({ type: 'goBackToManagement' });
|
||||
function goBackToProjects() {
|
||||
vscode.postMessage({ type: 'goBackToProjects' });
|
||||
}
|
||||
|
||||
// 对话框函数(与之前相同)
|
||||
// 对话框函数
|
||||
function showConfirmDialog(title, message, onConfirm, onCancel) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'modal-overlay';
|
||||
@@ -1,8 +1,8 @@
|
||||
// src/panels/views/ContainerConfigView.ts
|
||||
// src/panels/views/ConfigView.ts
|
||||
import { BaseView } from './BaseView';
|
||||
import { ContainerConfigData, ConfigViewData } from '../types/ViewTypes';
|
||||
|
||||
export class ContainerConfigView extends BaseView {
|
||||
export class ConfigView extends BaseView {
|
||||
render(data?: ContainerConfigData): string {
|
||||
const container = data?.container;
|
||||
const configs = data?.configs || [];
|
||||
@@ -27,13 +27,13 @@ export class ContainerConfigView extends BaseView {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>容器配置</title>
|
||||
<title>配置管理</title>
|
||||
${this.getStyles()}
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h2>⚙️ 容器配置 - <span style="color: var(--vscode-textLink-foreground);">${container?.name || '未知容器'}</span></h2>
|
||||
<button class="back-btn" onclick="goBackToAircraft()">← 返回飞行器</button>
|
||||
<h2>⚙️ 配置管理 - <span style="color: var(--vscode-textLink-foreground);">${container?.name || '未知容器'}</span></h2>
|
||||
<button class="back-btn" onclick="goBackToContainers()">← 返回容器管理</button>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
@@ -159,8 +159,8 @@ export class ContainerConfigView extends BaseView {
|
||||
currentConfigId = null;
|
||||
}
|
||||
|
||||
function goBackToAircraft() {
|
||||
vscode.postMessage({ type: 'goBackToAircraft' });
|
||||
function goBackToContainers() {
|
||||
vscode.postMessage({ type: 'goBackToContainers' });
|
||||
}
|
||||
|
||||
// 对话框函数
|
||||
@@ -1,8 +1,8 @@
|
||||
// src/panels/views/AircraftConfigView.ts
|
||||
// src/panels/views/ContainerView.ts
|
||||
import { BaseView } from './BaseView';
|
||||
import { AircraftConfigData, ContainerViewData } from '../types/ViewTypes';
|
||||
|
||||
export class AircraftConfigView extends BaseView {
|
||||
export class ContainerView extends BaseView {
|
||||
render(data?: AircraftConfigData): string {
|
||||
const project = data?.project;
|
||||
const containers = data?.containers || [];
|
||||
@@ -27,13 +27,13 @@ export class AircraftConfigView extends BaseView {
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>飞行器配置</title>
|
||||
<title>容器管理</title>
|
||||
${this.getStyles()}
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h2>📋 飞行器配置 - <span style="color: var(--vscode-textLink-foreground);">${project?.name || '未知项目'}</span></h2>
|
||||
<button class="back-btn" onclick="goBackToProjects()">← 返回项目列表</button>
|
||||
<h2>📋 容器管理 - <span style="color: var(--vscode-textLink-foreground);">${project?.name || '未知项目'}</span></h2>
|
||||
<button class="back-btn" onclick="goBackToAircrafts()">← 返回飞行器管理</button>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
@@ -97,8 +97,8 @@ export class AircraftConfigView extends BaseView {
|
||||
);
|
||||
}
|
||||
|
||||
function goBackToProjects() {
|
||||
vscode.postMessage({ type: 'goBackToProjects' });
|
||||
function goBackToAircrafts() {
|
||||
vscode.postMessage({ type: 'goBackToAircrafts' });
|
||||
}
|
||||
|
||||
function deleteContainer(containerId) {
|
||||
@@ -1,8 +1,8 @@
|
||||
// src/panels/views/ProjectManagementView.ts
|
||||
// src/panels/views/ProjectView.ts
|
||||
import { BaseView } from './BaseView';
|
||||
import { ProjectViewData } from '../types/ViewTypes';
|
||||
|
||||
export class ProjectManagementView extends BaseView {
|
||||
export class ProjectView extends BaseView {
|
||||
render(data?: { projects: ProjectViewData[], projectPaths?: Map<string, string> }): string {
|
||||
const projects = data?.projects || [];
|
||||
const projectPaths = data?.projectPaths || new Map();
|
||||
Reference in New Issue
Block a user