From bffc0b065596ac21e4e8a3cfecbb7b60c8a6e62d Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Wed, 26 May 2021 17:08:06 -0400 Subject: [PATCH] Auto-expand workspace --- app/src/modules/insights/routes/dashboard.vue | 46 +++++++++++++++++-- app/src/panels/metric/metric.vue | 3 ++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/app/src/modules/insights/routes/dashboard.vue b/app/src/modules/insights/routes/dashboard.vue index ac6774e888..19344e3e38 100644 --- a/app/src/modules/insights/routes/dashboard.vue +++ b/app/src/modules/insights/routes/dashboard.vue @@ -29,7 +29,7 @@ -
+
{ + const furthestPanelX = panels.value.reduce( + (aggr, panel) => { + if (panel.position_x! > aggr.position_x!) { + aggr.position_x = panel.position_x; + aggr.width = panel.width; + } + + return aggr; + }, + { position_x: 0, width: 0 } + ); + + const furthestPanelY = panels.value.reduce( + (aggr, panel) => { + if (panel.position_y! > aggr.position_y!) { + aggr.position_y = panel.position_y; + aggr.height = panel.height; + } + + return aggr; + }, + { position_y: 0, height: 0 } + ); + + if (editMode.value === true) { + return { + width: (furthestPanelX.position_x! + furthestPanelX.width! + 3) * 20 + 'px', + height: (furthestPanelY.position_y! + furthestPanelY.height! + 3) * 20 + 'px', + }; + } + + return { + width: (furthestPanelX.position_x! + furthestPanelX.width! - 1) * 20 + 'px', + height: (furthestPanelY.position_y! + furthestPanelY.height! - 1) * 20 + 'px', + }; + }); + return { currentDashboard, editMode, @@ -113,6 +151,7 @@ export default defineComponent({ saving, saveChanges, stageConfiguration, + workspaceSize, }; function stagePanelEdits(edits: Partial, key: string = props.panelKey) { @@ -187,8 +226,9 @@ export default defineComponent({ display: grid; grid-template-rows: repeat(auto-fill, 20px); grid-template-columns: repeat(auto-fill, 20px); - min-width: 200%; - min-height: 200%; + min-width: calc(100% - var(--content-padding) - var(--content-padding)); + min-height: calc(100% - 120px); + margin-right: var(--content-padding); margin-left: var(--content-padding); overflow: visible; } diff --git a/app/src/panels/metric/metric.vue b/app/src/panels/metric/metric.vue index 7789ba686a..b6b2c4fb56 100644 --- a/app/src/panels/metric/metric.vue +++ b/app/src/panels/metric/metric.vue @@ -58,5 +58,8 @@ export default defineComponent({ justify-content: center; width: 100%; height: calc(100% - 24px); + font-weight: 800; + font-size: 42px; + line-height: 52px; }