# All files / src/model visualizer.coffee

100% Statements 7/7
100% Branches 0/0
100% Functions 0/0
100% Lines 7/7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    401x
    1x
    1x
    1x
    1x

    1x

    1x
     mongoose = require "mongoose"
    server = require "../server"
    events = require "./events"
    connectionDefault = server.connectionDefault
    Schema = mongoose.Schema

    EventLinkDef =
      "eventType":  type: String, enum: events.eventTypes
      "eventName":  String
      "display":    String

    MediatorLinkDef =
      'mediator':   String # mediator URN
      'name':       String
      'display':    String

    VisualizerSchema = new Schema
      "name":                   type: String, required: true, unique: true
      "components":             [EventLinkDef]
      "channels":               [EventLinkDef]
      "mediators":              [MediatorLinkDef]
      "color":
        "inactive":             type: String, default: "#cccccc"
        "active":               type: String, default: "#4cae4c"
        "error":                type: String, default: "#d43f3a"
        "text":                 type: String, default: "#000000"
      "size":
        "responsive":           type: Boolean, default: true
        "width":                type: Number, default: 1000
        "height":               type: Number, default: 400
        "padding":              type: Number, default: 20
      "time":
        "updatePeriod":         type: Number, default: 200
        "minDisplayPeriod":     type: Number, default: 500
        "maxSpeed":             type: Number, default: 5
        "maxTimeout":           type: Number, default: 5000

    # Compile schema into Model
    exports.Visualizer = connectionDefault.model 'Visualizer', VisualizerSchema