From 016ad7e0ad1f7c6faf9a97ba6d595bac480b4568 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 19 Jun 2016 17:40:09 +0300 Subject: [PATCH 01/19] Update angular to the latest RC --- package.json | 22 +++++++++++----------- system.config.js | 38 +++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 39fb14df..8a6c87f4 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,11 @@ "jspm": { "configFile": "system.config.js", "dependencies": { - "@angular/common": "npm:@angular/common@^2.0.0-rc.1", - "@angular/compiler": "npm:@angular/compiler@^2.0.0-rc.1", - "@angular/core": "npm:@angular/core@^2.0.0-rc.1", - "@angular/platform-browser": "npm:@angular/platform-browser@^2.0.0-rc.1", - "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@^2.0.0-rc.1", + "@angular/common": "npm:@angular/common@^2.0.0-rc.2", + "@angular/compiler": "npm:@angular/compiler@^2.0.0-rc.2", + "@angular/core": "npm:@angular/core@^2.0.0-rc.2", + "@angular/platform-browser": "npm:@angular/platform-browser@^2.0.0-rc.2", + "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@^2.0.0-rc.2", "dropkickjs": "npm:dropkickjs@^2.1.8", "es6-shim": "github:es-shims/es6-shim@^0.33.6", "hint.css": "npm:hint.css@^2.2.1", @@ -76,12 +76,12 @@ } }, "devDependencies": { - "@angular/common": "2.0.0-rc.1", - "@angular/compiler": "2.0.0-rc.1", - "@angular/core": "2.0.0-rc.1", - "@angular/platform-browser": "2.0.0-rc.1", - "@angular/platform-browser-dynamic": "2.0.0-rc.1", - "@angular/platform-server": "2.0.0-rc.1", + "@angular/common": "^2.0.0-rc.2", + "@angular/compiler": "^2.0.0-rc.2", + "@angular/core": "^2.0.0-rc.2", + "@angular/platform-browser": "^2.0.0-rc.2", + "@angular/platform-browser-dynamic": "^2.0.0-rc.2", + "@angular/platform-server": "^2.0.0-rc.2", "babel-eslint": "^4.1.6", "babel-polyfill": "^6.3.14", "branch-release": "^1.0.3", diff --git a/system.config.js b/system.config.js index 0fe298f5..7b7378b2 100644 --- a/system.config.js +++ b/system.config.js @@ -16,11 +16,11 @@ System.config({ }, map: { - "@angular/common": "npm:@angular/common@2.0.0-rc.1", - "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1", - "@angular/core": "npm:@angular/core@2.0.0-rc.1", - "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.1", - "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0-rc.1", + "@angular/common": "npm:@angular/common@2.0.0-rc.2", + "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.2", + "@angular/core": "npm:@angular/core@2.0.0-rc.2", + "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.2", + "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0-rc.2", "babel": "npm:babel-core@5.8.34", "babel-runtime": "npm:babel-runtime@5.8.34", "clean-css": "npm:clean-css@3.4.17", @@ -116,30 +116,30 @@ System.config({ "github:jspm/nodelibs-zlib@0.1.0": { "browserify-zlib": "npm:browserify-zlib@0.1.4" }, - "npm:@angular/common@2.0.0-rc.1": { - "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "npm:@angular/common@2.0.0-rc.2": { + "@angular/core": "npm:@angular/core@2.0.0-rc.2", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:@angular/compiler@2.0.0-rc.1": { - "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "npm:@angular/compiler@2.0.0-rc.2": { + "@angular/core": "npm:@angular/core@2.0.0-rc.2", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:@angular/core@2.0.0-rc.1": { + "npm:@angular/core@2.0.0-rc.2": { "process": "github:jspm/nodelibs-process@0.1.2", "rxjs": "npm:rxjs@5.0.0-beta.6", "zone.js": "npm:zone.js@0.6.12" }, - "npm:@angular/platform-browser-dynamic@2.0.0-rc.1": { - "@angular/common": "npm:@angular/common@2.0.0-rc.1", - "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1", - "@angular/core": "npm:@angular/core@2.0.0-rc.1", - "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.1", + "npm:@angular/platform-browser-dynamic@2.0.0-rc.2": { + "@angular/common": "npm:@angular/common@2.0.0-rc.2", + "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.2", + "@angular/core": "npm:@angular/core@2.0.0-rc.2", + "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.2", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:@angular/platform-browser@2.0.0-rc.1": { - "@angular/common": "npm:@angular/common@2.0.0-rc.1", - "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.1", - "@angular/core": "npm:@angular/core@2.0.0-rc.1", + "npm:@angular/platform-browser@2.0.0-rc.2": { + "@angular/common": "npm:@angular/common@2.0.0-rc.2", + "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.2", + "@angular/core": "npm:@angular/core@2.0.0-rc.2", "process": "github:jspm/nodelibs-process@0.1.2" }, "npm:amdefine@1.0.0": { From a482c0b29e7644d08246e32cab071dae2bd03edc Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 19 Jun 2016 17:40:45 +0300 Subject: [PATCH 02/19] Remove second tsc task from build --- build/tasks/build.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/tasks/build.js b/build/tasks/build.js index b51a3e35..73753fc3 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -41,6 +41,7 @@ gulp.task('copyDebug', () => { gulp.task('rebuild', function(done) { return runSequence( + 'tsc', 'inlineTemplates', 'bundle', 'concatDeps', @@ -81,7 +82,7 @@ gulp.task('tsc', function() { // .pipe(gulp.dest(config.tmp)); // } -gulp.task('inlineTemplates', ['tsc', 'sass'], function() { +gulp.task('inlineTemplates', ['sass'], function() { return gulp.src('.tmp/**/*.js', { base: './tmp' }) .pipe(replace(/'(.*?)\.css'/g, '\'$1.scss\'')) .pipe(inlineNg2Template({ From 791355c60a429638d1ef81b3789c3db1a6828663 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 19 Jun 2016 17:41:04 +0300 Subject: [PATCH 03/19] Add simple animations --- lib/components/SideMenu/side-menu.html | 2 +- lib/components/SideMenu/side-menu.scss | 1 - lib/components/SideMenu/side-menu.ts | 15 +++++++++++++-- lib/components/base.ts | 1 + lib/shared/components/Zippy/zippy.html | 6 ++++-- lib/shared/components/Zippy/zippy.scss | 4 ++++ lib/shared/components/Zippy/zippy.ts | 23 +++++++++++++++++++---- 7 files changed, 42 insertions(+), 10 deletions(-) diff --git a/lib/components/SideMenu/side-menu.html b/lib/components/SideMenu/side-menu.html index a947fcc1..c0929bf8 100644 --- a/lib/components/SideMenu/side-menu.html +++ b/lib/components/SideMenu/side-menu.html @@ -10,7 +10,7 @@ -
- +
+
+ +
diff --git a/lib/shared/components/Zippy/zippy.scss b/lib/shared/components/Zippy/zippy.scss index 516a95db..05087ed3 100644 --- a/lib/shared/components/Zippy/zippy.scss +++ b/lib/shared/components/Zippy/zippy.scss @@ -47,6 +47,10 @@ span.zippy-indicator { } .zippy-content { + overflow: hidden; +} + +.zippy-content-wrap { padding: 15px 0; } diff --git a/lib/shared/components/Zippy/zippy.ts b/lib/shared/components/Zippy/zippy.ts index f23ccc1f..7ffa180b 100644 --- a/lib/shared/components/Zippy/zippy.ts +++ b/lib/shared/components/Zippy/zippy.ts @@ -1,13 +1,25 @@ 'use strict'; -import { Component, EventEmitter, Output, Input } from '@angular/core'; +import { Component, EventEmitter, Output, Input, + trigger, state, animate, transition, style } from '@angular/core'; import { CORE_DIRECTIVES } from '@angular/common'; @Component({ selector: 'zippy', templateUrl: './zippy.html', styleUrls: ['./zippy.css'], - directives: [CORE_DIRECTIVES] + directives: [CORE_DIRECTIVES], + animations: [ + trigger('openClose', [ + state('collapsed, void', + style({ height: '0px' })), + state('expanded', + style({ height: '*' })), + transition('collapsed <=> expanded', [ + animate(200) + ]) + ]) + ], }) export class Zippy { @Input() type = 'general'; @@ -16,10 +28,13 @@ export class Zippy { @Input() title; @Output() open = new EventEmitter(); @Output() close = new EventEmitter(); - toggle() { this.visible = !this.visible; if (this.empty) return; - (this.visible) ? this.open.next({}) : this.close.next({}); + if (this.visible) { + this.open.next({}); + } else { + this.close.next({}); + } } } From b65370c8ac48f8994f40ce2fcd65905ae593944d Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 22 Jun 2016 12:42:03 +0300 Subject: [PATCH 04/19] Replace marked with remarkable --- lib/utils/pipes.ts | 35 ++++++++++++++++++++--------------- package.json | 4 ++-- system.config.js | 25 ++++++++++++++++++++++++- typings/marked.d.ts | 7 ------- typings/remarkable.d.ts | 4 ++++ 5 files changed, 50 insertions(+), 25 deletions(-) delete mode 100644 typings/marked.d.ts create mode 100644 typings/remarkable.d.ts diff --git a/lib/utils/pipes.ts b/lib/utils/pipes.ts index ab09fbb8..425ce7ce 100644 --- a/lib/utils/pipes.ts +++ b/lib/utils/pipes.ts @@ -1,27 +1,27 @@ 'use strict'; import { Pipe, PipeTransform } from '@angular/core'; +import { DomSanitizationService } from '@angular/platform-browser'; import { isString, stringify, isBlank } from '@angular/core/src/facade/lang'; import { BaseException } from '@angular/core/src/facade/exceptions'; import JsonPointer from './JsonPointer'; declare var Prism: any; -import marked from 'marked'; +import Remarkable from 'remarkable'; -// in gfm mode marked doesn't parse #Heading (without space after #) as heading -// https://github.com/chjj/marked/issues/642 -marked['Lexer'].rules.gfm.heading = marked['Lexer'].rules.normal.heading; -marked['Lexer'].rules.tables.heading = marked['Lexer'].rules.normal.heading; - -marked.setOptions({ - renderer: new marked.Renderer(), - gfm: true, - tables: true, +const md = new Remarkable({ + html: true, + linkify: true, breaks: false, - pedantic: false, - smartLists: true, - smartypants: false + typographer: false, + highlight: (str, lang) => { + if (lang === 'json') lang = 'js'; + let grammar = Prism.languages[lang]; + //fallback to clike + if (!grammar) return str; + return Prism.highlight(str, grammar); + } }); class InvalidPipeArgumentException extends BaseException { @@ -65,12 +65,16 @@ export class JsonPointerEscapePipe implements PipeTransform { @Pipe({ name: 'marked' }) export class MarkedPipe implements PipeTransform { + constructor(private sanitizer: DomSanitizationService) {} transform(value) { if (isBlank(value)) return value; if (!isString(value)) { throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value); } - return `${marked(value)}`; + + return this.sanitizer.bypassSecurityTrustHtml( + `${md.render(value)}` + ); } } @@ -84,6 +88,7 @@ const langMap = { @Pipe({ name: 'prism' }) export class PrismPipe implements PipeTransform { + constructor(private sanitizer: DomSanitizationService) {} transform(value, args) { if (isBlank(args) || args.length === 0) { throw new BaseException('Prism pipe requires one argument'); @@ -98,7 +103,7 @@ export class PrismPipe implements PipeTransform { let grammar = Prism.languages[lang]; //fallback to clike if (!grammar) grammar = Prism.languages.clike; - return Prism.highlight(value, grammar); + return this.sanitizer.bypassSecurityTrustHtml(Prism.highlight(value, grammar)); } } diff --git a/package.json b/package.json index 8a6c87f4..34f355c7 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,9 @@ "json": "github:systemjs/plugin-json@^0.1.0", "json-pointer": "npm:json-pointer@^0.3.0", "json-schema-ref-parser": "npm:json-schema-ref-parser@^3.1.2", - "marked": "npm:marked@^0.3.5", "openapi-sampler": "npm:openapi-sampler@0.2.0", "prismjs": "npm:prismjs@^1.3.0", + "remarkable": "npm:remarkable@^1.6.2", "rxjs": "npm:rxjs@5.0.0-beta.6", "scrollparent": "npm:scrollparent@^0.1.0", "stream-http": "npm:stream-http@^2.3.0", @@ -121,13 +121,13 @@ "karma-regex-preprocessor": "github:makern/karma-regex-preprocessor", "karma-should": "^1.0.0", "karma-sinon": "^1.0.4", - "marked": "^0.3.5", "node-sass": "^3.7.0", "openapi-sampler": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", "protractor": "^3.0.0", "reflect-metadata": "^0.1.2", "remap-istanbul": "^0.6.4", + "remarkable": "^1.6.2", "require-dir": "^0.3.0", "rollup-plugin-commonjs": "^2.2.1", "run-sequence": "^1.1.5", diff --git a/system.config.js b/system.config.js index 7b7378b2..0a670a43 100644 --- a/system.config.js +++ b/system.config.js @@ -33,9 +33,9 @@ System.config({ "json-formatter-js": "npm:json-formatter-js@0.2.0", "json-pointer": "npm:json-pointer@0.3.0", "json-schema-ref-parser": "npm:json-schema-ref-parser@3.1.2", - "marked": "npm:marked@0.3.5", "openapi-sampler": "npm:openapi-sampler@0.2.0", "prismjs": "npm:prismjs@1.3.0", + "remarkable": "npm:remarkable@1.6.2", "rxjs": "npm:rxjs@5.0.0-beta.6", "scrollparent": "npm:scrollparent@0.1.0", "stream-http": "npm:stream-http@2.3.0", @@ -148,6 +148,15 @@ System.config({ "path": "github:jspm/nodelibs-path@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2" }, + "npm:argparse@0.1.16": { + "assert": "github:jspm/nodelibs-assert@0.1.0", + "fs": "github:jspm/nodelibs-fs@0.1.2", + "path": "github:jspm/nodelibs-path@0.1.0", + "process": "github:jspm/nodelibs-process@0.1.2", + "underscore": "npm:underscore@1.7.0", + "underscore.string": "npm:underscore.string@2.4.0", + "util": "github:jspm/nodelibs-util@0.1.0" + }, "npm:argparse@1.0.7": { "fs": "github:jspm/nodelibs-fs@0.1.2", "path": "github:jspm/nodelibs-path@0.1.0", @@ -193,6 +202,10 @@ System.config({ "npm:async@1.5.2": { "process": "github:jspm/nodelibs-process@0.1.2" }, + "npm:autolinker@0.15.3": { + "child_process": "github:jspm/nodelibs-child_process@0.1.0", + "process": "github:jspm/nodelibs-process@0.1.2" + }, "npm:aws-sign2@0.6.0": { "crypto": "github:jspm/nodelibs-crypto@0.1.0", "url": "github:jspm/nodelibs-url@0.1.0" @@ -743,6 +756,16 @@ System.config({ "string_decoder": "npm:string_decoder@0.10.31", "util-deprecate": "npm:util-deprecate@1.0.2" }, + "npm:remarkable@1.6.2": { + "argparse": "npm:argparse@0.1.16", + "autolinker": "npm:autolinker@0.15.3", + "buffer": "github:jspm/nodelibs-buffer@0.1.0", + "fs": "github:jspm/nodelibs-fs@0.1.2", + "path": "github:jspm/nodelibs-path@0.1.0", + "process": "github:jspm/nodelibs-process@0.1.2", + "systemjs-json": "github:systemjs/plugin-json@0.1.2", + "util": "github:jspm/nodelibs-util@0.1.0" + }, "npm:request@2.72.0": { "aws-sign2": "npm:aws-sign2@0.6.0", "aws4": "npm:aws4@1.4.1", diff --git a/typings/marked.d.ts b/typings/marked.d.ts deleted file mode 100644 index be77f66a..00000000 --- a/typings/marked.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by typings -// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/json-pointer/json-pointer.d.ts - -declare module "marked" { - var x: any; - export default x; -} \ No newline at end of file diff --git a/typings/remarkable.d.ts b/typings/remarkable.d.ts new file mode 100644 index 00000000..ee3c03b4 --- /dev/null +++ b/typings/remarkable.d.ts @@ -0,0 +1,4 @@ +declare module 'remarkable' { + var x: any; + export default x; +} From 43a0872530582162d2ba08b6ceced54d87e550b2 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 22 Jun 2016 12:45:03 +0300 Subject: [PATCH 05/19] bypass sanitization for markdown --- lib/components/ApiInfo/api-info.html | 2 +- lib/components/JsonSchema/json-schema-lazy.ts | 1 + lib/components/Method/method.html | 2 +- lib/components/MethodsList/methods-list.html | 2 +- lib/components/ParamsList/params-list.html | 4 ++-- lib/components/Redoc/redoc.scss | 3 ++- lib/components/RequestSamples/request-samples.html | 2 +- lib/components/ResponsesList/responses-list.html | 2 +- lib/components/SchemaSample/schema-sample.html | 2 +- lib/utils/JsonFormatterPipe.ts | 4 +++- 10 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/components/ApiInfo/api-info.html b/lib/components/ApiInfo/api-info.html index 8083a884..1c8151f5 100644 --- a/lib/components/ApiInfo/api-info.html +++ b/lib/components/ApiInfo/api-info.html @@ -1,6 +1,6 @@

{{data.title}} ({{data.version}})

-

+

Contact: diff --git a/lib/components/JsonSchema/json-schema-lazy.ts b/lib/components/JsonSchema/json-schema-lazy.ts index af01a9dd..23de877e 100644 --- a/lib/components/JsonSchema/json-schema-lazy.ts +++ b/lib/components/JsonSchema/json-schema-lazy.ts @@ -32,6 +32,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit { } _loadAfterSelf() { + // FIXME: get rid of DynamicComponentLoader as it is deprecated return this.dcl.loadNextToLocation(JsonSchema, this.viewRef).then((compRef) => { this.initComponent(compRef); if (compRef.changeDetectorRef) { diff --git a/lib/components/Method/method.html b/lib/components/Method/method.html index 1fdb449f..adbf9284 100644 --- a/lib/components/Method/method.html +++ b/lib/components/Method/method.html @@ -7,7 +7,7 @@ {{tag}}

+ [innerHtml]="data.methodInfo.description | marked">

diff --git a/lib/components/MethodsList/methods-list.html b/lib/components/MethodsList/methods-list.html index e8f134cf..c2217caa 100644 --- a/lib/components/MethodsList/methods-list.html +++ b/lib/components/MethodsList/methods-list.html @@ -2,7 +2,7 @@

{{tag.name}}

-

+

diff --git a/lib/components/ParamsList/params-list.html b/lib/components/ParamsList/params-list.html index b07078d5..f19d3414 100644 --- a/lib/components/ParamsList/params-list.html +++ b/lib/components/ParamsList/params-list.html @@ -20,7 +20,7 @@ {{enumItem.val | json}}
-
+
@@ -29,7 +29,7 @@
Request Body
-
+

diff --git a/lib/components/Redoc/redoc.scss b/lib/components/Redoc/redoc.scss index 048e4060..dd52ca75 100644 --- a/lib/components/Redoc/redoc.scss +++ b/lib/components/Redoc/redoc.scss @@ -160,7 +160,8 @@ footer { pre { font-family: Courier, monospace; white-space: pre-wrap; - background-color: rgba(38,50,56,0.04); + background-color: #263238; + color: white; padding: 12px 14px 15px 14px; overflow-x: auto; line-height: normal; diff --git a/lib/components/RequestSamples/request-samples.html b/lib/components/RequestSamples/request-samples.html index cc9bbb45..53a9ef20 100644 --- a/lib/components/RequestSamples/request-samples.html +++ b/lib/components/RequestSamples/request-samples.html @@ -5,6 +5,6 @@ -

+    

   
diff --git a/lib/components/ResponsesList/responses-list.html b/lib/components/ResponsesList/responses-list.html index 39746643..6cdae6c0 100644 --- a/lib/components/ResponsesList/responses-list.html +++ b/lib/components/ResponsesList/responses-list.html @@ -9,7 +9,7 @@
{{header.name}}
{{header.type}}
Default: {{header.default}}
-
+
diff --git a/lib/components/SchemaSample/schema-sample.html b/lib/components/SchemaSample/schema-sample.html index bcdc23f0..8d0f2973 100644 --- a/lib/components/SchemaSample/schema-sample.html +++ b/lib/components/SchemaSample/schema-sample.html @@ -1,5 +1,5 @@
 Sample unavailable 
-

+  

 
diff --git a/lib/utils/JsonFormatterPipe.ts b/lib/utils/JsonFormatterPipe.ts index d1270d0d..a8f7470d 100644 --- a/lib/utils/JsonFormatterPipe.ts +++ b/lib/utils/JsonFormatterPipe.ts @@ -1,15 +1,17 @@ 'use strict'; import { Pipe, PipeTransform } from '@angular/core'; import { isBlank } from '@angular/core/src/facade/lang'; +import { DomSanitizationService } from '@angular/platform-browser'; var level = 1; const COLLAPSE_LEVEL = 2; @Pipe({ name: 'jsonFormatter' }) export class JsonFormatter implements PipeTransform { + constructor(private sanitizer: DomSanitizationService) {} transform(value) { if (isBlank(value)) return value; - return jsonToHTML(value); + return this.sanitizer.bypassSecurityTrustHtml(jsonToHTML(value)); } } From 9341d4904e71f4c75f789077054211e6cce8e73c Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 22 Jun 2016 12:49:30 +0300 Subject: [PATCH 06/19] Minor demo update --- demo/index.html | 2 +- demo/swagger.yaml | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/demo/index.html b/demo/index.html index 0b3bf995..8f466a01 100644 --- a/demo/index.html +++ b/demo/index.html @@ -24,6 +24,6 @@ - + diff --git a/demo/swagger.yaml b/demo/swagger.yaml index 34e3414f..5034a924 100644 --- a/demo/swagger.yaml +++ b/demo/swagger.yaml @@ -25,18 +25,12 @@ tags: Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data. ```json { - ... - "pagination": { - "next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296", - "next_max_id": "13872296" - } - } ``` From 1e97ea655ea11e31183b2e7c988dc115326ed13b Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 22 Jun 2016 19:13:57 +0300 Subject: [PATCH 07/19] Refactor + perf optimizations --- lib/components/JsonSchema/json-schema-lazy.ts | 7 +- lib/components/JsonSchema/json-schema.html | 10 +- lib/components/JsonSchema/json-schema.spec.ts | 2 +- lib/components/JsonSchema/json-schema.ts | 31 ++- lib/components/Redoc/redoc.ts | 8 +- lib/components/SchemaSample/schema-sample.ts | 33 ++- lib/components/base.spec.ts | 248 ------------------ lib/components/base.ts | 137 +--------- lib/services/spec-helper.service.spec.ts | 238 +++++++++++++++++ lib/services/spec-helper.service.ts | 196 ++++++++++++++ lib/utils/SchemaManager.ts | 12 +- lib/utils/helpers.ts | 15 ++ tests/schemas/base-component-dereference.json | 8 +- 13 files changed, 526 insertions(+), 419 deletions(-) create mode 100644 lib/services/spec-helper.service.spec.ts create mode 100644 lib/services/spec-helper.service.ts diff --git a/lib/components/JsonSchema/json-schema-lazy.ts b/lib/components/JsonSchema/json-schema-lazy.ts index 23de877e..66b91239 100644 --- a/lib/components/JsonSchema/json-schema-lazy.ts +++ b/lib/components/JsonSchema/json-schema-lazy.ts @@ -59,9 +59,10 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit { setTimeout( ()=> { let $element = compRef.location.nativeElement; - // skip caching view with tabs inside (discriminator) as it needs attached controller - // FIXME: get rid of dependency on selector - if ($element.querySelector('.discriminator-wrap')) { + // skip caching view with tabs inside (discriminator) + // as it needs attached controller + if (compRef.instance.hasDiscriminator) { + this._loadAfterSelf(); return; } insertAfter($element.cloneNode(true), this.elementRef.nativeElement); diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html index 4605645c..a788448c 100644 --- a/lib/components/JsonSchema/json-schema.html +++ b/lib/components/JsonSchema/json-schema.html @@ -19,7 +19,7 @@ -