This commit is contained in:
2020-03-03 22:53:43 +00:00
parent 16314f119d
commit 8cc6d8a58e
2 changed files with 166 additions and 116 deletions

View File

@@ -128,6 +128,83 @@
/* xeslint-disable */
import ayaNovaVersion from "../api/ayanova-version";
export default {
created() {
var vm = this;
initForm(vm)
.then(() => {
vm.formState.ready = true;
window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(vm);
vm.formState.loading = false;
})
.catch(err => {
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
mounted() {
this.clientInfo = {};
this.clientInfo = ayaNovaVersion;
},
data() {
return {
serverInfo: { license: { license: {} } },
clientInfo: {},
browser: {},
formState: {
ready: false,
loading: true,
errorBoxMessage: null,
appError: null,
serverError: {}
}
};
},
methods: {
lt(ltKey) {
return window.$gz.locale.get(ltKey);
},
locale() {
return window.$gz.locale;
}
}
};
//////////////////////
//
//
function generateMenu(vm) {
var menuOptions = {
isMain: false,
icon: "fa-info-circle",
title: window.$gz.locale.get("HelpAboutAyaNova"),
helpUrl: "form-ay-about",
menuItems: [
{
title: window.$gz.locale.get("Copy"),
icon: "copy",
surface: true,
key: "about:copysupportinfo",
vm: vm
},
{
title: window.$gz.locale.get("Log"),
icon: "glasses",
surface: true,
key: "app:nav:log",
data: "ay-log"
}
]
};
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
/////////////////////////////
//
//
@@ -160,118 +237,88 @@ function clickHandler(menuItem) {
}
}
export default {
beforeCreate() {
var vm = this;
window.$gz.locale
.fetch([
"HelpAboutAyaNova",
"ClientApp",
"Server",
"Version",
"SchemaVersion",
"ServerTime",
"ServerAddress",
"TimeZone",
"HelpLicense",
"RegisteredUser",
"DatabaseID",
"LicenseSerial",
"LicenseExpiration",
"SupportedUntil",
"LicensedOptions",
"Log",
"User",
"Browser",
"LanguageCode",
"TimeZone",
"CurrencyCode"
])
.then(function() {
vm.formState.ready = true;
window.$gz.eventBus.$emit("menu-change", {
isMain: false,
icon: "fa-info-circle",
title: window.$gz.locale.get("HelpAboutAyaNova"),
helpUrl: "form-ay-about",
menuItems: [
{
title: window.$gz.locale.get("Copy"),
icon: "copy",
surface: true,
key: "about:copysupportinfo",
vm: vm
},
{
title: window.$gz.locale.get("Log"),
icon: "glasses",
surface: true,
key: "app:nav:log",
data: "ay-log"
}
]
});
window.$gz.eventBus.$on("menu-click", clickHandler);
})
.catch(err => {
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
},
created() {
this.browser = {
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
};
window.$gz.api
.get("ServerInfo")
.then(response => {
this.serverInfo = response.data;
})
.catch(function handleGetServerInfoError(error) {
throw error;
});
},
beforeDestroy() {},
mounted() {
this.clientInfo = {};
this.clientInfo = ayaNovaVersion;
},
data() {
return {
serverInfo: { license: { license: {} } },
clientInfo: {},
browser: {},
formState: {
ready: false,
loading: true,
errorBoxMessage: null,
appError: null,
serverError: {}
/////////////////////////////////
//
//
function initForm(vm) {
return new Promise(function(resolve, reject) {
(async function() {
try {
await fetchUILocalizedText(vm);
await getServerInfo(vm);
await getBrowserInfo(vm);
} catch (err) {
reject(err);
}
};
},
methods: {
lt(ltKey) {
return window.$gz.locale.get(ltKey);
},
locale() {
return window.$gz.locale;
resolve();
})();
});
}
//////////////////////////////////////////////////////////
//
// Ensures UI localized text is available
//
function fetchUILocalizedText(vm) {
var ltKeysRequired = [
"HelpAboutAyaNova",
"ClientApp",
"Server",
"Version",
"SchemaVersion",
"ServerTime",
"ServerAddress",
"TimeZone",
"HelpLicense",
"RegisteredUser",
"DatabaseID",
"LicenseSerial",
"LicenseExpiration",
"SupportedUntil",
"LicensedOptions",
"Log",
"User",
"Browser",
"LanguageCode",
"TimeZone",
"CurrencyCode"
];
return window.$gz.locale.fetch(ltKeysRequired);
}
////////////////////
//
function getServerInfo(vm) {
return window.$gz.api.get("ServerInfo").then(res => {
if (res.error != undefined) {
throw res.error;
} else {
vm.serverInfo = res.data;
}
}
};
});
}
////////////////////
//
function getBrowserInfo(vm) {
vm.browser = {
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
};
}
//eoc
</script>