fix(ui): Fix broken styling for swagger-ui.
MODIFY
manager/ui/war/plugins/api-manager/css/apiman.css
manager/ui/war/plugins/api-manager/css/apiman.css
+.swagger-ui .info pre
+{
+ padding: 0;
+ color: #fff;
+ background-color: transparent;
+ border: 0;
+ /*all: unset;*/
+}
body {
line-height: normal;
@@ -1435,44 +1443,6 @@ textarea.apiman-endpoint {
width: auto;
}
-#apiman-swagger.swagger-section .swagger-ui-wrap {
- max-width: none;
- margin-left: 0px;
- margin-right: 0px;
-}
-#apiman-swagger.swagger-section .swagger-ui-wrap a {
- cursor: pointer;
-}
-#apiman-swagger.swagger-section #resources_container {
- padding: 0px;
- margin: 0px;
- width: auto;
-}
-#apiman-swagger.swagger-section #resources_container #resources {
- padding: 0px;
- margin: 0px;
-}
-#apiman-swagger.swagger-section #resources_container #resources .resource h2 {
- margin: 0px;
-}
-#apiman-swagger.swagger-section #resources_container #resources ul.endpoints {
- padding: 0px;
- margin: 0px;
-}
-#apiman-swagger.swagger-section .swagger-ui-wrap table tbody tr td {
- font-size: inherit;
-}
-#apiman-swagger.swagger-section .swagger-ui-wrap table thead tr th {
- font-size: inherit;
-}
-#apiman-swagger.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4 {
- padding: 0px;
- margin: 0px;
-}
-#apiman-swagger.swagger-section .swagger-ui-wrap p {
- padding: 0px;
-}
-
.apiman-chart-title {
text-align: center;
text-decoration: underline;

MODIFY
manager/ui/war/plugins/api-manager/ts/catalog/api-catalog.ts
manager/ui/war/plugins/api-manager/ts/catalog/api-catalog.ts
@@ -264,23 +264,18 @@ module Apiman {
if (request.url === definitionUrl) {
request.headers.Authorization = Configuration.getAuthorizationHeader();
}
+ return request;
},
onComplete: function() {
- // $('#swagger-ui-container a').each(function (idx, elem) {
- // var href = $(elem).attr('href');
- // if (href[0] == '#') {
- // $(elem).removeAttr('href');
- // }
- // });
- // $('#swagger-ui-container div.sandbox_header').each(function (idx, elem) {
- // $(elem).remove();
- // });
- // $('#swagger-ui-container li.operation div.auth').each(function (idx, elem) {
- // $(elem).remove();
- // });
- // $('#swagger-ui-container li.operation div.access').each(function (idx, elem) {
- // $(elem).remove();
- // });
+ // Base URL doesn't make sense as we're calling through a gateway.
+ $('#swagger-ui-container .base-url').remove();
+
+ // Server URL (if baked into spec).
+ $('#swagger-ui-container div.global-server-container').remove();
+
+ // Link to spec in backend (won't work without auth).
+ $('#swagger-ui-container .info .main a').remove();
+
$scope.$apply(function(error) {
$scope.definitionStatus = 'complete';
});
@@ -291,7 +286,18 @@ module Apiman {
$scope.hasError = true;
$scope.error = error;
});
+ },
+ plugins: [
+ {
+ statePlugins: {
+ spec: {
+ wrapSelectors: {
+ allowTryItOutFor: () => () => false
+ }
+ }
+ }
}
+ ]
};
// Initialise Swagger UI

MODIFY
manager/ui/war/plugins/api-manager/ts/consumer/consumer-api.ts
manager/ui/war/plugins/api-manager/ts/consumer/consumer-api.ts
@@ -155,24 +155,18 @@ module Apiman {
if (request.url === url) {
request.headers.Authorization = Configuration.getAuthorizationHeader();
}
+ return request;
},
onComplete: function() {
- Logger.debug("complete");
- // $('#swagger-ui-container a').each(function(idx, elem) {
- // var href = $(elem).attr('href');
- // if (href[0] == '#') {
- // $(elem).removeAttr('href');
- // }
- // });
- // $('#swagger-ui-container div.sandbox_header').each(function(idx, elem) {
- // $(elem).remove();
- // });
- // $('#swagger-ui-container li.operation div.auth').each(function(idx, elem) {
- // $(elem).remove();
- // });
- // $('#swagger-ui-container li.operation div.access').each(function(idx, elem) {
- // $(elem).remove();
- // });
+ // Base URL doesn't make sense as we're calling through a gateway.
+ $('#swagger-ui-container .base-url').remove();
+
+ // Server URL (if baked into spec).
+ $('#swagger-ui-container div.global-server-container').remove();
+
+ // Link to spec in backend (won't work without auth).
+ $('#swagger-ui-container .info .main a').remove();
+
$scope.$apply(function(error) {
$scope.definitionStatus = 'complete';
});
@@ -183,7 +177,18 @@ module Apiman {
$scope.hasError = true;
$scope.error = error;
});
+ },
+ plugins: [
+ { // Thanks: https://github.com/swagger-api/swagger-ui/issues/3725#issuecomment-334899276
+ statePlugins: {
+ spec: {
+ wrapSelectors: {
+ allowTryItOutFor: () => () => false
+ }
+ }
+ }
}
+ ]
};
// Initialise Swagger UI

fix(ui): Fix broken styling for swagger-ui.

APIMAN-1302

Signed-off-by: Marc Savy <marc@rhymewithgravy.com>