This repository has been archived by the owner on Sep 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Call/SMS reporting:- #65
Open
shivkumarsah
wants to merge
1
commit into
facebookarchive:master
Choose a base branch
from
piyushabad88:sprint3_pr_call_report
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
154 changes: 154 additions & 0 deletions
154
cloud/endagaweb/templates/dashboard/report/call-sms.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{% extends "dashboard/layout.html" %} | ||
{% comment %} | ||
Copyright (c) 2016-present, Facebook, Inc. | ||
All rights reserved. | ||
|
||
This source code is licensed under the BSD-style license found in the | ||
LICENSE file in the root directory of this source tree. An additional grant | ||
of patent rights can be found in the PATENTS file in the same directory. | ||
{% endcomment %} | ||
{% load apptags %} | ||
{% load humanize %} | ||
{% load crispy_forms_tags %} | ||
|
||
|
||
{% block title %} | ||
{% tmpl_const "SITENAME" %} | Report | ||
{% if report_summary %} | ||
| "{{ report_summary }}" | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block pagestyle %} | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.13-beta/nv.d3.min.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.14.30/css/bootstrap-datetimepicker.min.css"> | ||
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" type="text/css"/> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
{% include "dashboard/report/header.html" with header='Call & SMS' %} | ||
|
||
<div class='row'> | ||
{% include "dashboard/report/nav.html" with active_tab='call_sms' %} | ||
|
||
<div class='content col-xs-12 col-sm-10 col-md-10'> | ||
|
||
{% include "dashboard/report/filter.html" with action_url='/dashboard/reports/calls' %} | ||
{% if network_has_activity %} | ||
<div class="row"> | ||
<div id='sms-usage-chart'></div> | ||
</div> | ||
<div class="row"> | ||
<div id='call-number-chart'></div> | ||
</div> | ||
<div class="row"> | ||
<div id='call-minutes-chart'></div> | ||
</div> | ||
|
||
<div class="row"> | ||
{% include 'dashboard/timezone-notice.html' %} | ||
</div> | ||
{% else %} | ||
<p>There is no network activity to display.</p> | ||
{% endif %} | ||
</div> <!-- /.col-md-4 --> | ||
</div> | ||
{% endblock %} | ||
|
||
|
||
{% block js %} | ||
{% if network_has_activity %} | ||
<script> | ||
$(function() { | ||
setTimeout(function() { | ||
$('.timezone-notice').fadeIn(500); | ||
}, 800); | ||
}); | ||
$("#save-btn").click(function() { | ||
$("#call-number-chart").get(0).toBlob(function(blob) { | ||
saveAs(blob, "call-number-chart.png"); | ||
}); | ||
}); | ||
</script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/JSXTransformer.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.1.5/d3.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.13-beta/nv.d3.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.14.30/js/bootstrap-datetimepicker.min.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already included above |
||
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is included above |
||
<script type="text/jsx" src="/static/js/dashboard/report-chart-components.js"></script> | ||
<script type="text/jsx"> | ||
var currentTimeEpoch = {{ current_time_epoch }}; | ||
var timezoneOffset = {{ timezone_offset }}; | ||
{% if 'Number of Calls' in reports %} | ||
React.render( | ||
<TimeseriesChartWithButtonsAndDatePickers | ||
title='Number of Calls' | ||
chartID='call-chart' | ||
statTypes='free_call,outside_call,local_call,local_recv_call,incoming_call,error_call' | ||
level='{{ level }}' | ||
levelID='{{ level_id }}' | ||
aggregation='count' | ||
yAxisLabel='numbers of calls' | ||
currentTimeEpoch={currentTimeEpoch} | ||
timezoneOffset={timezoneOffset} | ||
tooltipUnits='s of' | ||
chartType='pie-chart' | ||
reportView='summary' | ||
/>, | ||
document.getElementById('call-number-chart') | ||
); | ||
{% endif %} | ||
{% if 'Minutes of Call' in reports %} | ||
|
||
React.render( | ||
<TimeseriesChartWithButtonsAndDatePickers | ||
title='Minutes of Calls' | ||
chartID='data-chart' | ||
statTypes='free_call,outside_call,local_call,local_recv_call,incoming_call,error_call' | ||
level='{{ level }}' | ||
levelID='{{ level_id }}' | ||
aggregation='duration_minute' | ||
yAxisLabel='minutes of call' | ||
currentTimeEpoch={currentTimeEpoch} | ||
timezoneOffset={timezoneOffset} | ||
tooltipUnits='s of' | ||
chartType='pie-chart' | ||
reportView='summary' | ||
/>, | ||
document.getElementById('call-minutes-chart') | ||
); | ||
|
||
{% endif %} | ||
{% if 'Number of SMS' in reports %} | ||
|
||
React.render( | ||
<TimeseriesChartWithButtonsAndDatePickers | ||
title='Number of SMS ' | ||
chartID='sms-chart' | ||
statTypes='local_sms,local_recv_sms,outside_sms,incoming_sms,free_sms,error_sms' | ||
level='{{ level }}' | ||
levelID='{{ level_id }}' | ||
aggregation='count' | ||
yAxisLabel='number of SMS' | ||
currentTimeEpoch={currentTimeEpoch} | ||
timezoneOffset={timezoneOffset} | ||
tooltipUnits='' | ||
chartType='pie-chart' | ||
reportView='summary' | ||
/>, | ||
document.getElementById('sms-usage-chart') | ||
); | ||
{% endif %} | ||
|
||
</script> | ||
<script type="text/javascript"> | ||
function setloading() { | ||
var $btn = $('#submit').button().button('loading'); | ||
} | ||
</script> | ||
|
||
{% endif %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Network views. | ||
|
||
Copyright (c) 2016-present, Facebook, Inc. | ||
All rights reserved. | ||
|
||
This source code is licensed under the BSD-style license found in the | ||
LICENSE file in the root directory of this source tree. An additional grant | ||
of patent rights can be found in the PATENTS file in the same directory. | ||
""" | ||
|
||
|
||
class CallReportView(BaseReport): | ||
"""View Call and SMS reports on basis of Network or tower level.""" | ||
|
||
def __init__(self, **kwargs): | ||
template = "dashboard/report/call-sms.html" | ||
url_namespace = "call-report" | ||
reports = {'Call': ['Number of Calls', 'Minutes of Call'], | ||
'SMS': ['Number of SMS']} | ||
super(CallReportView, self).__init__(reports, template, | ||
url_namespace, **kwargs) | ||
|
||
def get(self, request): | ||
return self.handle_request(request) | ||
|
||
def post(self, request): | ||
return self.handle_request(request) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is included above. Let's keep script imports together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for chat js files. Above includes files are css style. CSS files are included in top of page in 'pagestyle' block to load pages fast, and js files are added in bottom '"js" block