This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(export): download clinical & biospec
Closes #1466
- Loading branch information
Terry Lin
authored and
Terry Lin
committed
Mar 18, 2016
1 parent
286fc9f
commit f3c382b
Showing
11 changed files
with
195 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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,64 @@ | ||
module ngApp.cases.directives { | ||
const ExportCasesButton = (config: IGDCConfig): ng.IDirective => ({ | ||
restrict: 'E', | ||
replace: true, | ||
scope: { | ||
filterKeyValues: '=', | ||
fields: '=', | ||
expands: '=', | ||
size: '=', | ||
filename: '=', | ||
fileType: '@', | ||
textNormal: '@', | ||
textInProgress: '@', | ||
styleClass: '@', | ||
icon: '@' | ||
}, | ||
template: '<a ng-class="[styleClass || \'btn btn-primary\']" data-downloader> \ | ||
<i class="fa {{icon || \'fa-download\'}}" ng-class="{\'fa-spinner\': active, \'fa-pulse\': active}" /> \ | ||
<span ng-if="textNormal"><span ng-if="! active"> {{ ::textNormal }}</span> \ | ||
<span ng-if="active"> {{ ::textInProgress }}</span></span></a>', | ||
link: ($scope, $element, $attrs) => { | ||
const scope = $scope; | ||
const inProgress = () => { | ||
scope.active = true; | ||
$attrs.$set('disabled', 'disabled'); | ||
}; | ||
const done = () => { | ||
scope.active = false; | ||
$element.removeAttr('disabled'); | ||
}; | ||
const url = config.api + '/cases'; | ||
const filters = { | ||
op: 'and', | ||
content: _.values(_.mapValues(scope.filterKeyValues, (value, key) => ({ | ||
op: 'in', | ||
content: { | ||
field: key, | ||
value: [].concat(value) | ||
} | ||
}))) | ||
}; | ||
|
||
const params = _.merge({ | ||
attachment: true, | ||
filters: filters, | ||
fields: ['case_id'].concat(scope.fields || []).join(), | ||
expand: [].concat(scope.expands || []).join(), | ||
format: scope.fileType || 'JSON', | ||
pretty: true, | ||
size: scope.size || 10000 | ||
}, scope.filename ? {filename: scope.filename} : {}); | ||
|
||
$element.on('click', () => { | ||
const checkProgress = scope.download(params, url, () => $element, 'POST'); | ||
|
||
checkProgress(inProgress, done); | ||
}); | ||
scope.active = false; | ||
} | ||
}); | ||
|
||
angular.module('cases.directives', []) | ||
.directive('exportCasesButton', ExportCasesButton); | ||
} |
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,5 @@ | ||
module ngApp.cases { | ||
angular.module('ngApp.cases', [ | ||
'cases.directives' | ||
]); | ||
} |
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
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
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
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
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
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