mirror of
https://github.com/ansible/awx.git
synced 2026-10-31 06:26:15 -02:30
Create AWX docsite with RST content (#14328)
Co-authored-by: Thanhnguyet Vo <tvo@ansible.com> Co-authored-by: TVo <thavo@redhat.com>
This commit is contained in:
co-authored by
Thanhnguyet Vo
TVo
parent
ab3ceaecad
commit
dc81aa46d0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":"","file":"swagger-ui.css","sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,50 @@
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
|
||||
import jinja2
|
||||
import pkg_resources
|
||||
import yaml
|
||||
|
||||
from sphinx.util.osutil import copyfile, ensuredir
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
with io.open(os.path.join(here, 'swagger.json'), 'r', encoding='utf-8') as f:
|
||||
spec = json.load(f)
|
||||
with io.open(os.path.join(here, 'tags.yml'), 'r', encoding='utf-8') as f:
|
||||
tags = yaml.load(f.read(), Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
def add_spec(app, pagename, templatename, context, doctree):
|
||||
if pagename == 'rest_api/api_ref':
|
||||
# Write tags in the order we want them sorted
|
||||
for category in tags.get('categories', []):
|
||||
tag = {'name': category['name']}
|
||||
if 'description' in category:
|
||||
tag['description'] = category['description']
|
||||
spec.setdefault('tags', []).append(tag)
|
||||
|
||||
context['body'] = context['body'].replace('{{SPEC}}', json.dumps(spec))
|
||||
|
||||
|
||||
def assets(app, exception):
|
||||
for asset in os.listdir(here):
|
||||
if asset == '__pycache__':
|
||||
continue
|
||||
|
||||
_, extension = os.path.splitext(asset)
|
||||
if extension in ('py', 'pyc'):
|
||||
continue
|
||||
if not exception and os.path.exists(
|
||||
os.path.join(app.outdir, '_static')
|
||||
):
|
||||
copyfile(
|
||||
os.path.join(here, asset),
|
||||
os.path.join(app.outdir, '_static', asset))
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_config_value('swagger', [], 'html')
|
||||
app.connect('html-page-context', add_spec)
|
||||
app.connect('build-finished', assets)
|
||||
return {'version': 1.0, 'parallel_read_safe': True}
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
# Add categories here for generated Swagger docs; order will be respected
|
||||
# in the generated document.
|
||||
categories:
|
||||
- name: Versioning
|
||||
- name: Authentication
|
||||
- name: Instances
|
||||
- name: Instance Groups
|
||||
- name: System Configuration
|
||||
- name: Settings
|
||||
- name: Dashboard
|
||||
- name: Organizations
|
||||
- name: Users
|
||||
- name: Projects
|
||||
- name: Project Updates
|
||||
- name: Teams
|
||||
- name: Credentials
|
||||
- name: Credential Types
|
||||
- name: Inventories
|
||||
- name: Custom Inventory Scripts
|
||||
- name: Inventory Sources
|
||||
- name: Inventory Updates
|
||||
- name: Groups
|
||||
- name: Hosts
|
||||
- name: Job Templates
|
||||
- name: Jobs
|
||||
- name: Job Events
|
||||
- name: Job Host Summaries
|
||||
- name: Ad Hoc Commands
|
||||
- name: Ad Hoc Command Events
|
||||
- name: System Job Templates
|
||||
- name: System Jobs
|
||||
- name: Schedules
|
||||
- name: Roles
|
||||
- name: Notification Templates
|
||||
- name: Notifications
|
||||
- name: Labels
|
||||
- name: Unified Job Templates
|
||||
- name: Unified Jobs
|
||||
- name: Activity Streams
|
||||
- name: Workflow Job Templates
|
||||
- name: Workflow Jobs
|
||||
- name: Workflow Job Template Nodes
|
||||
- name: Workflow Job Nodes
|
||||
@@ -0,0 +1,97 @@
|
||||
.swagger-ui {
|
||||
--blue: #337ab7;
|
||||
--green: #5cb85c;
|
||||
--red: #d9534f;
|
||||
--orange: #f0ad4e;
|
||||
--gray-b7: #b7b7b7;
|
||||
--gray-f6: #f6f6f6;
|
||||
}
|
||||
|
||||
.swagger-ui .topbar,
|
||||
.swagger-ui .information-container hgroup,
|
||||
.swagger-ui .topbar .download-url-wrapper,
|
||||
.swagger-ui .scheme-container,
|
||||
.swagger-ui .auth-wrapper .btn,
|
||||
.swagger-ui .opblock-tag .expand-operation,
|
||||
.swagger-ui .opblock-body .try-out,
|
||||
.swagger-ui .opblock-body ul.tab,
|
||||
.swagger-ui .topbar-wrapper a.link span {
|
||||
display: none !important;
|
||||
}
|
||||
.swagger-ui .opblock-tag {
|
||||
display: block;
|
||||
cursor: default;
|
||||
}
|
||||
.swagger-ui .opblock-tag:hover {
|
||||
background: transparent;
|
||||
}
|
||||
.swagger-ui .opblock-tag .markdown p {
|
||||
font-size: 16px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.swagger-ui .opblock-body .markdown pre {
|
||||
margin: 20px 0;
|
||||
}
|
||||
.swagger-ui .topbar-wrapper img {
|
||||
content:'';
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.swagger-ui .opblock-tag a:hover::after {
|
||||
content: '¶';
|
||||
color: #2980B9;
|
||||
font-size: 16px;
|
||||
padding-left: 5px;
|
||||
position: relative;
|
||||
top: -3px;
|
||||
}
|
||||
.swagger-ui .opblock-body pre code {
|
||||
font-size: 100%;
|
||||
color: #FFF;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-get {
|
||||
border-color: var(--blue);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-get .opblock-summary-method {
|
||||
background: var(--blue);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-post {
|
||||
border-color: var(--green);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-post .opblock-summary-method {
|
||||
background: var(--green);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-delete {
|
||||
border-color: var(--red);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-delete .opblock-summary-method {
|
||||
background-color: var(--red);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-put {
|
||||
border-color: var(--orange);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-put .opblock-summary-method {
|
||||
background-color: var(--orange);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-patch {
|
||||
background-color: var(--gray-f6);
|
||||
border-color: var(--gray-b7);
|
||||
}
|
||||
|
||||
.swagger-ui .opblock.opblock-patch .opblock-summary-method {
|
||||
background-color: var(--gray-b7);
|
||||
}
|
||||
Reference in New Issue
Block a user