diff --git a/app/package.json b/app/package.json
index 33fecdbf2b..f9b8d3c36c 100644
--- a/app/package.json
+++ b/app/package.json
@@ -58,7 +58,7 @@
"@vue/cli-plugin-vuex": "^4.5.8",
"@vue/cli-service": "^4.5.13",
"@vue/compiler-sfc": "^3.0.5",
- "apexcharts": "^3.26.3",
+ "apexcharts": "^3.26.3",
"axios": "^0.21.1",
"base-64": "^1.0.0",
"codemirror": "^5.61.1",
diff --git a/app/src/modules/insights/components/workspace.vue b/app/src/modules/insights/components/workspace.vue
new file mode 100644
index 0000000000..c038a243b2
--- /dev/null
+++ b/app/src/modules/insights/components/workspace.vue
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/modules/insights/routes/dashboard.vue b/app/src/modules/insights/routes/dashboard.vue
index 14a8456ae3..6133840d9a 100644
--- a/app/src/modules/insights/routes/dashboard.vue
+++ b/app/src/modules/insights/routes/dashboard.vue
@@ -34,9 +34,14 @@
-
+
+
+
+
+
+
@@ -47,17 +52,7 @@
-
-
-
+
import InsightsNavigation from '../components/navigation.vue';
-import { defineComponent, computed, ref } from 'vue';
-import { useInsightsStore } from '@/stores';
+import { defineComponent, computed, ref, toRefs, inject } from 'vue';
+import { useInsightsStore, useAppStore } from '@/stores';
import InsightsNotFound from './not-found.vue';
import { Panel } from '@/types';
import { nanoid } from 'nanoid';
@@ -95,13 +90,13 @@ import { merge, omit } from 'lodash';
import { router } from '@/router';
import { unexpectedError } from '@/utils/unexpected-error';
import api from '@/api';
-import InsightsPanel from '../components/panel.vue';
import { useI18n } from 'vue-i18n';
import { pointOnLine } from '@/utils/point-on-line';
+import InsightsWorkspace from '../components/workspace.vue';
export default defineComponent({
name: 'InsightsDashboard',
- components: { InsightsNotFound, InsightsNavigation, InsightsPanel },
+ components: { InsightsNotFound, InsightsNavigation, InsightsWorkspace },
props: {
primaryKey: {
type: String,
@@ -115,11 +110,17 @@ export default defineComponent({
setup(props) {
const { t } = useI18n();
+ const insightsStore = useInsightsStore();
+ const appStore = useAppStore();
+
+ const { fullScreen } = toRefs(appStore);
+
const editMode = ref(false);
const confirmDeletePanel = ref(null);
const deletingPanel = ref(false);
const saving = ref(false);
- const insightsStore = useInsightsStore();
+
+ const zoomToFit = ref(false);
const currentDashboard = computed(() =>
insightsStore.dashboards.find((dashboard) => dashboard.id === props.primaryKey)
@@ -188,44 +189,6 @@ export default defineComponent({
return withBorderRadii;
});
- const workspaceSize = computed(() => {
- 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! + 25) * 20 + 'px',
- height: (furthestPanelY.position_y! + furthestPanelY.height! + 25) * 20 + 'px',
- };
- }
-
- return {
- width: (furthestPanelX.position_x! + furthestPanelX.width! - 1) * 20 + 'px',
- height: (furthestPanelY.position_y! + furthestPanelY.height! - 1) * 20 + 'px',
- };
- });
-
return {
currentDashboard,
editMode,
@@ -235,13 +198,16 @@ export default defineComponent({
saving,
saveChanges,
stageConfiguration,
- workspaceSize,
deletingPanel,
deletePanel,
confirmDeletePanel,
cancelChanges,
duplicatePanel,
t,
+ toggleFullScreen,
+ zoomToFit,
+ fullScreen,
+ toggleZoomToFit,
};
function stagePanelEdits(edits: Partial, key: string = props.panelKey) {
@@ -339,48 +305,21 @@ export default defineComponent({
newPanel.position_y = newPanel.position_y + 2;
stagePanelEdits(newPanel, '+');
}
+
+ function toggleFullScreen() {
+ fullScreen.value = !fullScreen.value;
+ }
+
+ function toggleZoomToFit() {
+ zoomToFit.value = !zoomToFit.value;
+ }
},
});