Skip to content

Commit

Permalink
chore: merge develop into version-3
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Jan 1, 2025
2 parents 1dc2650 + ae82d31 commit 1105475
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 23 deletions.
39 changes: 25 additions & 14 deletions frontend/src/widgets/AxisChart/getAxisChartOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ function makeOptions(chartType, labels, datasets, options) {
areaStyle:
dataset.series_options.showArea || options.showArea
? {
color: new graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: dataset.series_options.color || colors[index] },
{ offset: 1, color: '#fff' },
]),
opacity: 0.2,
}
color: new graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: dataset.series_options.color || colors[index] },
{ offset: 1, color: '#fff' },
]),
opacity: 0.2,
}
: undefined,
// bar styles
itemStyle: {
Expand All @@ -194,6 +194,17 @@ function makeOptions(chartType, labels, datasets, options) {
barMaxWidth: 50,
stack: options.stack ? 'stack' : null,
})),

label: {
show: options.show_data_labels,
position: 'inside',
formatter: (params) => {
const value = params.value;
return !isNaN(value) ? getShortNumber(value, 1) : value;
},
fontSize: 12,
color: '#333',
},
legend: {
icon: 'circle',
type: 'scroll',
Expand All @@ -216,14 +227,14 @@ function makeOptions(chartType, labels, datasets, options) {
function getMarkLineOption(options) {
return options.referenceLine
? {
data: [
{
name: options.referenceLine,
type: options.referenceLine.toLowerCase(),
label: { position: 'middle', formatter: '{b}: {c}' },
},
],
}
data: [
{
name: options.referenceLine,
type: options.referenceLine.toLowerCase(),
label: { position: 'middle', formatter: '{b}: {c}' },
},
],
}
: {}
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/widgets/Bar/BarOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ const props = defineProps({

<Checkbox v-model="options.stack" label="Stack Values" />
<Checkbox v-model="options.roundedBars" label="Rounded Bars" />
<Checkbox v-model="options.show_data_labels" label="Show Data Labels" />
</div>
</template>
1 change: 1 addition & 0 deletions frontend/src/widgets/Row/RowOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ const props = defineProps({
<AxisChartOptions seriesType="bar" v-model:options="options" :columns="props.columns" />
<Checkbox v-model="options.stack" label="Stack Values" />
<Checkbox v-model="options.roundedBars" label="Rounded Bars" />
<Checkbox v-model="options.show_data_labels" label="Show Data Labels" />
</div>
</template>
15 changes: 7 additions & 8 deletions frontend/src2/components/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:class="isSidebarCollapsed ? 'w-12' : 'w-56'"
>
<div class="flex flex-col overflow-hidden">
<UserDropdown class="p-2" :isCollapsed="isSidebarCollapsed" />
<UserDropdown class="p-2" :isCollapsed="isSidebarCollapsed.value" />
<div class="flex flex-col overflow-y-auto">
<template v-for="link in links">
<SidebarLink
Expand All @@ -13,15 +13,15 @@
:icon="link.icon"
:label="link.label"
:to="link.to"
:isCollapsed="isSidebarCollapsed"
:isCollapsed="isSidebarCollapsed.value"
@click="link.onClick"
/>
</template>
</div>
</div>
<SidebarLink
:label="isSidebarCollapsed ? 'Expand' : 'Collapse'"
:isCollapsed="isSidebarCollapsed"
:isCollapsed="isSidebarCollapsed.value"
@click="isSidebarCollapsed = !isSidebarCollapsed"
class="m-2"
>
Expand All @@ -41,23 +41,22 @@
</template>

<script setup lang="ts">
import { useStorage } from '@vueuse/core'
import {
Book,
Database,
DatabaseZap,
LayoutGrid,
PanelRightOpen,
SettingsIcon,
Warehouse,
} from 'lucide-vue-next'
import { computed, ref, watch } from 'vue'
import { computed, ref } from 'vue'
import useSettings from '../settings/settings'
import Settings from '../settings/Settings.vue'
import SidebarLink from './SidebarLink.vue'
import UserDropdown from './UserDropdown.vue'
import { waitUntil } from '../helpers'
import useSettings from '../settings/settings'
const isSidebarCollapsed = ref(false)
const isSidebarCollapsed = useStorage('insights:sidebarCollapsed', false)
const showSettingsDialog = ref(false)
const settings = useSettings()
Expand Down
26 changes: 25 additions & 1 deletion frontend/src2/query/components/NativeQueryEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import ContentEditable from '../../components/ContentEditable.vue'
import DataSourceSelector from './source_selector/DataSourceSelector.vue'
import { wheneverChanges } from '../../helpers'
import useDataSourceStore from '../../data_source/data_source'
import { column } from '../../query/helpers'
const query = inject<Query>('query')!
const sortOrder = ref<Record<string, 'asc' | 'desc'>>({});
query.autoExecute = false
const operation = query.getSQLOperation()
Expand Down Expand Up @@ -71,6 +74,20 @@ const completions = computed(() => {
tables,
}
})
function onSort(newSortOrder: Record<string, 'asc' | 'desc'>) {
sortOrder.value = newSortOrder;
Object.entries(newSortOrder).forEach(([columnName, direction]) => {
query.addOrderBy({
column: column(columnName),
direction,
});
});
query.execute();
}
</script>

<template>
Expand Down Expand Up @@ -125,7 +142,14 @@ const completions = computed(() => {
<LoadingIndicator class="h-8 w-8 text-gray-700" />
</div>

<DataTable :columns="columns" :rows="rows" :on-export="query.downloadResults">
<DataTable
:columns="columns"
:rows="rows"
:enable-pagination="true"
:on-export="query.downloadResults"
:sort-order="sortOrder"
@sort="onSort"
>
<template #footer-left>
<div class="tnum flex items-center gap-2 text-sm text-gray-600">
<span> Showing {{ previewRowCount }} of </span>
Expand Down

0 comments on commit 1105475

Please sign in to comment.