Skip to content

Commit

Permalink
Add export default to *Db.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerlong committed Sep 10, 2017
1 parent a7d79ba commit 2a0bc3b
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 103 deletions.
88 changes: 0 additions & 88 deletions CONTRIBUTING.md

This file was deleted.

13 changes: 13 additions & 0 deletions src/diagrams/classDiagram/classDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,16 @@ export const relationType = {
COMPOSITION: 2,
DEPENDENCY: 3
}

export default {
addClass,
clear,
getClass,
getClasses,
getRelations,
addRelation,
addMembers,
cleanupLabel,
lineType,
relationType
}
26 changes: 13 additions & 13 deletions src/diagrams/flowchart/flowRenderer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import graph from './graphDb'
import graphDb from './graphDb'
import flow from './parser/flow'
import dot from './parser/dot'
import d3 from '../../d3'
Expand Down Expand Up @@ -217,18 +217,18 @@ export const addEdges = function (edges, g) {
*/
export const getClasses = function (text, isDot) {
var parser
graph.clear()
graphDb.clear()
if (isDot) {
parser = dot.parser
} else {
parser = flow.parser
}
parser.yy = graph
parser.yy = graphDb

// Parse the graph definition
parser.parse(text)

var classes = graph.getClasses()
var classes = graphDb.getClasses()

// Add default class if undefined
if (typeof (classes.default) === 'undefined') {
Expand All @@ -249,13 +249,13 @@ export const getClasses = function (text, isDot) {
export const draw = function (text, id, isDot) {
logger.debug('Drawing flowchart')
var parser
graph.clear()
graphDb.clear()
if (isDot) {
parser = dot.parser
} else {
parser = flow.parser
}
parser.yy = graph
parser.yy = graphDb

// Parse the graph definition
try {
Expand All @@ -266,7 +266,7 @@ export const draw = function (text, id, isDot) {

// Fetch the default direction, use TD if none was found
var dir
dir = graph.getDirection()
dir = graphDb.getDirection()
if (typeof dir === 'undefined') {
dir = 'TD'
}
Expand All @@ -287,17 +287,17 @@ export const draw = function (text, id, isDot) {
})

var subG
var subGraphs = graph.getSubGraphs()
var subGraphs = graphDb.getSubGraphs()
var i = 0
for (i = subGraphs.length - 1; i >= 0; i--) {
subG = subGraphs[i]
graph.addVertex(subG.id, subG.title, 'group', undefined)
graphDb.addVertex(subG.id, subG.title, 'group', undefined)
}

// Fetch the verices/nodes and edges/links from the parsed graph definition
var vert = graph.getVertices()
var vert = graphDb.getVertices()

var edges = graph.getEdges()
var edges = graphDb.getEdges()

i = 0
var j
Expand Down Expand Up @@ -430,7 +430,7 @@ export const draw = function (text, id, isDot) {

element.selectAll('g.node')
.attr('title', function () {
return graph.getTooltip(this.id)
return graphDb.getTooltip(this.id)
})

if (conf.useMaxWidth) {
Expand All @@ -451,7 +451,7 @@ export const draw = function (text, id, isDot) {
}

// Index nodes
graph.indexNodes('subGraph' + i)
graphDb.indexNodes('subGraph' + i)

for (i = 0; i < subGraphs.length; i++) {
subG = subGraphs[i]
Expand Down
23 changes: 23 additions & 0 deletions src/diagrams/flowchart/graphDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,26 @@ export const indexNodes = function () {
export const getSubGraphs = function () {
return subGraphs
}

export default {
addVertex,
addLink,
updateLinkInterpolate,
updateLink,
addClass,
setDirection,
setClass,
getTooltip,
setClickEvent,
bindFunctions,
getDirection,
getVertices,
getEdges,
getClasses,
clear,
defaultStyle,
addSubGraph,
getDepthFirstPos,
indexNodes,
getSubGraphs
}
13 changes: 13 additions & 0 deletions src/diagrams/gantt/ganttDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,16 @@ var compileTasks = function () {
}
return allProcessed
}

export default {
clear,
setDateFormat,
getDateFormat,
setTitle,
getTitle,
addSection,
getTasks,
addTask,
findTaskById,
addTaskOrg
}
20 changes: 20 additions & 0 deletions src/diagrams/gitGraph/gitGraphAst.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,23 @@ export const getCommitsArray = function () {
export const getCurrentBranch = function () { return curBranch }
export const getDirection = function () { return direction }
export const getHead = function () { return head }

export default {
setDirection,
setOptions,
getOptions,
commit,
branch,
merge,
checkout,
reset,
prettyPrint,
clear,
getBranchesAsObjArray,
getBranches,
getCommits,
getCommitsArray,
getCurrentBranch,
getDirection,
getHead
}
4 changes: 2 additions & 2 deletions src/diagrams/gitGraph/gitGraphParser.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env jasmine */
import ast from './gitGraphAst'
import gitGraphAst from './gitGraphAst'
import { parser } from './parser/gitGraph'

describe('when parsing a gitGraph', function () {
beforeEach(function () {
parser.yy = ast
parser.yy = gitGraphAst
parser.yy.clear()
})
it('should handle a gitGraph defintion', function () {
Expand Down
18 changes: 18 additions & 0 deletions src/diagrams/sequenceDiagram/sequenceDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,21 @@ export const apply = function (param) {
}
}
}

export default {
addActor,
addMessage,
addSignal,
getMessages,
getActors,
getActor,
getActorKeys,
getTitle,
clear,
LINETYPE,
ARROWTYPE,
PLACEMENT,
addNote,
setTitle,
apply
}

0 comments on commit 2a0bc3b

Please sign in to comment.