Added VNF_Catalogue Server 05/28405/2
authorKumar Rishabh <shailrishabh@gmail.com>
Fri, 10 Feb 2017 05:01:59 +0000 (10:31 +0530)
committerKumar Rishabh <shailrishabh@gmail.com>
Fri, 10 Feb 2017 05:08:38 +0000 (10:38 +0530)
Change-Id: I45cedac46f06e6e1f080dd3bc38d6f79eec37fa6
Signed-off-by: Kumar Rishabh <shailrishabh@gmail.com>
17 files changed:
.gitignore
utils/test/vnfcatalogue/VNF_Catalogue/README.md [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/app.js [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/bin/www [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/package.json [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/public/images/3rd_party/commits.png [moved from utils/test/vnfcatalogue/assets/Vnf_landing/assets/images/3rd_party/commits.png with 100% similarity]
utils/test/vnfcatalogue/VNF_Catalogue/public/images/logo.png [moved from utils/test/vnfcatalogue/assets/Vnf_landing/assets/images/logo.png with 100% similarity]
utils/test/vnfcatalogue/VNF_Catalogue/public/javascripts/global.js [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/public/stylesheets/3rd_party/bootstrap.css [moved from utils/test/vnfcatalogue/assets/Vnf_landing/assets/css/3rd_party/bootstrap.css with 100% similarity]
utils/test/vnfcatalogue/VNF_Catalogue/public/stylesheets/style.css [moved from utils/test/vnfcatalogue/assets/Vnf_landing/assets/css/style.css with 98% similarity]
utils/test/vnfcatalogue/VNF_Catalogue/routes/index.js [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/routes/search_projects.js [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/views/error.jade [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/views/index.jade [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/views/layout.jade [new file with mode: 0644]
utils/test/vnfcatalogue/VNF_Catalogue/views/search_projects.jade [new file with mode: 0644]
utils/test/vnfcatalogue/assets/Vnf_landing/index.html [deleted file]

index 024dfac..91ccabc 100644 (file)
@@ -26,3 +26,4 @@ wheels/
 .venv/
 venv/
 ENV/
+node_modules/
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/README.md b/utils/test/vnfcatalogue/VNF_Catalogue/README.md
new file mode 100644 (file)
index 0000000..32ad654
--- /dev/null
@@ -0,0 +1,12 @@
+#VNF_Catalogue Nodejs + Jade + MySql server
+
+
+## Quickstart
+
+First install the dependencies
+
+       ```npm install```
+
+Then Start the Server
+
+       ```npm start```
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/app.js b/utils/test/vnfcatalogue/VNF_Catalogue/app.js
new file mode 100644 (file)
index 0000000..0f842b6
--- /dev/null
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Kumar Rishabh and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+var express = require('express');
+var path = require('path');
+var favicon = require('serve-favicon');
+var logger = require('morgan');
+var cookieParser = require('cookie-parser');
+var bodyParser = require('body-parser');
+
+var routes = require('./routes/index');
+var search_projects = require('./routes/search_projects');
+
+var app = express();
+
+// view engine setup
+app.set('views', path.join(__dirname, 'views'));
+app.set('view engine', 'jade');
+
+// Database
+var db = require('mysql2');
+
+// uncomment after placing your favicon in /public
+//app.use(favicon(__dirname + '/public/favicon.ico'));
+app.use(logger('dev'));
+app.use(bodyParser.json());
+app.use(bodyParser.urlencoded({ extended: false }));
+app.use(cookieParser());
+app.use(express.static(path.join(__dirname, 'public')));
+
+// Make our db accessible to our router
+app.use(function(req,res,next){
+    req.db = db;
+    next();
+});
+
+app.use('/', routes);
+app.use('/search_projects', search_projects);
+
+
+// Some Error handling for now #TODO Remove
+
+/// catch 404 and forwarding to error handler
+app.use(function(req, res, next) {
+    var err = new Error('Not Found');
+    err.status = 404;
+    next(err);
+});
+
+
+// development error handler
+// will print stacktrace
+if (app.get('env') === 'development') {
+    app.use(function(err, req, res, next) {
+        res.status(err.status || 500);
+        res.render('error', {
+            message: err.message,
+            error: err
+        });
+    });
+}
+
+// production error handler
+// no stacktraces leaked to user
+app.use(function(err, req, res, next) {
+    res.status(err.status || 500);
+    res.render('error', {
+        message: err.message,
+        error: {}
+    });
+});
+
+module.exports = app;
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/bin/www b/utils/test/vnfcatalogue/VNF_Catalogue/bin/www
new file mode 100644 (file)
index 0000000..3cfbf77
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env node
+var debug = require('debug')('my-application');
+var app = require('../app');
+
+app.set('port', process.env.PORT || 3000);
+
+var server = app.listen(app.get('port'), function() {
+  debug('Express server listening on port ' + server.address().port);
+});
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/package.json b/utils/test/vnfcatalogue/VNF_Catalogue/package.json
new file mode 100644 (file)
index 0000000..7c6a867
--- /dev/null
@@ -0,0 +1,18 @@
+{
+    "name": "VNF_Catalogue",
+    "version": "0.0.1",
+    "private": true,
+    "scripts": {
+        "start": "node ./bin/www"
+    },
+    "dependencies": {
+        "body-parser": "~1.15.1",
+        "cookie-parser": "~1.4.3",
+        "debug": "~2.2.0",
+        "express": "~4.13.4",
+        "jade": "~1.11.0",
+        "morgan": "~1.7.0",
+        "serve-favicon": "~2.3.0",
+        "mysql2": "*"
+    }
+}
\ No newline at end of file
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/public/javascripts/global.js b/utils/test/vnfcatalogue/VNF_Catalogue/public/javascripts/global.js
new file mode 100644 (file)
index 0000000..73f16b6
--- /dev/null
@@ -0,0 +1,16 @@
+/*******************************************************************************\r
+ * Copyright (c) 2017 Kumar Rishabh and others.\r
+ *\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Apache License, Version 2.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *******************************************************************************/\r
+\r
+$(document).ready( function() {\r
+    $('#Search').click(function() {\r
+        var tags = $('#Tags').val().toLowerCase().split(/[ ,]+/);\r
+        window.location.href = '/search_projects?tags=' + tags;\r
+        return false;\r
+    });\r
+});\r
@@ -39,7 +39,7 @@ header ul li
 }
 header .logo
 {
-  background: url(../images/logo.png) no-repeat;
+  background: url(../../images/logo.png) no-repeat;
   background-size: cover;
   width: 155px;
   height: 34px;
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/routes/index.js b/utils/test/vnfcatalogue/VNF_Catalogue/routes/index.js
new file mode 100644 (file)
index 0000000..950fcd5
--- /dev/null
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Kumar Rishabh and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+var express = require('express');
+var router = express.Router();
+
+/* GET VNF_Catalogue Home Page. */
+router.get('/', function(req, res) {
+  res.render('index', { title: 'Express' });
+});
+
+module.exports = router;
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/routes/search_projects.js b/utils/test/vnfcatalogue/VNF_Catalogue/routes/search_projects.js
new file mode 100644 (file)
index 0000000..49fceeb
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Kumar Rishabh and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+var express = require('express');
+var router = express.Router();
+
+router.get('/', function(req, res) {
+  var tags = req.param('tags');
+  console.log(tags);
+  res.render('search_projects', { title: 'Express' });
+});
+
+module.exports = router;
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/views/error.jade b/utils/test/vnfcatalogue/VNF_Catalogue/views/error.jade
new file mode 100644 (file)
index 0000000..4f7fbca
--- /dev/null
@@ -0,0 +1,12 @@
+// 
+  Copyright (c) 2017 Kumar Rishabh and others.
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Apache License, Version 2.0
+  which accompanies this distribution, and is available at
+  http://www.apache.org/licenses/LICENSE-2.0
+extends layout
+
+block content
+  h1= message
+  h2= error.status
+  pre #{error.stack}
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/views/index.jade b/utils/test/vnfcatalogue/VNF_Catalogue/views/index.jade
new file mode 100644 (file)
index 0000000..b183f36
--- /dev/null
@@ -0,0 +1,131 @@
+doctype html
+//
+  Copyright (c) 2017 Kumar Rishabh and others.
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Apache License, Version 2.0
+  which accompanies this distribution, and is available at
+  http://www.apache.org/licenses/LICENSE-2.0
+html(lang='en')
+  head
+    meta(charset='UTF-8')
+    title Document
+    link(rel='stylesheet', href='/stylesheets/3rd_party/bootstrap.css')
+    link(rel='stylesheet', href='/stylesheets/style.css')
+  body
+    script(type='text/javascript' src='http://code.jquery.com/jquery.min.js')
+    script(src='/javascripts/global.js')
+    header
+      ul.navigation
+        li.logo
+        li.links
+          a(href='#') Projects
+        li.links
+          a(href='#') People
+        li.links
+          a(href='#') About
+      ul.navigation-right
+        li.signup
+          a(href='#') Sign up
+        li.option or
+        li.signin
+          a(href='#') Sign in
+    .search-box
+      h1 VNF Catalogue
+      form.search-form
+        input.search-input(type='text', placeholder='Search...', id='Tags')
+        .space-10
+        button.search-button(type='submit', value='Search', id='Search') Search
+    .content
+      ul.most-menu
+        li.items.active
+          a(href='#') Most Popular
+        li.items
+          a(href='#') Most Active
+        li.items
+          a(href='#') Most Active Contributions
+      .container
+        .row
+          .box-container
+            .col-md-3
+              .content-box
+                .content-data
+                  h1.content-title AAA
+                  .box
+                    img.commit-icon(src='/images/3rd_party/commits.png')
+                    h3.commits
+                      | 4,845
+                      br
+                      | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+      footer
+        | © 2017 OPNFV
+script.
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/views/layout.jade b/utils/test/vnfcatalogue/VNF_Catalogue/views/layout.jade
new file mode 100644 (file)
index 0000000..7cc7dfc
--- /dev/null
@@ -0,0 +1,15 @@
+doctype html
+//
+  Copyright (c) 2017 Kumar Rishabh and others.
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Apache License, Version 2.0
+  which accompanies this distribution, and is available at
+  http://www.apache.org/licenses/LICENSE-2.0
+html
+    head
+        title= title
+        link(rel='stylesheet', href='/stylesheets/style.css')
+    body
+        block content
+        script(src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js')
+        script(src='/javascripts/global.js')
diff --git a/utils/test/vnfcatalogue/VNF_Catalogue/views/search_projects.jade b/utils/test/vnfcatalogue/VNF_Catalogue/views/search_projects.jade
new file mode 100644 (file)
index 0000000..3076543
--- /dev/null
@@ -0,0 +1,128 @@
+doctype html
+//
+  Copyright (c) 2017 Kumar Rishabh and others.
+  All rights reserved. This program and the accompanying materials
+  are made available under the terms of the Apache License, Version 2.0
+  which accompanies this distribution, and is available at
+  http://www.apache.org/licenses/LICENSE-2.0
+html(lang='en')
+  head
+    meta(charset='UTF-8')
+    title Document
+    link(rel='stylesheet', href='/stylesheets/3rd_party/bootstrap.css')
+    link(rel='stylesheet', href='/stylesheets/style.css')
+  body
+    header
+      ul.navigation
+        li.logo
+        li.links
+          a(href='#') Projects
+        li.links
+          a(href='#') People
+        li.links
+          a(href='#') About
+      ul.navigation-right
+        li.signup
+          a(href='#') Sign up
+        li.option or
+        li.signin
+          a(href='#') Sign in
+    .search-box
+      h1 VNF Catalogue
+      form.search-form
+        input.search-input(type='text', placeholder='Search...')
+        .space-10
+        button.search-button(type='submit', value='Search') Search
+    .content
+      ul.most-menu
+        li.items.active
+          a(href='#') Most Popular
+        li.items
+          a(href='#') Most Active
+        li.items
+          a(href='#') Most Active Contributions
+      .container
+        .row
+          .box-container
+            .col-md-3
+              .content-box
+                .content-data
+                  h1.content-title AAA
+                  .box
+                    img.commit-icon(src='/images/3rd_party/commits.png')
+                    h3.commits
+                      | 4,845
+                      br
+                      | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+          .col-md-3
+            .content-box
+              .content-data
+                h1.content-title AAA
+                .box
+                  img.commit-icon(src='/images/3rd_party/commits.png')
+                  h3.commits
+                    | 4,845
+                    br
+                    | commits
+      footer
+        | © 2017 OPNFV
diff --git a/utils/test/vnfcatalogue/assets/Vnf_landing/index.html b/utils/test/vnfcatalogue/assets/Vnf_landing/index.html
deleted file mode 100644 (file)
index 5aebd46..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<!--
- Copyright (c) 2017 Kumar Rishabh and others.
-
-  All rights reserved. This program and the accompanying materials
-  are made available under the terms of the Apache License, Version 2.0
-  which accompanies this distribution, and is available at
-  http://www.apache.org/licenses/LICENSE-2.0
--->
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
-  <meta charset="UTF-8">
-  <title>Document</title>
-  <link rel="stylesheet" href="assets/css/3rd_party/bootstrap.css">
-  <link rel="stylesheet" href="assets/css/style.css">
-</head>
-<body>
-<header>
-  <ul class="navigation">
-    <li class="logo"></li>
-    <li class="links"><a href="#">Projects</a></li>
-    <li class="links"><a href="#">People</a></li>
-    <li class="links"><a href="#">About</a></li>
-  </ul>
-  <ul class="navigation-right">
-    <li class="signup"><a href="#">Sign up</a></li>
-    <li class="option">or</li>
-    <li class="signin"><a href="#">Sign in</a></li>
-  </ul>
-</header>
-<div class="search-box">
-  <h1>VNF Catalogue</h1>
-  <form class="search-form">
-    <input type="text" placeholder="Search..." class="search-input">
-    <div class="space-10"></div>
-    <button type="submit" value="Search" class="search-button">Search</button>
-  </form>
-</div>
-<div class="content">
-<ul class="most-menu">
-  <li class="items active"><a href="#">Most Popular</a></li>
-  <li class="items"><a href="#">Most Active</a></li>
-  <li class="items"><a href="#">Most Active Contributions</a></li>
-</ul>
-<div class="container">
-  <div class="row">
-    <div class="box-container">
-      <div class="col-md-3">
-        <div class="content-box">
-          <div class="content-data">
-            <h1 class="content-title">AAA</h1>
-            <div class="box">
-              <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-              <h3 class="commits">4,845<br>commits</h3>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-          <div class="col-md-3">
-        <div class="content-box">
-          <div class="content-data">
-            <h1 class="content-title">AAA</h1>
-            <div class="box">
-              <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-              <h3 class="commits">4,845<br>commits</h3>
-            </div>
-          </div>
-        </div>
-      </div>
-      <div class="col-md-3">
-        <div class="content-box">
-          <div class="content-data">
-            <h1 class="content-title">AAA</h1>
-            <div class="box">
-              <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-              <h3 class="commits">4,845<br>commits</h3>
-            </div>
-          </div>
-        </div>
-      </div>
-    <div class="col-md-3">
-      <div class="content-box">
-        <div class="content-data">
-          <h1 class="content-title">AAA</h1>
-          <div class="box">
-            <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-            <h3 class="commits">4,845<br>commits</h3>
-          </div>
-        </div>
-      </div>
-    </div>
-          <div class="col-md-3">
-        <div class="content-box">
-          <div class="content-data">
-            <h1 class="content-title">AAA</h1>
-            <div class="box">
-              <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-              <h3 class="commits">4,845<br>commits</h3>
-            </div>
-          </div>
-        </div>
-      </div>
-            <div class="col-md-3">
-        <div class="content-box">
-          <div class="content-data">
-            <h1 class="content-title">AAA</h1>
-            <div class="box">
-              <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-              <h3 class="commits">4,845<br>commits</h3>
-            </div>
-          </div>
-        </div>
-      </div>
-    <div class="col-md-3">
-      <div class="content-box">
-        <div class="content-data">
-          <h1 class="content-title">AAA</h1>
-          <div class="box">
-            <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-            <h3 class="commits">4,845<br>commits</h3>
-          </div>
-        </div>
-      </div>
-    </div>
-          <div class="col-md-3">
-        <div class="content-box">
-          <div class="content-data">
-            <h1 class="content-title">AAA</h1>
-            <div class="box">
-              <img src="assets/images/3rd_party/commits.png" class="commit-icon">
-              <h3 class="commits">4,845<br>commits</h3>
-            </div>
-          </div>
-        </div>
-    </div>
-  </div>
-</div>
-<footer>
-  &copy; 2017 OPNFV
-</footer>
-</div>
-</body>
-</html>