Skip to content

Commit

Permalink
using Start/End and Granularity instead of Days
Browse files Browse the repository at this point in the history
  • Loading branch information
WheelerXie committed Aug 11, 2017
1 parent b705c19 commit b2022b3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 209 deletions.
8 changes: 4 additions & 4 deletions public/main.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/js/app.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ app.constant('CONST', {
'SupportExperienceIssuesDetected': 'Support experience issues'
},
SERVICE_INFO: {
ENDPOINT: 'https://shpv2-dataslice.azurewebsites.net/WebServices/S3PDataService/',
ENDPOINT: 'http://shpv2-uat.azurewebsites.net/WebServices/SHPDateUnlimitedDataService/',
LOCAL_TEST_DATA: '/data/',
TWITTER_SERVER_STATUS:'https://shpv2-dataslice.azurewebsites.net/WebServices/S3PDataService/GetJobStatus',
OTHERS_SERVER_STATUS:'https://shpv2-rawdata-proccess.azurewebsites.net/WebServices/S3PDataService/GetJobStatus'
/*
ENDPOINT: 'https://shpv2-dataslice.azurewebsites.net/WebServices/S3PDataService/',
ENDPOINT: 'http://shpv2-uat.azurewebsites.net/WebServices/SHPDateUnlimitedDataService/',
LOCAL_TEST_DATA: '/data/',
TWITTER_SERVER_STATUS:'https://shpv2-dataslice.azurewebsites.net/WebServices/S3PDataService/GetJobStatus',
OTHERS_SERVER_STATUS:'https://shpv2-rawdata-proccess.azurewebsites.net/WebServices/S3PDataService/GetJobStatus'
Expand Down
9 changes: 7 additions & 2 deletions src/js/controller/homeCtrl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function ($scope, $rootScope, $timeout, $http, $q, $sce, $compile, $document, $websocket, CONST) {
module.exports = function ($scope, $rootScope, $timeout, $http, $q, $sce, $compile, $document, $websocket, CONST, utilitySrv) {
$scope.query = {};
// var totalrequests = 28+12;
var sections = 8,
Expand Down Expand Up @@ -88,7 +88,12 @@ module.exports = function ($scope, $rootScope, $timeout, $http, $q, $sce, $compi
$('#progress').show();
if ($scope.query.topic !== topic) {
$scope.enabledPlatforms = [];
$scope.query.topic = topic
$scope.query.topic = topic;
var days = 30;
var start = moment.utc().startOf('day').subtract(days, 'days').valueOf();
var end = moment.utc().startOf('day').subtract(1, 'days').valueOf();
$scope.query.start = start;
$scope.query.end = end;
// console.log($scope);
$timeout(function () {
$scope.topics.forEach(function (item) {
Expand Down
37 changes: 17 additions & 20 deletions src/js/directive/chartDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,8 @@ module.exports = /*@ngInject*/ function ($rootScope, $filter, $q, $location, $co
var apiFn = _.service[_.apiFn];
switch (_.apiFn) {
case 'getSpikes':
var fnPromise = apiFn(_.platform, _.query.topic, _.query.days);
customSpikesData(fnPromise, _).then(function (config) {
// console.log('getSpikes')
var fnPromise = apiFn(_.platform, _.query.topic, 3, _.query.start, _.query.end + 3600000 * 24);
customSpikesData(fnPromise, _, utilitySrv).then(function (config) {
_.chartOpt = angular.extend(_.chartOpt, config);
initChart(_.chartObj, _.chartOpt, _.group);
afterInit($rootScope, _, _.chartObj);
Expand Down Expand Up @@ -730,17 +729,23 @@ function customInfluenceData(fnPromise, scope) {
})
}

function customSpikesData(fnPromise, scope) {
function customSpikesData(fnPromise, scope, utilitySrv) {
var start = scope.query.start;
var end = scope.query.end;
console.log(start, end);
var xAxis = {
data: utilitySrv.getTimeRange(scope.query.start, scope.query.end).map(function (dt) {
//data: scope.$root.dateList.map(function (dt) {
return moment(dt).utc().format('L');
})
};

var simpleSeries = function (raw) {
var seriesData = raw.map(function (item) {
return item.dailyspikevol
})
});
return {
xAxis: {
data: scope.$root.dateList.map(function (dt) {
return moment(dt).utc().format('L');
})
},
xAxis: xAxis,
series: [{
name: 'Spikes',
type: 'bar',
Expand All @@ -760,11 +765,7 @@ function customSpikesData(fnPromise, scope) {
})

return {
xAxis: {
data: scope.$root.dateList.map(function (dt) {
return moment(dt).utc().format('L');
})
},
xAxis: xAxis,
grid: {
width: '75%'
},
Expand Down Expand Up @@ -819,11 +820,7 @@ function customSpikesData(fnPromise, scope) {
break;
}
return {
xAxis: {
data: scope.$root.dateList.map(function (dt) {
return moment(dt).utc().format('L');
})
},
xAxis: xAxis,
series: [{
name: 'Influence Vol',
type: 'line',
Expand Down
186 changes: 4 additions & 182 deletions src/js/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,186 +100,6 @@ app.factory('Notifications', function (baseSrv, CONST) {
}
});

app.factory('testSrv', function (baseSrv) {
return {
test: function (params) {
return baseSrv.devGet('GetMentionedServiceList')
},
getCate: function (platform) {
var params = params || {};
params.platform = platform || 'all';
return baseSrv.devGet('GetAllEnabledTopicsByPlatform', params);
},
getUser: function (platform, topNum, topic, PNScope) {
var params = params || {};
params.platform = platform || 'all';
params.topNum = topNum || 5;
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
return baseSrv.devGet('GetTopUsers', params);
},
getSpikes: function (platform, topic, days) {
var params = params || {};
params.platform = platform || 'all';
params.days = days || 7;
params.topic = topic || 'all';
return baseSrv.devGet('GetDailyVolSpikes', params);
},
getDistribution: function (platform, topic) {
var params = params || {};
params.platform = platform || 'all';
params.topic = topic || 'all';
return baseSrv.devGet('GetPNDistribution', params);
},
getMentionedMostServiceList: function (platform, topic, PNScope) {
var params = params || {};
params.platform = platform || 'all';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
return baseSrv.devGet('GetMentionedMostServiceList', params);
},
getMentionedMostServiceListByUserVol: function (platform, topic, PNScope) {
var params = params || {};
params.platform = platform || 'all';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
return baseSrv.devGet('GetMentionedMostServiceListByUserVol', params);
},
getMentionedMostServiceDistribution: function (platform, topic, PNScope) {
var params = params || {};
params.platform = platform || 'all';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
return baseSrv.devGet('GetMentionedMostServiceList', params);
},
getInfluence: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'all';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetDailyInfluence', params);
},
getVoCDetailsByDate: function (platform, topic, date, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.date = date || Math.floor(new Date().getTime() / 1000);
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('subwindow', params);
},
getVoCDetailsByUser: function (platform, topic, user, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.user = user || 1234;
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('subwindow' + '.' + params.platform, params);
},
getVoCDetailsByPN: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('subwindow' + '.' + params.platform, params);
},
getVoCDetailsByServiceName: function (platform, topic, service, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.servicename = service || 'webapp';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('subwindow' + '.' + params.platform, params);
},
getImpactSummary: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetImpactSummary', params);
},
getUserVolSpikes: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetUserVolSpikes', params);
},
getMessageVolSpikes: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetMessageVolSpikes', params);
},
getInfluenceVolSpikes: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetInfluenceVolSpikes', params);
},
getUserRegionVolSpikes: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetUserRegionVolSpikes', params);
},
getKeywordsMentionedMostMapping: function (platform, topic, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('GetKeywordsMentionedMostMapping', params);
},
getSubPageVoCDetails: function (platform, topic, date, PNScope, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.date = date || Math.floor(new Date().getTime() / 1000);
params.PNScope = PNScope || 'all';
params.days = days || 7;
return baseSrv.devGet('subwindow' + '.' + params.platform, params);
},
getSubPageVoCDetailsbyKeywords: function (platform, topic, keywords, PNScope, IsFuzzyQuery, days) {
var params = params || {};
params.platform = platform || 'twitter';
params.topic = topic || 'all';
params.keywords = keywords || 'notworking';
params.PNScope = PNScope || 'all';
params.IsFuzzyQuery = IsFuzzyQuery || 'true';
params.days = days || 7;
return baseSrv.devGet('subwindow' + '.' + params.platform, params);
},
getSysDetections: function (forumName, msgType, topic, downloadable, bgTime, egTime) {
var params = params || {};
params.forumName = forumName || 'all';
params.msgType = msgType || 'all';
params.topic = topic || 'all';
params.downloadable = downloadable || 'all';
params.bgTime = bgTime || 0;
params.egTime = egTime || 0;
return baseSrv.devGet('GetSysDetections', params);
},
getPlatformSyncSetting: function (platform) {
var params = params || {};
params.platform = platform || 'all';
return baseSrv.devGet('GetPlatformSyncSetting', params);
}
}
})

app.factory('rawdataSrv', function (baseSrv) {
return {
getCate: function (platform) {
Expand All @@ -296,11 +116,13 @@ app.factory('rawdataSrv', function (baseSrv) {
params.days = days || 7;
return baseSrv.get('GetTopUsers', params);
},
getSpikes: function (platform, topic, days) {
getSpikes: function (platform, topic, granularity, start, end) {
var params = params || {};
params.platform = platform || 'all';
params.days = days || 7;
params.topic = topic || 'all';
params.fromcycle = granularity || 3;
params.start = start / 1000;
params.end = end / 1000;
return baseSrv.get('GetDailyVolSpikes', params);
},
getDistribution: function (platform, topic, days) {
Expand Down

0 comments on commit b2022b3

Please sign in to comment.