Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assets 34569 #33

Merged
merged 4 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions blocks/gmo-metrics/gmo-metrics.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
content: '';
}

.gmo-metrics .title {
display: flex;
justify-content: space-between;
}

.gmo-metrics .subtitle-right {
font-size: 16px;
color: var(--assets-browser-text-color);
font-weight: normal;
}

.gmo-metrics .graph-container {
display: flex;
flex-flow: row wrap;
Expand Down Expand Up @@ -100,4 +111,5 @@
align-items: center;
justify-content: center;
}

}
57 changes: 31 additions & 26 deletions blocks/gmo-metrics/gmo-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import { logError } from '../../scripts/scripts.js';

const GENERAL_METRICS = [{
category: 'Total assets',
amount: 59475,
amount: 60882,
}, {
category: 'Total size',
amount: 1024 * 1024 * 1024 * 331.6,
amount: 1024 * 1024 * 1024 * 334,
unit: 'bytes',
}, {
category: 'Uploads year-to-date',
amount: 59475,
amount: 261,
}, {
category: 'Uploads quarter-to-date',
amount: 56629,
amount: 57865,
}, {
category: 'Uploads last 30 days',
amount: 56486,
amount: 261,
}];

function formatNumber(number) {
Expand Down Expand Up @@ -57,40 +57,42 @@ function formatAmount(metric) {
}

const MIME_TYPES = [
{ category: 'video/mp4', amount: 3579 },
{ category: 'image/jpeg', amount: 51258 },
{ category: 'image/png', amount: 2102 },
{ category: 'video/quicktime', amount: 422 },
{ category: 'image/vnd.adobe.photoshop', amount: 380 },
{ category: 'audio/x-wav', amount: 104 },
{ category: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', amount: 102 },
{ category: 'application/vnd.adobe.sparkler.project+dcx', amount: 578 },
{ category: 'application/pdf', amount: 571 },
{ category: 'application/octet-stream', amount: 48 },
{ category: 'application/postscript', amount: 33 },
{ category: 'application/json', amount: 30 },
{ category: 'image/jpeg', amount: 51595 },
{ category: 'video/mp4', amount: 3794 },
{ category: 'image/png', amount: 2404 },
{ category: 'application/vnd.adobe.sparkler.project+dcx', amount: 632 },
{ category: 'application/pdf', amount: 631 },
{ category: 'video/quicktime', amount: 598 },
{ category: 'image/vnd.adobe.photoshop', amount: 402 },
{ category: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', amount: 170 },
{ category: 'audio/x-wav', amount: 166 },
{ category: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', amount: 137 },
{ category: 'application/octet-stream', amount: 56 },
{ category: 'image/tiff', amount: 50 },
{ category: 'application/postscript', amount: 48 },
{ category: 'image/svg+xml', amount: 35 },
{ category: 'application/x-subrip', amount: 30 },
{ category: 'application/zip', amount: 30 },
{ category: 'application/x-font-otf', amount: 22 },
{ category: 'application/vnd.audiograph', amount: 19 },
{ category: 'application/x-subrip', amount: 18 },
{ category: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', amount: 15 },
{ category: 'application/zip', amount: 21 },
{ category: 'image/svg+xml', amount: 9 },
{ category: 'application/vnd.3gpp.pic-bw-small', amount: 11 },
{ category: 'image/gif', amount: 11 },
{ category: 'application/vnd.3gpp.pic-bw-small', amount: 9 },
{ category: 'video/ogg', amount: 9 },
{ category: 'image/tiff', amount: 8 },
{ category: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', amount: 170 },
{ category: 'audio/mpeg', amount: 4 },
{ category: 'image/dng', amount: 3 },
{ category: 'text/html', amount: 3 },
{ category: 'text/plain', amount: 2 },
{ category: 'application/x-indesign', amount: 1 },
];

const BUSINESS_UNITS = [{
/*const BUSINESS_UNITS = [{
category: 'Digital Media',
amount: 2517,
}, {
category: 'Other',
amount: 509,
}];
}];*/

const PRODUCTS = [{
category: 'Photoshop',
Expand Down Expand Up @@ -323,7 +325,10 @@ function sortByAmount(values) {
export default async function decorate(block) {
const config = readBlockConfig(block);
block.innerHTML = `
<h1>${config.title || 'Asset Metrics'}</h1>
<div class="title">
<h1>${config.title || 'Asset Metrics'}</h1>
<h1 class="subtitle-right">Updated: ${config.updated}</h1>
</div>
<div class="graph-container">
<div>
<h2>Asset Statistics</h2>
Expand Down
Loading