完成文件系统升级

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

View File

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

View File

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

View File

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

View File

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

2655
yarn.lock

File diff suppressed because it is too large Load Diff