Skip to content

Commit

Permalink
Merge pull request #228 from frappe/develop
Browse files Browse the repository at this point in the history
chore: merge `develop` into `main`
  • Loading branch information
nextchamp-saqib authored Feb 21, 2024
2 parents 458cd15 + eeb0609 commit 78e0b25
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 38 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Charts/BaseChart.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import { areDeeplyEqual } from '@/utils'
import * as echarts from 'echarts'
import { onBeforeUnmount, onMounted, onUpdated, ref, watch } from 'vue'
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
import ChartTitle from './ChartTitle.vue'
const props = defineProps({
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Controls/Attachment.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="flex flex-col text-base">
<div class="flex flex-col overflow-hidden text-base">
<span class="mb-2 block text-sm leading-4 text-gray-700">
{{ label || 'Attach File' }}
</span>
Expand All @@ -14,14 +14,14 @@
/>

<!-- Upload Button -->
<Button v-if="!file?.name" class="form-input h-7" @click="upload" :loading="uploading">
<Button v-if="!file?.name" @click="upload" :loading="uploading">
<FeatherIcon name="upload" class="mr-1 inline-block h-3 w-3" />
{{ placeholder || 'Upload a file' }}
</Button>

<!-- Clear Button -->
<Button v-else class="form-input h-7" iconRight="x" @click="clear">
{{ file.file_name }}
<Button v-else iconRight="x" @click="clear">
<span class="truncate">{{ file.file_name }}</span>
</Button>
</div>
</template>
Expand Down
12 changes: 1 addition & 11 deletions frontend/src/query/PublicChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,5 @@ const chart = usePublicChart(props.public_key)
:data="chart.data"
:options="chart.doc.options"
:key="JSON.stringify(chart.doc.options)"
>
<template #placeholder>
<InvalidWidget
class="absolute"
title="Insufficient options"
message="Please check the options for this chart"
icon="settings"
icon-class="text-gray-500"
/>
</template>
</component>
/>
</template>
4 changes: 3 additions & 1 deletion frontend/src/query/usePublicChart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { safeJSONParse } from '@/utils'
import { getFormattedResult } from '@/utils/query/results'
import { convertResultToObjects } from '@/widgets/useChartData'
import { createResource } from 'frappe-ui'
import { reactive } from 'vue'

Expand All @@ -22,7 +23,8 @@ export default function usePublicChart(publicKey) {
async function load() {
state.loading = true
state.doc = await resource.fetch()
state.data = getFormattedResult(state.doc.data)
const results = getFormattedResult(state.doc.data)
state.data = convertResultToObjects(results)
state.loading = false
}
load()
Expand Down
11 changes: 4 additions & 7 deletions frontend/src/query/visual/ColumnExpressionEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const emptyExpressionColumn = {
}
const assistedQuery = inject('assistedQuery')
const emit = defineEmits(['save', 'discard', 'remove'])
const emit = defineEmits(['save', 'remove'])
const props = defineProps({ column: Object })
const propsColumn = props.column || emptyExpressionColumn
Expand Down Expand Up @@ -83,12 +83,9 @@ function onSave() {
</div>
</div>

<div class="flex flex-col justify-between gap-2 lg:flex-row">
<Button variant="outline" @click="emit('discard')"> Discard </Button>
<div class="flex flex-col gap-2 lg:flex-row">
<Button variant="outline" theme="red" @click="emit('remove')">Remove</Button>
<Button variant="solid" :disabled="!isValid" @click="onSave"> Save </Button>
</div>
<div class="flex flex-col justify-end gap-2 lg:flex-row">
<Button variant="outline" theme="red" @click="emit('remove')">Remove</Button>
<Button variant="solid" :disabled="!isValid" @click="onSave"> Save </Button>
</div>
</div>
</template>
29 changes: 15 additions & 14 deletions frontend/src/query/visual/ColumnSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,21 @@ function onColumnSort(e) {
</DraggableList>
</div>

<Dialog
:modelValue="showExpressionEditor"
:options="{
title: 'Column Expression',
size: '3xl',
}"
>
<template #body-content>
<ColumnExpressionEditor
:column="columns[activeColumnIdx]"
@remove="onRemoveColumn"
@save="onSaveColumn"
@discard="activeColumnIdx = null"
/>
<Dialog :modelValue="showExpressionEditor" :options="{ size: '3xl' }">
<template #body>
<div class="bg-white px-4 pb-6 pt-5 sm:px-6">
<div class="flex items-center justify-between pb-4">
<h3 class="text-2xl font-semibold leading-6 text-gray-900">
Column Expression
</h3>
<Button variant="ghost" @click="activeColumnIdx = null" icon="x"> </Button>
</div>
<ColumnExpressionEditor
:column="columns[activeColumnIdx]"
@remove="onRemoveColumn"
@save="onSaveColumn"
/>
</div>
</template>
</Dialog>
</template>

0 comments on commit 78e0b25

Please sign in to comment.