"YANGMAN_SELECT_OPTIONS": "Select options",
"YANGMAN_SELECT_ALL": "Select All",
"YANGMAN_DESELECT_ALL": "Deselect All",
- "YANGMAN_IS_AUGMENT": "Augment's Group"
+ "YANGMAN_IS_AUGMENT": "Augment's Group",
+ "YANGMAN_LOADING_MODULES": "Loading application modules...",
+ "YANGMAN_EXECUTING_REQUEST": "Request is beeing executed...",
+ "YANGMAN_CM_FONT_SIZE_HINT": "Use \"Alt +\" key and \"Alt -\" key in editor to enlarge or reduce json font size",
+ "YANGMAN_CM_HINT_DONT_SHOW": "Got it"
}
angular.module('app.yangman').controller('RequestDataCtrl', RequestDataCtrl);
- RequestDataCtrl.$inject = ['$mdToast', '$scope', 'RequestsService'];
+ RequestDataCtrl.$inject = ['$filter', '$mdToast', '$scope', 'RequestsService'];
- function RequestDataCtrl($mdToast, $scope, RequestsService) {
+ function RequestDataCtrl($filter, $mdToast, $scope, RequestsService) {
var requestData = this;
requestData.paramsArray = [];
*/
function showCMHint(type) {
- if (!$scope.shownCMHint){
+ if (!localStorage.getItem('yangman_cm_hint_got_it')){
$mdToast.show(
$mdToast.simple()
- .textContent('Use "Ctrl +" key and "Ctrl -" key in editor to enlarge or reduce json font size')
+ .textContent($filter('translate')('YANGMAN_CM_FONT_SIZE_HINT'))
+ .action($filter('translate')('YANGMAN_CM_HINT_DONT_SHOW'))
.position('top right')
.parent(angular.element('.yangmanModule__right-panel__req-data__cm-' + type))
- .hideDelay(50000)
- );
+ .hideDelay(10000)
+ ).then(function (response){
+ if (response === 'ok') {
+ localStorage.setItem('yangman_cm_hint_got_it', 1);
+ }
+ });
}
}
$scope.$on('YANGMAN_SET_CODEMIRROR_DATA_' + type, function (event, args){
requestData.data = args.params.data;
+ showCMHint(type);
});
$scope.$on('YANGMAN_GET_CODEMIRROR_DATA_' + type, function (event, args){
requestHeader.selectedPluginsButtons = [];
requestHeader.selectedPlugin = null;
requestHeader.statusObj = null;
- requestHeader.executingProgress = false;
// methods
requestHeader.executeOperation = executeOperation;
}
function showRequestProgress(){
- requestHeader.executingProgress = true;
+ $scope.rootBroadcast('YANGMAN_EXECUTING_REQUEST_PROGRESS_START');
}
function finishRequestProgress(message){
- requestHeader.executingProgress = false;
-
- //$mdToast.show(
- // $mdToast.simple()
- // .textContent(message)
- // .position('bottom right')
- // .parent(angular.element('.yangmanModule__right-panel__header'))
- // .hideDelay(1500)
- //);
+ $scope.rootBroadcast('YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP');
+ // $mdToast.show(
+ // $mdToast.simple()
+ // .textContent(message)
+ // .position('bottom right')
+ // .parent(angular.element('.yangmanModule__right-panel__header'))
+ // .hideDelay(1500)
+ // );
}
requestHeader.selectedShownDataType
);
+ finishRequestProgress();
+
requestHeader.statusObj = reqInfo;
sendErrorData({});
$scope.rootBroadcast('YANGMAN_SAVE_EXECUTED_REQUEST', historyReq);
(executeCbk || angular.noop)(historyReq);
- finishRequestProgress('dfsaf dasf adsfx');
}
function executeReqErrCbk(reqInfo, response) {
requestHeader.statusObj = reqInfo;
+ finishRequestProgress();
+
historyReq.setExecutionData(
- reqInfo.requestSrcData, null,
+ reqInfo.requestSrcData,
+ response.data,
reqInfo.status,
reqInfo.status,
reqInfo.statusText,
}
(executeCbk || angular.noop)(historyReq);
- finishRequestProgress('sadfsadf adsf');
}
* @param params
*/
function saveBcstedHistoryRequest(broadcastEvent, params) {
+ console.debug('params.params', params.params);
+
vm.requestList.addRequestToList(params.params);
vm.requestList.groupListByDate();
vm.requestList.saveToStorage();
function showForm(reqObj) {
var data = reqObj.method === 'GET' ? reqObj.receivedData : reqObj.sentData;
- $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', {});
+ $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', reqObj.receivedData.hasOwnProperty('errors') ? reqObj.receivedData : {});
$scope.rootBroadcast('YANGMAN_FILL_NODE_FROM_REQ', { requestUrl: reqObj.path, requestData: data },
function (){
},
});
- $scope.rootBroadcast('YANGMAN_SET_ERROR_DATA', {});
+ $scope.rootBroadcast(
+ 'YANGMAN_SET_ERROR_DATA',
+ reqObj.receivedData && reqObj.receivedData.hasOwnProperty('errors') ? reqObj.receivedData : {}
+ );
$scope.rootBroadcast(
'YANGMAN_SET_CODEMIRROR_DATA_SENT',
* @param data
*/
function setRcvdErrorData(event, data) {
+
if (data.params.errors) {
yangForm.errorMsg = data.params.errors.error[0]['error-message'];
}
received: true,
sent: false,
};
+ main.executingRequestProgress = false;
// methods
main.init = init;
$scope.setCMHintShown = setCMHintShown;
+ $scope.$on('YANGMAN_EXECUTING_REQUEST_PROGRESS_START', startExecutingRequestProgress);
+ $scope.$on('YANGMAN_EXECUTING_REQUEST_PROGRESS_STOP', stopExecutingRequestProgress);
+
+
init();
function setCMHintShown(shown) {
$scope.shownCMHint = shown;
}
+ function startExecutingRequestProgress() {
+ main.executingRequestProgress = true;
+ }
+
+ function stopExecutingRequestProgress() {
+ main.executingRequestProgress = false;
+ }
+
/**
* Set parametersList
* @param parametersList
*/
function createHistoryRequest(sentData, receivedData, path, operation, status, name, collection, timestamp,
responseStatus, responseStatusText, responseTime) {
- var receivedDataProcessed = status === 'success' ? receivedData : null,
- result = new HistoryRequestModel(PathUtilsService, YangUtilsService, ParsingJsonService);
+ // TODO: investigate, if this line is needed
+ // var receivedDataProcessed = status === 'success' ? receivedData : null,
+ var result = new HistoryRequestModel(PathUtilsService, YangUtilsService, ParsingJsonService);
- result.setData(sentData, receivedDataProcessed, status, path, operation, name, collection, timestamp,
+ result.setData(sentData, receivedData, status, path, operation, name, collection, timestamp,
responseStatus, responseStatusText, responseTime);
return result;
});
}
},
- default: function(){
+ default: function (){
var methodType = {
GET: function () {
node.clear();
<!-- list of requests in current group -->
<md-list>
- <div ng-repeat="request in group.requests | filter: reqList.filterReq track by $index | orderBy: 'timestamp'"
+ <div ng-repeat="request in group.requests | filter: reqList.filterReq | orderBy: '-timestamp' track by $index"
layout="row"
ng-include src="globalViewPath + 'leftpanel/request-item.tpl.html'">
</div>
<div class="yangmanModule__left-panel__loading-container" ng-show="modulesList.showLoadingBox">
<md-progress-linear md-mode="query"></md-progress-linear>
<div class="bottom-block">
- <span>Loading application modules...</span>
+ <span>{{ 'YANGMAN_LOADING_MODULES' | translate }}</span>
</div>
</div>
ng-include src="globalViewPath + 'rightpanel/request-header.tpl.html'"></section>
<!-- /Header -->
-<section class="requestMsgs" style="height: 25px;"></section>
+<section class="yangmanModule__right-panel__request-progress">
+ <div class="yangmanModule__right-panel__request-progress__loading-container" ng-show="main.executingRequestProgress">
+ <md-progress-linear md-mode="query"></md-progress-linear>
+ <div class="bottom-block">
+ <span>{{ 'YANGMAN_EXECUTING_REQUEST' | translate }}...</span>
+ </div>
+ </div>
+</section>
<!-- Form section -->
<section class="yangmanModule__right-panel__form bottom-content"
- ng-show="rightPanelSection === 'form'"
+ ng-show="rightPanelSection === 'form' && !main.executingRequestProgress"
ng-if="node"
ng-controller="YangFormCtrl as yangForm">
<div ng-show="yangForm.errorMsg"><p class="error">{{ yangForm.errorMsg }}</p></div>
<!-- JSON section -->
<section class="yangmanModule__right-panel__req-data bottom-content"
- ng-show="rightPanelSection === 'req-data'">
+ ng-show="rightPanelSection === 'req-data' && !main.executingRequestProgress">
<!-- Sent data -->
<div ng-controller="RequestDataCtrl as requestData"
ng-click="requestHeader.prepareDataAndExecute(
main.modulesTreeDisplayed() ? main.leftPanelShowModule : null
)">
- <md-progress-circular ng-disabled="!vm.activated" class="md-raised" md-diameter="25px" ng-show="requestHeader.executingProgress"></md-progress-circular>
{{'YANGMAN_SEND' | translate}}
</md-button>
label{
font-weight: normal;
}
-
- md-progress-circular{
- position: absolute;
- margin-top: 5px;
- }
- md-progress-circular .md-inner .md-gap{
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
- }
-
- md-progress-circular .md-inner .md-left .md-half-circle{
- border-left-color: #ffffff;
- border-top-color: #ffffff;
- }
-
- md-progress-circular .md-inner .md-right .md-half-circle{
- border-top-color: #ffffff;
- border-right-color: #ffffff;
- }
-}
-
-button.has-progress{
- span{
- margin-left: 23px;
- margin-right: 23px;
- }
}
.ui-resizable-e{
}
}
+ &__request-progress{
+
+ margin-top: 12px;
+ margin-bottom: 12px;
+
+ &__loading-container {
+ display: block;
+ position: relative;
+ border: 2px solid @infoBoxBorderColor;
+ transition: opacity 0.1s linear;
+ border-top: 0px;
+ margin: 0;
+
+ .bottom-block {
+ display: block;
+ position: relative;
+ background-color: @infoBoxBackColor;
+ height: 85px;
+
+ > span {
+ display: inline-block;
+ margin-top: 10px;
+ padding: 25px;
+ font-size: 0.9em;
+ }
+ }
+ }
+ }
+
&__req-data{
> div{