Skip to content

Commit 577ecbd

Browse files
committed
Fixing traits at child level
1 parent 8e67c45 commit 577ecbd

File tree

7 files changed

+38
-20
lines changed

7 files changed

+38
-20
lines changed

dist/examples/leagues.raml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ securitySchemes:
5151
headers:
5252
auth:
5353

54-
securedBy: [ null, basic, digest_auth, oauth_2_0, custom_scheme_1, custom_scheme_2 ]
54+
securedBy: [ basic, digest_auth, oauth_2_0, custom_scheme_1, custom_scheme_2 ]
5555

5656
/teams:
5757
displayName: Teams

dist/scripts/api-console.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
$inactiveElements.removeClass('raml-console-is-active');
107107
$scope.showPanel = false;
108108
$scope.traits = null;
109+
$scope.methodInfo = {};
109110
};
110111
}
111112
};
@@ -393,12 +394,14 @@
393394
traitList = traitList.concat($scope.resource.traits);
394395

395396
traitList.map(function (trait) {
396-
if (typeof trait === 'object') {
397+
if (trait) {
398+
if (typeof trait === 'object') {
397399
trait = Object.keys(trait).join(', ');
398-
}
400+
}
399401

400-
if (list.indexOf(trait) === -1) {
401-
list.push(trait);
402+
if (list.indexOf(trait) === -1) {
403+
list.push(trait);
404+
}
402405
}
403406
});
404407

@@ -496,10 +499,12 @@
496499
$scope.showPanel = false;
497500
$inactiveElements.removeClass('raml-console-is-active');
498501
$scope.traits = null;
502+
$scope.methodInfo = {};
499503
} else {
500504
jQuery($this).addClass('raml-console-is-active');
501505
jQuery($this).siblings('.raml-console-tab').removeClass('raml-console-is-active');
502506
$scope.traits = null;
507+
$scope.methodInfo = {};
503508
}
504509
};
505510
}
@@ -1668,10 +1673,12 @@
16681673

16691674
if (traits) {
16701675
traits.map(function (trait) {
1671-
if (typeof trait === 'object') {
1672-
list.push(Object.keys(trait).join(', '));
1673-
} else {
1674-
list.push(trait);
1676+
if (trait) {
1677+
if (typeof trait === 'object') {
1678+
list.push(Object.keys(trait).join(', '));
1679+
} else {
1680+
list.push(trait);
1681+
}
16751682
}
16761683
});
16771684
}
@@ -5694,7 +5701,9 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache)
56945701
" </h3>\n" +
56955702
"\n" +
56965703
" <resource-type></resource-type>\n" +
5697-
" <span ng-if=\"traits\" class=\"raml-console-flag raml-console-resource-heading-flag raml-console-resource-trait\"><b>Traits:</b> {{traits}}</span>\n" +
5704+
" <span ng-if=\"methodInfo.is\" class=\"raml-console-flag raml-console-resource-heading-flag raml-console-resource-trait\"><b>Traits:</b> {{readTraits(methodInfo.is)}}</span>\n" +
5705+
"\n" +
5706+
" <span ng-hide=\"methodInfo.is\" ng-if=\"resource.traits\" class=\"raml-console-flag raml-console-resource-heading-flag\"><b>Traits:</b> {{readResourceTraits(resource.traits)}}</span>\n" +
56985707
" </div>\n" +
56995708
"\n" +
57005709
" <method-list></method-list>\n" +

src/app/directives/close-button.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
$inactiveElements.removeClass('raml-console-is-active');
1515
$scope.showPanel = false;
1616
$scope.traits = null;
17+
$scope.methodInfo = {};
1718
};
1819
}
1920
};

src/app/directives/method-list.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@
6464
traitList = traitList.concat($scope.resource.traits);
6565

6666
traitList.map(function (trait) {
67-
if (typeof trait === 'object') {
67+
if (trait) {
68+
if (typeof trait === 'object') {
6869
trait = Object.keys(trait).join(', ');
69-
}
70+
}
7071

71-
if (list.indexOf(trait) === -1) {
72-
list.push(trait);
72+
if (list.indexOf(trait) === -1) {
73+
list.push(trait);
74+
}
7375
}
7476
});
7577

@@ -167,10 +169,12 @@
167169
$scope.showPanel = false;
168170
$inactiveElements.removeClass('raml-console-is-active');
169171
$scope.traits = null;
172+
$scope.methodInfo = {};
170173
} else {
171174
jQuery($this).addClass('raml-console-is-active');
172175
jQuery($this).siblings('.raml-console-tab').removeClass('raml-console-is-active');
173176
$scope.traits = null;
177+
$scope.methodInfo = {};
174178
}
175179
};
176180
}

src/app/resources/resources.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@
4848

4949
if (traits) {
5050
traits.map(function (trait) {
51-
if (typeof trait === 'object') {
52-
list.push(Object.keys(trait).join(', '));
53-
} else {
54-
list.push(trait);
51+
if (trait) {
52+
if (typeof trait === 'object') {
53+
list.push(Object.keys(trait).join(', '));
54+
} else {
55+
list.push(trait);
56+
}
5557
}
5658
});
5759
}

src/app/resources/resources.tpl.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ <h3 class="raml-console-resource-heading" ng-click="showResourceDescription($eve
8181
</h3>
8282

8383
<resource-type></resource-type>
84-
<span ng-if="traits" class="raml-console-flag raml-console-resource-heading-flag raml-console-resource-trait"><b>Traits:</b> {{traits}}</span>
84+
<span ng-if="methodInfo.is" class="raml-console-flag raml-console-resource-heading-flag raml-console-resource-trait"><b>Traits:</b> {{readTraits(methodInfo.is)}}</span>
85+
86+
<span ng-hide="methodInfo.is" ng-if="resource.traits" class="raml-console-flag raml-console-resource-heading-flag"><b>Traits:</b> {{readResourceTraits(resource.traits)}}</span>
8587
</div>
8688

8789
<method-list></method-list>

src/assets/examples/leagues.raml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ securitySchemes:
5151
headers:
5252
auth:
5353

54-
securedBy: [ null, basic, digest_auth, oauth_2_0, custom_scheme_1, custom_scheme_2 ]
54+
securedBy: [ basic, digest_auth, oauth_2_0, custom_scheme_1, custom_scheme_2 ]
5555

5656
/teams:
5757
displayName: Teams

0 commit comments

Comments
 (0)