fix: remote update failed and template not found
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="bg-base-200 min-h-screen p-6">
|
||||
<div class="flex flex-row align-middle">
|
||||
<div class="flex flex-row justify-between items-center">
|
||||
<h1 class="text-3xl font-bold mb-6">FPGA 设备管理</h1>
|
||||
<button class="btn btn-ghost self-end" @click="
|
||||
<button class="btn btn-ghost text-error hover:underline" @click="
|
||||
() => {
|
||||
isEditMode = !isEditMode;
|
||||
}
|
||||
@@ -13,16 +13,19 @@
|
||||
|
||||
<div class="card bg-base-100 shadow-xl">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title mb-4">IP 地址列表</h2>
|
||||
<div class="flex flex-row justify-between items-center">
|
||||
<h2 class="card-title mb-4">IP 地址列表</h2>
|
||||
<button class="btn btn-ghost" @click="">刷新</button>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table w-full">
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr class="bg-base-300">
|
||||
<th>IP 地址</th>
|
||||
<th>版本号</th>
|
||||
<th>默认启动位流</th>
|
||||
<th class="w-50">IP 地址</th>
|
||||
<th class="w-30">版本号</th>
|
||||
<th class="w-50">默认启动位流</th>
|
||||
<th class="w-80">黄金位流</th>
|
||||
<th class="w-80">应用位流1</th>
|
||||
<th class="w-80">应用位流2</th>
|
||||
@@ -35,7 +38,7 @@
|
||||
<tbody>
|
||||
<tr class="hover">
|
||||
<td class="font-medium">
|
||||
<input v-if="isEditMode" type="text" placeholder="Type here" class="input" />
|
||||
<input v-if="isEditMode" type="text" placeholder="Type here" class="input m-0" v-model="devAddr" />
|
||||
<span v-else>{{ devAddr }}</span>
|
||||
</td>
|
||||
<td>v1.2.3</td>
|
||||
@@ -50,29 +53,25 @@
|
||||
<!-- 黄金位流上传区 -->
|
||||
<td>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<input type="file" class="file-input file-input-primary"
|
||||
@change="handleFileChange($event, goldBitstreamFile)" />
|
||||
<input type="file" class="file-input file-input-primary" @change="handleFileChange($event, 0)" />
|
||||
</div>
|
||||
</td>
|
||||
<!-- 应用位流1上传区 -->
|
||||
<td>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<input type="file" class="file-input file-input-secondary"
|
||||
@change="handleFileChange($event, appBitstream1File)" />
|
||||
<input type="file" class="file-input file-input-secondary" @change="handleFileChange($event, 1)" />
|
||||
</div>
|
||||
</td>
|
||||
<!-- 应用位流2上传区 -->
|
||||
<td>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<input type="file" class="file-input file-input-accent"
|
||||
@change="handleFileChange($event, appBitstream2File)" />
|
||||
<input type="file" class="file-input file-input-accent" @change="handleFileChange($event, 2)" />
|
||||
</div>
|
||||
</td>
|
||||
<!-- 应用位流3上传区 -->
|
||||
<td>
|
||||
<div class="flex flex-col items-center gap-2">
|
||||
<input type="file" class="file-input file-input-info"
|
||||
@change="handleFileChange($event, appBitstream3File)" />
|
||||
<input type="file" class="file-input file-input-info" @change="handleFileChange($event, 3)" />
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -138,7 +137,7 @@ const devPort = 1234;
|
||||
const remoteUpdater = new RemoteUpdaterClient();
|
||||
|
||||
// 处理文件上传
|
||||
function handleFileChange(event: Event, fileRef: any) {
|
||||
function handleFileChange(event: Event, bistreamNum: number) {
|
||||
const target = event.target as HTMLInputElement;
|
||||
const file = target.files?.[0]; // 获取选中的第一个文件
|
||||
|
||||
@@ -146,8 +145,16 @@ function handleFileChange(event: Event, fileRef: any) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isUndefined(fileRef)) {
|
||||
fileRef.value = file;
|
||||
if (bistreamNum === 0) {
|
||||
goldBitstreamFile.value = file;
|
||||
} else if (bistreamNum === 1) {
|
||||
appBitstream1File.value = file;
|
||||
} else if (bistreamNum === 2) {
|
||||
appBitstream2File.value = file;
|
||||
} else if (bistreamNum === 3) {
|
||||
appBitstream3File.value = file;
|
||||
} else {
|
||||
goldBitstreamFile.value = file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,12 +179,13 @@ async function uploadAndDownloadBitstreams(
|
||||
appBitstream3?: File,
|
||||
) {
|
||||
let cnt = 0;
|
||||
if (isUndefined(goldBitstream)) cnt++;
|
||||
if (isUndefined(appBitstream1)) cnt++;
|
||||
if (isUndefined(appBitstream2)) cnt++;
|
||||
if (isUndefined(appBitstream3)) cnt++;
|
||||
if ((cnt = 0)) {
|
||||
if (!isUndefined(goldBitstream)) cnt++;
|
||||
if (!isUndefined(appBitstream1)) cnt++;
|
||||
if (!isUndefined(appBitstream2)) cnt++;
|
||||
if (!isUndefined(appBitstream3)) cnt++;
|
||||
if (cnt === 0) {
|
||||
dialog.error("未选择比特流");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -189,10 +197,9 @@ async function uploadAndDownloadBitstreams(
|
||||
Common.toFileParameterOrNull(appBitstream2),
|
||||
Common.toFileParameterOrNull(appBitstream3),
|
||||
);
|
||||
if (ret) {
|
||||
if (!ret) {
|
||||
dialog.warn("上传比特流出错");
|
||||
} else {
|
||||
dialog.info("上传比特流成功");
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -230,6 +237,15 @@ async function hotresetBitstream(devAddr: string, bitstreamNum: number) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshData() {
|
||||
try {
|
||||
const ret = await remoteUpdater.getFirmwareVersion(devAddr.value, devPort);
|
||||
} catch (e) {
|
||||
dialog.error("获取数据失败");
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="postcss">
|
||||
|
||||
Reference in New Issue
Block a user