Enable renaming views and lint
This commit is contained in:
parent
3eeb945934
commit
f5e5a883cf
|
@ -54,23 +54,20 @@ export function createViewsV2Store() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const save = async view => {
|
const save = async view => {
|
||||||
// No dedicated save endpoint at this time
|
const savedView = await API.viewV2.update(view)
|
||||||
// const savedView = await API.saveView(view)
|
|
||||||
//
|
|
||||||
// // Update tables
|
|
||||||
// tables.update(state => {
|
|
||||||
// const table = state.list.find(table => table._id === view.tableId)
|
|
||||||
// if (table) {
|
|
||||||
// if (view.originalName) {
|
|
||||||
// delete table.views[view.originalName]
|
|
||||||
// }
|
|
||||||
// table.views[view.name] = savedView
|
|
||||||
// }
|
|
||||||
// return { ...state }
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
|
|
||||||
const replace = (id, view) => {}
|
// Update tables
|
||||||
|
tables.update(state => {
|
||||||
|
const table = state.list.find(table => table._id === view.tableId)
|
||||||
|
if (table) {
|
||||||
|
if (view.originalName) {
|
||||||
|
delete table.views[view.originalName]
|
||||||
|
}
|
||||||
|
table.views[view.name] = savedView
|
||||||
|
}
|
||||||
|
return { ...state }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
subscribe: derivedStore.subscribe,
|
subscribe: derivedStore.subscribe,
|
||||||
|
@ -78,7 +75,6 @@ export function createViewsV2Store() {
|
||||||
delete: deleteView,
|
delete: deleteView,
|
||||||
create,
|
create,
|
||||||
save,
|
save,
|
||||||
replace,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ export const createStores = context => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialise = context => {
|
export const initialise = context => {
|
||||||
const { sort, initialSortColumn, initialSortOrder, table, datasource } =
|
const { sort, initialSortColumn, initialSortOrder } = context
|
||||||
context
|
|
||||||
|
|
||||||
// Reset sort when initial sort props change
|
// Reset sort when initial sort props change
|
||||||
initialSortColumn.subscribe(newSortColumn => {
|
initialSortColumn.subscribe(newSortColumn => {
|
||||||
|
|
Loading…
Reference in New Issue