Skip to content

Commit

Permalink
Rename and refactor Twitter History screen to Interface History scree…
Browse files Browse the repository at this point in the history
…n. Add Github queue wait times to Interface History screen
  • Loading branch information
bpred754 committed Oct 1, 2016
1 parent 5cdffed commit ac9bb1d
Show file tree
Hide file tree
Showing 24 changed files with 365 additions and 311 deletions.
32 changes: 30 additions & 2 deletions src/api/github-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
var API = 'github-api';
var CALLBACK = '/callback';
var GET_AUTHENTICATION_DATA = '/getAuthenticationData';
var GET_QUEUE_WAIT_TIMES = '/getQueueWaitTimes';
var INVALID_SESSION = 'Invalid session';

// Global variables
Expand Down Expand Up @@ -108,10 +109,10 @@
if (request.session.user.profileImg == 'image/avatar-medium.png') {
UserService.setProfileImage('Github', request.session.user, logData, function (updatedUser) {
request.session.user = updatedUser;
response.redirect(process.env.AUGEO_HOME + '/twitterHistory');
response.redirect(process.env.AUGEO_HOME + '/interfaceHistory');
});
} else {
response.redirect(process.env.AUGEO_HOME + '/twitterHistory');
response.redirect(process.env.AUGEO_HOME + '/interfaceHistory');
}
});
});
Expand Down Expand Up @@ -162,5 +163,32 @@
}
});

GithubRouter.get(GET_QUEUE_WAIT_TIMES, function(request, response) {
var username = AugeoValidator.isSessionValid(request) ? request.session.user.username : null;

var rollback = function(message) {
log.functionError(API, GET_QUEUE_WAIT_TIMES, username, message);
response.sendStatus(401);
};

if(username) {
log.functionCall(API, GET_QUEUE_WAIT_TIMES, null, username);
var logData = AugeoUtility.formatLogData(API+GET_QUEUE_WAIT_TIMES, username);

var userId = request.session.user._id;

var waitTimes = new Array();
if(request.session.user.github) {
waitTimes.push(QueueService.githubEventQueue.getUserWaitTime(userId, logData));
} else {
waitTimes.push(QueueService.githubEventQueue.getWaitTime(logData));
}

response.status(200).json({waitTimes:waitTimes});
} else { // If the user doesn't exist in session respond with "Unauthorized" HTTP code
rollback(INVALID_SESSION);
}
});

module.exports = GithubRouter;

28 changes: 12 additions & 16 deletions src/api/twitter-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
var API = 'twitter-api';
var CALLBACK = '/callback';
var GET_AUTHENTICATION_DATA = '/getAuthenticationData';
var GET_TWITTER_HISTORY_PAGE_DATA = '/getTwitterHistoryPageData';
var GET_QUEUE_WAIT_TIMES = '/getQueueWaitTimes';
var INVALID_SESSION = 'Invalid session';

// Global variables
Expand Down Expand Up @@ -111,7 +111,7 @@
screenName: screenName
};

response.redirect(process.env.AUGEO_HOME + '/twitterHistory');
response.redirect(process.env.AUGEO_HOME + '/interfaceHistory');
}, rollback); // End updateTwitterInfo

}, rollback); // End getTwitterUser
Expand Down Expand Up @@ -154,35 +154,31 @@
}
});

TwitterRouter.get(GET_TWITTER_HISTORY_PAGE_DATA, function(request, response) {
TwitterRouter.get(GET_QUEUE_WAIT_TIMES, function(request, response) {
var username = AugeoValidator.isSessionValid(request) ? request.session.user.username : null;

var rollback = function(message) {
log.functionError(API, GET_TWITTER_HISTORY_PAGE_DATA, username, message);
log.functionError(API, GET_QUEUE_WAIT_TIMES, username, message);
response.sendStatus(401);
};

// If user exists in session get profile data
if(username) {
log.functionCall(API, GET_TWITTER_HISTORY_PAGE_DATA, null, username);
var logData = AugeoUtility.formatLogData(API+GET_TWITTER_HISTORY_PAGE_DATA, username);
log.functionCall(API, GET_QUEUE_WAIT_TIMES, null, username);
var logData = AugeoUtility.formatLogData(API+GET_QUEUE_WAIT_TIMES, username);

var userId = request.session.user._id;

var pageData = {
mentionWaitTime: '',
tweetWaitTime: ''
};

var waitTimes = new Array();
if(request.session.user.twitter) {
pageData.mentionWaitTime = QueueService.mentionEventQueue.getUserWaitTime(userId, logData);
pageData.tweetWaitTime = QueueService.tweetEventQueue.getUserWaitTime(userId, logData);
waitTimes.push(QueueService.tweetEventQueue.getUserWaitTime(userId, logData));
waitTimes.push(QueueService.mentionEventQueue.getUserWaitTime(userId, logData));
} else {
pageData.mentionWaitTime = QueueService.mentionEventQueue.getWaitTime(logData);
pageData.tweetWaitTime = QueueService.tweetEventQueue.getWaitTime(logData);
waitTimes.push(QueueService.tweetEventQueue.getWaitTime(logData));
waitTimes.push(QueueService.mentionEventQueue.getWaitTime(logData));
}

response.status(200).json(pageData);
response.status(200).json({waitTimes:waitTimes});
} else { // If the user doesn't exist in session respond with "Unauthorized" HTTP code
rollback(INVALID_SESSION);
}
Expand Down
2 changes: 1 addition & 1 deletion src/interface/github-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
if (error) {
dnsCheckCount++;
if(dnsCheckCount < 2) {
resolveDNS(dnsCheckCount, options, requestToSubmit, errorCallback);
resolveDNS(dnsCheckCount, options, requestToSubmit, callback, errorCallback);
} else {
errorCallback(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,73 @@
/***************************************************************************/

/***************************************************************************/
/* Description: css for twitter-history.html */
/* Description: css for interface-history.html */
/***************************************************************************/

#th-auth-container {
#ih-auth-container {
height:100%;
display:flex;
justify-content:center;
margin-top:15px;
margin-bottom:15px;
}

#th-auth-inner-container {
height:100%;
border-style:solid;
border-color: #333;
padding:15px;
#ih-head-container {
height:250px;
}

.status-container {
margin-top:2%;
.ih-activity {
display:flex;
padding-top:15px;
padding-bottom:15px;
}

.text-icon-container {
text-align:center;
margin-top:-3%;
.ih-description {
margin-bottom: 30px;
margin-top:30px;
}

.twitter-history-glyphicon {
.ih-glyphicon {
display:inline-block;
}

.twitter-history-icon {
text-align:center;
.ih-icon {
width:100%;
max-height:200px;
max-width:200px;
}

.ih-icon-container {
height:100%;
margin:auto;
}

.twitter-history-spacer {
.ih-icon-right {
text-align: right;
}

.ih-spacer {
height:inherit;
}

.status-container {
margin-top:2%;
}

.text-icon-container {
text-align:center;
margin-top:-3%;
}


/***************************************************************************/
/* Screen Size: less than custom small */
/***************************************************************************/

@media(max-width:599px) {

#th-head-container {
height:250px;
margin-left:0px;
}

#header-description {
font-size:1em;
margin-left:5%;
margin-right:0%;
}

#th-title {
#ih-title {
margin-bottom:15px;
font-size:3em;
}

Expand All @@ -89,19 +99,9 @@
margin-top:0px;
}

.tweet-description {
margin-left:80px;
}

.twitter-history-icon {
text-align:center;
font-size: 9em;
margin-top: 30px;
}

.type-description {
text-align:center;
margin-top:43px;
margin:auto;
line-height: 1.4;
}
}
Expand All @@ -112,14 +112,8 @@

@media(min-width:600px) {

#th-head-container {
height:250px;
margin-left:0px;
}

#header-description {
margin-left:5%;
margin-right:0%;
#ih-title {
margin-bottom:15px;
}

.text-icon {
Expand All @@ -128,93 +122,21 @@
margin-top:0px;
}

.tweet-description {
margin-left:80px;
}

.twitter-history-icon {
text-align:center;
font-size: 12em;
margin-top: 30px;
}

.type-description {
text-align:center;
margin-top:43px;
margin:auto;
line-height: 1.4;
}
}

/***************************************************************************/
/* Screen Size: small */
/***************************************************************************/

@media(min-width:767px) {

#header-description {
margin-left:5%;
margin-right:0%;
}

.tweet-description {
margin-left:80px;
}
}

/***************************************************************************/
/* Screen Size: custom medium */
/***************************************************************************/

@media(min-width:850px) {

#header-description {
margin-left:5%;
margin-right:0%;
}

.tweet-description {
margin-left:55px;
}

.twitter-history-jumbotron {
.ih-jumbotron {
padding-left:0px;
padding-right:0px;
}
}

/***************************************************************************/
/* Screen Size: medium */
/***************************************************************************/

@media(min-width:992px) {

#header-description {
margin-left:5%;
margin-right:0%;
}

.tweet-description {
margin-left:50px;
}
}

/***************************************************************************/
/* Screen Size: large */
/***************************************************************************/

@media(min-width:1200px) {

#th-head-container {
height:250px;
margin-left:125px;
}

#header-description {
margin-left:5%;
margin-right:15%;
}

.tweet-description {
margin-left:0px;
}
}
2 changes: 1 addition & 1 deletion src/public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@import url('./dashboard.css');
@import url('./leaderboard.css');
@import url('./login.css');
@import url('./twitter-history.css');
@import url('./interface-history.css');
@import url('./view-activity.css');

/* Directives */
Expand Down
Loading

0 comments on commit ac9bb1d

Please sign in to comment.