Renamed
This commit is contained in:
@ -6,7 +6,7 @@ import Sequelize from 'sequelize';
|
|||||||
|
|
||||||
import auth from './auth';
|
import auth from './auth';
|
||||||
import user from './user';
|
import user from './user';
|
||||||
import atlases from './atlases';
|
import collections from './collections';
|
||||||
import documents from './documents';
|
import documents from './documents';
|
||||||
|
|
||||||
import validation from './validation';
|
import validation from './validation';
|
||||||
@ -44,7 +44,7 @@ api.use(validation());
|
|||||||
|
|
||||||
router.use('/', auth.routes());
|
router.use('/', auth.routes());
|
||||||
router.use('/', user.routes());
|
router.use('/', user.routes());
|
||||||
router.use('/', atlases.routes());
|
router.use('/', collections.routes());
|
||||||
router.use('/', documents.routes());
|
router.use('/', documents.routes());
|
||||||
|
|
||||||
// Router is embedded in a Koa application wrapper, because koa-router does not
|
// Router is embedded in a Koa application wrapper, because koa-router does not
|
||||||
|
@ -14,7 +14,7 @@ const Atlas = sequelize.define('atlas', {
|
|||||||
type: { type: DataTypes.STRING, validate: { isIn: allowedAtlasTypes }},
|
type: { type: DataTypes.STRING, validate: { isIn: allowedAtlasTypes }},
|
||||||
|
|
||||||
/* type: atlas */
|
/* type: atlas */
|
||||||
atlasStructure: DataTypes.JSONB,
|
navigationTree: DataTypes.JSONB,
|
||||||
}, {
|
}, {
|
||||||
tableName: 'atlases',
|
tableName: 'atlases',
|
||||||
hooks: {
|
hooks: {
|
||||||
@ -32,8 +32,8 @@ const Atlas = sequelize.define('atlas', {
|
|||||||
},
|
},
|
||||||
instanceMethods: {
|
instanceMethods: {
|
||||||
async getStructure() {
|
async getStructure() {
|
||||||
if (this.atlasStructure) {
|
if (this.navigationTree) {
|
||||||
return this.atlasStructure;
|
return this.navigationTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getNodeForDocument = async (document) => {
|
const getNodeForDocument = async (document) => {
|
||||||
@ -122,7 +122,7 @@ const Atlas = sequelize.define('atlas', {
|
|||||||
throw new Error('Invalid navigation tree');
|
throw new Error('Invalid navigation tree');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.atlasStructure = newTree;
|
this.navigationTree = newTree;
|
||||||
await this.save();
|
await this.save();
|
||||||
|
|
||||||
return newTree;
|
return newTree;
|
||||||
@ -147,7 +147,7 @@ const Atlas = sequelize.define('atlas', {
|
|||||||
return node;
|
return node;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.atlasStructure = insertNode(this.atlasStructure);
|
this.navigationTree = insertNode(this.navigationTree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -32,8 +32,7 @@ export function presentAtlas(atlas, includeRecentDocuments=false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (atlas.type === 'atlas') {
|
if (atlas.type === 'atlas') {
|
||||||
// Todo replace with `.atlasStructure`
|
data.navigationTree = await atlas.getStructure();
|
||||||
data.structure = await atlas.getStructure();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeRecentDocuments) {
|
if (includeRecentDocuments) {
|
||||||
|
@ -21,7 +21,7 @@ class Atlas extends React.Component {
|
|||||||
|
|
||||||
// Forward directly to root document
|
// Forward directly to root document
|
||||||
if (data.type === 'atlas') {
|
if (data.type === 'atlas') {
|
||||||
History.replace(data.structure.url);
|
History.replace(data.navigationTree.url);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ class DocumentScene extends React.Component {
|
|||||||
<div className={ styles.sidebar }>
|
<div className={ styles.sidebar }>
|
||||||
<Tree
|
<Tree
|
||||||
paddingLeft={10}
|
paddingLeft={10}
|
||||||
tree={ doc.atlas.structure }
|
tree={ doc.atlas.navigationTree }
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
isNodeCollapsed={this.isNodeCollapsed}
|
isNodeCollapsed={this.isNodeCollapsed}
|
||||||
renderNode={this.renderNode}
|
renderNode={this.renderNode}
|
||||||
|
Reference in New Issue
Block a user