添加清空缓存按钮,复位按钮从关于页面移动到设置->其它设置下面

This commit is contained in:
fangxiang 2022-10-10 16:27:50 +08:00
parent 3e9e13f6fd
commit 364f8cd54d
6 changed files with 108 additions and 59 deletions

View File

@ -553,6 +553,14 @@ export default class ClientConnection {
this.ws?.send(JSON.stringify(new Protocol.CallModeRequestEntity(uuid))); this.ws?.send(JSON.stringify(new Protocol.CallModeRequestEntity(uuid)));
} }
public cleanBrowserCache() {
this.ws?.send(
JSON.stringify(
new Protocol.NormalRequestEntity(Protocol.Commands.kCleanBrowserCache)
)
);
}
public async getApplicationSettins() { public async getApplicationSettins() {
try { try {
return await this.doRpc<Protocol.GetApplicationConfigResponseEntity>( return await this.doRpc<Protocol.GetApplicationConfigResponseEntity>(

View File

@ -91,20 +91,6 @@
> >
</q-item> </q-item>
</div> </div>
<q-item>
<q-btn
@click="onRestore"
outline
:label="$t('restore')"
color="primary"
no-caps
/>
<q-item-section>
<div class="fit text-right">
{{ product_name }}
</div>
</q-item-section>
</q-item>
</q-list> </q-list>
</q-card-section> </q-card-section>
</q-card> </q-card>
@ -192,51 +178,6 @@ export default defineComponent({
} }
} catch {} } catch {}
}, },
onRestore() {
$q.dialog({
title: $t.t("restore"),
message: $t.t(
"are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!"
),
options: {
type: "checkbox",
model: [],
// inline: true
items: [
{
label: $t.t("delete upload files ."),
value: "delete_upload",
color: "secondary",
},
],
},
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk((data) => {
if (Array.isArray(data)) {
const delete_upload = data.length != 0;
GlobalData.getInstance()
.getCurrentClient()
?.restoreDevice(delete_upload);
$q.notify({
color: "positive",
icon: "done",
message: $t.t("send restore command success!"),
position: "top",
timeout: 1500,
});
}
});
},
}; };
}, },
}); });

View File

@ -760,6 +760,26 @@
/> />
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item class="q-mt-xl border">
<q-space />
<q-btn
@click="onCleanBrowserCache"
outline
:label="$t('clean browser cache')"
color="primary"
class="q-mx-md"
no-caps
/>
<q-btn
@click="onRestore"
outline
:label="$t('system') + $t(' ') + $t('restore')"
color="primary"
class="q-mx-md"
no-caps
/>
</q-item>
</q-list> </q-list>
</q-form> </q-form>
</q-card-section> </q-card-section>
@ -1972,6 +1992,61 @@ export default defineComponent({
} }
} }
}, },
onRestore() {
$q.dialog({
title: $t.t("restore"),
message: $t.t(
"are you sure to restore factory settings? the configuration parameters, signal source, mode, and plan will be deleted!"
),
options: {
type: "checkbox",
model: [],
// inline: true
items: [
{
label: $t.t("delete upload files ."),
value: "delete_upload",
color: "secondary",
},
],
},
ok: {
label: $t.t("ok"),
noCaps: true,
flat: true,
},
cancel: {
label: $t.t("cancel"),
noCaps: true,
flat: true,
},
persistent: true,
}).onOk((data) => {
if (Array.isArray(data)) {
const delete_upload = data.length != 0;
GlobalData.getInstance()
.getCurrentClient()
?.restoreDevice(delete_upload);
$q.notify({
color: "positive",
icon: "done",
message: $t.t("send restore command success!"),
position: "top",
timeout: 1500,
});
}
});
},
onCleanBrowserCache() {
GlobalData.getInstance().getCurrentClient()?.cleanBrowserCache();
$q.notify({
color: "positive",
icon: "done",
message: $t.t("clean browser cache command send success") + " !",
position: "top",
timeout: 1000 * 2,
});
},
}; };
}, },
}); });

View File

@ -455,6 +455,9 @@ export namespace Protocol {
public static get kRpcDeleteJointActionEquipment() { public static get kRpcDeleteJointActionEquipment() {
return Commands.PROTOCOL_PREFIX + "RpcDeleteJointActionEquipment"; return Commands.PROTOCOL_PREFIX + "RpcDeleteJointActionEquipment";
} }
public static get kCleanBrowserCache() {
return Commands.PROTOCOL_PREFIX + "CleanBrowserCache";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
@ -568,6 +571,7 @@ export namespace Protocol {
Commands.kRpcGetJointActionEquipment, Commands.kRpcGetJointActionEquipment,
Commands.kRpcSetJointActionEquipment, Commands.kRpcSetJointActionEquipment,
Commands.kRpcDeleteJointActionEquipment, Commands.kRpcDeleteJointActionEquipment,
Commands.kCleanBrowserCache,
]); ]);
public static get AllCommands() { public static get AllCommands() {
return this._all_commands; return this._all_commands;
@ -2952,4 +2956,16 @@ export namespace Protocol {
this.delete_upload_dates = delete_upload_dates; this.delete_upload_dates = delete_upload_dates;
} }
} }
export class NormalRequestEntity extends PacketEntity {
constructor(command: string) {
super();
super.command = command;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = 0;
}
timestamp = Date.now();
}
} }

View File

@ -368,4 +368,9 @@ export default {
"The Sound Card Takes Effect Inly After It Is Restarted. Restart The System", "The Sound Card Takes Effect Inly After It Is Restarted. Restart The System",
"the time zone takes effect only after it is restarted. Restart the system": "the time zone takes effect only after it is restarted. Restart the system":
"The Time Zone Takes Effect Inly After It Is Restarted. Restart The System", "The Time Zone Takes Effect Inly After It Is Restarted. Restart The System",
"restore setting": "Restore Setting",
"clean browser cache": "Clean Browser Cache",
system: "System",
"clean browser cache command send success":
"Clean Browser Cache Command Send Success",
}; };

View File

@ -641,4 +641,8 @@ export default {
"multimedia rotation": "媒体旋转", "multimedia rotation": "媒体旋转",
"please select multimedia rotation": "请选择旋转值", "please select multimedia rotation": "请选择旋转值",
"mode is empty! please add mode first": "当前没有模式,请先添加模式!", "mode is empty! please add mode first": "当前没有模式,请先添加模式!",
"restore setting": "恢复默认设置",
"clean browser cache": "清空浏览器缓存",
system: "系统",
"clean browser cache command send success": "清除浏览器缓存指令发送成功",
}; };