RequestsListCtrl.$inject = [
'$filter', '$mdDialog', '$scope', 'YMHandleFileService', 'PathUtilsService', 'RequestsService', 'YangmanService',
- 'YangmanDesignService',
+ 'YangmanDesignService', 'constants',
];
/**
* @constructor
*/
function RequestsListCtrl($filter, $mdDialog, $scope, YMHandleFileService, PathUtilsService, RequestsService,
- YangmanService, YangmanDesignService) {
+ YangmanService, YangmanDesignService, constants) {
var vm = this;
/**
* @type {*|CollectionList}
*/
vm.collectionList = null;
+ vm.constants = constants;
/**
*
vm.deselectAllRequests = deselectAllRequests;
vm.filterCollReq = filterCollReq;
-
-
-
/**
* Save request obje to collection from other controller
* @param reqObj
else {
clearFileInputValue();
}
+ removeButtonBackground();
+
+ function removeButtonBackground() {
+ $('#importCollection').next().css({ 'background': 'transparent' });
+ }
}
function toggleCollectionsSort() {
var data = reqObj.sentData;
// exception for get meth
- if ( reqObj.method === 'GET' ) {
+ if ( reqObj.method === constants.OPERATION_GET ) {
data = reqObj.receivedData;
}
$scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path, requestData: data },
function (){
- $scope.setRightPanelSection('form');
+ $scope.setRightPanelSection(constants.DISPLAY_TYPE_FORM);
$scope.rootBroadcast('YANGMAN_HEADER_INIT', {
path: reqObj.path,
method: reqObj.method,
if ( $scope.node ) {
// prepare data for filling form
- data = $scope.node.type === 'rpc' ?
+ data = $scope.node.type === constants.NODE_RPC ?
YangmanService.prepareReceivedData(
$scope.node,
reqObj.method,
reqObj.receivedData,
reqObj.sentData,
- 'form'
+ constants.DISPLAY_TYPE_FORM
) : data;
// try to fill node
);
}
- $scope.setRightPanelSection('req-data');
- $scope.setJsonView(true, reqObj.method !== 'GET');
+ $scope.setRightPanelSection(constants.DISPLAY_TYPE_REQ_DATA);
+ $scope.setJsonView(true, reqObj.method !== constants.OPERATION_GET);
$scope.rootBroadcast('YANGMAN_HEADER_INIT', headerObj);
$scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path });
}
});
- $scope.$on('YANGMAN_REFRESH_COLLECTIONS', loadCollectionsList);
+ $scope.$on('YANGMAN_REFRESH_COLLECTIONS', function (event, params){
+ loadCollectionsList();
+ (params.cbk || angular.noop)();
+ });
// list type dependend operations
if (mainList === 'history') {
// saving from request header
$scope.$on('YANGMAN_SAVE_REQUEST_TO_COLLECTION', saveRequestFromExt);
// saving collections expanded status on refresh
- $scope.$on('YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS', function(event, params){
- $scope.rootBroadcast('YANGMAN_REFRESH_COLLECTIONS');
- (params.cbk || angular.noop)();
+ $scope.$on('YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS', function(){
+ var expandedColNames = vm.collectionList.getExpandedCollectionNames();
+ $scope.rootBroadcast('YANGMAN_REFRESH_COLLECTIONS', {}, function (){
+ vm.collectionList.expandCollectionByNames(expandedColNames);
+ });
});
}
-
-
}
* Refresh and expand collections
*/
function refreshCollectionsWithExpansion(){
- var expandedCollNames = vm.collectionList.getExpandedCollectionNames();
- $scope.rootBroadcast('YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS', null, function (){
- vm.collectionList.expandCollectionByNames(expandedCollNames);
- });
+ $scope.rootBroadcast('YANGMAN_REFRESH_AND_EXPAND_COLLECTIONS');
}
}