1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

4 Commits

Author SHA1 Message Date
lana-k
12fa0749b1 Update package.json 2025-07-30 23:27:35 +02:00
saaj
75bf849823 Build SQLite 3.50.3 (#124)
* Build SQLite 3.50.3

* Update pivot_vtab, base in Dockerfile.test, fix test after SQLite 3.47

* Update CI image for tests
2025-07-30 23:26:22 +02:00
lana-k
3ee825defe fix standart chart resize in pivot, improve performance 2025-04-03 22:36:50 +02:00
lana-k
77df3a8446 use only camel case for props 2025-03-30 21:01:06 +02:00
31 changed files with 240 additions and 144 deletions

View File

@@ -14,7 +14,9 @@ module.exports = {
'vue/no-mutating-props': 'warn',
'vue/no-reserved-component-names': 'warn',
'vue/no-v-model-argument': 'off',
'vue/require-default-prop': 'off'
'vue/require-default-prop': 'off',
'vue/custom-event-name-casing': ['error', 'camelCase'],
'vue/attribute-hyphenation': ['error', 'never']
},
overrides: [
{

View File

@@ -11,7 +11,7 @@ on:
jobs:
test:
name: Run tests
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Use Node.js
@@ -21,8 +21,9 @@ jobs:
- name: Install browsers
run: |
export DEBIAN_FRONTEND=noninteractive
sudo add-apt-repository -y ppa:mozillateam/ppa
sudo apt-get update
sudo apt-get install -y chromium-browser firefox
sudo apt-get install -y chromium-browser firefox-esr
- name: Update npm
run: npm install -g npm@10

View File

@@ -3,7 +3,7 @@
# docker build -t sqliteviz/test -f Dockerfile.test .
#
FROM node:12.22-buster
FROM node:12.22-bullseye
RUN set -ex; \
apt update; \

View File

@@ -10,7 +10,7 @@ from pathlib import Path
from urllib import request
amalgamation_url = 'https://sqlite.org/2023/sqlite-amalgamation-3410000.zip'
amalgamation_url = 'https://sqlite.org/2025/sqlite-amalgamation-3500300.zip'
# Extension-functions
# ===================
@@ -22,15 +22,15 @@ contrib_functions_url = 'https://sqlite.org/contrib/download/extension-functions
extension_urls = (
# Miscellaneous extensions
# ========================
('https://sqlite.org/src/raw/8d79354f?at=series.c', 'sqlite3_series_init'),
('https://sqlite.org/src/raw/dbfd8543?at=closure.c', 'sqlite3_closure_init'),
('https://sqlite.org/src/raw/e212edb2?at=series.c', 'sqlite3_series_init'),
('https://sqlite.org/src/raw/5559daf1?at=closure.c', 'sqlite3_closure_init'),
('https://sqlite.org/src/raw/5bb2264c?at=uuid.c', 'sqlite3_uuid_init'),
('https://sqlite.org/src/raw/5853b0e5?at=regexp.c', 'sqlite3_regexp_init'),
('https://sqlite.org/src/raw/b9086e22?at=percentile.c', 'sqlite3_percentile_init'),
('https://sqlite.org/src/raw/09f967dc?at=decimal.c', 'sqlite3_decimal_init'),
('https://sqlite.org/src/raw/388e7f23?at=regexp.c', 'sqlite3_regexp_init'),
('https://sqlite.org/src/raw/72e05a21?at=percentile.c', 'sqlite3_percentile_init'),
('https://sqlite.org/src/raw/228d47e9?at=decimal.c', 'sqlite3_decimal_init'),
# Third-party extension
# =====================
('https://github.com/jakethaw/pivot_vtab/raw/9323ef93/pivot_vtab.c', 'sqlite3_pivotvtab_init'),
('https://github.com/jakethaw/pivot_vtab/raw/e7705f34/pivot_vtab.c', 'sqlite3_pivotvtab_init'),
('https://github.com/nalgeon/sqlean/raw/95e8d21a/src/pearson.c', 'sqlite3_pearson_init'),
# Third-party extension with own dependencies
# ===========================================

File diff suppressed because one or more lines are too long

Binary file not shown.

24
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "sqliteviz",
"version": "0.25.1",
"version": "0.26.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sqliteviz",
"version": "0.25.1",
"version": "0.26.0",
"license": "Apache-2.0",
"dependencies": {
"buffer": "^6.0.3",
@@ -3259,12 +3259,20 @@
"resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz",
"integrity": "sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA=="
},
"node_modules/@types/prop-types": {
"version": "15.7.14",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz",
"integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==",
"peer": true
},
"node_modules/@types/react": {
"version": "19.0.10",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.10.tgz",
"integrity": "sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g==",
"version": "17.0.85",
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.85.tgz",
"integrity": "sha512-5oBDUsRDsrYq4DdyHaL99gE1AJCfuDhyxqF6/55fvvOIRkp1PpKuwJ+aMiGJR+GJt7YqMNclPROTHF20vY2cXA==",
"peer": true,
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "^0.16",
"csstype": "^3.0.2"
}
},
@@ -3276,6 +3284,12 @@
"@types/react": "*"
}
},
"node_modules/@types/scheduler": {
"version": "0.16.8",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz",
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
"peer": true
},
"node_modules/@types/supercluster": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.3.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "sqliteviz",
"version": "0.26.0",
"version": "0.26.1",
"license": "Apache-2.0",
"private": true,
"type": "module",

View File

@@ -1,10 +1,10 @@
<template>
<modal
:modal-id="dialogName"
:modalId="dialogName"
class="dialog"
content-class="import-modal"
contentClass="import-modal"
scrollable
:click-to-close="false"
:clickToClose="false"
>
<div class="dialog-header">
{{ typeName }} import
@@ -17,7 +17,7 @@
label="Table name"
width="484px"
:disabled="disableDialog"
:error-msg="tableNameError"
:errorMsg="tableNameError"
/>
<div v-if="!isJson && !isNdJson" class="chars">
<delimiter-selector
@@ -45,7 +45,7 @@
The character used to escape the quote character within a field
(e.g. "column with ""quotes"" in text").
'
max-hint-width="242px"
maxHintWidth="242px"
width="93px"
:disabled="disableDialog"
class="char-input"

View File

@@ -47,7 +47,7 @@
ref="addCsvJson"
:file="file"
:db="newDb"
dialog-name="importFromCsvJson"
dialogName="importFromCsvJson"
@cancel="cancelImport"
@finish="finish"
/>

View File

@@ -1,10 +1,10 @@
<template>
<modal
:modal-id="name"
:modalId="name"
class="dialog"
:click-to-close="false"
:content-transition="{ name: 'loading-dialog' }"
:overlay-transition="{ name: 'loading-dialog' }"
:clickToClose="false"
:contentTransition="{ name: 'loading-dialog' }"
:overlayTransition="{ name: 'loading-dialog' }"
>
<div class="dialog-header">
{{ title }}

View File

@@ -1,19 +1,19 @@
<template>
<paginate
v-model="page"
:page-count="pageCount"
:page-range="5"
:margin-pages="1"
:prev-text="chevron"
:next-text="chevron"
:no-li-surround="true"
container-class="paginator-continer"
page-link-class="paginator-page-link"
active-class="paginator-active-page"
break-view-link-class="paginator-break"
next-link-class="paginator-next"
prev-link-class="paginator-prev"
disabled-class="paginator-disabled"
:pageCount="pageCount"
:pageRange="5"
:marginPages="1"
:prevText="chevron"
:nextText="chevron"
:noLiSurround="true"
containerClass="paginator-continer"
pageLinkClass="paginator-page-link"
activeClass="paginator-active-page"
breakViewLinkClass="paginator-break"
nextLinkClass="paginator-next"
prevLinkClass="paginator-prev"
disabledClass="paginator-disabled"
/>
</template>

View File

@@ -62,7 +62,7 @@
<pager
v-show="pageCount > 1"
v-model="currentPage"
:page-count="pageCount"
:pageCount="pageCount"
/>
</div>
</div>

View File

@@ -9,7 +9,7 @@
v-if="hint"
class="hint"
:hint="hint"
:max-width="maxHintWidth || '149px'"
:maxWidth="maxHintWidth || '149px'"
/>
</div>
<input

View File

@@ -5,7 +5,7 @@
src="~@/assets/images/info.svg"
@click="$modal.show('app-info')"
/>
<modal modal-id="app-info" class="dialog" content-class="app-info-modal">
<modal modalId="app-info" class="dialog" contentClass="app-info-modal">
<div class="dialog-header">
App info
<close-icon @click="$modal.hide('app-info')" />

View File

@@ -122,7 +122,7 @@
<copy-icon @click="duplicateInquiry(index)" />
<export-icon
tooltip="Export inquiry to file"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="exportToFile([inquiry], `${inquiry.name}.json`)"
/>
<delete-icon
@@ -140,7 +140,7 @@
</div>
<!--Rename Inquiry dialog -->
<modal modal-id="rename" class="dialog" content-style="width: 560px;">
<modal modalId="rename" class="dialog" contentStyle="width: 560px;">
<div class="dialog-header">
Rename inquiry
<close-icon @click="$modal.hide('rename')" />
@@ -149,7 +149,7 @@
<text-field
v-model="newName"
label="New inquiry name"
:error-msg="errorMsg"
:errorMsg="errorMsg"
width="100%"
/>
</div>
@@ -160,7 +160,7 @@
</modal>
<!--Delete Inquiry dialog -->
<modal modal-id="delete" class="dialog" content-style="width: 480px;">
<modal modalId="delete" class="dialog" contentStyle="width: 480px;">
<div class="dialog-header">
Delete {{ deleteGroup ? 'inquiries' : 'inquiry' }}
<close-icon @click="$modal.hide('delete')" />

View File

@@ -25,7 +25,7 @@
</div>
<!--Save Inquiry dialog -->
<modal modal-id="save" class="dialog" content-style="width: 560px;">
<modal modalId="save" class="dialog" contentStyle="width: 560px;">
<div class="dialog-header">
Save inquiry
<close-icon @click="cancelSave" />
@@ -39,7 +39,7 @@
<text-field
v-model="name"
label="Inquiry name"
:error-msg="errorMsg"
:errorMsg="errorMsg"
width="100%"
/>
</div>

View File

@@ -26,7 +26,7 @@
ref="addCsvJson"
:file="file"
:db="$store.state.db"
dialog-name="addCsvJson"
dialogName="addCsvJson"
/>
</div>
</template>

View File

@@ -1,6 +1,6 @@
<template>
<div ref="chartContainer" class="chart-container">
<div v-show="!dataSources && visible" class="warning chart-warning">
<div v-show="!dataSources" class="warning chart-warning">
There is no data to build a chart. Run your SQL query and make sure the
result is not empty.
</div>
@@ -9,18 +9,17 @@
:style="{ height: !dataSources ? 'calc(100% - 40px)' : '100%' }"
>
<PlotlyEditor
v-show="visible"
ref="plotlyEditor"
:data="state.data"
:layout="state.layout"
:frames="state.frames"
:config="config"
:data-sources="dataSources"
:data-source-options="dataSourceOptions"
:dataSources="dataSources"
:dataSourceOptions="dataSourceOptions"
:plotly="plotly"
:use-resize-handler="useResizeHandler"
:useResizeHandler="useResizeHandler"
:debug="true"
:advanced-trace-type-selector="true"
:advancedTraceTypeSelector="true"
@update="update"
@render="onRender"
/>
@@ -64,7 +63,6 @@ export default {
displaylogo: false,
modeBarButtonsToRemove: ['toImage']
},
visible: true,
resizeObserver: null,
useResizeHandler: this.$store.state.isWorkspaceVisible
}
@@ -137,7 +135,7 @@ export default {
updatePlotly() {
const plotComponent = this.$refs.plotlyEditor.plotComponentRef.current
plotComponent.updatePlotly(
false, // shouldInvokeResizeHandler
true, // shouldInvokeResizeHandler
plotComponent.props.onUpdate, // figureCallbackFunction
false // shouldAttachUpdateEvents
)

View File

@@ -9,11 +9,11 @@
:options="colsToSelect"
:disabled="colsToSelect.length === 0"
:multiple="true"
:hide-selected="true"
:close-on-select="true"
:show-labels="false"
:hideSelected="true"
:closeOnSelect="true"
:showLabels="false"
:max="colsToSelect.length"
open-direction="bottom"
openDirection="bottom"
placeholder=""
>
<template #maxElements>
@@ -37,12 +37,12 @@
:options="rowsToSelect"
:disabled="rowsToSelect.length === 0"
:multiple="true"
:hide-selected="true"
:close-on-select="true"
:show-labels="false"
:hideSelected="true"
:closeOnSelect="true"
:showLabels="false"
:max="rowsToSelect.length"
:option-height="29"
open-direction="bottom"
:optionHeight="29"
openDirection="bottom"
placeholder=""
>
<template #maxElements>
@@ -65,12 +65,12 @@
class="sqliteviz-select short aggregator"
:options="aggregators"
label="name"
track-by="name"
:close-on-select="true"
:show-labels="false"
:hide-selected="true"
:option-height="29"
open-direction="bottom"
trackBy="name"
:closeOnSelect="true"
:showLabels="false"
:hideSelected="true"
:optionHeight="29"
openDirection="bottom"
placeholder="Choose a function"
>
<template #noResult>
@@ -84,11 +84,11 @@
class="sqliteviz-select aggr-arg"
:options="keyNames"
:disabled="keyNames.length === 0"
:close-on-select="true"
:show-labels="false"
:hide-selected="true"
:option-height="29"
open-direction="bottom"
:closeOnSelect="true"
:showLabels="false"
:hideSelected="true"
:optionHeight="29"
openDirection="bottom"
placeholder="Choose an argument"
/>
@@ -98,11 +98,11 @@
class="sqliteviz-select aggr-arg"
:options="keyNames"
:disabled="keyNames.length === 0"
:close-on-select="true"
:show-labels="false"
:hide-selected="true"
:option-height="29"
open-direction="bottom"
:closeOnSelect="true"
:showLabels="false"
:hideSelected="true"
:optionHeight="29"
openDirection="bottom"
placeholder="Choose a second argument"
/>
</div>
@@ -114,13 +114,13 @@
class="sqliteviz-select short renderer"
:options="renderers"
label="name"
track-by="name"
:close-on-select="true"
:allow-empty="false"
:show-labels="false"
:hide-selected="true"
:option-height="29"
open-direction="bottom"
trackBy="name"
:closeOnSelect="true"
:allowEmpty="false"
:showLabels="false"
:hideSelected="true"
:optionHeight="29"
openDirection="bottom"
placeholder="Choose a view"
>
<template #noResult>

View File

@@ -6,7 +6,7 @@
</div>
<pivot-ui
v-model="pivotOptions"
:key-names="columns"
:keyNames="columns"
@update="$emit('update')"
/>
<div ref="pivotOutput" class="pivot-output" />
@@ -35,6 +35,7 @@ import pivotHelper from './pivotHelper'
import Chart from '@/views/MainView/Workspace/Tabs/Tab/DataView/Chart'
import chartHelper from '@/lib/chartHelper'
import events from '@/lib/utils/events'
import plotly from 'plotly.js'
export default {
name: 'Pivot',
@@ -130,17 +131,19 @@ export default {
// We need to detect resizing because plotly doesn't resize when resize its container
// but it resize on window.resize (we will trigger it manualy in order to make plotly resize)
this.resizeObserver = new ResizeObserver(this.handleResize)
this.resizeObserver.observe(this.$refs.customChartOutput)
this.resizeObserver.observe(this.$refs.pivotOutput)
},
beforeUnmount() {
this.resizeObserver.unobserve(this.$refs.customChartOutput)
this.resizeObserver.unobserve(this.$refs.pivotOutput)
},
methods: {
handleResize() {
// hack: plotly changes size only on window.resize event,
// so, we trigger it when container resizes (e.g. when move splitter)
// so, we resize it manually when container resizes (e.g. when move splitter)
if (this.viewStandartChart) {
window.dispatchEvent(new Event('resize'))
plotly.Plots.resize(
this.$refs.pivotOutput.querySelector('.js-plotly-plot')
)
}
},
@@ -184,9 +187,7 @@ export default {
)
// fix for Firefox: fit plotly renderers just after choosing it in pivotUi
if (this.viewStandartChart) {
window.dispatchEvent(new Event('resize'))
}
this.handleResize()
},
getOptionsForSave() {

View File

@@ -4,9 +4,9 @@
<component
:is="mode"
ref="viewComponent"
v-model:import-to-png-enabled="importToPngEnabled"
v-model:import-to-svg-enabled="importToSvgEnabled"
:init-options="mode === initMode ? initOptions : undefined"
v-model:importToPngEnabled="importToPngEnabled"
v-model:importToSvgEnabled="importToSvgEnabled"
:initOptions="mode === initMode ? initOptions : undefined"
:data-sources="dataSource"
@loading-image-completed="loadingImage = false"
@update="$emit('update')"
@@ -16,7 +16,7 @@
<icon-button
:active="mode === 'chart'"
tooltip="Switch to chart"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="mode = 'chart'"
>
<chart-icon />
@@ -25,7 +25,7 @@
ref="pivotBtn"
:active="mode === 'pivot'"
tooltip="Switch to pivot"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="mode = 'pivot'"
>
<pivot-icon />
@@ -37,7 +37,7 @@
:disabled="!importToPngEnabled || loadingImage"
:loading="loadingImage"
tooltip="Save as PNG image"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="saveAsPng"
>
<png-icon />
@@ -46,7 +46,7 @@
ref="svgExportBtn"
:disabled="!importToSvgEnabled"
tooltip="Save as SVG"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="saveAsSvg"
>
<export-to-svg-icon />
@@ -55,7 +55,7 @@
<icon-button
ref="htmlExportBtn"
tooltip="Save as HTML"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="saveAsHtml"
>
<HtmlIcon />
@@ -64,7 +64,7 @@
ref="copyToClipboardBtn"
:loading="copyingImage"
tooltip="Copy visualisation to clipboard"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="prepareCopy"
>
<clipboard-icon />
@@ -72,9 +72,9 @@
</side-tool-bar>
<loading-dialog
loading-msg="Rendering the visualisation..."
success-msg="Image is ready"
action-btn-name="Copy"
loadingMsg="Rendering the visualisation..."
successMsg="Image is ready"
actionBtnName="Copy"
name="prepareCopy"
title="Copy to clipboard"
:loading="preparingCopy"

View File

@@ -3,7 +3,7 @@
<icon-button
:disabled="modelValue === 0"
tooltip="First row"
tooltip-position="top-left"
tooltipPosition="top-left"
class="first"
@click="$emit('update:modelValue', 0)"
>
@@ -12,7 +12,7 @@
<icon-button
:disabled="modelValue === 0"
tooltip="Previous row"
tooltip-position="top-left"
tooltipPosition="top-left"
class="prev"
@click="$emit('update:modelValue', modelValue - 1)"
>
@@ -21,7 +21,7 @@
<icon-button
:disabled="modelValue === total - 1"
tooltip="Next row"
tooltip-position="top-left"
tooltipPosition="top-left"
class="next"
@click="$emit('update:modelValue', modelValue + 1)"
>
@@ -30,7 +30,7 @@
<icon-button
:disabled="modelValue === total - 1"
tooltip="Last row"
tooltip-position="top-left"
tooltipPosition="top-left"
class="last"
@click="$emit('update:modelValue', total - 1)"
>

View File

@@ -21,7 +21,7 @@
<div class="value-viewer-container">
<value-viewer
v-show="selectedCell"
:cell-value="
:cellValue="
selectedCell
? result.values[result.columns[selectedCell.dataset.col]][
selectedCell.dataset.row
@@ -40,7 +40,7 @@
<icon-button
:disabled="!result"
tooltip="Export result set to CSV file"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="exportToCsv"
>
<export-to-csv-icon />
@@ -50,7 +50,7 @@
ref="copyToClipboardBtn"
:disabled="!result"
tooltip="Copy result set to clipboard"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="prepareCopy"
>
<clipboard-icon />
@@ -60,7 +60,7 @@
ref="rowBtn"
:disabled="!result"
tooltip="View record"
tooltip-position="top-left"
tooltipPosition="top-left"
:active="viewRecord"
@click="toggleViewRecord"
>
@@ -71,7 +71,7 @@
ref="viewCellValueBtn"
:disabled="!result"
tooltip="View value"
tooltip-position="top-left"
tooltipPosition="top-left"
:active="viewValuePanelVisible"
@click="toggleViewValuePanel"
>
@@ -80,9 +80,9 @@
</side-tool-bar>
<loading-dialog
loading-msg="Building CSV..."
success-msg="CSV is ready"
action-btn-name="Copy"
loadingMsg="Building CSV..."
successMsg="CSV is ready"
actionBtnName="Copy"
name="prepareCSVCopy"
title="Copy to clipboard"
:loading="preparingCopy"
@@ -113,9 +113,9 @@
v-if="result && !viewRecord"
:data-set="result"
:time="time"
:page-size="pageSize"
:pageSize="pageSize"
:page="defaultPage"
:selected-cell-coordinates="defaultSelectedCell"
:selectedCellCoordinates="defaultSelectedCell"
class="straight"
@update-selected-cell="onUpdateSelectedCell"
/>
@@ -125,8 +125,8 @@
ref="recordView"
:data-set="result"
:time="time"
:selected-column-index="selectedCell ? +selectedCell.dataset.col : 0"
:row-index="selectedCell ? +selectedCell.dataset.row : 0"
:selectedColumnIndex="selectedCell ? +selectedCell.dataset.col : 0"
:rowIndex="selectedCell ? +selectedCell.dataset.row : 0"
@update-selected-cell="onUpdateSelectedCell"
/>
</div>

View File

@@ -4,7 +4,7 @@
ref="sqlEditorBtn"
:active="panel === 'sqlEditor'"
tooltip="Switch panel to SQL editor"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="$emit('switchTo', 'sqlEditor')"
>
<sql-editor-icon />
@@ -14,7 +14,7 @@
ref="tableBtn"
:active="panel === 'table'"
tooltip="Switch panel to result set"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="$emit('switchTo', 'table')"
>
<table-icon />
@@ -24,7 +24,7 @@
ref="dataViewBtn"
:active="panel === 'dataView'"
tooltip="Switch panel to data view"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="$emit('switchTo', 'dataView')"
>
<data-view-icon />

View File

@@ -5,7 +5,7 @@
ref="cm"
v-model:value="query"
:options="cmOptions"
:original-style="true"
:originalStyle="true"
@change="onChange"
/>
</div>
@@ -15,7 +15,7 @@
:disabled="runDisabled"
:loading="isGettingResults"
tooltip="Run SQL query"
tooltip-position="top-left"
tooltipPosition="top-left"
@click="$emit('run')"
>
<run-icon :disabled="runDisabled" />

View File

@@ -25,7 +25,7 @@
<sql-editor
ref="sqlEditor"
v-model="tab.query"
:is-getting-results="tab.isGettingResults"
:isGettingResults="tab.isGettingResults"
@switch-to="onSwitchView('sqlEditor', $event)"
@run="tab.execute()"
/>
@@ -39,7 +39,7 @@
<run-result
:tab="tab"
:result="tab.result"
:is-getting-results="tab.isGettingResults"
:isGettingResults="tab.isGettingResults"
:error="tab.error"
:time="tab.time"
@switch-to="onSwitchView('table', $event)"
@@ -54,8 +54,8 @@
<data-view
ref="dataView"
:data-source="(tab.result && tab.result.values) || null"
:init-options="tab.viewOptions"
:init-mode="tab.viewType"
:initOptions="tab.viewOptions"
:initMode="tab.viewType"
@switch-to="onSwitchView('dataView', $event)"
@update="onDataViewUpdate"
/>
@@ -134,7 +134,6 @@ export default {
const fromPosition = this.tab.layout[from]
this.tab.layout[from] = this.tab.layout[to]
this.tab.layout[to] = fromPosition
window.dispatchEvent(new Event('resize'))
events.send('inquiry.panel', null, { panel: to })
},

View File

@@ -29,7 +29,7 @@
</div>
<!--Close tab warning dialog -->
<modal modal-id="close-warn" class="dialog" content-style="width: 560px;">
<modal modalId="close-warn" class="dialog" contentStyle="width: 560px;">
<div class="dialog-header">
Close tab
{{

View File

@@ -413,7 +413,7 @@ describe('SQLite extensions', function () {
WHERE ip.id <= p.id
) AS path
FROM tmp, json_each(filename_array) AS p
WHERE p.id > 1 -- because the filenames start with the separator
WHERE p.key > 0 -- because the filenames start with the separator
`)
expect(actual.values).to.eql({
path: [

View File

@@ -123,10 +123,8 @@ describe('Chart.vue', () => {
const newContainerWidth = initialContainerWidth * 2 || 1000
const newContainerHeight = initialContainerHeight * 2 || 2000
wrapper.find('.chart-container').wrapperElement.parentElement.style.width =
`${newContainerWidth}px`
wrapper.find('.chart-container').wrapperElement.parentElement.style.height =
`${newContainerHeight}px`
container.style.width = `${newContainerWidth}px`
container.style.height = `${newContainerHeight}px`
await flushPromises()
@@ -179,4 +177,34 @@ describe('Chart.vue', () => {
expect(fIo.downloadFromUrl.calledOnceWith(url, 'chart'))
wrapper.unmount()
})
it('dataSources are passed correctly', async () => {
const dataSources = {
name: ['Gryffindor'],
points: [80]
}
const wrapper = mount(Chart, {
attachTo: document.body,
props: {
dataSources
},
global: {
mocks: { $store }
}
})
await flushPromises()
await wrapper.find('button.js-add-button').wrapperElement.click()
await flushPromises()
await wrapper
.find('.field .dropdown-container .Select__indicator')
.wrapperElement.dispatchEvent(
new MouseEvent('mousedown', { bubbles: true })
)
expect(wrapper.find('.Select__menu').text()).to.contain('name' + 'points')
wrapper.unmount()
})
})

View File

@@ -1,5 +1,5 @@
import { expect } from 'chai'
import { mount } from '@vue/test-utils'
import { mount, flushPromises } from '@vue/test-utils'
import Pivot from '@/views/MainView/Workspace/Tabs/Tab/DataView/Pivot'
import chartHelper from '@/lib/chartHelper'
import fIo from '@/lib/utils/fileIo'
@@ -533,4 +533,57 @@ describe('Pivot.vue', () => {
fIo.downloadFromUrl.calledOnceWith('canvas data url', 'pivot')
).to.equal(true)
})
it('resizes standart chart', async () => {
const wrapper = mount(Pivot, {
global: {
mocks: { $store: { state: { isWorkspaceVisible: true } } }
},
props: {
dataSources: {
item: ['foo', 'bar', 'bar', 'bar'],
year: [2021, 2021, 2020, 2020]
},
initOptions: {
rows: ['item'],
cols: ['year'],
colOrder: 'key_a_to_z',
rowOrder: 'key_a_to_z',
aggregatorName: 'Count',
vals: [],
renderer: $.pivotUtilities.renderers['Bar Chart'],
rendererName: 'Bar Chart'
}
},
attachTo: container
})
await flushPromises()
const plotContainer = wrapper.find('.pivot-output').wrapperElement
const plot = wrapper.find('.svg-container').wrapperElement
const initialContainerWidth = plotContainer.scrollWidth
const initialContainerHeight = plotContainer.scrollHeight
const initialPlotWidth = plot.scrollWidth
const initialPlotHeight = plot.scrollHeight
const newContainerWidth = initialContainerWidth * 2 || 1000
const newContainerHeight = initialContainerHeight * 2 || 2000
plotContainer.style.width = `${newContainerWidth}px`
plotContainer.style.height = `${newContainerHeight}px`
await flushPromises()
const plotAfterResize = wrapper.find('.svg-container').wrapperElement
expect(plotAfterResize.scrollWidth).not.to.equal(initialPlotWidth)
expect(plotAfterResize.scrollWidth.scrollHeight).not.to.equal(
initialPlotHeight
)
wrapper.unmount()
})
})