Welcome to the Taranta dashboard-repo documentation!¶
This project provides a cenntral store used by the Taranta suite for storing and sharing the dashboards created by taranta users.
It consists of:
- A data store (implemented as a MongoDB database)
- A set of RESTful services used by the Taranta application to create, retrieve, update and delete individual dashboards associated with a particular user and access to one or more user groups.
- Basic action logging service / store for Taranta actions
The ‘models’ contains the data strucures used to store the two types of information
Data model for storing the dashboards¶
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | let dashboardSchema = mongoose.Schema({ _id: { type: ObjectId, auto: true, }, name: { type: String, required: true, }, user: { type: String, required: true, }, widgets: { type: [WIDGET], required: true, }, variables: { type: Object, required: false, default: [{}], }, insertTime: { type: Date, default: Date.now, }, updateTime: { type: Date, required: true, default: Date.now, }, group: { type: String, required: false, default: null, }, groupWriteAccess: { type: Boolean, required: false, default: false, }, lastUpdatedBy: { type: String, required: false, default: null, }, deleted: { type: Boolean, default: false, }, tangoDB: { type: String, default: '', }, }); |
1 2 3 4 5 6 7 8 9 10 11 12 | const WIDGET = { canvas: String, id: String, x: Number, y: Number, height: Number, width: Number, type: { type: String }, // Necessary since `type' is a reserved word in Mongoose inputs: Schema.Types.Mixed, order: Number, }; |
Data model for storing the user action log details¶
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 | let userActionLog = mongoose.Schema({ actionType: { type: String, required: true, }, timestamp: { type: Date, required: true, default: Date.now, }, user: { type: String, required: true, }, tangoDB: { type: String, default: '', }, device: { type: String, required: true, }, name: { type: String, }, value: { type: Schema.Types.Mixed, }, argin: { type: String, }, valueBefore: { type: Schema.Types.Mixed, }, valueAfter: { type: Schema.Types.Mixed, }, }); |