Skip to content

Commit

Permalink
Merge pull request #2 from EspadaV8/dialog-popup-for-mobile
Browse files Browse the repository at this point in the history
Show file details in a popup for small screen users
  • Loading branch information
Josh5 authored Mar 13, 2024
2 parents 4248397 + 1e67bf5 commit 7429fad
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 65 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**<span style="color:#56adda">0.1.1</span>**
- When viewing on mobile, show individual file metrics in a dialog popup

**<span style="color:#56adda">0.1.0</span>**
- New layout to try and make better use of space

Expand Down
4 changes: 2 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"on_postprocessor_task_results": 0
},
"tags": "data panel",
"version": "0.1.0"
}
"version": "0.1.1"
}
39 changes: 37 additions & 2 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ html {
background-color: var(--q-card-head-hover);
}

.content {
.card-content {
background-color: var(--q-card);
display: none;
overflow: hidden;
padding: 0 18px;
}
Expand Down Expand Up @@ -126,7 +125,10 @@ html {
}

#individual_file_size_chart {
display: block;
order: 2;
overflow: hidden;
padding: 0 3px;
}

#individual_file_size_chart .card {
Expand Down Expand Up @@ -195,6 +197,7 @@ html {

#individual_file_size_chart {
order: 1;
display: none;
}

#individual_file_size_chart .card {
Expand All @@ -210,3 +213,35 @@ html {
padding-top: 20px;
}
}

dialog {
color: var(--q-text);
border: none;
background-color: var(--q-card);
width: 100%;
padding: 0;
}

dialog::backdrop {
background-color: var(--q-card-head);
opacity: 0.85;
}

dialog .card-content {
padding: 0 10px;
}

dialog .card-footer {
padding: 0 0 10px 0;
}

dialog .q-btn {
background: var(--q-primary);
border: 0;
color: #fff;
font-size: 14px;
font-weight: 500;
outline: 0;
padding: 8px 20px;
text-transform: uppercase;
}
45 changes: 30 additions & 15 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
</head>
<body id="top-of-page">
<!-- ######## BEGIN PAGE CONTENT -->
<input
id="selected_task_id"
type="hidden"
name="selected_task_id"
value=""
/>

<div class="top-content">
<div class="charts">
Expand Down Expand Up @@ -91,27 +97,36 @@
<div class="card">
<div class="card-header active">Individual File Size Change</div>
<div class="card-content">
<div class="content" style="display: block">
<input
id="selected_task_id"
type="hidden"
name="selected_task_id"
value=""
/>

<div id="task_details">
<div id="file_size_chart">
There was an issue showing this chart
</div>
<div class="task_details">
<div id="file_size_chart">
There was an issue showing this chart
</div>
</div>

<div class="selected_task_name" class="car-header"></div>
</div>
</div>
</div>

<div id="selected_task_name" class="car-header">
(Select a task from the table)
<dialog id="individual_file_size_chart_dialog" data-modal>
<div class="card">
<div class="card-header active">Individual File Size Change</div>
<div class="card-content">
<div class="task_details">
<div id="file_size_chart_dialog">
There was an issue showing this chart
</div>
</div>

<div class="selected_task_name" class="car-header"></div>
</div>
<div class="card-footer">
<form method="dialog">
<button autofocus class="q-btn">Close</button>
</form>
</div>
</div>
</div>
</dialog>
</div>

<a href="#top-of-page" class="top-of-page-link" data-visible="true">
Expand Down
73 changes: 27 additions & 46 deletions static/js/filesizechart.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const CompletedTasksFileSizeDiffChart = (function () {
let source_total_size = 0;
let destination_total_size = 0;

const individualChart = Highcharts.chart("file_size_chart", {
Highcharts.setOptions({
chart: {
backgroundColor: chart_background,
height: chartHeight,
Expand All @@ -58,6 +58,9 @@ const CompletedTasksFileSizeDiffChart = (function () {
},
},
colors: [default_bar_colour, positive_bar_colour],
legend: {
enabled: false,
},
xAxis: {
type: "category",
labels: {
Expand All @@ -74,62 +77,33 @@ const CompletedTasksFileSizeDiffChart = (function () {
},
},
title: {
text: "Sizes",
text: "Size",
style: {
color: subtext_colour,
},
},
},
legend: {
enabled: false,
},
series: [],
});

const totalChart = Highcharts.chart("total_size_chart", {
const individualChart = new Highcharts.Chart({
chart: {
backgroundColor: chart_background,
height: chartHeight,
renderTo: "file_size_chart",
},
title: {
text: "",
style: {
color: text_colour,
},
});
const individualChart2 = new Highcharts.Chart({
chart: {
renderTo: "file_size_chart_dialog",
},
});

const totalChart = new Highcharts.Chart({
chart: {
renderTo: "total_size_chart",
},
subtitle: {
text: "Displaying the total file size changed on disk by Unmanic processing files",
style: {
color: subtext_colour,
},
},
colors: [default_bar_colour, positive_bar_colour],
xAxis: {
type: "category",
labels: {
style: {
color: text_colour,
},
},
lineColor: text_colour,
},
yAxis: {
labels: {
style: {
color: text_colour,
},
},
title: {
text: "Sizes",
style: {
color: subtext_colour,
},
},
},
legend: {
enabled: false,
},
series: [],
});

const updateIndividualChart = function () {
Expand All @@ -149,7 +123,7 @@ const CompletedTasksFileSizeDiffChart = (function () {
source_file_size = Number(source_file_size);
destination_file_size = Number(destination_file_size);

individualChart.update({
const options = {
chart: {
backgroundColor: chart_background,
type: "bar",
Expand All @@ -173,7 +147,10 @@ const CompletedTasksFileSizeDiffChart = (function () {
File Size: ${formatBytes(Math.abs(this.point.y))}`;
},
},
});
};

individualChart.update(options);
individualChart2.update(options);

const newSeriesData = {
borderWidth: 0,
Expand All @@ -193,10 +170,14 @@ const CompletedTasksFileSizeDiffChart = (function () {

for (let i = individualChart.series.length - 1; i >= 0; i--) {
individualChart.series[i].remove(false);
individualChart2.series[i].remove(false);
}

individualChart.addSeries(newSeriesData, false);
individualChart2.addSeries(newSeriesData, false);

individualChart.redraw();
individualChart2.redraw();
};

const updateTotalChart = function () {
Expand Down Expand Up @@ -303,7 +284,7 @@ const CompletedTasksFileSizeDiffChart = (function () {
</p>`;
}

$("#selected_task_name").html(html);
$(".selected_task_name").html(html);
});
};

Expand Down
6 changes: 6 additions & 0 deletions static/js/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const viewConversionDetails = (jobId) => {
};

const CompletedTasksDatatable = (function () {
const modal = document.querySelector("[data-modal]");

const recordName = (basename, type, { task_success } = row) => {
if (task_success) {
return `<span class="q-badge success"></span> <span class="name" title="View Details">${basename}</span>`;
Expand Down Expand Up @@ -69,6 +71,10 @@ const CompletedTasksDatatable = (function () {

viewConversionDetails(data.id);
}

if ($("#individual_file_size_chart").is(":visible") === false) {
modal.showModal();
}
});
};

Expand Down

0 comments on commit 7429fad

Please sign in to comment.