|
824 | 824 | return [arrayType.items]; |
825 | 825 | }; |
826 | 826 |
|
827 | | - $scope.getType = function (type) { |
828 | | - var newType = $scope.mergeType(type); |
829 | | - newType.type = RAML.Inspector.Types.ensureArray(newType.type); |
| 827 | + $scope.getType = function (property) { |
| 828 | + var newProperty = $scope.mergeProperty(property); |
| 829 | + newProperty.type = RAML.Inspector.Types.ensureArray(newProperty.type); |
830 | 830 |
|
831 | | - if (newType.type[0] === 'array') { |
832 | | - newType.type = getArrayTypes(newType).map(function (aType) { |
| 831 | + if (newProperty.type[0].type) { newProperty.type = newProperty.type[0].type; } |
| 832 | + |
| 833 | + if (newProperty.type[0] === 'array') { |
| 834 | + newProperty.type = getArrayTypes(newProperty).map(function (aType) { |
833 | 835 | return aType + '[]'; |
834 | 836 | }); |
835 | | - newType.properties = newType.items.properties; |
| 837 | + newProperty.properties = newProperty.items.properties; |
836 | 838 | } |
837 | 839 |
|
838 | | - return newType; |
| 840 | + return newProperty; |
839 | 841 | }; |
840 | 842 |
|
841 | 843 | var isPattern = function (propertyName) { |
|
846 | 848 | return ($scope.showSecuritySchemaProperties || !property[0].isFromSecurityScheme) && !isPattern(property[0].displayName); |
847 | 849 | }; |
848 | 850 |
|
849 | | - $scope.mergeType = function (type) { |
850 | | - var newType = angular.copy(type); |
| 851 | + $scope.mergeProperty = function (property) { |
| 852 | + var newProperty = angular.copy(property); |
851 | 853 |
|
852 | 854 | if (!$scope.isNestedProperty && $rootScope.types) { |
853 | | - return RAML.Inspector.Types.mergeType(newType, $rootScope.types); |
| 855 | + return RAML.Inspector.Types.mergeType(newProperty, $rootScope.types); |
854 | 856 | } |
855 | | - return newType; |
| 857 | + return newProperty; |
856 | 858 | }; |
857 | 859 |
|
858 | 860 | $scope.isNativeType = RAML.Inspector.Types.isNativeType; |
|
1238 | 1240 | } |
1239 | 1241 | }; |
1240 | 1242 | }) |
1241 | | - .controller('RamlConsoleController', |
| 1243 | + .controller('RamlConsoleController', |
1242 | 1244 | ['$attrs', '$scope', '$rootScope', '$timeout', '$window', function RamlConsoleController( |
1243 | 1245 | $attrs, $scope, $rootScope, $timeout, $window |
1244 | 1246 | ) { |
|
1249 | 1251 | $scope.disableThemeSwitcher = $attrs.hasOwnProperty('disableThemeSwitcher'); |
1250 | 1252 | $scope.disableTitle = $attrs.hasOwnProperty('disableTitle'); |
1251 | 1253 | $scope.disableTryIt = $attrs.hasOwnProperty('disableTryIt'); |
| 1254 | + $scope.disableDescription = $attrs.hasOwnProperty('disableDescription'); |
| 1255 | + $scope.descriptionLimit = $attrs.hasOwnProperty('descriptionLimit') || 50; |
1252 | 1256 | $scope.documentationCollapsed = $attrs.hasOwnProperty('documentationCollapsed'); |
1253 | 1257 | $scope.proxy = $window.RAML.Settings.proxy; |
1254 | 1258 | $scope.readResourceTraits = readResourceTraits; |
|
2708 | 2712 | $rootScope.$broadcast(TOGGLE_POPOVER); |
2709 | 2713 |
|
2710 | 2714 | $timeout(function () { |
2711 | | - $scope.selectedType = RAML.Inspector.Types.mergeType({ |
| 2715 | + $scope.selectedType = RAML.Inspector.Types.mergeProperty({ |
2712 | 2716 | displayName: type, |
2713 | 2717 | type: [type] |
2714 | 2718 | }, |
|
3091 | 3095 | }; |
3092 | 3096 |
|
3093 | 3097 | $scope.ownerOptionsEnabled = function () { |
3094 | | - return $scope.credentials.grant === 'owner'; |
| 3098 | + return $scope.credentials.grant === 'password'; |
3095 | 3099 | }; |
3096 | 3100 |
|
3097 | 3101 | $scope.isImplicitEnabled = function () { |
|
3115 | 3119 | label: 'Authorization Code', |
3116 | 3120 | value: 'authorization_code' |
3117 | 3121 | }, |
3118 | | - { |
3119 | | - label: 'Resource Owner Password Credentials', |
3120 | | - value: 'owner' |
3121 | | - }, |
3122 | 3122 | { |
3123 | 3123 | label: 'Resource Owner Password Credentials', |
3124 | 3124 | value: 'password' |
3125 | 3125 | }, |
3126 | | - { |
3127 | | - label: 'Client Credentials', |
3128 | | - value: 'credentials' |
3129 | | - }, |
3130 | 3126 | { |
3131 | 3127 | label: 'Client Credentials', |
3132 | 3128 | value: 'client_credentials' |
|
3689 | 3685 | popup(auth[grantType].getUri()); |
3690 | 3686 | } |
3691 | 3687 |
|
3692 | | - if (grantType === 'owner' || grantType === 'password') { |
| 3688 | + if (grantType === 'password') { |
3693 | 3689 | auth.owner.getToken(this.credentials.username, this.credentials.password, function (err, user, raw) { |
3694 | 3690 | if (err) { |
3695 | 3691 | done(raw, err); |
|
3703 | 3699 | }); |
3704 | 3700 | } |
3705 | 3701 |
|
3706 | | - if (grantType === 'credentials'|| grantType === 'client_credentials') { |
| 3702 | + if (grantType === 'client_credentials') { |
3707 | 3703 | auth.credentials.getToken(function (err, user, raw) { |
3708 | 3704 | if (err) { |
3709 | 3705 | done(raw, err); |
@@ -7168,6 +7164,21 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache) |
7168 | 7164 | "\n" + |
7169 | 7165 | " <h1 ng-if=\"!disableTitle\" class=\"raml-console-title\">{{raml.title}}</h1>\n" + |
7170 | 7166 | "\n" + |
| 7167 | + "\n" + |
| 7168 | + " <div ng-if=\"!disableDescription && !!raml.description && raml.description.length > 0\" ng-init=\"actualSize = descriptionLimit\" >\n" + |
| 7169 | + " <div class=\"raml-console-root-description\" markdown=\"raml.description | limitTo : actualSize\"></div>\n" + |
| 7170 | + " <span>\n" + |
| 7171 | + " <a class=\"raml-console-show-more-less\"\n" + |
| 7172 | + " ng-hide=\"raml.description.length <= descriptionLimit || raml.description.length > actualSize || raml.description.length < actualSize\"\n" + |
| 7173 | + " ng-click=\"actualSize = descriptionLimit\"\n" + |
| 7174 | + " >show less</a>\n" + |
| 7175 | + " <a class=\"raml-console-show-more-less\"\n" + |
| 7176 | + " ng-hide=\"raml.description.length <= descriptionLimit || raml.description.length == actualSize\"\n" + |
| 7177 | + " ng-click=\"actualSize = raml.description.length\"\n" + |
| 7178 | + " >show more</a>\n" + |
| 7179 | + " </span>\n" + |
| 7180 | + " </div>\n" + |
| 7181 | + "\n" + |
7171 | 7182 | " <root-documentation></root-documentation>\n" + |
7172 | 7183 | "\n" + |
7173 | 7184 | " <root-types types=\"types\" ng-if=\"types\"></root-types>\n" + |
|
0 commit comments