Skip to content

Commit ce90a37

Browse files
committed
Merge branch 'master' of github.com:mulesoft/api-console
2 parents f83e915 + dd5e547 commit ce90a37

File tree

7 files changed

+71
-61
lines changed

7 files changed

+71
-61
lines changed

dist/scripts/api-console-vendor.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var block = {
2020
lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
2121
blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
2222
list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
23-
html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,
23+
html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
2424
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
2525
table: noop,
2626
paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
@@ -868,7 +868,7 @@ Renderer.prototype.link = function(href, title, text) {
868868
} catch (e) {
869869
return '';
870870
}
871-
if (prot.indexOf('javascript:') === 0) {
871+
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {
872872
return '';
873873
}
874874
}
@@ -1154,8 +1154,13 @@ function marked(src, opt, callback) {
11541154

11551155
pending = tokens.length;
11561156

1157-
var done = function() {
1158-
var out, err;
1157+
var done = function(err) {
1158+
if (err) {
1159+
opt.highlight = highlight;
1160+
return callback(err);
1161+
}
1162+
1163+
var out;
11591164

11601165
try {
11611166
out = Parser.parse(tokens, opt);
@@ -1184,6 +1189,7 @@ function marked(src, opt, callback) {
11841189
return --pending || done();
11851190
}
11861191
return highlight(token.text, token.lang, function(err, code) {
1192+
if (err) return done(err);
11871193
if (code == null || code === token.text) {
11881194
return --pending || done();
11891195
}
@@ -1253,7 +1259,7 @@ marked.inlineLexer = InlineLexer.output;
12531259

12541260
marked.parse = marked;
12551261

1256-
if (typeof exports === 'object') {
1262+
if (typeof module !== 'undefined' && typeof exports === 'object') {
12571263
module.exports = marked;
12581264
} else if (typeof define === 'function' && define.amd) {
12591265
define(function() { return marked; });

dist/scripts/api-console.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,21 +1581,23 @@
15811581
var $this = jQuery($event.currentTarget);
15821582

15831583
if ($this.hasClass('raml-console-resources-expanded')) {
1584+
$scope.collapsed = true;
15841585
$this.text('expand all');
15851586
$this.removeClass('raml-console-resources-expanded');
15861587
jQuery('#raml-console-resources-container').find('ol.raml-console-resource-list').velocity('slideUp', {
15871588
duration: 200
15881589
});
15891590
} else {
1591+
$scope.collapsed = false;
15901592
$this.text('collapse all');
15911593
$this.addClass('raml-console-resources-expanded');
15921594
jQuery('#raml-console-resources-container').find('ol.raml-console-resource-list').velocity('slideDown', {
15931595
duration: 200
15941596
});
15951597
}
15961598

1597-
jQuery('#raml-console-resources-container').find('.raml-console-resource-list-root ol.raml-console-resource-list').toggleClass('raml-console-is-collapsed');
1598-
jQuery('#raml-console-resources-container').find('button.raml-console-resource-root-toggle').toggleClass('raml-console-is-active');
1599+
// jQuery('#raml-console-resources-container').find('.raml-console-resource-list-item ol.raml-console-resource-list').toggleClass('raml-console-is-collapsed');
1600+
// jQuery('#raml-console-resources-container').find('button.raml-console-resource-root-toggle').toggleClass('raml-console-is-active');
15991601
};
16001602

16011603
$scope.hasResourcesWithChilds = function () {
@@ -2082,7 +2084,7 @@
20822084
var options = request.toOptions();
20832085

20842086
return [
2085-
options.type.toUpperCase(),
2087+
options.method.toUpperCase(),
20862088
this.encodeURI(options.url),
20872089
rfc3986Encode(this.encodeParameters(request, oauthParams))
20882090
].join('&');
@@ -2438,7 +2440,7 @@
24382440

24392441
RAML.Client.Request = {
24402442
create: function(url, method) {
2441-
return new RequestDsl({ url: url, type: method });
2443+
return new RequestDsl({ url: url, method: method });
24422444
}
24432445
};
24442446
})();
@@ -3600,8 +3602,8 @@ RAML.Inspector = (function() {
36003602
var xhr = new root.XMLHttpRequest();
36013603
var headers = options.headers || {};
36023604

3603-
// Open the request to the uri and method.
3604-
xhr.open(options.method, options.uri);
3605+
// Open the request to the url and method.
3606+
xhr.open(options.method, options.url);
36053607

36063608
// When the request has loaded, attempt to automatically parse the body.
36073609
xhr.onload = function () {
@@ -3638,20 +3640,20 @@ RAML.Inspector = (function() {
36383640
* @param {Function} done
36393641
*/
36403642
ClientOAuth2.prototype.request = function (options, done) {
3641-
var lib = http;
3642-
var reqOpts = url.parse(options.uri);
3643+
var lib = http;
3644+
var reqOptions = url.parse(options.url);
36433645

36443646
// If the protocol is over https, switch request library.
3645-
if (reqOpts.protocol === 'https:') {
3647+
if (reqOptions.protocol === 'https:') {
36463648
lib = https;
36473649
}
36483650

36493651
// Alias request options.
3650-
reqOpts.method = options.method;
3651-
reqOpts.headers = options.headers;
3652+
reqOptions.method = options.method;
3653+
reqOptions.headers = options.headers;
36523654

36533655
// Send the http request and listen for the response to finish.
3654-
var req = lib.request(reqOpts, function (res) {
3656+
var req = lib.request(reqOptions, function (res) {
36553657
var data = '';
36563658

36573659
// Callback to `done` if a response error occurs.
@@ -3711,44 +3713,44 @@ RAML.Inspector = (function() {
37113713
/**
37123714
* Sign a standardised request object with user authentication information.
37133715
*
3714-
* @param {Object} opts
3716+
* @param {Object} options
37153717
* @return {Object}
37163718
*/
3717-
ClientOAuth2Token.prototype.sign = function (opts) {
3719+
ClientOAuth2Token.prototype.sign = function (options) {
37183720
if (!this.accessToken) {
37193721
throw new Error('Unable to sign without access token');
37203722
}
37213723

3722-
opts.headers = opts.headers || {};
3724+
options.headers = options.headers || {};
37233725

37243726
if (this.tokenType === 'bearer') {
3725-
opts.headers.Authorization = 'Bearer ' + this.accessToken;
3727+
options.headers.Authorization = 'Bearer ' + this.accessToken;
37263728
} else {
3727-
var parts = opts.uri.split('#');
3729+
var parts = options.url.split('#');
37283730
var token = 'access_token=' + this.accessToken;
3729-
var uri = parts[0].replace(/[?&]access_token=[^&#]/, '');
3731+
var url = parts[0].replace(/[?&]access_token=[^&#]/, '');
37303732
var fragment = parts[1] ? '#' + parts[1] : '';
37313733

3732-
// Prepend the correct query string parameter to the uri.
3733-
opts.uri = uri + (uri.indexOf('?') > -1 ? '&' : '?') + token + fragment;
3734+
// Prepend the correct query string parameter to the url.
3735+
options.url = url + (url.indexOf('?') > -1 ? '&' : '?') + token + fragment;
37343736

3735-
// Attempt to avoid storing the uri in proxies, since the access token
3737+
// Attempt to avoid storing the url in proxies, since the access token
37363738
// is exposed in the query parameters.
3737-
opts.headers.Pragma = 'no-store';
3738-
opts.headers['Cache-Control'] = 'no-store';
3739+
options.headers.Pragma = 'no-store';
3740+
options.headers['Cache-Control'] = 'no-store';
37393741
}
37403742

3741-
return opts;
3743+
return options;
37423744
};
37433745

37443746
/**
37453747
* Make a HTTP request as the user.
37463748
*
3747-
* @param {Object} opts
3749+
* @param {Object} options
37483750
* @param {Function} done
37493751
*/
3750-
ClientOAuth2Token.prototype.request = function (opts, done) {
3751-
return this.client.client.request(this.sign(opts), done);
3752+
ClientOAuth2Token.prototype.request = function (options, done) {
3753+
return this.client.client.request(this.sign(options), done);
37523754
};
37533755

37543756
/**
@@ -5390,7 +5392,7 @@ angular.module('ramlConsoleApp').run(['$templateCache', function($templateCache)
53905392
"\n" +
53915393
" <root-documentation></root-documentation>\n" +
53925394
"\n" +
5393-
" <ol <ol ng-class=\"{'raml-console-resources-container-no-title': disableTitle, 'raml-console-resources-container': !disableTitle}\" id=\"raml-console-resources-container\" class=\"raml-console-resource-list raml-console-resource-list-root\">\n" +
5395+
" <ol ng-class=\"{'raml-console-resources-container-no-title': disableTitle, 'raml-console-resources-container': !disableTitle}\" id=\"raml-console-resources-container\" class=\"raml-console-resource-list raml-console-resource-list-root\">\n" +
53945396
" <li id=\"raml_documentation\" class=\"raml-console-resource-list-item raml-console-documentation-header\">\n" +
53955397
" <div ng-if=\"proxy\" align=\"right\" class=\"raml-console-resource-proxy\">\n" +
53965398
" <label for=\"raml-console-api-behind-firewall\">API is behind a firewall <a href=\"http://www.mulesoft.org/documentation/display/current/Accessing+Your+API+Behind+a+Firewall\" target=\"_blank\">(?)</a></label>\n" +

src/app/resources/resources.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,23 @@
8585
var $this = jQuery($event.currentTarget);
8686

8787
if ($this.hasClass('raml-console-resources-expanded')) {
88+
$scope.collapsed = true;
8889
$this.text('expand all');
8990
$this.removeClass('raml-console-resources-expanded');
9091
jQuery('#raml-console-resources-container').find('ol.raml-console-resource-list').velocity('slideUp', {
9192
duration: 200
9293
});
9394
} else {
95+
$scope.collapsed = false;
9496
$this.text('collapse all');
9597
$this.addClass('raml-console-resources-expanded');
9698
jQuery('#raml-console-resources-container').find('ol.raml-console-resource-list').velocity('slideDown', {
9799
duration: 200
98100
});
99101
}
100102

101-
jQuery('#raml-console-resources-container').find('.raml-console-resource-list-root ol.raml-console-resource-list').toggleClass('raml-console-is-collapsed');
102-
jQuery('#raml-console-resources-container').find('button.raml-console-resource-root-toggle').toggleClass('raml-console-is-active');
103+
// jQuery('#raml-console-resources-container').find('.raml-console-resource-list-item ol.raml-console-resource-list').toggleClass('raml-console-is-collapsed');
104+
// jQuery('#raml-console-resources-container').find('button.raml-console-resource-root-toggle').toggleClass('raml-console-is-active');
103105
};
104106

105107
$scope.hasResourcesWithChilds = function () {

src/app/resources/resources.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1 ng-if="!disableTitle" class="raml-console-title">{{raml.title}}</h1>
2020

2121
<root-documentation></root-documentation>
2222

23-
<ol <ol ng-class="{'raml-console-resources-container-no-title': disableTitle, 'raml-console-resources-container': !disableTitle}" id="raml-console-resources-container" class="raml-console-resource-list raml-console-resource-list-root">
23+
<ol ng-class="{'raml-console-resources-container-no-title': disableTitle, 'raml-console-resources-container': !disableTitle}" id="raml-console-resources-container" class="raml-console-resource-list raml-console-resource-list-root">
2424
<li id="raml_documentation" class="raml-console-resource-list-item raml-console-documentation-header">
2525
<div ng-if="proxy" align="right" class="raml-console-resource-proxy">
2626
<label for="raml-console-api-behind-firewall">API is behind a firewall <a href="http://www.mulesoft.org/documentation/display/current/Accessing+Your+API+Behind+a+Firewall" target="_blank">(?)</a></label>

src/common/client/auth_strategies/oauth1/signer/hmac.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
var options = request.toOptions();
2323

2424
return [
25-
options.type.toUpperCase(),
25+
options.method.toUpperCase(),
2626
this.encodeURI(options.url),
2727
rfc3986Encode(this.encodeParameters(request, oauthParams))
2828
].join('&');

src/common/client/request.js

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

106106
RAML.Client.Request = {
107107
create: function(url, method) {
108-
return new RequestDsl({ url: url, type: method });
108+
return new RequestDsl({ url: url, method: method });
109109
}
110110
};
111111
})();

src/vendor/client-oauth2/client-oauth2.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@
362362
var xhr = new root.XMLHttpRequest();
363363
var headers = options.headers || {};
364364

365-
// Open the request to the uri and method.
366-
xhr.open(options.method, options.uri);
365+
// Open the request to the url and method.
366+
xhr.open(options.method, options.url);
367367

368368
// When the request has loaded, attempt to automatically parse the body.
369369
xhr.onload = function () {
@@ -400,20 +400,20 @@
400400
* @param {Function} done
401401
*/
402402
ClientOAuth2.prototype.request = function (options, done) {
403-
var lib = http;
404-
var reqOpts = url.parse(options.uri);
403+
var lib = http;
404+
var reqOptions = url.parse(options.url);
405405

406406
// If the protocol is over https, switch request library.
407-
if (reqOpts.protocol === 'https:') {
407+
if (reqOptions.protocol === 'https:') {
408408
lib = https;
409409
}
410410

411411
// Alias request options.
412-
reqOpts.method = options.method;
413-
reqOpts.headers = options.headers;
412+
reqOptions.method = options.method;
413+
reqOptions.headers = options.headers;
414414

415415
// Send the http request and listen for the response to finish.
416-
var req = lib.request(reqOpts, function (res) {
416+
var req = lib.request(reqOptions, function (res) {
417417
var data = '';
418418

419419
// Callback to `done` if a response error occurs.
@@ -473,44 +473,44 @@
473473
/**
474474
* Sign a standardised request object with user authentication information.
475475
*
476-
* @param {Object} opts
476+
* @param {Object} options
477477
* @return {Object}
478478
*/
479-
ClientOAuth2Token.prototype.sign = function (opts) {
479+
ClientOAuth2Token.prototype.sign = function (options) {
480480
if (!this.accessToken) {
481481
throw new Error('Unable to sign without access token');
482482
}
483483

484-
opts.headers = opts.headers || {};
484+
options.headers = options.headers || {};
485485

486486
if (this.tokenType === 'bearer') {
487-
opts.headers.Authorization = 'Bearer ' + this.accessToken;
487+
options.headers.Authorization = 'Bearer ' + this.accessToken;
488488
} else {
489-
var parts = opts.uri.split('#');
489+
var parts = options.url.split('#');
490490
var token = 'access_token=' + this.accessToken;
491-
var uri = parts[0].replace(/[?&]access_token=[^&#]/, '');
491+
var url = parts[0].replace(/[?&]access_token=[^&#]/, '');
492492
var fragment = parts[1] ? '#' + parts[1] : '';
493493

494-
// Prepend the correct query string parameter to the uri.
495-
opts.uri = uri + (uri.indexOf('?') > -1 ? '&' : '?') + token + fragment;
494+
// Prepend the correct query string parameter to the url.
495+
options.url = url + (url.indexOf('?') > -1 ? '&' : '?') + token + fragment;
496496

497-
// Attempt to avoid storing the uri in proxies, since the access token
497+
// Attempt to avoid storing the url in proxies, since the access token
498498
// is exposed in the query parameters.
499-
opts.headers.Pragma = 'no-store';
500-
opts.headers['Cache-Control'] = 'no-store';
499+
options.headers.Pragma = 'no-store';
500+
options.headers['Cache-Control'] = 'no-store';
501501
}
502502

503-
return opts;
503+
return options;
504504
};
505505

506506
/**
507507
* Make a HTTP request as the user.
508508
*
509-
* @param {Object} opts
509+
* @param {Object} options
510510
* @param {Function} done
511511
*/
512-
ClientOAuth2Token.prototype.request = function (opts, done) {
513-
return this.client.client.request(this.sign(opts), done);
512+
ClientOAuth2Token.prototype.request = function (options, done) {
513+
return this.client.client.request(this.sign(options), done);
514514
};
515515

516516
/**

0 commit comments

Comments
 (0)