Jack Lloyd-Walters has proposed merging ~lloydwaltersj/maas:fix-offline-oapi-docs into maas:master.
Commit message: Make openapi docs work offline Requested reviews: MAAS Maintainers (maas-maintainers) For more details, see: https://code.launchpad.net/~lloydwaltersj/maas/+git/maas/+merge/434713 `Make doc` now fetches the required css and js dependencies for OpenAPI docs. -- Your team MAAS Maintainers is requested to review the proposed merge of ~lloydwaltersj/maas:fix-offline-oapi-docs into maas:master.
diff --git a/Makefile b/Makefile index fbc57fc..3baa9ef 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,11 @@ UI_BUILD := src/maasui/build OFFLINE_DOCS := src/maas-offline-docs/src +swagger-js: file := src/maasserver/templates/dist/swagger-ui-bundle.js +swagger-js: url := "https://unpkg.com/swagger-ui-dist@latest/swagger-ui-bundle.js" +swagger-css: file := src/maasserver/templates/dist/swagger-ui.css +swagger-css: url := "https://unpkg.com/swagger-ui-dist@latest/swagger-ui.css" + build: \ .run \ $(VENV) \ @@ -111,6 +116,14 @@ $(UI_BUILD): $(OFFLINE_DOCS): $(MAKE) -C src/maas-offline-docs +swagger-js: + test -f $@ || wget -O $(file) $(url) +.PHONY: swagger-js + +swagger-css: + test -f $@ || wget -O $(file) $(url) +.PHONY: swagger-css + go-bins: $(MAKE) -j -C src/host-info build .PHONY: go-bins @@ -222,7 +235,7 @@ api-docs.rst: bin/maas-region src/maasserver/api/doc_handler.py syncdb openapi.yaml: bin/maas-region src/maasserver/api/doc_handler.py syncdb bin/maas-region generate_oapi_spec > $@ -doc: api-docs.rst openapi.yaml +doc: api-docs.rst openapi.yaml swagger-css swagger-js .PHONY: doc .run: run-skel diff --git a/src/maasserver/templates/openapi.html b/src/maasserver/templates/openapi.html index 41c492b..4b75523 100644 --- a/src/maasserver/templates/openapi.html +++ b/src/maasserver/templates/openapi.html @@ -4,8 +4,10 @@ <head> <meta charset="UTF-8"> <title>MAAS API</title> - <link href="https://maas.io/static/css/main.css" rel="stylesheet"> - <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@latest/swagger-ui.css" /> + <link href="/MAAS/r/static/css/main.a4c6517c.css" rel="stylesheet"> + <style> + {% include "dist/swagger-ui.css" %} + </style> <style> html * { font-family: ubuntu !important; @@ -50,7 +52,9 @@ </div> </header> <div id="swagger-ui" style="max-width: 72rem; margin: auto;"></div> - <script src="https://unpkg.com/swagger-ui-dist@latest/swagger-ui-bundle.js" crossorigin></script> + <script> + {% include "dist/swagger-ui-bundle.js" %} + </script> <script> window.onload = function() { window.ui = SwaggerUIBundle({
-- Mailing list: https://launchpad.net/~sts-sponsors Post to : [email protected] Unsubscribe : https://launchpad.net/~sts-sponsors More help : https://help.launchpad.net/ListHelp

