diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index f4db50ff..db901e91 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -9,12 +9,66 @@ export default { // Clear all properties from object without resorting to assigning a new object (o={}) // which can be problematic in some cases (IE bugs, watched data items in forms etc) - removeAllPropertiesFromObject(o) { + removeAllPropertiesFromObject: function(o) { for (var variableKey in o) { if (o.hasOwnProperty(variableKey)) { delete o[variableKey]; } } + }, + /** + * Copy a string to clipboard + * @param {String} string The string to be copied to clipboard + * @return {Boolean} returns a boolean correspondent to the success of the copy operation. + * Modified from an example here: https://stackoverflow.com/a/53951634/8939 + * Basically a fallback if navigator.clipboard is not available + */ + copyToClipboard: function(string) { + let textarea; + let result; + + if (navigator && navigator.clipboard) { + navigator.clipboard.writeText(string); + } else { + try { + textarea = document.createElement("textarea"); + textarea.setAttribute("readonly", true); + textarea.setAttribute("contenteditable", true); + textarea.style.position = "fixed"; // prevent scroll from jumping to the bottom when focus is set. + textarea.value = string; + + document.body.appendChild(textarea); + + textarea.focus(); + textarea.select(); + + const range = document.createRange(); + range.selectNodeContents(textarea); + + const sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + + textarea.setSelectionRange(0, textarea.value.length); + result = document.execCommand("copy"); + } catch (err) { + //console.error(err); + result = null; + } finally { + document.body.removeChild(textarea); + } + + // manual copy fallback using prompt + if (!result) { + const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0; + const copyHotkey = isMac ? "⌘C" : "CTRL+C"; + result = prompt(`Press ${copyHotkey}`, string); // eslint-disable-line no-alert + if (!result) { + return false; + } + } + } + return true; } //new functions above here diff --git a/ayanova/src/views/About.vue b/ayanova/src/views/About.vue index e39d7df5..9106e515 100644 --- a/ayanova/src/views/About.vue +++ b/ayanova/src/views/About.vue @@ -10,8 +10,7 @@ transition="scale-transition" class="multi-line" outline - >{{ formState.errorBoxMessage }} + >{{ formState.errorBoxMessage }} @@ -26,53 +25,37 @@
- {{ this.$gzlocale.get("UserTimeZoneOffset") }}: - {{ + {{ this.$gzlocale.get("UserTimeZoneOffset") }}: + + {{ this.$gzlocale.format().timeZoneOffset - }} -
- -
- {{ this.$gzlocale.get("DecimalSeparator") }}: - - {{ this.$gzlocale.format().decimalSeparator }} + }}
- {{ this.$gzlocale.get("CurrencySymbol") }}: - - {{ this.$gzlocale.format().currencySymbol }} - + {{ this.$gzlocale.get("DecimalSeparator") }}: + {{ this.$gzlocale.format().decimalSeparator }}
- {{ this.$gzlocale.get("ShortDateFormat") }}: + {{ this.$gzlocale.get("CurrencySymbol") }}: + {{ this.$gzlocale.format().currencySymbol }} +
+ +
+ {{ this.$gzlocale.get("ShortDateFormat") }}: {{ this.$gzlocale.format().shortDate }}
- {{ this.$gzlocale.get("ShortTimeFormat") }}: + {{ this.$gzlocale.get("ShortTimeFormat") }}: {{ this.$gzlocale.format().shortTime }}
- {{ this.$gzlocale.get("ShortDateAndTimeFormat") }}: - - {{ this.$gzlocale.format().shortDateAndTime }} - + {{ this.$gzlocale.get("ShortDateAndTimeFormat") }}: + {{ this.$gzlocale.format().shortDateAndTime }}
@@ -85,9 +68,7 @@ {{ this.$gzlocale.get("Server") }}
- {{ this.$gzlocale.get("ServerAddress") }}: + {{ this.$gzlocale.get("ServerAddress") }}: {{ this.$store.state.apiUrl }}
@@ -95,15 +76,11 @@ {{ serverInfo.serverVersion }}
- {{ this.$gzlocale.get("SchemaVersion") }}: + {{ this.$gzlocale.get("SchemaVersion") }}: {{ serverInfo.dbSchemaVersion }}
- {{ this.$gzlocale.get("ServerTime") }}: + {{ this.$gzlocale.get("ServerTime") }}: {{ serverInfo.serverLocalTime }}
@@ -114,49 +91,30 @@ {{ this.$gzlocale.get("HelpLicense") }}
- {{ this.$gzlocale.get("RegisteredUser") }}: - - {{ serverInfo.license.license.licensedTo }} - + {{ this.$gzlocale.get("RegisteredUser") }}: + {{ serverInfo.license.license.licensedTo }}
- {{ this.$gzlocale.get("DatabaseID") }}: + {{ this.$gzlocale.get("DatabaseID") }}: {{ serverInfo.license.license.dbId }}
- {{ this.$gzlocale.get("LicenseSerial") }}: + {{ this.$gzlocale.get("LicenseSerial") }}: {{ serverInfo.license.license.keySerial }}
- {{ this.$gzlocale.get("LicenseExpiration") }}: - - {{ serverInfo.license.license.licenseExpiration }} - + {{ this.$gzlocale.get("LicenseExpiration") }}: + {{ serverInfo.license.license.licenseExpiration }}
- {{ this.$gzlocale.get("SupportedUntil") }}: - - {{ serverInfo.license.license.maintenanceExpiration }} - + {{ this.$gzlocale.get("SupportedUntil") }}: + {{ serverInfo.license.license.maintenanceExpiration }}
{{ this.$gzlocale.get("LicensedOptions") }} -
+
{{ item.Feature }} {{ item.Count ? ": " + item.Count : "" }}
@@ -192,8 +150,7 @@ function clickHandler(menuItem) { ) { logText += value + "\n"; }); - - navigator.clipboard.writeText(text + "\nCLIENT LOG\n" + logText); + this.$gzutil.copyToClipboard(text + "\nCLIENT LOG\n" + logText); break; default: m.vm.$gzevent.$emit(