Skip to content

Commit

Permalink
Merge pull request #5 from paulsjv/master
Browse files Browse the repository at this point in the history
Get latest changes from paulsjv.
  • Loading branch information
satvidh committed Jan 31, 2016
2 parents c7c6345 + ed1db38 commit 8c328c3
Show file tree
Hide file tree
Showing 25 changed files with 361 additions and 101 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/**/*
nodejs/server.js
.DS_Store
bower_components/
.idea/
4 changes: 4 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

97 changes: 66 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,77 @@ Life Cycle

Installing & Running
-------------------------
Currently there is no home for LeanSheets so you will have to clone the repo and run it locally. You'll also need a Google Spread Sheet that you can link to for LeanSheets to work. If you would like an example sheet please open an issue as I'm in the process of making one that can be the example/demo sheet.
You have two options to run LeanSheets:

1. Clone the following repo: https://github.com/paulsjv/leansheets
* The master branch is what you want. It's the latest version.
2. Make sure you have Nodejs installed on your system. Next run the following commands to install everything.
1. Download either the [.zip](https://github.com/paulsjv/leansheets/zipball/master) or the [tar.gz](https://github.com/paulsjv/leansheets/tarball/master)
* If you choose this option you can skip the steps of installing Git and running "git clone" in the below instructions.
2. Clone the Git repo.
* If you choose this step follow all the below instructions.

```
$> npm install
$> bower install
```
3. Update the ./src/config.json file to be like below (Google Sheet is the demo I'm currently working on):
Installation instructions:

```json
{
"configUrl": "https://docs.google.com/a/google.com/spreadsheet/ccc?key=12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw&usp=drive_web&gid=44020743#",
"dataUrl": "https://docs.google.com/a/google.com/spreadsheet/ccc?key=12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw&usp=drive_web&gid=497466409#",
"debugEnabled": true,
"showAllWork": true,
"cacheTtl": 300,
"datePickerFormat": "mm/dd/yyyy",
"datePickerMomentFormat": "MM/DD/YYYY",
"queryDateMomentFormat": "YYYY-MM-DD",
"defaultHistoricalNumberOfDays": 60
}
```
See the video here:

http://www.screencast.com/t/q0aWDzuQGn

Download and Install the following

Nodejs - http://www.nodejs.org

Click the “Install” button on the page

Git - https://git-scm.com/downloads

Click on the OS you use

Once these two programs are installed do the following steps:

NOTE: The configUrl and dataUrl must be of the form https:https://docs.google.com/spreadsheet/ccc?key=<key>&gid=<id>. If the url is of the form https://docs.google.com/spreadsheets/d/<key>/edit#gid=<id> then translate it into the above expected format.
If you are running Windows make sure to run the "GIT Bash" program from your Start menu. This will get you the command prompt you will need to run the below commands.

4. Run the following command to install grunt-cli if you have not done so already.
```
$> npm install -g grunt-cli
```
5. Run the following command to start the server.
```
$> grunt run
```
If you are running Mac you will want to run the following commands from your "Terminal."

```
cmd> git clone https://github.com/paulsjv/leansheets.git
cmd> cd leansheets
cmd> npm install -g bower <may have to run as root>
cmd> npm install -g grunt-cli <may have to run as root>
cmd> npm install grunt
cmd> bower install
cmd> npm install
cmd> grunt run
```

Open the link in your browser:

http://localhost:8081

Choose a date between 11/1/2014 and 4/31/2015. See the Google Sheet here for the data your local instance is currently running.

https://docs.google.com/spreadsheets/d/12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw/edit?gid=44020743#gid=497466409

Update to use your own Google Sheet
-------------------------
Update the ./src/config.json file to be like below (Google Sheet is the demo when you first run and lauch LeanSheets in your browser). Make sure you change the key and the gid in the URL. Also, depending on what version of Google Sheets you are running the URL might be slightly different. If you can not figure it out please open an issue on the github page.

https://docs.google.com/spreadsheets/d/[key]/edit?gid=[gid]

```json
{
"sheets": {
"Sheet: Demo Team": {
"configUrl": "https://docs.google.com/spreadsheets/d/12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw/edit?gid=44020743",
"dataUrl": "https://docs.google.com/spreadsheets/d/12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw/edit?gid=497466409"
}
},
"debugEnabled": true,
"showAllWork": true,
"cacheTtl": 300,
"datePickerFormat": "mm/dd/yyyy",
"datePickerMomentFormat": "MM/DD/YYYY",
"queryDateMomentFormat": "YYYY-MM-DD",
"defaultHistoricalNumberOfDays": 60
}
```

Running Tests
-------------------------
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leansheets",
"version": "0.0.7",
"version": "0.1.1",
"homepage": "https://github.com/paulsjv/leansheets",
"authors": [
"Jay Paulson <[email protected]>"
Expand All @@ -11,7 +11,7 @@
"kanban",
"lean"
],
"license": "MIT",
"license": "CC-BY-NC-ND-3.0",
"private": true,
"ignore": [
"node_modules",
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "Leansheets",
"description": "A tool to trak team performance.",
"version": "0.0.7",
"author": "Jay Paulson",
"version": "0.1.1",
"author": "Jay Paulson [email protected]",
"homepage": "http://www.leansheets.org",
"license": "CC-BY-NC-ND-3.0",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -12,7 +14,7 @@
"url": "https://github.com/paulsjv/leansheets.git"
},
"bugs": {
"url": "ihttps://github.com/paulsjv/leansheets/issues"
"url": "https://github.com/paulsjv/leansheets/issues"
},
"devDependencies": {
"bower": "^1.3.12",
Expand Down
8 changes: 6 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"configUrl": "https://docs.google.com/a/drillinginfo.com/spreadsheet/ccc?key=0AonIdzD-Ya1EdHdlRWNXcmVrMlRGRlZ4bXVwb1B5T2c&usp=drive_web&gid=5#",
"dataUrl": "https://docs.google.com/a/drillinginfo.com/spreadsheet/ccc?key=0AonIdzD-Ya1EdHdlRWNXcmVrMlRGRlZ4bXVwb1B5T2c&gid=2&usp=drive_web#",
"sheets": {
"Sheet: Demo Team": {
"configUrl": "https://docs.google.com/spreadsheets/d/12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw/edit?gid=44020743",
"dataUrl": "https://docs.google.com/spreadsheets/d/12cvMUMnWEKynGTsyXQywvJ9drpjYAyyo0-2cnTUJSFw/edit?gid=497466409"
}
},
"debugEnabled": true,
"showAllWork": true,
"cacheTtl": 300,
Expand Down
Binary file added src/img/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 45 additions & 7 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,25 @@

<!-- build:section partials._header -->
<!-- /build -->
<div data-ng-if="initialLoad">
<p>Loading Application....</p>
</div>
<div class="container-fluid di-flex-box" data-ng-cloak>

<div class="loading" data-ng-class="{hide: true}"></div>

<div class="container-fluid di-flex-box" style="display: none;" data-ng-style="{display: 'block'}">
<a id="nav-sheets"></a>
<!-- Sheets Drop Down -->
<div id="sheets-dropdown">
<div class="btn-group" role="sheets" aria-label="Sheet Selections" style="padding-right:5px">
<button type="button" class="btn btn-default">{{sheet}}</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu scrollable-menu" role="menu">
<li ng-model="value" ng-click="changeSheet(key)" ng-repeat="(key, value) in sheets"><a>{{key}}</a></li>
</ul>
</div>
</div>
<!-- /Sheets Drop Down -->
<a id="nav-histogram"></a>
<div id="histogramChart" data-ng-controller="ls-histogramController">
<div class="btn-group" role="date-picker" aira-label="Date Picker">
Expand Down Expand Up @@ -57,7 +72,15 @@
ng-model="value" ng-click="changeType(workType, key)" ng-repeat="workType in workTypes"><a>{{workType.name}}</a></li>
</ul>
</div>
<highchart id="histogramHighChart" config="config"></highchart>

<div class="chart-container">
<div class="alert alert-warning" role="alert" data-ng-if="!dataStatus.histogram">
<button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
<strong>Your query returned no results</strong>
</div>
<highchart id="histogramHighChart" config="config"></highchart>
</div>

</div>

<a id="nav-leadtimerun"></a>
Expand Down Expand Up @@ -91,7 +114,13 @@
ng-model="value" ng-click="changeType(workType, key)" ng-repeat="workType in workTypes"><a>{{workType.name}}</a></li>
</ul>
</div>
<highchart id="controlHighChart" config="config"></highchart>
<div class="chart-container">
<div class="alert alert-warning" role="alert" data-ng-if="!dataStatus.control">
<button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
<strong>Your query returned no results</strong>
</div>
<highchart id="controlHighChart" config="config"></highchart>
</div>
</div>

<a id="nav-cfd"></a>
Expand Down Expand Up @@ -125,7 +154,16 @@
ng-model="value" ng-click="changeType(workType, key)" ng-repeat="workType in workTypes"><a>{{workType.name}}</a></li>
</ul>
</div>
<highchart id="cfdHighChart" config="config"></highchart>
<div class="chart-container">
<div class="alert alert-warning" role="alert" data-ng-if="!dataStatus.cfd">
<button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
<strong>Your query returned no results</strong>
</div>
<highchart id="cfdHighChart" config="config"></highchart>
</div>


</div>
</div>

<!-- build:section partials._footer -->
Expand Down
56 changes: 38 additions & 18 deletions src/js/modules/leansheets/controllers/ls-applicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,58 @@ define(['angular'], function (ng) {
*/
return ['$log','$scope','ls-typeService','ls-configService','$moment',
function ($log, $scope, typeService, configService, $moment) {

$scope.workType;
$scope.workTypes;
// this is the data status for each chart. It is set in the parent controller
// as an empty array but, each controller initilizes it to false upon startup.
// it turns to ture in this controller when there is no data returned.
$scope.dataStatus = [];

typeService.getWorkTypes().then(
function(success) {
$log.log('Got work types: ls-applicationController', success);
$scope.workTypes = success;
$scope.workType = $scope.workTypes[0].column != "" ? $scope.workTypes[0] : $scope.workTypes[1];

// broadcast event to all child contorllers so they will draw their charts
$log.debug('Firing "types:loaded" event: ls-applicationController');
$scope.$broadcast('types:loaded', $scope.workType);
}, function(error) {
$log.log('Error getting work types: ls-applicationController!', error);
alert('Error getting work types! ' + error);
});
$scope.sheetsKeys = Object.keys(configService.getSheets());
$scope.sheet = $scope.sheetsKeys[0];
$scope.sheets = configService.getSheets();

$scope.changeSheet = function(sheet) {
$log.debug("ls-applicationController: Changing sheet");
$scope.sheet = sheet;
getWorkTypes(sheet);
};

var getWorkTypes = function(sheet) {
typeService.getWorkTypes(sheet).then(
function(success) {
$log.log('Got work types: ls-applicationController', success);
$scope.workTypes = success;
$scope.workType = $scope.workTypes[0].column != "" ? $scope.workTypes[0] : $scope.workTypes[1];

// broadcast event to all child contorllers so they will draw their charts
$log.debug('Firing "types:loaded" event: ls-applicationController');
$scope.$broadcast('types:loaded', $scope.workType);
}, function(error) {
$log.log('Error getting work types: ls-applicationController!', error);
alert('Error getting work types! ' + error);
});
};

getWorkTypes($scope.sheet);

$scope.updateChart = function(obj, chart, chartName) {

$log.debug('updateChart: ls-applicationController');
if (areWorkTypesValid(obj.workTypes) &&
areDatesValid(obj.startDate, obj.endDate)) {
chart.getChart(obj).then(
function(success) {
// hide the error message message for the chart
$log.debug('Firing "chart:' + chartName + '" event: ls-applicationController!');
$scope.$broadcast('chart:' + chartName, success);
$scope.dataStatus[chartName] = true;
}, function(error) {
// show error message for the chart
$scope.dataStatus[chartName] = false;
$log.debug('Error getting data from Google Sheets!', error);
alert('Error getting data from Google Sheets! ' + error);
});
}

};

$scope.addDropdownParent = function(dropdowns, defaultWorkType, key) {
Expand All @@ -73,7 +93,7 @@ define(['angular'], function (ng) {
return dropdowns;
};

// returns current date minus number of days to subtract
// returns current date minus number of days to subtract
// from current date that is supplied in the config.json
$scope.getDefaultStartDate = function() {
return $moment()
Expand All @@ -87,7 +107,7 @@ define(['angular'], function (ng) {
};

var areDatesValid = function(startDate, endDate) {
if (!ng.isDefined(startDate) ||
if (!ng.isDefined(startDate) ||
!ng.isDefined(endDate) ||
!isDateValid(startDate) ||
!isDateValid(endDate)) {
Expand Down
18 changes: 18 additions & 0 deletions src/js/modules/leansheets/controllers/ls-cfdController.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,35 @@ define(['angular'], function (ng) {
$scope.startDate;
$scope.endDate;

$scope.dataStatus[chartName] = false;

$scope.addDropdown = function() {
$log.debug('ls-cfdController: adding dropdown');
$scope.dropdowns = $scope.addDropdownParent($scope.dropdowns, defaultWorkType, $scope.dropdowns.length);
key = $scope.dropdowns.length;
};

/**
* @function removeDropdown
* @param {integer} key
* Removes one of the dropdowns in the dropdown Array. The key is passed as a parameter.
* This parameter is set from using the $index in the HTML.
*/
$scope.removeDropdown = function(key) {
$log.debug('ls-cfdController: removing dropdown');
$scope.dropdowns = $scope.removeDropdownParent($scope.dropdowns, key);
key = $scope.dropdowns.length;
};

/**
* @function removeAllDropdowns
* Resets the dropdowns array to an empty arrray.
* $scope.removeDropdown().
*/
var removeAllDropdowns = function() {
$scope.dropdowns = [];
};

$scope.query = function() {
$log.debug('ls-cfdController: Calling parent controller to update control chart!');
$log.debug('ls-cfdController: work types sending to query', $scope.dropdowns);
Expand All @@ -57,6 +74,7 @@ define(['angular'], function (ng) {
function(event, workType) {
$log.debug('ls-cfdController: Caught "types:loaded" event!');
defaultWorkType = workType;
removeAllDropdowns();
$scope.addDropdown();
$scope.startDate = $scope.getDefaultStartDate();
$scope.endDate = $scope.getDefaultEndDate();
Expand Down
Loading

0 comments on commit 8c328c3

Please sign in to comment.