Skip to content

Commit 13ca35b

Browse files
authored
Merge branch 'master' into fix-issue-380
2 parents ced8077 + 795eedd commit 13ca35b

File tree

14 files changed

+4533
-2291
lines changed

14 files changed

+4533
-2291
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
"angular-marked": "0.0.18",
1515
"angular-sanitize": "~1.3.17",
1616
"angular-ui-codemirror": "0.1.6",
17-
"codemirror": "~3.15.0",
17+
"codemirror": "~4.2.0",
1818
"crypto-js": "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/crypto-js/CryptoJS%20v3.1.2.zip",
1919
"FileSaver": "eligrey/FileSaver.js#683f689326c231002164621dc8a6451df4e86e8a",
2020
"highlight-js": "~7.0.1",
2121
"jquery": "~2.1.1",
2222
"jszip": "~2.0.0",
2323
"marked": "~0.3.1",
2424
"raml-client-generator": "~0.0.7",
25-
"raml-1-parser": "https://github.com/raml-org/raml-js-parser-2/releases/download/1.1.16/raml-1-parser.zip",
25+
"raml-1-parser": "https://github.com/raml-org/raml-js-parser-2/releases/download/1.1.14/raml-1-parser.zip",
2626
"resolve-url": "~0.2.1",
2727
"slug": "~0.8.0",
2828
"velocity": "~1.1.0",

dist/scripts/api-console-vendor.js

Lines changed: 4417 additions & 2240 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/scripts/api-console.js

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -824,18 +824,20 @@
824824
return [arrayType.items];
825825
};
826826

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);
830830

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) {
833835
return aType + '[]';
834836
});
835-
newType.properties = newType.items.properties;
837+
newProperty.properties = newProperty.items.properties;
836838
}
837839

838-
return newType;
840+
return newProperty;
839841
};
840842

841843
var isPattern = function (propertyName) {
@@ -846,13 +848,13 @@
846848
return ($scope.showSecuritySchemaProperties || !property[0].isFromSecurityScheme) && !isPattern(property[0].displayName);
847849
};
848850

849-
$scope.mergeType = function (type) {
850-
var newType = angular.copy(type);
851+
$scope.mergeProperty = function (property) {
852+
var newProperty = angular.copy(property);
851853

852854
if (!$scope.isNestedProperty && $rootScope.types) {
853-
return RAML.Inspector.Types.mergeType(newType, $rootScope.types);
855+
return RAML.Inspector.Types.mergeType(newProperty, $rootScope.types);
854856
}
855-
return newType;
857+
return newProperty;
856858
};
857859

858860
$scope.isNativeType = RAML.Inspector.Types.isNativeType;
@@ -1238,7 +1240,7 @@
12381240
}
12391241
};
12401242
})
1241-
.controller('RamlConsoleController',
1243+
.controller('RamlConsoleController',
12421244
['$attrs', '$scope', '$rootScope', '$timeout', '$window', function RamlConsoleController(
12431245
$attrs, $scope, $rootScope, $timeout, $window
12441246
) {
@@ -1249,6 +1251,8 @@
12491251
$scope.disableThemeSwitcher = $attrs.hasOwnProperty('disableThemeSwitcher');
12501252
$scope.disableTitle = $attrs.hasOwnProperty('disableTitle');
12511253
$scope.disableTryIt = $attrs.hasOwnProperty('disableTryIt');
1254+
$scope.disableDescription = $attrs.hasOwnProperty('disableDescription');
1255+
$scope.descriptionLimit = $attrs.hasOwnProperty('descriptionLimit') || 50;
12521256
$scope.documentationCollapsed = $attrs.hasOwnProperty('documentationCollapsed');
12531257
$scope.proxy = $window.RAML.Settings.proxy;
12541258
$scope.readResourceTraits = readResourceTraits;
@@ -2708,7 +2712,7 @@
27082712
$rootScope.$broadcast(TOGGLE_POPOVER);
27092713

27102714
$timeout(function () {
2711-
$scope.selectedType = RAML.Inspector.Types.mergeType({
2715+
$scope.selectedType = RAML.Inspector.Types.mergeProperty({
27122716
displayName: type,
27132717
type: [type]
27142718
},
@@ -3091,7 +3095,7 @@
30913095
};
30923096

30933097
$scope.ownerOptionsEnabled = function () {
3094-
return $scope.credentials.grant === 'owner';
3098+
return $scope.credentials.grant === 'password';
30953099
};
30963100

30973101
$scope.isImplicitEnabled = function () {
@@ -3115,18 +3119,10 @@
31153119
label: 'Authorization Code',
31163120
value: 'authorization_code'
31173121
},
3118-
{
3119-
label: 'Resource Owner Password Credentials',
3120-
value: 'owner'
3121-
},
31223122
{
31233123
label: 'Resource Owner Password Credentials',
31243124
value: 'password'
31253125
},
3126-
{
3127-
label: 'Client Credentials',
3128-
value: 'credentials'
3129-
},
31303126
{
31313127
label: 'Client Credentials',
31323128
value: 'client_credentials'
@@ -3689,7 +3685,7 @@
36893685
popup(auth[grantType].getUri());
36903686
}
36913687

3692-
if (grantType === 'owner' || grantType === 'password') {
3688+
if (grantType === 'password') {
36933689
auth.owner.getToken(this.credentials.username, this.credentials.password, function (err, user, raw) {
36943690
if (err) {
36953691
done(raw, err);
@@ -3703,7 +3699,7 @@
37033699
});
37043700
}
37053701

3706-
if (grantType === 'credentials'|| grantType === 'client_credentials') {
3702+
if (grantType === 'client_credentials') {
37073703
auth.credentials.getToken(function (err, user, raw) {
37083704
if (err) {
37093705
done(raw, err);
@@ -7168,6 +7164,21 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache)
71687164
"\n" +
71697165
" <h1 ng-if=\"!disableTitle\" class=\"raml-console-title\">{{raml.title}}</h1>\n" +
71707166
"\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" +
71717182
" <root-documentation></root-documentation>\n" +
71727183
"\n" +
71737184
" <root-types types=\"types\" ng-if=\"types\"></root-types>\n" +

dist/styles/api-console-dark-theme.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,20 @@ th {
12561256
-webkit-font-smoothing: antialiased;
12571257
}
12581258

1259+
.raml-console-show-more-less {
1260+
cursor: default;
1261+
color: blue;
1262+
font-size: small;
1263+
}
1264+
1265+
.raml-console-root-description {
1266+
font-size: medium;
1267+
}
1268+
1269+
.raml-console-root-description p {
1270+
margin-bottom: 3px;
1271+
}
1272+
12591273
.raml-console-title {
12601274
font-size: 24px;
12611275
text-align: center;

dist/styles/api-console-light-theme.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,20 @@ th {
12561256
-webkit-font-smoothing: antialiased;
12571257
}
12581258

1259+
.raml-console-show-more-less {
1260+
cursor: default;
1261+
color: blue;
1262+
font-size: small;
1263+
}
1264+
1265+
.raml-console-root-description {
1266+
font-size: medium;
1267+
}
1268+
1269+
.raml-console-root-description p {
1270+
margin-bottom: 3px;
1271+
}
1272+
12591273
.raml-console-title {
12601274
font-size: 24px;
12611275
text-align: center;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"grunt-karma": "~0.10.1",
4545
"grunt-protractor-runner": "~1.1.4",
4646
"jasmine-spec-reporter": "~1.1.0",
47+
"karma": "^0.12.37",
4748
"load-grunt-tasks": "~2.0.0",
4849
"serve-static": "~1.8.0"
4950
}

src/app/directives/properties.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@
3838
return [arrayType.items];
3939
};
4040

41-
$scope.getType = function (type) {
42-
var newType = $scope.mergeType(type);
43-
newType.type = RAML.Inspector.Types.ensureArray(newType.type);
41+
$scope.getType = function (property) {
42+
var newProperty = $scope.mergeProperty(property);
43+
newProperty.type = RAML.Inspector.Types.ensureArray(newProperty.type);
4444

45-
if (newType.type[0] === 'array') {
46-
newType.type = getArrayTypes(newType).map(function (aType) {
45+
if (newProperty.type[0].type) { newProperty.type = newProperty.type[0].type; }
46+
47+
if (newProperty.type[0] === 'array') {
48+
newProperty.type = getArrayTypes(newProperty).map(function (aType) {
4749
return aType + '[]';
4850
});
49-
newType.properties = newType.items.properties;
51+
newProperty.properties = newProperty.items.properties;
5052
}
5153

52-
return newType;
54+
return newProperty;
5355
};
5456

5557
var isPattern = function (propertyName) {
@@ -60,13 +62,13 @@
6062
return ($scope.showSecuritySchemaProperties || !property[0].isFromSecurityScheme) && !isPattern(property[0].displayName);
6163
};
6264

63-
$scope.mergeType = function (type) {
64-
var newType = angular.copy(type);
65+
$scope.mergeProperty = function (property) {
66+
var newProperty = angular.copy(property);
6567

6668
if (!$scope.isNestedProperty && $rootScope.types) {
67-
return RAML.Inspector.Types.mergeType(newType, $rootScope.types);
69+
return RAML.Inspector.Types.mergeType(newProperty, $rootScope.types);
6870
}
69-
return newType;
71+
return newProperty;
7072
};
7173

7274
$scope.isNativeType = RAML.Inspector.Types.isNativeType;

src/app/directives/raml-console.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
};
1616
})
17-
.controller('RamlConsoleController',
17+
.controller('RamlConsoleController',
1818
['$attrs', '$scope', '$rootScope', '$timeout', '$window', function RamlConsoleController(
1919
$attrs, $scope, $rootScope, $timeout, $window
2020
) {
@@ -25,6 +25,8 @@
2525
$scope.disableThemeSwitcher = $attrs.hasOwnProperty('disableThemeSwitcher');
2626
$scope.disableTitle = $attrs.hasOwnProperty('disableTitle');
2727
$scope.disableTryIt = $attrs.hasOwnProperty('disableTryIt');
28+
$scope.disableDescription = $attrs.hasOwnProperty('disableDescription');
29+
$scope.descriptionLimit = $attrs.hasOwnProperty('descriptionLimit') || 50;
2830
$scope.documentationCollapsed = $attrs.hasOwnProperty('documentationCollapsed');
2931
$scope.proxy = $window.RAML.Settings.proxy;
3032
$scope.readResourceTraits = readResourceTraits;

src/app/directives/raml-console.tpl.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66

77
<h1 ng-if="!disableTitle" class="raml-console-title">{{raml.title}}</h1>
88

9+
10+
<div ng-if="!disableDescription && !!raml.description && raml.description.length > 0" ng-init="actualSize = descriptionLimit" >
11+
<div class="raml-console-root-description" markdown="raml.description | limitTo : actualSize"></div>
12+
<span>
13+
<a class="raml-console-show-more-less"
14+
ng-hide="raml.description.length <= descriptionLimit || raml.description.length > actualSize || raml.description.length < actualSize"
15+
ng-click="actualSize = descriptionLimit"
16+
>show less</a>
17+
<a class="raml-console-show-more-less"
18+
ng-hide="raml.description.length <= descriptionLimit || raml.description.length == actualSize"
19+
ng-click="actualSize = raml.description.length"
20+
>show more</a>
21+
</span>
22+
</div>
23+
924
<root-documentation></root-documentation>
1025

1126
<root-types types="types" ng-if="types"></root-types>

src/app/directives/type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
$rootScope.$broadcast(TOGGLE_POPOVER);
5050

5151
$timeout(function () {
52-
$scope.selectedType = RAML.Inspector.Types.mergeType({
52+
$scope.selectedType = RAML.Inspector.Types.mergeProperty({
5353
displayName: type,
5454
type: [type]
5555
},

0 commit comments

Comments
 (0)