Skip to content

Commit

Permalink
hg flow, merge release 1.0.3 to publish branch default
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Rynarzewski authored and Pawel Rynarzewski committed Dec 16, 2015
2 parents 0f57d27 + 09c2511 commit 78b167f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 20 deletions.
12 changes: 11 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-connect-proxy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-processhtml');

function proxy(path) {
return {
Expand Down Expand Up @@ -34,6 +35,14 @@ module.exports = function (grunt) {
}
});

grunt.config('processhtml', {
build: {
files: {
'build/index.html': ['app/index.html']
}
}
});

grunt.config('uglify', {
build: {
files: {
Expand All @@ -56,7 +65,7 @@ module.exports = function (grunt) {
expand: true,
dest: 'build/',
cwd: 'app',
src: ['img/logo.svg','img/grad.png', 'style/main.css', 'index.html']
src: ['img/logo.svg','img/grad.png', 'style/main.css']
}
]
}
Expand All @@ -68,6 +77,7 @@ module.exports = function (grunt) {
]);

grunt.registerTask('build', [
'processhtml',
'uglify',
'copy'
]);
Expand Down
7 changes: 7 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ <h2 class="title beige center">Füllstand</h2>

</div>

<!-- build:remove -->
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/moment/locale/de.js"></script>
<script src="bower_components/jquery/dist/jquery.js"></script>
<!-- /build -->

<script src="script/main.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
Expand Down
39 changes: 32 additions & 7 deletions app/script/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,8 @@

showSpinner();

getMeasurementData().success(function (data) {
var measurements = data.measurements,
map = {},
getMeasurements().then(function (measurements) {
var map = {},
graphData = measurements.map(function (m) {
var d = moment(m.time);

Expand Down Expand Up @@ -356,21 +355,47 @@
});
}

function getMeasurementData() {
var months = 12,
function getMeasurements() {
var deferred = $.Deferred(),
months = 4,
dateFrom = moment().subtract(months, 'months').format('YYYY-MM-DD'),
dateTo = moment().add(1, 'days').format('YYYY-MM-DD'),
url = URL_BASE + '/measurement/measurements/?' +
'pageSize=5000' +
'pageSize=2000' +
'&source=' + DEVICE_DATA.id +
'&dateFrom=' + dateFrom +
'&dateTo=' + dateTo +
'&type=c8y_TekelecRemainingFuel';

getMeasurementsFromUrl([], url)
.then(function (measurements) {
deferred.resolve(measurements);
});

return deferred.promise();
}

function getMeasurementsFromUrl(measurements, url) {
var deferred = $.Deferred();

return $.ajax({
$.ajax({
url: url,
headers: getHeadersNoContent()
}).success(function (res) {
$.each(res.measurements, function (i, measurement) {
measurements.push(measurement);
});
if (res.measurements.length) {
getMeasurementsFromUrl(measurements, res.next)
.then(function () {
deferred.resolve(measurements);
});
} else {
deferred.resolve(measurements);
}
});

return deferred.promise();
}

function getHeaders(_token) {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "proteus",
"version": "1.0.1",
"version": "1.0.3",
"authors": [
"Luis Confraria <lconfraria@gmail.com>"
],
Expand Down
18 changes: 9 additions & 9 deletions build/script/main.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "proteus",
"version": "1.0.2",
"version": "1.0.3",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -13,6 +13,7 @@
"grunt-connect-proxy": "^0.2.0",
"grunt-contrib-connect": "^0.8.0",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-uglify": "^0.5.1"
"grunt-contrib-uglify": "^0.5.1",
"grunt-processhtml": "^0.3.8"
}
}

0 comments on commit 78b167f

Please sign in to comment.