Skip to content

Commit

Permalink
fix: move editable to context
Browse files Browse the repository at this point in the history
  • Loading branch information
filipgutica committed Nov 1, 2024
1 parent b103fc2 commit bd46c63
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const appLinks: SandboxNavigationItem[] = inject('app-links', [])
const context: DashboardRendererContext = {
filters: [],
refreshInterval: 0,
editable: true,
}
const dashboardConfig: DashboardConfig = {
Expand Down Expand Up @@ -136,7 +137,6 @@ const dashboardConfig: DashboardConfig = {
datasource: 'basic',
dimensions: ['route'],
},
editable: true,
},
layout: {
position: {
Expand All @@ -159,7 +159,6 @@ const dashboardConfig: DashboardConfig = {
datasource: 'basic',
dimensions: ['time'],
},
editable: true,
},
layout: {
position: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<BaseAnalyticsChartRenderer
:chart-options="chartOptions"
:context="context"
:editable="editable"
:editable="context.editable"
:extra-props="{ showAnnotations: false }"
:height="height"
:query="query"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
:chart-options="options"
:chart-title="chartOptions.chartTitle"
legend-position="bottom"
:show-menu="editable"
:show-menu="context.editable"
:synthetics-data-key="chartOptions.syntheticsDataKey"
tooltip-title=""
v-bind="extraProps"
>
<template
v-if="editable"
v-if="context.editable"
#menu-items
>
<KDropdownItem @click="editTile">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const componentData = computed(() => {
queryReady: props.queryReady,
chartOptions: props.definition.chart,
height: props.height - PADDING_SIZE * 2,
editable: props.definition.editable,
editable: props.context.editable,
},
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<BaseAnalyticsChartRenderer
:chart-options="chartOptions"
:context="context"
:editable="editable"
:editable="context.editable"
:height="height"
:query="query"
:query-ready="queryReady"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface DashboardRendererContext {
timeSpec?: TimeRangeV4
tz?: string
refreshInterval?: number
editable?: boolean
}

type FromSchemaWithOptions<T extends JSONSchema> = FromSchema<T, { keepDefaultedPropertiesOptional: true }>
Expand Down Expand Up @@ -59,10 +60,6 @@ const goToExplore = {
type: 'string',
} as const

const editable = {
type: 'boolean',
} as const

const chartDatasetColorsSchema = {
type: ['object', 'array'],
items: {
Expand Down Expand Up @@ -408,7 +405,6 @@ export const tileDefinitionSchema = {
chart: {
anyOf: [barChartSchema, gaugeChartSchema, timeseriesChartSchema, metricCardSchema, topNTableSchema, slottableSchema],
},
editable,
},
required: ['query', 'chart'],
additionalProperties: false,
Expand Down Expand Up @@ -508,5 +504,4 @@ export interface RendererProps<T> {
queryReady: boolean
chartOptions: T
height: number
editable?: boolean
}

0 comments on commit bd46c63

Please sign in to comment.