User home page and styling fixes
This commit is contained in:
@@ -144,11 +144,11 @@ onMount(() => {
|
||||
},
|
||||
];
|
||||
|
||||
loadGraph(10080, 10, false);
|
||||
loadGraph(43200, 60, true);
|
||||
getStats("calls")
|
||||
statsInterval = setInterval(() => {
|
||||
getStats(lastOrder)
|
||||
}, 10000)
|
||||
}, 20000)
|
||||
})
|
||||
onDestroy(() => {
|
||||
if (graphTimeout !== null) {
|
||||
@@ -164,14 +164,14 @@ onDestroy(() => {
|
||||
<h3>Bandwidth usage and file views</h3>
|
||||
</section>
|
||||
<div class="highlight_shaded" style="margin-bottom: 6px;">
|
||||
<button on:click={() => { loadGraph(1440, 1, true) }}>Day</button>
|
||||
<button on:click={() => { loadGraph(10080, 10, false) }}>Week</button>
|
||||
<button on:click={() => { loadGraph(20160, 60, false) }}>Two Weeks</button>
|
||||
<button on:click={() => { loadGraph(43200, 60, false) }}>Month</button>
|
||||
<button on:click={() => { loadGraph(131400, 1440, false) }}>Quarter</button>
|
||||
<button on:click={() => { loadGraph(262800, 1440, false) }}>Half-year</button>
|
||||
<button on:click={() => { loadGraph(525600, 1440, false) }}>Year</button>
|
||||
<button on:click={() => { loadGraph(1051200, 1440, false) }}>Two Years</button>
|
||||
<button on:click={() => loadGraph(1440, 1, true)}>Day 1m</button>
|
||||
<button on:click={() => loadGraph(10080, 10, true)}>Week 10m</button>
|
||||
<button on:click={() => loadGraph(10080, 60, true)}>Week 1h</button>
|
||||
<button on:click={() => loadGraph(43200, 60, true)}>Month 1h</button>
|
||||
<button on:click={() => loadGraph(131400, 1440, false)}>Quarter 1d</button>
|
||||
<button on:click={() => loadGraph(262800, 1440, false)}>Half-year 1d</button>
|
||||
<button on:click={() => loadGraph(525600, 1440, false)}>Year 1d</button>
|
||||
<button on:click={() => loadGraph(1051200, 1440, false)}>Two Years 1d</button>
|
||||
</div>
|
||||
<Chart bind:this={graphBandwidth} data_type="bytes" legend={false} />
|
||||
<Chart bind:this={graphViews} data_type="number" legend={false} />
|
||||
|
@@ -609,9 +609,10 @@ const keyboard_event = evt => {
|
||||
<ReportWindow file={file} list={list}></ReportWindow>
|
||||
</Modal>
|
||||
|
||||
{#if ads_enabled}
|
||||
<!-- Disabled to reduce clutter while the Ukraine banner is live -->
|
||||
<!-- {#if ads_enabled}
|
||||
<IntroPopup target={button_home}></IntroPopup>
|
||||
{/if}
|
||||
{/if} -->
|
||||
|
||||
<Downloader bind:this={downloader} file={file} list={list}></Downloader>
|
||||
</div>
|
||||
|
@@ -85,44 +85,38 @@ onMount(() => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="table_scroll">
|
||||
<table style="text-align: left;">
|
||||
<thead>
|
||||
<table style="text-align: left;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Time</td>
|
||||
<td>File name</td>
|
||||
<td>Event</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each data as row}
|
||||
<tr>
|
||||
<td>Time</td>
|
||||
<td>Event</td>
|
||||
<td>File name</td>
|
||||
<td>File removal reason</td>
|
||||
<td>
|
||||
{formatDate(row.time, true, true, false)}
|
||||
</td>
|
||||
<td>
|
||||
{#if row.event === "file_instance_blocked"}
|
||||
<a href="/u/{row.file_id}">{row.file_name}</a>
|
||||
{:else}
|
||||
{row.file_name}
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
{#if row.event === "file_instance_blocked"}
|
||||
Blocked for abuse
|
||||
{:else if row.event === "file_instance_expired"}
|
||||
Expired
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each data as row}
|
||||
<tr>
|
||||
<td>
|
||||
{formatDate(row.time, true, true, false)}
|
||||
</td>
|
||||
<td>
|
||||
{#if row.event === "file_instance_blocked"}
|
||||
File blocked for abuse
|
||||
{:else if row.event === "file_instance_expired"}
|
||||
File expired
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
{#if row.event === "file_instance_blocked"}
|
||||
<a href="/u/{row.file_id}">{row.file_name}</a>
|
||||
{:else}
|
||||
{row.file_name}
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
{row.file_removal_reason}
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{#if data.length > 100}
|
||||
<div class="toolbar">
|
||||
|
@@ -11,10 +11,6 @@ let graph_views_downloads = null
|
||||
let graph_bandwidth = null
|
||||
let time_start = ""
|
||||
let time_end = ""
|
||||
let total_views = 0
|
||||
let total_downloads = 0
|
||||
let total_bandwidth = 0
|
||||
let total_transfer_paid = 0
|
||||
|
||||
let load_graphs = async (minutes, interval) => {
|
||||
let end = new Date()
|
||||
@@ -52,6 +48,12 @@ let load_graphs = async (minutes, interval) => {
|
||||
}
|
||||
}
|
||||
|
||||
let total_views = 0
|
||||
let total_downloads = 0
|
||||
let total_bandwidth = 0
|
||||
let total_transfer_paid = 0
|
||||
let total_transfer_kickback = 0
|
||||
|
||||
let get_graph_data = async (stat, start, end, interval) => {
|
||||
let resp = await fetch(
|
||||
window.api_endpoint + "/user/time_series/" + stat +
|
||||
@@ -64,7 +66,8 @@ let get_graph_data = async (stat, start, end, interval) => {
|
||||
// Convert the timestamps to a human-friendly format
|
||||
resp.timestamps.forEach((val, idx) => {
|
||||
let date = new Date(val);
|
||||
let str = ("00" + (date.getMonth() + 1)).slice(-2);
|
||||
let str = date.getFullYear();
|
||||
str += "-" + ("00" + (date.getMonth() + 1)).slice(-2);
|
||||
str += "-" + ("00" + date.getDate()).slice(-2);
|
||||
str += " " + ("00" + date.getHours()).slice(-2);
|
||||
str += ":" + ("00" + date.getMinutes()).slice(-2);
|
||||
@@ -83,6 +86,8 @@ let get_graph_data = async (stat, start, end, interval) => {
|
||||
total_bandwidth = total;
|
||||
} else if (stat == "transfer_paid") {
|
||||
total_transfer_paid = total;
|
||||
} else if (stat == "transfer_kickback") {
|
||||
total_transfer_kickback = total;
|
||||
}
|
||||
|
||||
return resp
|
||||
@@ -176,7 +181,7 @@ onMount(() => {
|
||||
},
|
||||
];
|
||||
|
||||
update_graphs(1440, 1, true);
|
||||
update_graphs(10080, 60, true);
|
||||
})
|
||||
onDestroy(() => {
|
||||
if (graph_timeout !== null) {
|
||||
@@ -244,58 +249,49 @@ onDestroy(() => {
|
||||
|
||||
<h2>Statistics</h2>
|
||||
<p>
|
||||
Here you can see how often your files are viewed, downloaded
|
||||
and how much bandwidth they consume. The buttons at the top
|
||||
can be pressed to adjust the timeframe. If you choose 'Day'
|
||||
the statistics will be updated periodically. No need to
|
||||
refresh the page.
|
||||
Here you can see how often your files are viewed, downloaded and how
|
||||
much bandwidth they consume. The buttons below can be pressed to adjust
|
||||
the timeframe.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<div class="highlight_shaded">
|
||||
<button
|
||||
on:click={() => { update_graphs(1440, 1, true) }}
|
||||
class:button_highlight={graph_timespan == 1440}>
|
||||
Day (1m)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => { update_graphs(10080, 10, false) }}
|
||||
class:button_highlight={graph_timespan == 10080}>
|
||||
Week (10m)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => { update_graphs(20160, 60, false) }}
|
||||
class:button_highlight={graph_timespan == 20160}>
|
||||
Two Weeks (1h)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => { update_graphs(43200, 1440, false) }}
|
||||
class:button_highlight={graph_timespan == 43200}>
|
||||
Month (1d)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => { update_graphs(131400, 1440, false) }}
|
||||
class:button_highlight={graph_timespan == 131400}>
|
||||
Quarter (1d)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => { update_graphs(525600, 1440, false) }}
|
||||
class:button_highlight={graph_timespan == 525600}>
|
||||
Year (1d)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => { update_graphs(1051200, 1440, false) }}
|
||||
class:button_highlight={graph_timespan == 1051200}>
|
||||
Two Years (1d)
|
||||
</button>
|
||||
<br/>
|
||||
Total usage from {time_start} to {time_end}<br/>
|
||||
{formatThousands(total_views)} views,
|
||||
{formatThousands(total_downloads)} downloads,
|
||||
{formatDataVolume(total_bandwidth, 3)} bandwidth and
|
||||
{formatDataVolume(total_transfer_paid, 3)} paid transfers
|
||||
</div>
|
||||
<section>
|
||||
<div class="highlight_shaded">
|
||||
<button
|
||||
on:click={() => update_graphs(1440, 1, true)}
|
||||
class:button_highlight={graph_timespan == 1440}>
|
||||
Day (1m)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => update_graphs(10080, 60, true)}
|
||||
class:button_highlight={graph_timespan == 10080}>
|
||||
Week (1h)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => update_graphs(20160, 60, true)}
|
||||
class:button_highlight={graph_timespan == 20160}>
|
||||
Two Weeks (1h)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => update_graphs(43200, 1440, false)}
|
||||
class:button_highlight={graph_timespan == 43200}>
|
||||
Month (1d)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => update_graphs(131400, 1440, false)}
|
||||
class:button_highlight={graph_timespan == 131400}>
|
||||
Quarter (1d)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => update_graphs(525600, 1440, false)}
|
||||
class:button_highlight={graph_timespan == 525600}>
|
||||
Year (1d)
|
||||
</button>
|
||||
<button
|
||||
on:click={() => update_graphs(1051200, 1440, false)}
|
||||
class:button_highlight={graph_timespan == 1051200}>
|
||||
Two Years (1d)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<h3>Premium transfers and total bandwidth usage</h3>
|
||||
<p>
|
||||
Total bandwidth usage is the combined bandwidth usage of all the files
|
||||
@@ -316,9 +312,17 @@ onDestroy(() => {
|
||||
<a href="/user/transactions">transactions page</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<Chart bind:this={graph_bandwidth} data_type="bytes"/>
|
||||
|
||||
<section>
|
||||
<div class="highlight_shaded">
|
||||
Total usage from {time_start} to {time_end}<br/>
|
||||
{formatDataVolume(total_bandwidth, 3)} bandwidth,
|
||||
{formatDataVolume(total_transfer_paid, 3)} paid transfers
|
||||
{formatDataVolume(total_transfer_kickback, 3)} kickback transfers
|
||||
</div>
|
||||
|
||||
<h3>Views and downloads</h3>
|
||||
<p>
|
||||
A view is counted when someone visits the download page of one of
|
||||
@@ -330,4 +334,13 @@ onDestroy(() => {
|
||||
or not, only the start of the download is counted.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<Chart bind:this={graph_views_downloads} data_type="number"/>
|
||||
|
||||
<section>
|
||||
<div class="highlight_shaded">
|
||||
Total usage from {time_start} to {time_end}<br/>
|
||||
{formatThousands(total_views)} views and
|
||||
{formatThousands(total_downloads)} downloads
|
||||
</div>
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user