mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
Pivot implementation and redesign (#69)
- Pivot support implementation - Rename queries into inquiries - Rename editor into workspace - Change result set format - New JSON format for inquiries - Redesign panels
This commit is contained in:
@@ -58,12 +58,10 @@ describe('CsvImport.vue', () => {
|
||||
sinon.stub(csv, 'parse').resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
messages: [{
|
||||
code: 'UndetectableDelimiter',
|
||||
message: 'Comma was used as a standart delimiter',
|
||||
@@ -101,11 +99,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
}
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1
|
||||
})
|
||||
|
||||
wrapper.vm.previewCsv()
|
||||
@@ -116,11 +113,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: ',',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [2],
|
||||
col2: ['bar']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false
|
||||
})
|
||||
await wrapper.find('.delimiter-selector-container input').setValue(',')
|
||||
@@ -137,11 +133,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(2).resolves({
|
||||
delimiter: ',',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[3, 'baz']
|
||||
]
|
||||
col1: [3],
|
||||
col2: ['baz']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: true,
|
||||
messages: [{
|
||||
code: 'MissingQuotes',
|
||||
@@ -167,11 +162,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(3).resolves({
|
||||
delimiter: ',',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[4, 'qux']
|
||||
]
|
||||
col1: [4],
|
||||
col2: ['qux']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false
|
||||
})
|
||||
await wrapper.find('#escape-char input').setValue("'")
|
||||
@@ -187,11 +181,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(4).resolves({
|
||||
delimiter: ',',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[5, 'corge']
|
||||
]
|
||||
col1: [5],
|
||||
col2: ['corge']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false
|
||||
})
|
||||
await wrapper.findComponent({ name: 'check-box' }).trigger('click')
|
||||
@@ -210,11 +203,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
}
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1
|
||||
})
|
||||
|
||||
wrapper.vm.previewCsv()
|
||||
@@ -264,11 +256,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -276,12 +267,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -322,11 +311,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -334,12 +322,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
hasErrors: false,
|
||||
messages: [{
|
||||
code: 'UndetectableDelimiter',
|
||||
@@ -387,11 +373,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -399,12 +384,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
hasErrors: true,
|
||||
messages: [{
|
||||
code: 'Error',
|
||||
@@ -446,11 +429,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -458,12 +440,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -516,11 +496,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -528,12 +507,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -568,11 +545,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(0).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -580,12 +556,10 @@ describe('CsvImport.vue', () => {
|
||||
parse.onCall(1).resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
rowCount: 2,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -622,11 +596,10 @@ describe('CsvImport.vue', () => {
|
||||
sinon.stub(csv, 'parse').resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
@@ -651,11 +624,10 @@ describe('CsvImport.vue', () => {
|
||||
sinon.stub(csv, 'parse').resolves({
|
||||
delimiter: '|',
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo']
|
||||
]
|
||||
col1: [1],
|
||||
col2: ['foo']
|
||||
},
|
||||
rowCount: 1,
|
||||
hasErrors: false,
|
||||
messages: []
|
||||
})
|
||||
|
||||
@@ -19,11 +19,9 @@ describe('csv.js', () => {
|
||||
}
|
||||
}
|
||||
expect(csv.getResult(source)).to.eql({
|
||||
columns: ['id', 'name', 'date'],
|
||||
values: [
|
||||
[1, 'foo', '2021-06-30T14:10:24.717Z'],
|
||||
[2, 'bar', '2021-07-30T14:10:15.717Z']
|
||||
]
|
||||
id: [1, 2],
|
||||
name: ['foo', 'bar'],
|
||||
date: ['2021-06-30T14:10:24.717Z', '2021-07-30T14:10:15.717Z']
|
||||
})
|
||||
})
|
||||
|
||||
@@ -36,11 +34,9 @@ describe('csv.js', () => {
|
||||
meta: {}
|
||||
}
|
||||
expect(csv.getResult(source)).to.eql({
|
||||
columns: ['col1', 'col2', 'col3'],
|
||||
values: [
|
||||
[1, 'foo', '2021-06-30T14:10:24.717Z'],
|
||||
[2, 'bar', '2021-07-30T14:10:15.717Z']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar'],
|
||||
col3: ['2021-06-30T14:10:24.717Z', '2021-07-30T14:10:15.717Z']
|
||||
})
|
||||
})
|
||||
|
||||
@@ -77,13 +73,11 @@ describe('csv.js', () => {
|
||||
const result = await csv.parse(file)
|
||||
expect(result).to.eql({
|
||||
data: {
|
||||
columns: ['col1', 'col2'],
|
||||
values: [
|
||||
[1, 'foo'],
|
||||
[2, 'bar']
|
||||
]
|
||||
col1: [1, 2],
|
||||
col2: ['foo', 'bar']
|
||||
},
|
||||
delimiter: ',',
|
||||
rowCount: 2,
|
||||
hasErrors: true,
|
||||
messages: [
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('DbUploader.vue', () => {
|
||||
place.remove()
|
||||
})
|
||||
|
||||
it('loads db on click and redirects to /editor', async () => {
|
||||
it('loads db on click and redirects to /workspace', async () => {
|
||||
// mock getting a file from user
|
||||
const file = { name: 'test.db' }
|
||||
sinon.stub(fu, 'getFileFromUser').resolves(file)
|
||||
@@ -59,11 +59,11 @@ describe('DbUploader.vue', () => {
|
||||
await db.loadDb.returnValues[0]
|
||||
await wrapper.vm.animationPromise
|
||||
await wrapper.vm.$nextTick()
|
||||
expect($router.push.calledOnceWith('/editor')).to.equal(true)
|
||||
expect($router.push.calledOnceWith('/workspace')).to.equal(true)
|
||||
wrapper.destroy()
|
||||
})
|
||||
|
||||
it('loads db on drop and redirects to /editor', async () => {
|
||||
it('loads db on drop and redirects to /workspace', async () => {
|
||||
// mock db loading
|
||||
const db = {
|
||||
loadDb: sinon.stub().resolves()
|
||||
@@ -97,11 +97,11 @@ describe('DbUploader.vue', () => {
|
||||
await db.loadDb.returnValues[0]
|
||||
await wrapper.vm.animationPromise
|
||||
await wrapper.vm.$nextTick()
|
||||
expect($router.push.calledOnceWith('/editor')).to.equal(true)
|
||||
expect($router.push.calledOnceWith('/workspace')).to.equal(true)
|
||||
wrapper.destroy()
|
||||
})
|
||||
|
||||
it("doesn't redirect if already on /editor", async () => {
|
||||
it("doesn't redirect if already on /workspace", async () => {
|
||||
// mock getting a file from user
|
||||
const file = { name: 'test.db' }
|
||||
sinon.stub(fu, 'getFileFromUser').resolves(file)
|
||||
@@ -114,7 +114,7 @@ describe('DbUploader.vue', () => {
|
||||
|
||||
// mock router
|
||||
const $router = { push: sinon.stub() }
|
||||
const $route = { path: '/editor' }
|
||||
const $route = { path: '/workspace' }
|
||||
|
||||
// mount the component
|
||||
const wrapper = shallowMount(DbUploader, {
|
||||
@@ -141,7 +141,7 @@ describe('DbUploader.vue', () => {
|
||||
|
||||
// mock router
|
||||
const $router = { push: sinon.stub() }
|
||||
const $route = { path: '/editor' }
|
||||
const $route = { path: '/workspace' }
|
||||
|
||||
// mount the component
|
||||
const wrapper = mount(DbUploader, {
|
||||
@@ -175,7 +175,7 @@ describe('DbUploader.vue', () => {
|
||||
|
||||
// mock router
|
||||
const $router = { push: sinon.stub() }
|
||||
const $route = { path: '/editor' }
|
||||
const $route = { path: '/workspace' }
|
||||
|
||||
// mount the component
|
||||
const wrapper = mount(DbUploader, {
|
||||
|
||||
@@ -8,6 +8,7 @@ describe('Logs.vue', () => {
|
||||
place = document.createElement('div')
|
||||
document.body.appendChild(place)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
place.remove()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user