Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
coursework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NLP11
coursework
Commits
ce7ce2b6
Commit
ce7ce2b6
authored
4 years ago
by
Iskandar, Michelle P (UG - Computer Science)
Browse files
Options
Downloads
Patches
Plain Diff
Connected db to submissions front end
parent
fac28e8d
No related branches found
No related tags found
1 merge request
!5
Database
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
NodeAPI/index.js
+5
-6
5 additions, 6 deletions
NodeAPI/index.js
NodeAPI/public/css/style.css
+11
-1
11 additions, 1 deletion
NodeAPI/public/css/style.css
NodeAPI/views/submissions.ejs
+4
-1
4 additions, 1 deletion
NodeAPI/views/submissions.ejs
NodeAPI/views/table.ejs
+17
-0
17 additions, 0 deletions
NodeAPI/views/table.ejs
with
37 additions
and
8 deletions
NodeAPI/index.js
+
5
−
6
View file @
ce7ce2b6
...
@@ -41,11 +41,11 @@ app.post('/predict', (req,res) => {
...
@@ -41,11 +41,11 @@ app.post('/predict', (req,res) => {
if
(
err
)
{
return
console
.
dir
(
err
);
}
if
(
err
)
{
return
console
.
dir
(
err
);
}
// Create collection if does not exist
// Create collection if does not exist
var
collection
=
db
.
createC
ollection
(
'
Pred_Records
'
);
var
collection
=
db
.
db
(
'
ClusterNLP
'
).
c
ollection
(
'
Pred_Records
'
);
// Get the data to be stored
// Get the data to be stored
var
plot
=
req
.
body
.
plot
;
var
plot
=
req
.
body
.
plot
;
var
prediction
=
JSON
.
parse
(
body
).
predictionText
;
var
prediction
=
JSON
.
parse
(
JSON
.
parse
(
body
).
predictionText
)
;
// Get rcord to be inserted
// Get rcord to be inserted
var
rec
=
{
'
Plot
'
:
plot
,
'
Prediction
'
:
prediction
};
var
rec
=
{
'
Plot
'
:
plot
,
'
Prediction
'
:
prediction
};
...
@@ -67,17 +67,16 @@ app.post('/predict', (req,res) => {
...
@@ -67,17 +67,16 @@ app.post('/predict', (req,res) => {
app
.
get
(
'
/submissions
'
,
function
(
req
,
res
)
{
app
.
get
(
'
/submissions
'
,
function
(
req
,
res
)
{
var
resultArray
=
[];
var
resultArray
=
[];
/**
MongoClient.connect(url, function(err, d
atabase
) {
MongoClient
.
connect
(
url
,
function
(
err
,
d
b
)
{
if
(
err
)
{
return
console
.
dir
(
err
);
}
if
(
err
)
{
return
console
.
dir
(
err
);
}
var cursor = d
atabase.db(
).collection('Pred_Records').find()
var
cursor
=
d
b
.
db
(
'
ClusterNLP
'
).
collection
(
'
Pred_Records
'
).
find
()
;
cursor
.
forEach
(
function
(
doc
,
err
){
cursor
.
forEach
(
function
(
doc
,
err
){
resultArray
.
push
(
doc
)
resultArray
.
push
(
doc
)
},
function
(){
},
function
(){
db
.
close
();
db
.
close
();
res
.
render
(
'
submissions
'
,
{
items
:
resultArray
});
res
.
render
(
'
submissions
'
,
{
items
:
resultArray
});
});
});
});**/
});
res
.
render
(
'
submissions
'
,
{});
});
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
NodeAPI/public/css/style.css
+
11
−
1
View file @
ce7ce2b6
...
@@ -146,8 +146,8 @@ p {
...
@@ -146,8 +146,8 @@ p {
color
:
#f2f2f2
;
color
:
#f2f2f2
;
text-align
:
center
;
text-align
:
center
;
padding
:
14px
16px
;
padding
:
14px
16px
;
text-decoration
:
none
;
font-size
:
1.3em
;
font-size
:
1.3em
;
text-decoration
:
none
;
font-family
:
Calibri
,
'Trebuchet MS'
,
sans-serif
;
font-family
:
Calibri
,
'Trebuchet MS'
,
sans-serif
;
font-weight
:
bold
;
font-weight
:
bold
;
}
}
...
@@ -156,6 +156,7 @@ p {
...
@@ -156,6 +156,7 @@ p {
.topnav
a
:hover
{
.topnav
a
:hover
{
background-color
:
#ddd
;
background-color
:
#ddd
;
color
:
#e95e01
;
color
:
#e95e01
;
text-decoration
:
none
;
}
}
/* Add a color to the active/current link */
/* Add a color to the active/current link */
...
@@ -173,4 +174,13 @@ p {
...
@@ -173,4 +174,13 @@ p {
.subtitle
{
.subtitle
{
color
:
#e95e01
;
color
:
#e95e01
;
font-size
:
1.2em
;
font-size
:
1.2em
;
}
table
,
th
,
td
{
border
:
1px
solid
black
;
color
:
black
;
}
td
{
min-width
:
10em
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
NodeAPI/views/submissions.ejs
+
4
−
1
View file @
ce7ce2b6
...
@@ -17,7 +17,10 @@
...
@@ -17,7 +17,10 @@
<a
href=
"/"
>
NLP11
</a>
<a
href=
"/"
>
NLP11
</a>
<a
class=
"active"
href=
"/submissions"
>
Submissions
</a>
<a
class=
"active"
href=
"/submissions"
>
Submissions
</a>
</div>
</div>
<body
class=
"text-center"
>
<body>
<h1>
Posts
</h1>
<
%
-
include
("
table
",
{
items
});
%
>
</body>
</body>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
NodeAPI/views/table.ejs
0 → 100644
+
17
−
0
View file @
ce7ce2b6
<table class="table">
<tr>
<th>Prediction</th>
<th>Plot</th>
</tr>
<%if (items.length >0){ %>
<% items.forEach(function(row) { %>
<tr>
<td><%= row.Prediction %></td>
<td><%= row.Plot %></td>
</tr>
<% })}else{ %>
<tr>
<td colspan="6">No Record Found</td>
</tr>
<% } %>
</table>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment