Skip to content

Commit 4318a9b

Browse files
author
vinod
committed
vis netowrk
1 parent 601b30d commit 4318a9b

File tree

6 files changed

+71
-42
lines changed

6 files changed

+71
-42
lines changed

controllers/notes.controller.js

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,50 @@ notesCtrl.renderNotesgrids = (req, res) => {
142142
});
143143
};
144144
notesCtrl.renderNotesNetwork = (req, res) => {
145-
Note.find({user:req.user.id})
145+
Note.find({ user: req.user.id })
146146
.then(notes => {
147-
var temp=[]
147+
var temp = []
148+
var c = 0;
148149
notes.forEach(function (item) {
149-
let obj={}
150-
var date = moment(item.createdAt, "YYYYMMDD").fromNow();
151-
item.date = date
152-
obj={
153-
title:item.title,
154-
description:item.description,
155-
Created:item.date
150+
c += 1
151+
let obj = {}
152+
obj = {
153+
label: item.title,
154+
id: c,
155+
156+
arrows: 'to, from'
156157
}
157158
temp.push(obj)
158159
});
159-
temp=JSON.stringify(temp)
160-
res.render("notes/notesnetwork", { temp });
160+
var count = 0
161+
if (temp.length) {
162+
count = temp.length + 1
163+
let obj = {
164+
label: "User Tasks",
165+
id: count
166+
}
167+
temp.push(obj)
168+
}
169+
let Edge = [];
170+
temp.forEach(function (item) {
171+
let obj = {};
172+
if (count != item.id) {
173+
obj = {
174+
from: count,
175+
to: item.id
176+
}
177+
Edge.push(obj);
178+
}
179+
});
180+
181+
temp = JSON.stringify(temp)
182+
Edge = JSON.stringify(Edge)
183+
184+
res.render("notes/notesnetwork", { temp, Edge });
161185
}).catch(err => {
162186
res.status(500).send({
163187
message: err.message
164188
});
165189
});
166-
};
190+
};
167191
module.exports = notesCtrl;

database.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const mongoose = require("mongoose");
22
const MONGODB_URI = "mongodb://localhost/pucsd"
33

4-
mongoose.connect(MONGODB_URI, {useNewUrlParser: true, useUnifiedTopology: true})
4+
mongoose.connect(MONGODB_URI,{useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false })
55
.then(() => {
66
console.log("Successfully connected to MongoDB.");
77
}).catch(err => {

routes/notes.routes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ router.post("/notes/statusUpdate/:id", isAuthenticated, updateStatus);
4040
router.get("/notesgrid", isAuthenticated, renderNotesgrids);
4141
router.get("/NotesNetwork", isAuthenticated, renderNotesNetwork);
4242

43+
4344
module.exports = router;

views/index.hbs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
<div class="section-img-wrap">
1919
<img src="/img/control_task.svg" alt="" height="400" width="600">
2020
</div>
21-
{{!-- <a href="#secondSec">Click Me Smooth Scroll to Section 2 Below</a> --}}
2221
</div>
23-
</div>
22+
</div>
23+
<div class="scrollMe"><a href="#secondSec" style="color:black;">Click Me </a></div>
2424
</section>
2525
<section class="section container section-important" id="secondSec" >
2626
<div class="row text-sm-left text-sm-left text-right">
@@ -37,7 +37,7 @@
3737
<p class="section-text">
3838
Never lose track of important emails, action items from meeting notes, or Trello cards. VS InfoTech <strong>keeps</strong> your prefered task manager (Todoist, Wunderlist) <strong>updated with all your tasks</strong> from all your different applications.
3939
</p>
40-
{{!--<a href="#firstSec">Click Me </a>--}}
40+
<a href="#thirdSec" style="color:black;">Click Me </a>
4141
</div>
4242
</div>
4343
</div>
@@ -46,7 +46,7 @@
4646

4747
<section class="section container section-always-know">
4848
<div class="row">
49-
<div class="col-md-6 col-sm-6 col-xs-12 section__content--left">
49+
<div class="col-md-6 col-sm-6 col-xs-12 section__content--left" id="thirdSec">
5050
<div class="section__text-block">
5151
<span class="section-subtitle mr-0">Always know</span><br>
5252
<h3 class="section-title mr-t-0 mb-2"><strong>what’s next </strong></h3>
@@ -56,8 +56,9 @@
5656
You <span class="bold-text">always know what’s on top</span> of the list based on due dates and priorities, no matter where the task came from. <br>
5757
</p>
5858

59-
<a href="/users/signup"><button data-toggle="modal" data-target="#sign-in-modal" class="btn btn-success ">Get started - it’s free </button></a>
60-
</div>
59+
{{!-- <a href="/users/signup"><button data-toggle="modal" data-target="#sign-in-modal" class="btn btn-success ">Get started - it’s free </button></a> --}}
60+
</div></br>
61+
<div class="scrollMe"><a href="#firstSec" style="color:black;">Click Me </a></div>
6162
</div>
6263
<div class="col-md-6 col-sm-6 col-xs-12 section__content--right">
6364
<div class="section-img-wrap">

views/notes/notesnetwork.hbs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11

22

3-
<div id="mynetwork" style="height: 500px;"></div>
3+
<div id="mynetwork" style="height: 500px;"></div>
4+
5+
<script >
6+
var nodeData='{{{temp}}}'
7+
var EdgeData='{{{Edge}}}'
8+
console.log(nodeData)
9+
console.log(EdgeData)
410
5-
<script type="text/javascript">
611
// create an array with nodes
7-
var nodes = new vis.DataSet([
8-
{id: 1, label: 'Node 1'},
9-
{id: 2, label: 'Node 2'},
10-
{id: 3, label: 'Node 3'},
11-
{id: 4, label: 'Node 4'},
12-
{id: 5, label: 'Node 5'}
13-
]);
12+
var nodes = new vis.DataSet(JSON.parse(nodeData));
1413
1514
// create an array with edges
16-
var edges = new vis.DataSet([
17-
{from: 1, to: 3},
18-
{from: 1, to: 2},
19-
{from: 2, to: 4},
20-
{from: 2, to: 5},
21-
{from: 3, to: 3}
22-
]);
15+
var edges = new vis.DataSet(JSON.parse(EdgeData));
2316
2417
// create a network
2518
var container = document.getElementById('mynetwork');

views/partials/navigation.hbs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
{{#if user}}
1515
<li class="nav-item dropdown">
1616
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
17-
Notes
17+
{{ user.name }}
1818
</a>
1919
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
2020
<a class="dropdown-item" href="/notes">All Notes</a>
21+
<a class="dropdown-item" href="/usrDetails">Profile</a>
2122
<a class="dropdown-item" href="/notesgrid">All Notes List</a>
2223
<a class="dropdown-item" href="/NotesNetwork">All Notes network</a>
2324
<a class="dropdown-item" href="/notes/add">Add A Note</a>
@@ -26,12 +27,21 @@
2627
</div>
2728
</li>
2829
{{else}}
29-
<li class="nav-item">
30-
<a class="nav-link" href="/users/signin">Login</a>
31-
</li>
32-
<li class="nav-item">
33-
<a class="nav-link" href="/users/signup">Register</a>
34-
</li>
30+
<li class="nav-item">
31+
<a class="nav-link" href="#firstSec" style="color:white; font-weight:bold">Features</a>
32+
</li>
33+
<li class="nav-item">
34+
<a class="nav-link" href="#secondSec" style="color:white; font-weight:bold">For Team</a>
35+
</li>
36+
<li class="nav-item">
37+
<a class="nav-link" href="#thirdSec" style="color:white; font-weight:bold">Bussiness Report</a>
38+
</li>
39+
<li class="nav-item">
40+
<a class="nav-link" href="/users/signin">Login</a>
41+
</li>
42+
<li class="nav-item">
43+
<a class="nav-link" href="/users/signup">Register</a>
44+
</li>
3545
{{/if}}
3646
</ul>
3747
</div>

0 commit comments

Comments
 (0)