Browse Source

Merge pull request #2924 from bodnia/config-operationsSorter

operationsSorter config
bubble
Anna 7 years ago
committed by GitHub
parent
commit
7790383ba6
7 changed files with 68 additions and 57 deletions
  1. +39
    -39
      dist/swagger-ui-bundle.js
  2. +1
    -1
      dist/swagger-ui-bundle.js.map
  3. +1
    -1
      dist/swagger-ui.css
  4. +8
    -8
      dist/swagger-ui.js
  5. +1
    -1
      dist/swagger-ui.js.map
  6. +11
    -7
      src/core/plugins/spec/selectors.js
  7. +7
    -0
      src/core/utils.js

+ 39
- 39
dist/swagger-ui-bundle.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/swagger-ui-bundle.js.map View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA66IA;AA47FA;AAyrGA;AA8hFA;AA6rFA;AAm9CA;AA4hDA;AA0rCA;AA47EA;AA+yHA;;;;;;;;;;;;;;AAmvIA;AA4mIA;AAquJA;AAwsHA;AAinGA;AAmiEA;AAy4DA;AAm2DA;AAytBA;;;;;;AA68EA;AAm0FA;;;;;AA23CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AA6kFA;AA81FA;;;;;;;;;AAo4CA;AA2zIA;AAi4DA;AAqlDA","sourceRoot":""}
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA+4IA;AAs1FA;AAk3GA;AAwmFA;AAkkFA;AAq9CA;AA2jDA;AA0qCA;AA48EA;AAi3HA;;;;;;;;;;;;;;AA85HA;AAyoIA;AAiuJA;AA8kHA;AA8mGA;AAokEA;AAi3DA;AA4xDA;AAi3BA;;;;;;AAqzEA;AAm0FA;;;;;AA23CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AAwwEA;AA48FA;;;;;;;;;AA81BA;AA2zIA;AAi4DA;AAqlDA","sourceRoot":""}

+ 1
- 1
dist/swagger-ui.css
File diff suppressed because it is too large
View File


+ 8
- 8
dist/swagger-ui.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/swagger-ui.js.map View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAuwCA;AAoyHA;AAmxHA;AAo8FA;AAooCA;AAghCA;AA0gCA;AA06BA","sourceRoot":""}
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AA4wCA;AAoyHA;AAuxHA;AAy4FA;AA4rCA;AAugCA;AA4hCA;AAg5BA","sourceRoot":""}

+ 11
- 7
src/core/plugins/spec/selectors.js View File

@@ -1,4 +1,5 @@
import { createSelector } from "reselect"
import { sorters } from "core/utils"
import { fromJS, Set, Map, List } from "immutable"

const DEFAULT_TAG = "default"
@@ -198,13 +199,16 @@ export const operationsWithTags = createSelector(
}
)

export const taggedOperations = createSelector(
state,
operationsWithTags,
(state, tagMap) => {
return tagMap.map((ops, tag) => Map({tagDetails: tagDetails(state, tag), operations: ops}))
}
)
export const taggedOperations = ( state ) =>( { getConfigs } ) => {
let { operationsSorter }= getConfigs()

return operationsWithTags(state).map((ops, tag) => {
let sortFn = typeof operationsSorter === "function" ? operationsSorter
: sorters.operationsSorter[operationsSorter]
let operations = !sortFn ? ops : ops.sort(sortFn)

return Map({tagDetails: tagDetails(state, tag), operations: operations})})
}

export const responses = createSelector(
state,


+ 7
- 0
src/core/utils.js View File

@@ -559,3 +559,10 @@ export const btoa = (str) => {

return buffer.toString("base64")
}

export const sorters = {
operationsSorter: {
alpha: (a, b) => a.get("path").localeCompare(b.get("path")),
method: (a, b) => a.get("method").localeCompare(b.get("method"))
}
}

Loading…
Cancel
Save