Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jkmarx/data set2 utility persist bug #1507

Merged
merged 5 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions refinery/templates/core/data_set2.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ <h1>Data Set <small>{{ data_set.name }}</small></h1>
<script type="text/javascript" src="{% static "js/provvis/provvis-render.js" %}"></script>
<script type="text/javascript" src="{% static "js/provvis/provvis.js" %}"></script>

<script type="text/ng-template" id='assayfilesutilmodal.html'>
<rp-assay-files-util-modal-detail></rp-assay-files-util-modal-detail>
</script>

<script type="application/javascript">
setTimeout(function() {
sizing();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
'use strict';

function AssayFilesUtilModalCtrl (
fileBrowserFactory,
$log,
$q,
$scope,
$uibModalInstance,
$window,
$q,
$log,
fileBrowserFactory,
resetGridService) {
$window
) {
var vm = this;
vm.assayAttributeOrder = [];

// modal close button
$scope.close = function () {
resetGridService.setResetGridFlag(true);
vm.close = function () {
$uibModalInstance.close('close');
};

// Refresh attribute lists when modal opens
vm.refreshAssayAttributes = function () {
var assayUuid = $window.externalAssayUuid;

fileBrowserFactory.getAssayAttributeOrder(assayUuid).then(function () {
vm.assayAttributeOrder = fileBrowserFactory.assayAttributeOrder;
}, function (error) {
Expand Down Expand Up @@ -57,13 +55,12 @@ angular
.controller(
'AssayFilesUtilModalCtrl',
[
'fileBrowserFactory',
'$log',
'$q',
'$scope',
'$uibModalInstance',
'$window',
'$q',
'$log',
'fileBrowserFactory',
'resetGridService',
AssayFilesUtilModalCtrl
]
);
18 changes: 18 additions & 0 deletions refinery/ui/source/js/file-browser/ctrls/ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,24 @@ function FileBrowserCtrl (
}
);

/**
* Refresh grid flag if set to true, grid, but keep params, filters, & nodes
* Require for utils modal as it lives in this parent ctrl scope.
*/
$scope.$watch(
function () {
return resetGridService.refreshGridFlag;
},
function () {
if (resetGridService.refreshGridFlag) {
// reset assayFiles
angular.copy([], fileBrowserFactory.assayFiles);
initializeDataOnPageLoad();
resetGridService.setRefreshGridFlag(false);
}
}
);

// Ensure data owner
vm.checkDataSetOwnership();
// initialize the dataset and updates ui-grid selection, filters, and url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@

function rpAssayFilesUtilModal (
$compile,
resetGridService,
$templateCache,
$uibModal,
resetGridService
$uibModal
) {
return {
restrict: 'AE',
link: function (scope, element) {
var modalInstance;

element.bind('click', function () {
var template = $templateCache.get('assayfilesutilmodal.html');
var modalContent = $compile(template)(scope);

modalInstance = $uibModal.open({
template: modalContent,
templateUrl: '/static/partials/file-browser/partials/assay-files-util-modal-detail.html',
controller: 'AssayFilesUtilModalCtrl',
controllerAs: 'AFUMCtrl'
});

// default calls when modal closes or dismisses
modalInstance.result.then(function () {
resetGridService.setResetGridFlag(true);
resetGridService.setRefreshGridFlag(true);
}, function () {
resetGridService.setResetGridFlag(true);
resetGridService.setRefreshGridFlag(true);
});
});
}
Expand All @@ -37,9 +33,9 @@ angular
'rpAssayFilesUtilModal',
[
'$compile',
'resetGridService',
'$templateCache',
'$uibModal',
'resetGridService',
rpAssayFilesUtilModal
]
);
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ <h4>

</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="close()">Close</button>
<button class="btn btn-default" ng-click="AFUMCtrl.close()">Close</button>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
function resetGridService () {
var vm = this;
vm.resetGridFlag = false;
// param keeps current filter params
vm.refreshGridFlag = false;

vm.setResetGridFlag = function (state) {
vm.resetGridFlag = state;
};

vm.setRefreshGridFlag = function (state) {
vm.refreshGridFlag = state;
};
}

angular.module('refineryFileBrowser')
Expand Down
2 changes: 1 addition & 1 deletion refinery/ui/source/js/file-browser/views/files-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<rp-file-display></rp-file-display>
<span ng-if="FBCtrl.isOwner">
<i class="fa fa-wrench fa-border"
rp-assay-files-util-modal ng-click="open()">
rp-assay-files-util-modal>
</i>
<a
id="help-view-selector"
Expand Down