From 89ab965714710a4cfda2f6da2ba5be49dcdb07ef Mon Sep 17 00:00:00 2001 From: mathis-m Date: Fri, 24 Sep 2021 03:30:48 +0200 Subject: [PATCH 1/3] feat(react): allow displayRequestDuration via react --- flavors/swagger-ui-react/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flavors/swagger-ui-react/index.jsx b/flavors/swagger-ui-react/index.jsx index 10bb7f396a3..a4f040ed5b8 100644 --- a/flavors/swagger-ui-react/index.jsx +++ b/flavors/swagger-ui-react/index.jsx @@ -24,6 +24,7 @@ export default class SwaggerUI extends React.Component { defaultModelExpandDepth: this.props.defaultModelExpandDepth, displayOperationId: this.props.displayOperationId, tryItOutEnabled: this.props.tryItOutEnabled, + displayRequestDuration: this.props.displayRequestDuration, showMutatedRequest: typeof this.props.showMutatedRequest === "boolean" ? this.props.showMutatedRequest : true, deepLinking: typeof this.props.deepLinking === "boolean" ? this.props.deepLinking : false, }) @@ -102,7 +103,8 @@ SwaggerUI.propTypes = { defaultModelsExpandDepth: PropTypes.number, presets: PropTypes.arrayOf(PropTypes.func), deepLinking: PropTypes.bool, - tryItOutEnabled: PropTypes.bool + tryItOutEnabled: PropTypes.bool, + displayRequestDuration: PropTypes.bool, } SwaggerUI.defaultProps = { @@ -112,4 +114,5 @@ SwaggerUI.defaultProps = { defaultModelsExpandDepth: 1, presets: [], deepLinking: false, + displayRequestDuration: false, } From 49f8cb364f0a032af6ff813a154aee00bc941f08 Mon Sep 17 00:00:00 2001 From: mathis-m Date: Fri, 24 Sep 2021 03:31:43 +0200 Subject: [PATCH 2/3] docs(react): added displayRequestDuration prop --- flavors/swagger-ui-react/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index a3df264b4ee..702cd35cee8 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -119,6 +119,12 @@ Controls whether the "Try it out" section should start enabled. The default is f ⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. +#### `displayRequestDuration`: PropTypes.bool + +Controls whether to display the duration of the request. The default is false. + +⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. + ## Limitations * Not all configuration bindings are available. From 0216d0ed1090773f2eaffa95a069d62717dcc839 Mon Sep 17 00:00:00 2001 From: Vladimir Gorej Date: Mon, 27 Sep 2021 10:07:46 +0300 Subject: [PATCH 3/3] Update flavors/swagger-ui-react/README.md --- flavors/swagger-ui-react/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index 702cd35cee8..f5f59ec77c0 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -121,7 +121,7 @@ Controls whether the "Try it out" section should start enabled. The default is f #### `displayRequestDuration`: PropTypes.bool -Controls whether to display the duration of the request. The default is false. +Controls the display of the request duration (in milliseconds) for "Try it out" requests. The default is false. ⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.