operationsSorter config
This commit is contained in:
24
dist/swagger-ui-bundle.js
vendored
24
dist/swagger-ui-bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui-bundle.js.map
vendored
2
dist/swagger-ui-bundle.js.map
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;AAkoJA;AAyiCA;;;;;AAskCA;AA66IA;AA20FA;AAg3GA;AAonEA;AA+9CA;AA6/CA;AA+rCA;AA+3EA;AA68HA;;;;;;;;;;;;;;AA8tGA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAw6BA;;;;;;AAs0EA;AA24FA;;;;;AAy3CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AAwwEA;AA48FA;;;;;;;;;AA81BA;AA2zIA;AAi4DA;AAqlDA;;;;;;AA4kCA;AA8iHA;AAipGA","sourceRoot":""}
|
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;AAkoJA;AAyiCA;;;;;AAskCA;AA+4IA;AAs1FA;AAk3GA;AAsoEA;AAi+CA;AA+/CA;AA+rCA;AAm4EA;AAi7HA;;;;;;;;;;;;;;AA0vGA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AA+2EA;AAm6GA;;;;;;AA4yEA;AA24FA;;;;;AAy3CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AAwwEA;AA48FA;;;;;;;;;AA81BA;AA2zIA;AAi4DA;AAqlDA;;;;;;AA4kCA;AA8iHA;AAipGA","sourceRoot":""}
|
||||||
14
dist/swagger-ui.js
vendored
14
dist/swagger-ui.js
vendored
File diff suppressed because one or more lines are too long
2
dist/swagger-ui.js.map
vendored
2
dist/swagger-ui.js.map
vendored
@@ -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;AAmxHA;AAy4FA;AA4rCA;AAugCA;AA4hCA;AAg5BA","sourceRoot":""}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createSelector } from "reselect"
|
import { createSelector } from "reselect"
|
||||||
|
import { sorters } from "core/utils"
|
||||||
import { fromJS, Set, Map, List } from "immutable"
|
import { fromJS, Set, Map, List } from "immutable"
|
||||||
|
|
||||||
const DEFAULT_TAG = "default"
|
const DEFAULT_TAG = "default"
|
||||||
@@ -198,13 +199,16 @@ export const operationsWithTags = createSelector(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export const taggedOperations = createSelector(
|
export const taggedOperations = ( state ) =>( { getConfigs } ) => {
|
||||||
state,
|
let { operationsSorter }= getConfigs()
|
||||||
operationsWithTags,
|
|
||||||
(state, tagMap) => {
|
return operationsWithTags(state).map((ops, tag) => {
|
||||||
return tagMap.map((ops, tag) => Map({tagDetails: tagDetails(state, tag), operations: ops}))
|
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(
|
export const responses = createSelector(
|
||||||
state,
|
state,
|
||||||
|
|||||||
@@ -559,3 +559,10 @@ export const btoa = (str) => {
|
|||||||
|
|
||||||
return buffer.toString("base64")
|
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"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user