This commit is contained in:
2022-02-22 19:51:21 +00:00
parent 521a77324f
commit 07036364f4
3 changed files with 86 additions and 57 deletions

View File

@@ -210,9 +210,9 @@ function generateMenu(vm) {
helpUrl: "ay-about", helpUrl: "ay-about",
menuItems: [ menuItems: [
{ {
title: "CopySupportInfo", title: "Copy",
icon: "$ayiCopy", icon: "$ayiCopy",
key: "about:copysupportinfo", key: "about:copy",
vm: vm vm: vm
}, },
{ {
@@ -259,7 +259,7 @@ function clickHandler(menuItem) {
data: "license" data: "license"
}); });
break; break;
case "copysupportinfo": case "copy":
//put the support info on the clipboard: //put the support info on the clipboard:
{ {
const element = document.getElementById("ayaNovaVersioncard"); const element = document.getElementById("ayaNovaVersioncard");
@@ -297,7 +297,6 @@ async function fetchTranslatedText() {
await window.$gz.translation.cacheTranslations([ await window.$gz.translation.cacheTranslations([
"HelpAboutAyaNova", "HelpAboutAyaNova",
"HelpTechSupport", "HelpTechSupport",
"CopySupportInfo",
"Server", "Server",
"Version", "Version",
"SchemaVersion", "SchemaVersion",

View File

@@ -99,39 +99,7 @@ export default {
// window.$gz.eventBus.$emit("notify-error", this.$ay.t("JobFailed")); // window.$gz.eventBus.$emit("notify-error", this.$ay.t("JobFailed"));
} }
}, },
async copyFullTechSupportInfo() {
const vm = this;
window.$gz.form.deleteAllErrorBoxErrors(vm);
try {
const res = await window.$gz.api.get("server-state/tech-support-info");
if (res.error) {
if (res.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
}
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
if (res) {
window.$gz.util.copyToClipboard(res.data);
//vm.log = res;
} else {
//vm.log = vm.$ay.t("NoData");
}
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true,
loading: false
});
}
} catch (error) {
window.$gz.form.setFormState({
vm: vm,
loading: false
});
window.$gz.errorHandler.handleFormError(error, vm);
}
},
async getDataFromApi() { async getDataFromApi() {
const vm = this; const vm = this;
if (!vm.selectedLog) { if (!vm.selectedLog) {
@@ -196,12 +164,6 @@ function generateMenu(vm) {
icon: "$ayiFileDownload", icon: "$ayiFileDownload",
key: FORM_KEY + ":download", key: FORM_KEY + ":download",
vm: vm vm: vm
},
{
title: "CopySupportInfo",
icon: "$ayiCopy",
key: FORM_KEY + ":copyFullTechSupportInfo",
vm: vm
} }
] ]
}; };

View File

@@ -152,6 +152,7 @@ export default {
async created() { async created() {
const vm = this; const vm = this;
try { try {
await fetchTranslatedText();
vm.formState.ready = true; vm.formState.ready = true;
window.$gz.eventBus.$on("menu-click", clickHandler); window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(vm); generateMenu(vm);
@@ -166,6 +167,70 @@ export default {
window.$gz.eventBus.$off("menu-click", clickHandler); window.$gz.eventBus.$off("menu-click", clickHandler);
}, },
methods: { methods: {
async copyFullTechSupportInfo() {
const vm = this;
window.$gz.form.deleteAllErrorBoxErrors(vm);
try {
const serverSupportInfoResponse = await window.$gz.api.get(
"server-state/tech-support-info"
);
if (serverSupportInfoResponse.error) {
if (serverSupportInfoResponse.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
}
vm.formState.serverError = serverSupportInfoResponse.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
if (serverSupportInfoResponse) {
const browserInfo = {
platform: window.navigator.platform,
userAgent: window.navigator.userAgent,
languages: window.navigator.languages,
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
oscpu: window.navigator.oscpu,
maxTouchPoints: window.navigator.maxTouchPoints,
webdriver: window.navigator.webdriver,
vendor: window.navigator.vendor,
availWidth: window.screen.availWidth,
availHeight: window.screen.availHeight,
width: window.screen.width,
height: window.screen.height,
devicePixelRatio: window.devicePixelRatio,
pixelDepth: window.screen.pixelDepth
};
let logText = "";
this.$store.state.logArray.forEach(function appendLogItem(value) {
logText += value + "\n";
});
window.$gz.util.copyToClipboard(
`#########################################################\nCLIENT BROWSER INFO\n${JSON.stringify(
browserInfo
)}\n#########################################################\nCLIENT ERROR LOG\n${logText}\n${
serverSupportInfoResponse.data
}`
);
//vm.log = res;
} else {
//vm.log = vm.$ay.t("NoData");
}
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true,
loading: false
});
}
} catch (error) {
window.$gz.form.setFormState({
vm: vm,
loading: false
});
window.$gz.errorHandler.handleFormError(error, vm);
}
},
async getDataFromApi() { async getDataFromApi() {
const vm = this; const vm = this;
vm.formState.loading = true; vm.formState.loading = true;
@@ -209,9 +274,9 @@ function generateMenu(vm) {
helpUrl: "ops-server-information", helpUrl: "ops-server-information",
menuItems: [ menuItems: [
{ {
title: "CopyToClipboard", title: "CopySupportInfo",
icon: "$ayiCopy", icon: "$ayiCopy",
key: `${FORM_KEY}:copyinfo`, key: FORM_KEY + ":copyFullTechSupportInfo",
vm: vm vm: vm
} }
] ]
@@ -230,18 +295,8 @@ function clickHandler(menuItem) {
const m = window.$gz.menu.parseMenuItem(menuItem); const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) { if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) { switch (m.key) {
case "copyinfo": case "copyFullTechSupportInfo":
//put the info on the clipboard: m.vm.copyFullTechSupportInfo();
{
const element = document.getElementById("ayaNovaConfigCard");
const text = element.innerText || element.textContent;
window.$gz.util.copyToClipboard(text);
// let logText = "";
// m.vm.$store.state.logArray.forEach(function appendLogItem(value) {
// logText += value + "\n";
// });
//window.$gz.util.copyToClipboard(text + "\nCLIENT LOG\n" + logText);
}
break; break;
default: default:
window.$gz.eventBus.$emit( window.$gz.eventBus.$emit(
@@ -251,4 +306,17 @@ function clickHandler(menuItem) {
} }
} }
} }
//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
async function fetchTranslatedText() {
await window.$gz.translation.cacheTranslations([
"OpsTestJob",
"Log",
"Download",
"CopySupportInfo"
]);
}
</script> </script>