+ { operation && operation.size ? null :
+
})
+ }
{ deprecated &&
Warning: Deprecated
}
{ description &&
@@ -176,23 +180,25 @@ export default class Operation extends PureComponent {
: null
}
-
+ fn={fn}
+ getComponent={ getComponent }
+ specActions={ specActions }
+ specSelectors={ specSelectors }
+ pathMethod={ [path, method] }
+ getConfigs={ getConfigs }
+ />
+ }
{ !tryItOutEnabled ? null :
({specActions, specSelectors, errActio
})
}
-export const requestResolvedSubtree = path => system => {
- const {
- errActions,
- fn: {
- resolveSubtree,
- AST: { getLineNumberForPath }
- },
- specSelectors,
- specActions,
- } = system
+let requestBatch = []
- const specStr = specSelectors.specStr()
+const debResolveSubtrees = debounce(async () => {
+ const system = requestBatch.system // Just a reference to the "latest" system
+
+ if(!system) {
+ console.error("debResolveSubtrees: don't have a system to operate on, aborting.")
+ return
+ }
+ const {
+ errActions,
+ errSelectors,
+ fn: {
+ resolveSubtree,
+ AST: { getLineNumberForPath }
+ },
+ specSelectors,
+ specActions,
+ } = system
if(!resolveSubtree) {
console.error("Error: Swagger-Client did not provide a `resolveSubtree` method, doing nothing.")
return
}
- const currentValue = specSelectors.specResolvedSubtree(path)
+ const specStr = specSelectors.specStr()
- if(currentValue) {
- return
- }
+ try {
+ var batchResult = await requestBatch.reduce(async (prev, path) => {
+ const { resultMap, specWithCurrentSubtrees } = await prev
+
+ const { errors, spec } = await resolveSubtree(specWithCurrentSubtrees, path)
+
+ if(errSelectors.allErrors().size) {
+ errActions.clear({
+ type: "thrown"
+ })
+ }
- return resolveSubtree(specSelectors.specJson().toJS(), path)
- .then(({ spec, errors }) => {
- errActions.clear({
- type: "thrown"
- })
if(Array.isArray(errors) && errors.length > 0) {
let preparedErrors = errors
.map(err => {
- console.error(err)
err.line = err.fullPath ? getLineNumberForPath(specStr, err.fullPath) : null
err.path = err.fullPath ? err.fullPath.join(".") : null
err.level = "error"
@@ -177,9 +188,31 @@ export const requestResolvedSubtree = path => system => {
errActions.newThrownErrBatch(preparedErrors)
}
- return specActions.updateResolvedSubtree(path, spec)
- })
- .catch(e => console.error(e))
+ set(resultMap, path, spec)
+ set(specWithCurrentSubtrees, path, spec)
+
+ return {
+ resultMap,
+ specWithCurrentSubtrees
+ }
+ }, Promise.resolve({
+ resultMap: (specSelectors.specResolvedSubtree([]) || Map()).toJS(),
+ specWithCurrentSubtrees: specSelectors.specJson().toJS()
+ }))
+
+ delete requestBatch.system
+ requestBatch = [] // Clear stack
+ } catch(e) {
+ console.error(e)
+ }
+
+ specActions.updateResolvedSubtree([], batchResult.resultMap)
+}, 35)
+
+export const requestResolvedSubtree = path => system => {
+ requestBatch.push(path)
+ requestBatch.system = system
+ debResolveSubtrees()
}
export function changeParam( path, paramName, paramIn, value, isXml ){
diff --git a/src/img/rolling-load.svg b/src/img/rolling-load.svg
new file mode 100644
index 00000000..86ead2e4
--- /dev/null
+++ b/src/img/rolling-load.svg
@@ -0,0 +1 @@
+
diff --git a/src/style/_layout.scss b/src/style/_layout.scss
index 7bb218dc..4a117e5a 100644
--- a/src/style/_layout.scss
+++ b/src/style/_layout.scss
@@ -586,6 +586,16 @@
}
}
+.opblock-body
+{
+ .opblock-loading-animation
+ {
+ display: block;
+ margin: 3em;
+ margin-left: auto;
+ margin-right: auto;
+ }
+}
.opblock-body pre
{