fix cv in mobile pandora_enterprise#12196

This commit is contained in:
daniel 2023-10-11 10:48:26 +02:00
parent 98d843c32f
commit d19b506781
8 changed files with 99 additions and 29 deletions

View File

@ -1440,22 +1440,56 @@ function openURLTagWindow(url) {
*/ */
function defineTinyMCE(selector) { function defineTinyMCE(selector) {
var defaultToolbar =
"undo redo | blocks | bold italic | code | alignleft aligncenter alignright alignjustify | outdent indent";
tinymce.init({ tinymce.init({
selector: selector, selector: selector,
plugins: "preview, searchreplace, table, nonbreaking, link, image", plugins:
"preview, searchreplace, table, nonbreaking, link, image, code, codesample",
promotion: false, promotion: false,
branding: false branding: false,
codesample_languages: [
{ text: "HTML/XML", value: "markup" },
{ text: "JavaScript", value: "javascript" },
{ text: "CSS", value: "css" },
{ text: "PHP", value: "php" },
{ text: "Ruby", value: "ruby" },
{ text: "Python", value: "python" },
{ text: "Java", value: "java" },
{ text: "C", value: "c" },
{ text: "C#", value: "csharp" },
{ text: "C++", value: "cpp" }
],
toolbar: defaultToolbar
}); });
} }
function defineTinyMCEDark(selector) { function defineTinyMCEDark(selector) {
var defaultToolbar =
"undo redo | blocks | bold italic | code | alignleft aligncenter alignright alignjustify | outdent indent";
tinymce.init({ tinymce.init({
selector: selector, selector: selector,
plugins: "preview, searchreplace, table, nonbreaking, link, image", plugins:
"preview, searchreplace, table, nonbreaking, link, image, code, codesample",
promotion: false, promotion: false,
branding: false, branding: false,
skin: "oxide-dark", skin: "oxide-dark",
content_css: "dark" content_css: "dark",
codesample_languages: [
{ text: "HTML/XML", value: "markup" },
{ text: "JavaScript", value: "javascript" },
{ text: "CSS", value: "css" },
{ text: "PHP", value: "php" },
{ text: "Ruby", value: "ruby" },
{ text: "Python", value: "python" },
{ text: "Java", value: "java" },
{ text: "C", value: "c" },
{ text: "C#", value: "csharp" },
{ text: "C++", value: "cpp" }
],
toolbar: defaultToolbar
}); });
} }

View File

@ -1487,12 +1487,26 @@ function dashboardLoadVC(settings) {
let width = 0; let width = 0;
let height = 0; let height = 0;
let isMobile = true;
// If it is detected that it is a real mobile not the web inspector
// deducts 45 more for the header and footer of the mobile.
const fixHeader = 45;
if (navigator && navigator.userAgentData != null) {
isMobile = navigator.userAgentData.mobile;
}
if (event.target.screen.orientation.angle === 0) { if (event.target.screen.orientation.angle === 0) {
width = $(window).height() + 45; width = $(window).height();
height = $(window).width() - 45; if (isMobile) {
width += fixHeader;
}
height = $(window).width();
} else { } else {
width = $(window).height() + 45; width = $(window).height();
height = $(window).width() - 45 * 2; height = $(window).width() - fixHeader;
if (isMobile) {
height -= fixHeader;
}
} }
var dimensions = { var dimensions = {

View File

@ -1497,7 +1497,11 @@ function show_dialog(dialog) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data; const requestBody = ajaxOptions.data;
try { try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) { if (
requestBody &&
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log( console.log(
"AJAX request sent with drawConsoleSound=1:", "AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url ajaxOptions.url
@ -1659,7 +1663,11 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data; const requestBody = ajaxOptions.data;
try { try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) { if (
requestBody &&
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log( console.log(
"AJAX request sent with drawConsoleSound=1:", "AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url ajaxOptions.url

View File

@ -353,7 +353,6 @@ class Manager
} }
} }
} catch (\Exception $e) { } catch (\Exception $e) {
hd($e->getMessage());
$error_upload = $e->getMessage(); $error_upload = $e->getMessage();
} }
@ -1499,7 +1498,6 @@ class Manager
$result = $ITSM->pingItsmtoPandora($path); $result = $ITSM->pingItsmtoPandora($path);
} catch (Throwable $e) { } catch (Throwable $e) {
echo $e->getMessage(); echo $e->getMessage();
hd($e->getMessage(), true);
$result = false; $result = false;
exit; exit;
} }

View File

@ -325,10 +325,6 @@ final class ModuleGraph extends Item
$width = (int) $data['width']; $width = (int) $data['width'];
$height = (int) $data['height']; $height = (int) $data['height'];
if ($height == 0) {
$height = 15;
}
// Custom graph. // Custom graph.
if (empty($customGraphId) === false) { if (empty($customGraphId) === false) {
$customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId); $customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId);
@ -340,7 +336,12 @@ final class ModuleGraph extends Item
'field_order' 'field_order'
); );
$hackLegendHight = (28 * count($sources)); $total_labels = $config['items_combined_charts'];
if (count($sources) < $config['items_combined_charts']) {
$total_labels = count($sources);
}
$hackLegendHight = (25.5 * $total_labels);
// Trick for legend monstruosity. // Trick for legend monstruosity.
if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_STACKED_LINE if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_STACKED_LINE
@ -348,16 +349,20 @@ final class ModuleGraph extends Item
|| (int) $customGraph['stacked'] === CUSTOM_GRAPH_AREA || (int) $customGraph['stacked'] === CUSTOM_GRAPH_AREA
|| (int) $customGraph['stacked'] === CUSTOM_GRAPH_LINE || (int) $customGraph['stacked'] === CUSTOM_GRAPH_LINE
) { ) {
if ($width < 200 || $height < 200) { if (($height - $hackLegendHight) <= 50) {
$showLegend = false; $showLegend = false;
} else { } else {
$height = ($height - 10 - $hackLegendHight); $height = ($height - $hackLegendHight);
$showLegend = true;
} }
} else if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_VBARS) { } else if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_VBARS) {
$height = ($height - 40); $height = ($height - 40);
} }
if ($height <= 0) {
$showLegend = false;
$height = 100;
}
$params = [ $params = [
'period' => $period, 'period' => $period,
'width' => $width, 'width' => $width,
@ -394,11 +399,8 @@ final class ModuleGraph extends Item
} }
// Trick for legend monstruosity. // Trick for legend monstruosity.
if ($width < 200 || $height < 200) { if ((bool) $showLegend === true) {
$showLegend = false; $height -= 30;
} else {
$height = ($height - 30);
$showLegend = true;
} }
$params = [ $params = [

View File

@ -51,6 +51,11 @@ h1 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.visual-console-container-dashboard h1 {
font-size: inherit;
margin-bottom: inherit;
}
.container-fluid { .container-fluid {
margin-top: 5px; margin-top: 5px;
} }

View File

@ -3320,7 +3320,3 @@ div.visual-console-container-dashboard fieldset {
.ui-page-theme-a div.visual-console-container-dashboard a { .ui-page-theme-a div.visual-console-container-dashboard a {
color: inherit !important; color: inherit !important;
} }
body div.visual-console-container-dashboard .visual-console-item-label {
line-height: 10px;
}

View File

@ -1032,6 +1032,19 @@ class Ui
$(document).ready(function () { $(document).ready(function () {
dashboardLoadVC(settings); dashboardLoadVC(settings);
if(settings.mobile_view_orientation_vc === false) {
$("#main_page > .ui-content").css("display", "block");
$(".container-center").css("padding", "50% 0");
$(".container-center").css("height", "100vh");
$(".visual-console-container-dashboard").css("display", "block");
$(".visual-console-container-dashboard").css("transform-origin", "left top");
$(".visual-console-container-dashboard").css("transform", "rotate(-90deg) translate(-100%)");
$(".visual-console-container-dashboard").css("margin-top", "-50%");
$(".visual-console-container-dashboard").css("white-space", "nowrap");
if(settings.props.height > settings.props.width) {
$(".container-center").css("overflow", "auto");
}
}
}); });
</script>' </script>'
); );