完成文件系统升级

This commit is contained in:
fangxiang 2021-12-20 17:39:51 +08:00
parent d3d4c7c7d0
commit 90478b7e53
6 changed files with 1960 additions and 762 deletions

View File

@ -9,18 +9,19 @@
"test": "echo \"No test specified\" && exit 0"
},
"dependencies": {
"@quasar/extras": "^1.11.1",
"@quasar/cli": "^1.2.1",
"@quasar/extras": "^1.12.2",
"@types/element-resize-detector": "^1.1.3",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"element-resize-detector": "^1.2.3",
"quasar": "^2.1.0",
"quasar": "^2.3.4",
"v-viewer": "^3.0.9",
"vue-i18n": "^9.0.0-beta.0",
"vuex": "^4.0.1"
},
"devDependencies": {
"@quasar/app": "^3.1.0",
"@quasar/app": "^3.2.5",
"@types/node": "^10.17.15",
"workbox-webpack-plugin": "^6.0.0"
},

View File

@ -611,7 +611,7 @@ export default defineComponent({
message: $t.t("input folder name") + ":",
prompt: {
model: "",
isValid: (val: string) => val && val.trim().length > 0,
isValid: (val: string) => !!val && val.trim().length > 0,
type: "text",
},
cancel: true,
@ -697,7 +697,7 @@ export default defineComponent({
message: $t.t("input new file name") + ":",
prompt: {
model: file.name,
isValid: (val: string) => val && val.trim().length > 0,
isValid: (val: string) => !!val && val.trim().length > 0,
type: "text",
},
cancel: true,

View File

@ -5,7 +5,7 @@
<q-card-section class="q-ma-none q-pa-sm">
<div class="row">
<div class="col-auto text-h6">
{{ $t(upgrade_type) }}{{ $t("upgrade") }}
{{ upgrade_type }}{{ $t("upgrade") }}
</div>
<q-space />
<div>
@ -44,7 +44,7 @@
<q-item>
<q-item-section>
<q-uploader
v-if="upgrade_type == 'software'"
v-show="upgrade_type == $t('software')"
class="full-width"
ref="uploader_software"
:url="upload_url_software"
@ -59,7 +59,7 @@
@removed="(files) => files && (file_count -= files.length)"
/>
<q-uploader
v-if="upgrade_type == 'rootfs'"
v-show="upgrade_type == $t('rootfs')"
class="full-width"
ref="uploader_rootfs"
:url="upload_url_rootfs"
@ -128,8 +128,8 @@ export default defineComponent({
let upload_url_rootfs = ref("");
let file_count = ref(0);
let select_options = ["software", "rootfs"];
let upgrade_type = ref("software");
let select_options = [$t.t("software"), $t.t("rootfs")];
let upgrade_type = ref($t.t("software"));
return {
show_dialog,
@ -183,7 +183,7 @@ export default defineComponent({
upload_url_rootfs.value = "";
file_count.value = 0;
},
async onSubmit(a: any) {
async onSubmit() {
if (file_count.value <= 0) {
$q.notify({
type: "warning",
@ -196,7 +196,7 @@ export default defineComponent({
loading.value = true;
try {
let upgrader =
upgrade_type.value == "software"
upgrade_type.value == $t.t("software")
? uploader_software.value
: uploader_rootfs.value;
$q.dialog({
@ -210,48 +210,16 @@ export default defineComponent({
})
.onCancel(() => {
loading.value = false;
loading.value = false;
});
} catch {}
},
onUploaded() {
$q.notify({
type: "positive",
message: $t.t("upgrade file upload") + $t.t("success") + "!",
position: "top",
timeout: 1000,
});
$q.dialog({
title: "Confirm",
message:
$t.t("upgrade requires a restart") +
"!" +
"<p class='text-red'>" +
$t.t("reboot now") +
"?" +
"</p>",
html: true,
cancel: true,
persistent: true,
})
.onOk(() => {
GlobalData.getInstance().getCurrentClient()?.restartDevice();
$q.notify({
type: "positive",
message: $t.t("reboot device command sended") + "!",
position: "top",
timeout: 1000,
});
})
.onDismiss(() => {
loading.value = false;
show_dialog.value = false;
});
},
onUploaded() {},
onFailed(info: any) {
console.log(info);
$q.notify({
type: "warning",
message: $t.t("data import") + $t.t("fail") + "!",
message: $t.t("update file upload") + $t.t("fail") + "!",
position: "top",
timeout: 1000,
});

View File

@ -254,4 +254,6 @@ export default {
on: "开",
off: "关",
"output board setting": "输出板设置",
roofs: "文件系统",
"update file upload": "升级文件上传",
};

View File

@ -183,7 +183,7 @@ export default defineComponent({
let $q = useQuasar();
let $t = useI18n();
let show_advanced_menu = ref(false);
let show_advanced_menu = ref(true);
let show_stop_plan = ref(false);
EventBus.getInstance().on(

2655
yarn.lock

File diff suppressed because it is too large Load Diff