Improve version modal rendering calls
This commit is contained in:
parent
a7d3ec6a1f
commit
ffb5e35205
@ -37,7 +37,13 @@ class FormCode extends Controller {
|
||||
}
|
||||
|
||||
async get_config(req, res) {
|
||||
return res.api(req.form.codium)
|
||||
const { codium } = req.form
|
||||
|
||||
if ( req.query.version ) {
|
||||
return res.api(await codium.as_version(req.query.version))
|
||||
}
|
||||
|
||||
return res.api(codium)
|
||||
}
|
||||
|
||||
async set_values(req, res) {
|
||||
|
@ -37,11 +37,23 @@ class FormDatabase extends Controller {
|
||||
async get_config(req, res) {
|
||||
const { page, node, database } = req.form
|
||||
|
||||
if ( req.query.version ) {
|
||||
console.log('db version', req.query.version)
|
||||
return res.api(await database.as_version(req.query.version))
|
||||
}
|
||||
|
||||
return res.api(database)
|
||||
}
|
||||
|
||||
async get_columns(req, res) {
|
||||
const { page, node, database } = req.form
|
||||
let { page, node, database } = req.form
|
||||
if ( req.query.database_version ) {
|
||||
database = await database.as_version(req.query.database_version)
|
||||
if ( !database )
|
||||
return res.status(400)
|
||||
.message('Version not found.')
|
||||
.api()
|
||||
}
|
||||
|
||||
const columns = []
|
||||
for ( const col_id of database.ColumnIds ) {
|
||||
|
@ -30,6 +30,11 @@ class Node extends VersionedModel {
|
||||
};
|
||||
}
|
||||
|
||||
__initialize_version(base, data = {}) {
|
||||
super.__initialize_version(base, data)
|
||||
this.associated_type_version_num = data.associated_type_version_num
|
||||
}
|
||||
|
||||
// Static and instance methods can go here
|
||||
get page() {
|
||||
const Page = this.models.get('api:Page')
|
||||
|
@ -369,6 +369,12 @@ class Page extends VersionedModel {
|
||||
return data
|
||||
}
|
||||
|
||||
async as_version(version_num = undefined) {
|
||||
const inst = await super.as_version(version_num)
|
||||
inst.node_version_nums = inst.__version_data?.node_version_nums
|
||||
return inst
|
||||
}
|
||||
|
||||
async revert_to_version(version_num, user_id = undefined) {
|
||||
const Node = this.models.get('api:Node')
|
||||
const reverted = await super.revert_to_version(version_num, user_id)
|
||||
|
Loading…
Reference in New Issue
Block a user