This commit is contained in:
2020-06-01 22:16:52 +00:00
parent 2e11c39396
commit 27a02153e2
2 changed files with 154 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -0,0 +1,154 @@
<template>
<v-row v-if="this.formState.ready" v-resize="onResize">
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-col cols="12">
<v-btn @click="refreshProfile">
<v-icon>fa-sync</v-icon>
</v-btn>
</v-col>
<v-col cols="12">
<v-card elevation="4">
<v-card :height="cardHeight" >
<iframe
id="profileFrame"
style="width:100%;height:100%"
:src="profileUrl()"
></iframe>
</v-card>
</v-card>
</v-col>
</v-row>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const FORM_KEY = "ops-profile";
export default {
created() {
let vm = this;
initForm(vm)
.then(() => {
window.$gz.eventBus.$on("menu-click", clickHandler);
generateMenu(vm);
// vm.getDataFromApi();
this.formState.ready = true;
})
.catch(err => {
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err, vm);
});
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
data() {
return {
cardHeight: 300,
formState: {
ready: false,
loading: false,
errorBoxMessage: null,
appError: null,
serverError: {}
}
};
},
methods: {
onResize() {
this.cardHeight = window.innerHeight * 0.85;
},
profileUrl() {
// "http://localhost:7575/profiler/results-index?t=l47NWWuZo89MU1GuHV/tYY0d2xwsFrY/K5MZb1zTTvY";
return (
window.$gz.api.ServerBaseUrl() +
"profiler/results-index?t=" +
this.$store.state.downloadToken
);
},
refreshProfile() {
let ifr = document.getElementById("profileFrame");
ifr.src = ifr.src;
}
}
};
//////////////////////
//
//
function generateMenu(vm) {
let menuOptions = {
isMain: true,
icon: "fa-binoculars",
title: vm.$ay.t("ServerProfiler"),
helpUrl: "form-ops-profile",
menuItems: [
// {
// title: vm.$ay.t("Copy"),
// icon: "fa-copy",
// surface: false,
// key: FORM_KEY + ":copylog",
// vm: vm
// }
]
};
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
/////////////////////////////
//
//
function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
// case "copylog":
// //put the log info on the clipboard:
// window.$gz.util.copyToClipboard("SERVER LOG\n" + m.vm.log);
// break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
FORM_KEY + "::context click: [" + m.key + "]"
);
}
}
}
/////////////////////////////////
//
//
function initForm(vm) {
return new Promise(function(resolve, reject) {
(async function() {
try {
await fetchTranslatedText(vm);
} catch (err) {
reject(err);
}
resolve();
})();
});
}
//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
function fetchTranslatedText(vm) {
let tKeysRequired = ["ServerProfiler"];
return window.$gz.translation.fetch(tKeysRequired);
}
</script>