Skip to content

Commit

Permalink
added firerepirts upload, admin, public list
Browse files Browse the repository at this point in the history
  • Loading branch information
cactus committed Mar 12, 2015
1 parent f678dba commit 2bc2cde
Show file tree
Hide file tree
Showing 32 changed files with 887 additions and 221 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ node_modules
temp
.git
s2t.build
public/files
!.gitignore
9 changes: 6 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ var flash = require('connect-flash')
var routes = require('./routes/index');
var users = require('./routes/users');
var api = require('./routes/api');
var org = require('./routes/org');
var organization = require('./routes/organization');
var incidents = require('./routes/incidents');
var portfolio = require('./routes/portfolio');
var upload = require('./routes/upload');
var targets = require('./routes/targets');

var dashboard = require('./routes/dashboard');
var authenticate = require('./routes/authenticate');

// db
var DB=config.database.db;
Expand Down Expand Up @@ -151,12 +152,14 @@ if (config.v1.syncEpics.mode!="off"){

app.use('/', routes);
app.use('/api', api);
app.use('/org', org);
app.use('/organization', organization);
app.use('/users', users);
app.use('/upload', upload);
app.use('/portfolio', portfolio);
app.use('/incidents', incidents);
app.use('/targets', targets);
app.use('/dashboard', dashboard);
app.use('/authenticate', authenticate);



Expand Down
9 changes: 8 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

"locale": "en",

"version" : "1.0.0 alpha",
"version" : "1.0.1 beta",

"build" : "---should be dynamically assigned",

Expand Down Expand Up @@ -50,6 +50,13 @@
"notifications" : {
"portfolioupdate": "[email protected]"

},

"firereports" : {
"contact": "Pablo Delgado Caballero",
"contactEmail" : "[email protected]"

}


}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "space",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"scripts": {
"startDEV": "nodemon ./bin/www",
Expand Down
Binary file added public/images/pi/logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/space/logo_appdynamics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/space/logo_msexcel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/space/logo_oracle_ebusiness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/space/logo_pdf.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/space/logo_servicenow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/space/logo_versionone.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 38 additions & 1 deletion public/javascripts/kanban/admin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _excelExportURL = '/api/kanbanv2/export/xlsx/';
var _excelExportURL = '/api/space/export/xlsx/';

var admingrid;

Expand Down Expand Up @@ -58,6 +58,7 @@ function getConfig(collection){
case "metrics": return getMetricConfig();
case "initiatives": return getInitiativeConfig();
case "scrumteams": return getTeamConfig();
case "v1teams": return getV1TeamConfig();
case "boards": return getBoardConfig();
case "v1epics": return getV1EpicsConfig();
case "incidents": return getIncidentsConfig();
Expand All @@ -68,6 +69,7 @@ function getConfig(collection){
case "productcatalog": return getProductCatalogConfig();
case "roadmaps": return getRoadmapConfig();
case "availability": return getAvailabilityConfig();
case "firereport": return getFirereportConfig();

}
}
Expand Down Expand Up @@ -195,6 +197,21 @@ function getAvailabilityConfig(){
return _config;
}

function getFirereportConfig(){
var _firereport = [
{ id:"id", name: "id", field: "_id",sortable:true,cssClass:"onKanbanImmutable" },
{ id: "year", name: "year", field: "year" ,width:70,sortable:true, editor: Slick.Editors.Text, cssClass: "cell-standard"},
{ id: "type", name: "type", field: "type",sortable:true, cssClass: "cell-standard" },
{ id: "count", name: "count", field: "count" ,sortable:true,width:50, editor: Slick.Editors.Text, cssClass: "cell-standard"},
{ id: "path", name: "path", field: "path",width:250,sortable:true,editor:Slick.Editors.Text, cssClass: "cell-standard"},
{ id: "contact", name: "contact", field: "contact",width:200,sortable:true,editor:Slick.Editors.Text, cssClass: "cell-standard"}];

var _config ={};
_config.mode="editable";
_config.fields = _firereport;
return _config;
}

function getBoardConfig(){
//lanetext
var _boards = [
Expand Down Expand Up @@ -302,6 +319,24 @@ function getTeamConfig(){
}


//scrumteams exported from V1 Teamrooms
// http://v1.bwinparty.corp/V1-Production/Default.aspx?menu=TeamRoomsPage
function getV1TeamConfig(){
var _v1teams =[
{ id:"id", name: "id", field: "_id",sortable:true,width:30 ,cssClass:"onKanbanImmutable"},
{ id:"Title", name: "Title", field: "Title",sortable:true,width:250, editor: Slick.Editors.Text,cssClass: "cell-title" },
{ id: "Business Backlog", name: "Business Backlog", field: "Business Backlog",width:200,sortable:true, editor: Slick.Editors.Text, cssClass: "cell-standard"},
{ id: "Sprint Schedule", name: "Sprint Schedule", field: "Sprint Schedule",editor: Slick.Editors.Text,width:150, cssClass: "cell-standard"},
{ id: "Description", name: "Description", field: "Description",width:400 ,sortable:true, cssClass: "cell-standard"}
];
var _config ={};
_config.mode="editable";
_config.fields = _v1teams;
return _config;
}



function getV1EpicsConfig(){
//v1 epics
var _v1Epics =[
Expand Down Expand Up @@ -480,6 +515,8 @@ function renderAdminGrid(data,conf){

var dataView = new Slick.Data.DataView();
dataView.setItems(data,"_id");

$('#countitems').html(dataView.getLength());

admingrid = new Slick.Grid("#adminGrid", dataView, columns, options);

Expand Down
57 changes: 55 additions & 2 deletions routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var PATH = {
REST_POSTITS : BASE+'/space/rest/postits',
REST_LANES : BASE+'/space/rest/lanes',
REST_SCRUMTEAMS : BASE+'/space/rest/scrumteams',
REST_V1TEAMS : BASE+'/space/rest/v1teams',
REST_PRODUCTPORTFOLIO : BASE+'/space/rest/productportfolio',
REST_PRODUCTCATALOG : BASE+'/space/rest/productcatalog',
REST_INCIDENTS : BASE+'/space/rest/incidents',
Expand All @@ -54,6 +55,7 @@ var PATH = {
REST_PRODUCTCATALOG : BASE+'/space/rest/productcatalog',
REST_ROADMAPS : BASE+'/space/rest/roadmaps',
REST_AVAILABILITY : BASE+'/space/rest/availability',
REST_FIREREPORT : BASE+'/space/rest/firereport',

REST_INITIATIVES_DIFF_TRAIL : BASE+'/space/rest/initiatives_diff_trail',
REST_ORGANIZATION : BASE+'/space/rest/organization/:date',
Expand All @@ -74,6 +76,7 @@ var PATH = {
EXPORT_PRODUCTCATALOG : BASE+'/space/export/xlsx/productcatalog',
EXPORT_ROADMAPS : BASE+'/space/export/xlsx/roadmaps',
EXPORT_AVAILABILITY : BASE+'/space/export/xlsx/availability',
EXPORT_FIREREPORT : BASE+'/space/export/xlsx/firereport',



Expand Down Expand Up @@ -109,6 +112,7 @@ router.get(PATH.REST_POSTITS, function(req, res, next) {findAllByName(req,res,ne
router.get(PATH.REST_LANES, function(req, res, next) {findAllByName(req,res,next);});
router.get(PATH.REST_LANETEXT, function(req, res, next) {findAllByName(req,res,next);});
router.get(PATH.REST_SCRUMTEAMS, function(req, res, next) {findAllByName(req,res,next);});
router.get(PATH.REST_V1TEAMS, function(req, res, next) {findAllByName(req,res,next);});
router.get(PATH.REST_PRODUCTPORTFOLIO, function(req, res, next) {findAllByName(req,res,next);});
router.get(PATH.REST_PRODUCTCATALOG, function(req, res, next) {findAllByName(req,res,next);});
router.get(PATH.REST_INCIDENTS, function(req, res, next) {findAllByName(req,res,next);});
Expand Down Expand Up @@ -141,6 +145,10 @@ router.get(PATH.REST_AVAILABILITY, function(req, res, next) {findAllByName(req,r
router.post(PATH.REST_AVAILABILITY, function(req, res, next) {save(req,res,next); });
router.delete(PATH.REST_AVAILABILITY, function(req, res, next) {remove(req,res,next); });

router.get(PATH.REST_FIREREPORT, function(req, res, next) {findAllByName(req,res,next);});
router.post(PATH.REST_FIREREPORT, function(req, res, next) {save(req,res,next); });
router.delete(PATH.REST_FIREREPORT, function(req, res, next) {remove(req,res,next); });


router.post(PATH.REST_MAIL, function(req, res, next) {mail(req,res,next); });

Expand Down Expand Up @@ -173,7 +181,8 @@ router.get(PATH.EXPORT_CUSTOMERS, function(req, res, next) {excelCustomers(req,r
router.get(PATH.EXPORT_COMPETITORS, function(req, res, next) {excelCompetitors(req,res,next);});
router.get(PATH.EXPORT_PRODUCTCATALOG, function(req, res, next) {excelProductCatalog(req,res,next);});
router.get(PATH.EXPORT_ROADMAPS, function(req, res, next) {excelRoadmaps(req,res,next);});

router.get(PATH.EXPORT_AVAILABILITY, function(req, res, next) {excelAvailability(req,res,next);});
router.get(PATH.EXPORT_FIREREPORT, function(req, res, next) {excelFirereport(req,res,next);});
router.post(PATH.TRANSCODE_BOARDS, function(req, res, next) {transcode(req,res,next); });

router.get(PATH.CONFIG, function(req, res, next) {getConfig(req,res,next);});
Expand Down Expand Up @@ -746,11 +755,55 @@ function excelScrumTeams(req, res , next){
{caption:'Self-formation?',type:'string',width:7,captionStyleIndex:2,beforeCellWrite:_formatCell}
];

_generateAndSendExcel("scrumteams",conf,req,res,next);

/**
* generate scrumteams excel
*/
function excelFirereport(req, res , next){
var conf ={};


conf.stylesXmlFile = "views/excel_export/styles.xml";
conf.cols = [
{caption:'_id',type:'string',width:20,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'type',type:'string',width:20,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'path',type:'string',width:5,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'year',type:'string',width:8,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'count',type:'string',width:8,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'contact',type:'string',width:10,captionStyleIndex:2,beforeCellWrite:_formatCell}


];

_generateAndSendExcel("v1teams",conf,req,res,next);
} _generateAndSendExcel("scrumteams",conf,req,res,next);
}




/**
* generate scrumteams excel
*/
function excelV1Teams(req, res , next){
var conf ={};


conf.stylesXmlFile = "views/excel_export/styles.xml";
conf.cols = [
{caption:'_id',type:'string',width:20,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'Title',type:'string',width:20,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'Business Backlog',type:'string',width:5,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'Program',type:'string',width:8,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'Description',type:'string',width:8,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'Mascot',type:'string',width:10,captionStyleIndex:2,beforeCellWrite:_formatCell},
{caption:'Sprint Schedule',type:'string',width:10,captionStyleIndex:2,beforeCellWrite:_formatCell}

];

_generateAndSendExcel("v1teams",conf,req,res,next);
}

/**
* generate labels excel
*/
Expand Down
83 changes: 83 additions & 0 deletions routes/authenticate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
var express = require('express');
var router = express.Router();
//underscore
var _ = require('lodash');

var config = require('config');

var passport = require('passport')
, LocalStrategy = require('passport-local').Strategy;


var user = require('../services/UserService');


passport.use('local-signin', new LocalStrategy(
{passReqToCallback : true}, // allows us to pass back the request to the callback
function(req,username, password, done) {

console.log("....trying to authenticate");
debugger;

user.findByUsername(username, function (err, user) {
console.log("...in find");
if (err) {
console.log("...error");
return done(err);
}
if (!user) {
console.log("...invalid user");
return done(null, false, { message: 'Unknown user ' + username });
}
if (user.password != password) {
console.log("...wrong password");
return done(null, false, { message: 'Invalid password' });
}
console.log("...[OK]");
return done(null, user);

});

}
));

// Passport session setup.
passport.serializeUser(function(user, done) {
console.log("serializing " + user.username);
done(null, user);
});

passport.deserializeUser(function(obj, done) {
console.log("deserializing " + JSON.stringify(obj));
done(null, obj);
});






/** passport authetication
*/
router.post('/', function(req,res,next){
debugger;
passport.authenticate('local-signin', function(err,user,info){
if (err) { return next(err); }
if (!user) { return res.render('login'); }
req.logIn(user, function(err) {
if (err) { return next(err); }
console.log("[we are very close :-), req.session.ORIGINAL_URL: "+req.session.ORIGINAL_URL);
var sess = req.session;
sess.AUTH=user.role;
//return res.json({detail: info});
res.send({AUTH:user.role,ORIGINAL_URL:req.session.ORIGINAL_URL});
});
})(req, res, next);
});

module.exports = router;





37 changes: 37 additions & 0 deletions routes/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var express = require('express');
var router = express.Router();
var _ = require('lodash');

var config = require('config');


var avService = require('../services/AvailabilityService');



//
router.get('/', function(req, res) {
//if (!req.session.AUTH){
if (!req.session.AUTH){
req.session.ORIGINAL_URL = req.originalUrl;
console.log("no req.session.AUTH found: ");
res.redirect("/login");
}
else{
avService.getLatest(function(av){

res.locals.availability = av;
res.locals.downtime = avService.getDowntimeYTD(av.unplannedYTD,av.week);
res.locals.targetDowntime = avService.getDowntimeYTD(99.75,52);
res.locals.leftDowntime = avService.getDowntimeYTD(99.75,52);
res.render('dashboard', { title: 's p a c e - dashboards' });
});
}
});

module.exports = router;





Loading

0 comments on commit 2bc2cde

Please sign in to comment.