operationsSorter config

This commit is contained in:
Anna Bodnia
2017-04-18 19:06:15 +03:00
parent 4b984e3c42
commit 8e64c866e8
6 changed files with 40 additions and 29 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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

File diff suppressed because one or more lines are too long

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;AAmxHA;AAy4FA;AA4rCA;AAugCA;AA4hCA;AAg5BA","sourceRoot":""}

View File

@@ -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,
@@ -294,7 +298,7 @@ export const operationScheme = ( state, path, method ) => {
let url = state.get("url") let url = state.get("url")
let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/) let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/)
let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || "http" return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || "http"
} }

View File

@@ -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"))
}
}