This commit is contained in:
@@ -210,9 +210,9 @@ function generateMenu(vm) {
|
||||
helpUrl: "ay-about",
|
||||
menuItems: [
|
||||
{
|
||||
title: "CopySupportInfo",
|
||||
title: "Copy",
|
||||
icon: "$ayiCopy",
|
||||
key: "about:copysupportinfo",
|
||||
key: "about:copy",
|
||||
vm: vm
|
||||
},
|
||||
{
|
||||
@@ -259,7 +259,7 @@ function clickHandler(menuItem) {
|
||||
data: "license"
|
||||
});
|
||||
break;
|
||||
case "copysupportinfo":
|
||||
case "copy":
|
||||
//put the support info on the clipboard:
|
||||
{
|
||||
const element = document.getElementById("ayaNovaVersioncard");
|
||||
@@ -297,7 +297,6 @@ async function fetchTranslatedText() {
|
||||
await window.$gz.translation.cacheTranslations([
|
||||
"HelpAboutAyaNova",
|
||||
"HelpTechSupport",
|
||||
"CopySupportInfo",
|
||||
"Server",
|
||||
"Version",
|
||||
"SchemaVersion",
|
||||
|
||||
@@ -99,39 +99,7 @@ export default {
|
||||
// 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() {
|
||||
const vm = this;
|
||||
if (!vm.selectedLog) {
|
||||
@@ -196,12 +164,6 @@ function generateMenu(vm) {
|
||||
icon: "$ayiFileDownload",
|
||||
key: FORM_KEY + ":download",
|
||||
vm: vm
|
||||
},
|
||||
{
|
||||
title: "CopySupportInfo",
|
||||
icon: "$ayiCopy",
|
||||
key: FORM_KEY + ":copyFullTechSupportInfo",
|
||||
vm: vm
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -152,6 +152,7 @@ export default {
|
||||
async created() {
|
||||
const vm = this;
|
||||
try {
|
||||
await fetchTranslatedText();
|
||||
vm.formState.ready = true;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
generateMenu(vm);
|
||||
@@ -166,6 +167,70 @@ export default {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
},
|
||||
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() {
|
||||
const vm = this;
|
||||
vm.formState.loading = true;
|
||||
@@ -209,9 +274,9 @@ function generateMenu(vm) {
|
||||
helpUrl: "ops-server-information",
|
||||
menuItems: [
|
||||
{
|
||||
title: "CopyToClipboard",
|
||||
title: "CopySupportInfo",
|
||||
icon: "$ayiCopy",
|
||||
key: `${FORM_KEY}:copyinfo`,
|
||||
key: FORM_KEY + ":copyFullTechSupportInfo",
|
||||
vm: vm
|
||||
}
|
||||
]
|
||||
@@ -230,18 +295,8 @@ function clickHandler(menuItem) {
|
||||
const m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "copyinfo":
|
||||
//put the info on the clipboard:
|
||||
{
|
||||
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);
|
||||
}
|
||||
case "copyFullTechSupportInfo":
|
||||
m.vm.copyFullTechSupportInfo();
|
||||
break;
|
||||
default:
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user