From a87ba13806070d61fcb98b43b57179a92d140c21 Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 17 Mar 2016 10:27:45 -0400 Subject: [PATCH 1/8] Fixes in JSONSchema treem and descriminator --- .../JsonSchema/json-schema-common.scss | 12 +++++++++--- lib/components/JsonSchema/json-schema.scss | 18 ++++++++++-------- .../RequestSamples/request-samples.scss | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/components/JsonSchema/json-schema-common.scss b/lib/components/JsonSchema/json-schema-common.scss index d4ae7d5a..51942c3f 100644 --- a/lib/components/JsonSchema/json-schema-common.scss +++ b/lib/components/JsonSchema/json-schema-common.scss @@ -49,6 +49,12 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin; .param-range { color: rgba($primary-color, .7); + position: relative; + top: 1px; + padding: 0 4px; + border-radius: $border-radius; + background-color: rgba($primary-color, .1); + margin-left: 6px; } .param-description { @@ -114,7 +120,7 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin; border-top: $line-border; width: $bullet-margin; left: 0; - top: ($param-name-height/2) + $cell-padding + 1px; + top: ($param-name-height/2) + $cell-padding + 1; } .param:first-of-type > .param-name:before { @@ -124,7 +130,7 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin; left: -$lines-width; top: 0; border-left: $line-border-erase; - height: ($param-name-height/2) + $cell-padding; + height: ($param-name-height/2) + $cell-padding + 1; } .param:last-of-type > .param-name { @@ -136,7 +142,7 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin; position: absolute; left: -$lines-width - 1px; border-left: $line-border-erase; - top: ($param-name-height/2) + $cell-padding + $lines-width; + top: ($param-name-height/2) + $cell-padding + $lines-width + 1; background-color: white; bottom: 0; } diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss index 10a33ce6..18bd21cb 100644 --- a/lib/components/JsonSchema/json-schema.scss +++ b/lib/components/JsonSchema/json-schema.scss @@ -106,7 +106,7 @@ json-schema.nested-schema { } .discriminator-info { - font-weight: bold; + font-weight: $regular; } .discriminator-wrap > td { @@ -123,19 +123,21 @@ json-schema.nested-schema { } :host tabs li { - margin: 0.2em 0.5em 0.2em 0; - font-size: 14px; + margin: 0.2em 0.3em 0.2em 0; + font-family: $headers-font, $headers-font-family; + font-size: .929em; + line-height: .929em; border: 0; color: white; - padding: 0 15px; - border-radius: 10px; - background-color: #8A9094; + padding: 2px 8px 4px 8px; + border-radius: $border-radius; + background-color: rgba($black, 0.3); &:last-of-type { - margin: 0; + margin-right: 0; } &.active { - background-color: $headers-color; + background-color: $primary-color; } } diff --git a/lib/components/RequestSamples/request-samples.scss b/lib/components/RequestSamples/request-samples.scss index 4f14dfe2..333d0420 100644 --- a/lib/components/RequestSamples/request-samples.scss +++ b/lib/components/RequestSamples/request-samples.scss @@ -19,7 +19,7 @@ header { line-height: 1.25; color: $sample-panel-headers-color; - &.hover { + &:hover { background-color: rgba(white, .1); color: #ffffff; } From c95414286190e7822aa4cf7dafbfd4203125fef8 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Thu, 17 Mar 2016 20:30:50 +0200 Subject: [PATCH 2/8] discriminator ui update --- lib/components/JsonSchema/json-schema.html | 18 +++++++++++------- lib/components/JsonSchema/json-schema.js | 9 +++++++++ lib/components/JsonSchema/json-schema.scss | 20 ++++++++++++++------ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html index c22bc7e8..6d2d4e8a 100644 --- a/lib/components/JsonSchema/json-schema.html +++ b/lib/components/JsonSchema/json-schema.html @@ -20,7 +20,13 @@
-
This field value determines the exact schema:
+
+ This field value determines the exact schema: +
    +
  • {{derived.name}}
  • +
+
@@ -32,12 +38,10 @@ - - - - - - +
+ + +
diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index c5ef5430..31215928 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -21,6 +21,14 @@ export default class JsonSchema extends BaseComponent { this.final = false; } + selectDerived(subClass) { + if (subClass.active) return; + this.data.derived.forEach((subSchema) => { + subSchema.active = false; + }); + subClass.active = true; + } + prepareModel() { this.data = {}; this.data.properties = []; @@ -43,6 +51,7 @@ export default class JsonSchema extends BaseComponent { let normPtr = schema._pointer || this.pointer; let derived = this.schemaMgr.findDerivedDefinitions( normPtr ); if (!this.final && derived.length) { + derived[0].active = true; this.data.derived = derived; this.data.discriminator = schema.discriminator; } diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss index 18bd21cb..ff5350d5 100644 --- a/lib/components/JsonSchema/json-schema.scss +++ b/lib/components/JsonSchema/json-schema.scss @@ -12,6 +12,13 @@ $array-marker-line-height: 1.5; padding: 0 10px; } +.derived-schema { + display: none; +} +.derived-schema.active { + display: block; +} + json-schema.nested-schema { background-color: $side-menu-active-bg-color; padding: 10px 20px; @@ -114,15 +121,14 @@ json-schema.nested-schema { padding: 0; } -:host tabs { +ul { + text-align: left; + margin: 0; + padding: 0; display: block; } -:host ul { - text-align: center; -} - -:host tabs li { +li { margin: 0.2em 0.3em 0.2em 0; font-family: $headers-font, $headers-font-family; font-size: .929em; @@ -132,6 +138,8 @@ json-schema.nested-schema { padding: 2px 8px 4px 8px; border-radius: $border-radius; background-color: rgba($black, 0.3); + display: inline-block; + cursor: pointer; &:last-of-type { margin-right: 0; From 5818f171f7a0283a2b0733a708bfb6f9643cfd5e Mon Sep 17 00:00:00 2001 From: Cesar Date: Thu, 17 Mar 2016 15:22:34 -0400 Subject: [PATCH 3/8] Adding style for rebilly api logo --- demo/index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/demo/index.html b/demo/index.html index c189d992..3c78ea56 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,6 +4,11 @@ ReDoc + - + + From 5decc3ceb5c729c38e34228dda790db9baa08b58 Mon Sep 17 00:00:00 2001 From: Cesar Date: Fri, 18 Mar 2016 09:06:22 -0400 Subject: [PATCH 4/8] merge with origin --- lib/components/JsonSchema/json-schema.html | 18 +++++++++++------- lib/components/JsonSchema/json-schema.js | 9 +++++++++ lib/components/JsonSchema/json-schema.scss | 20 ++++++++++++++------ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html index c22bc7e8..6d2d4e8a 100644 --- a/lib/components/JsonSchema/json-schema.html +++ b/lib/components/JsonSchema/json-schema.html @@ -20,7 +20,13 @@
-
This field value determines the exact schema:
+
+ This field value determines the exact schema: +
    +
  • {{derived.name}}
  • +
+
@@ -32,12 +38,10 @@ - - - - - - +
+ + +
diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index c5ef5430..31215928 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -21,6 +21,14 @@ export default class JsonSchema extends BaseComponent { this.final = false; } + selectDerived(subClass) { + if (subClass.active) return; + this.data.derived.forEach((subSchema) => { + subSchema.active = false; + }); + subClass.active = true; + } + prepareModel() { this.data = {}; this.data.properties = []; @@ -43,6 +51,7 @@ export default class JsonSchema extends BaseComponent { let normPtr = schema._pointer || this.pointer; let derived = this.schemaMgr.findDerivedDefinitions( normPtr ); if (!this.final && derived.length) { + derived[0].active = true; this.data.derived = derived; this.data.discriminator = schema.discriminator; } diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss index 18bd21cb..ff5350d5 100644 --- a/lib/components/JsonSchema/json-schema.scss +++ b/lib/components/JsonSchema/json-schema.scss @@ -12,6 +12,13 @@ $array-marker-line-height: 1.5; padding: 0 10px; } +.derived-schema { + display: none; +} +.derived-schema.active { + display: block; +} + json-schema.nested-schema { background-color: $side-menu-active-bg-color; padding: 10px 20px; @@ -114,15 +121,14 @@ json-schema.nested-schema { padding: 0; } -:host tabs { +ul { + text-align: left; + margin: 0; + padding: 0; display: block; } -:host ul { - text-align: center; -} - -:host tabs li { +li { margin: 0.2em 0.3em 0.2em 0; font-family: $headers-font, $headers-font-family; font-size: .929em; @@ -132,6 +138,8 @@ json-schema.nested-schema { padding: 2px 8px 4px 8px; border-radius: $border-radius; background-color: rgba($black, 0.3); + display: inline-block; + cursor: pointer; &:last-of-type { margin-right: 0; From 1af0d8e54e59a00fbc56e5bbfc2eb6fa0294bdf2 Mon Sep 17 00:00:00 2001 From: Cesar Date: Fri, 18 Mar 2016 09:10:29 -0400 Subject: [PATCH 5/8] Discriminator styling --- demo/index.html | 4 ++-- lib/components/JsonSchema/json-schema.scss | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/demo/index.html b/demo/index.html index 3c78ea56..4654082e 100644 --- a/demo/index.html +++ b/demo/index.html @@ -19,8 +19,8 @@ - - + + diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss index ff5350d5..44f4def8 100644 --- a/lib/components/JsonSchema/json-schema.scss +++ b/lib/components/JsonSchema/json-schema.scss @@ -114,6 +114,7 @@ json-schema.nested-schema { .discriminator-info { font-weight: $regular; + margin-bottom: 10px; } .discriminator-wrap > td { @@ -129,7 +130,7 @@ ul { } li { - margin: 0.2em 0.3em 0.2em 0; + margin: 0.5em 0.3em 0.2em 0; font-family: $headers-font, $headers-font-family; font-size: .929em; line-height: .929em; From 592e44e759f952c6dff57c0687c0b0769617a9ad Mon Sep 17 00:00:00 2001 From: Cesar Date: Tue, 22 Mar 2016 13:11:27 -0400 Subject: [PATCH 6/8] Remove rebilly api tag --- demo/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/demo/index.html b/demo/index.html index 4654082e..473d3ca2 100644 --- a/demo/index.html +++ b/demo/index.html @@ -20,7 +20,6 @@ - From cfcfb95e5899d19025ac35448ac4e222e4e8ee29 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Tue, 22 Mar 2016 19:26:36 +0200 Subject: [PATCH 7/8] Revert "Adding style for rebilly api logo" This reverts commit 5818f171f7a0283a2b0733a708bfb6f9643cfd5e. --- demo/index.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/demo/index.html b/demo/index.html index 473d3ca2..c189d992 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,11 +4,6 @@ ReDoc -