Skip to content

Commit 7c533f4

Browse files
committed
Merge pull request #95 from mulesoft/bugs/bug-fixing
Bugs/bug fixing
2 parents 651ad2f + 14e2374 commit 7c533f4

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed

dist/scripts/api-console.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@
118118

119119
$scope.currentStatusCode = '200';
120120

121+
if ($scope.methodInfo.responseCodes && $scope.methodInfo.responseCodes.length > 0) {
122+
$scope.currentStatusCode = $scope.methodInfo.responseCodes[0];
123+
}
124+
121125
function beautify(body, contentType) {
122126
if(contentType.indexOf('json')) {
123127
body = vkbeautify.json(body, 2);
@@ -342,7 +346,7 @@
342346

343347
if (responses) {
344348
Object.keys(responses).map(function (key) {
345-
if(typeof responses[key].body !== 'undefined') {
349+
if(responses[key] && typeof responses[key].body !== 'undefined') {
346350
responseInfo[key] = {};
347351

348352
Object.keys(responses[key].body).sort().reverse().map(function (type) {
@@ -1294,6 +1298,12 @@
12941298
$scope.showRequestMetadata = true;
12951299
}
12961300
};
1301+
1302+
$scope.showResponseMetadata = true;
1303+
1304+
$scope.toggleResponseMetadata = function () {
1305+
$scope.showResponseMetadata = !$scope.showResponseMetadata;
1306+
};
12971307
}
12981308
};
12991309
};
@@ -5294,10 +5304,14 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache)
52945304
"\n" +
52955305
" <section class=\"raml-console-side-bar-try-it-description\">\n" +
52965306
" <header class=\"raml-console-sidebar-row raml-console-sidebar-header\">\n" +
5297-
" <h3 class=\"raml-console-sidebar-head\">Response</h3>\n" +
5307+
" <h3 class=\"raml-console-sidebar-head\">\n" +
5308+
" <button ng-class=\"{'raml-console-is-open':showResponseMetadata, 'raml-console-is-collapsed':!showResponseMetadata}\" class=\"raml-console-sidebar-expand-btn\" ng-click=\"toggleResponseMetadata()\">\n" +
5309+
" Response\n" +
5310+
" </button>\n" +
5311+
" </h3>\n" +
52985312
" </header>\n" +
52995313
"\n" +
5300-
" <div class=\"raml-console-sidebar-row sidebar-response\" ng-class=\"{'raml-console-is-active':requestEnd}\">\n" +
5314+
" <div class=\"raml-console-sidebar-row raml-console-sidebar-response\" ng-class=\"{'raml-console-is-active':showResponseMetadata}\">\n" +
53015315
" <h3 class=\"raml-console-sidebar-response-head\">Status</h3>\n" +
53025316
" <p class=\"raml-console-sidebar-response-item\">{{response.status}}</p>\n" +
53035317
"\n" +

src/app/directives/documentation.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
$scope.currentStatusCode = '200';
1515

16+
if ($scope.methodInfo.responseCodes && $scope.methodInfo.responseCodes.length > 0) {
17+
$scope.currentStatusCode = $scope.methodInfo.responseCodes[0];
18+
}
19+
1620
function beautify(body, contentType) {
1721
if(contentType.indexOf('json')) {
1822
body = vkbeautify.json(body, 2);

src/app/directives/method-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
if (responses) {
3333
Object.keys(responses).map(function (key) {
34-
if(typeof responses[key].body !== 'undefined') {
34+
if(responses[key] && typeof responses[key].body !== 'undefined') {
3535
responseInfo[key] = {};
3636

3737
Object.keys(responses[key].body).sort().reverse().map(function (type) {

src/app/directives/sidebar.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@
438438
$scope.showRequestMetadata = true;
439439
}
440440
};
441+
442+
$scope.showResponseMetadata = true;
443+
444+
$scope.toggleResponseMetadata = function () {
445+
$scope.showResponseMetadata = !$scope.showResponseMetadata;
446+
};
441447
}
442448
};
443449
};

src/app/directives/sidebar.tpl.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,14 @@ <h3 class="raml-console-sidebar-response-head raml-console-sidebar-response-head
151151

152152
<section class="raml-console-side-bar-try-it-description">
153153
<header class="raml-console-sidebar-row raml-console-sidebar-header">
154-
<h3 class="raml-console-sidebar-head">Response</h3>
154+
<h3 class="raml-console-sidebar-head">
155+
<button ng-class="{'raml-console-is-open':showResponseMetadata, 'raml-console-is-collapsed':!showResponseMetadata}" class="raml-console-sidebar-expand-btn" ng-click="toggleResponseMetadata()">
156+
Response
157+
</button>
158+
</h3>
155159
</header>
156160

157-
<div class="raml-console-sidebar-row sidebar-response" ng-class="{'raml-console-is-active':requestEnd}">
161+
<div class="raml-console-sidebar-row raml-console-sidebar-response" ng-class="{'raml-console-is-active':showResponseMetadata}">
158162
<h3 class="raml-console-sidebar-response-head">Status</h3>
159163
<p class="raml-console-sidebar-response-item">{{response.status}}</p>
160164

0 commit comments

Comments
 (0)