Merge "Improve resource types list rendering"
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from functools import cmp_to_key
|
from functools import cmp_to_key
|
||||||
|
import json
|
||||||
import pydoc
|
import pydoc
|
||||||
|
|
||||||
from docutils import core
|
from docutils import core
|
||||||
@@ -130,8 +131,17 @@ class ResourcePages(rst.Directive):
|
|||||||
'status_msg': sstatus['message']}
|
'status_msg': sstatus['message']}
|
||||||
if not (sstatus['status'] == support.SUPPORTED and
|
if not (sstatus['status'] == support.SUPPORTED and
|
||||||
sstatus['version'] is None):
|
sstatus['version'] is None):
|
||||||
para = nodes.paragraph('', msg)
|
para = nodes.inline('', msg)
|
||||||
note = nodes.note('', para)
|
para['classes'] = ['versionmodified']
|
||||||
|
parent_para = nodes.paragraph()
|
||||||
|
parent_para['classes'] = ['versionsupport']
|
||||||
|
parent_para.append(para)
|
||||||
|
note = nodes.topic()
|
||||||
|
if sstatus['status'] == support.SUPPORTED:
|
||||||
|
note['classes'] = ['versionadded']
|
||||||
|
else:
|
||||||
|
note['classes'] = ['deprecated']
|
||||||
|
note.append(parent_para)
|
||||||
section.append(note)
|
section.append(note)
|
||||||
support_status = support_status.previous_status
|
support_status = support_status.previous_status
|
||||||
|
|
||||||
@@ -143,6 +153,23 @@ class ResourcePages(rst.Directive):
|
|||||||
section.append(title)
|
section.append(title)
|
||||||
return section
|
return section
|
||||||
|
|
||||||
|
def _prop_section(self, parent, title, id_pattern):
|
||||||
|
id = id_pattern % self.resource_type
|
||||||
|
section = nodes.section(ids=[id])
|
||||||
|
parent.append(section)
|
||||||
|
|
||||||
|
# Ignore title generated for list items
|
||||||
|
if title != '*':
|
||||||
|
title = nodes.term('', title)
|
||||||
|
ref = nodes.reference('', u'\xb6')
|
||||||
|
ref['classes'] = ['headerlink']
|
||||||
|
ref['refid'] = id
|
||||||
|
title.append(ref)
|
||||||
|
section.append(title)
|
||||||
|
field = nodes.definition()
|
||||||
|
section.append(field)
|
||||||
|
return field
|
||||||
|
|
||||||
def _prop_syntax_example(self, prop):
|
def _prop_syntax_example(self, prop):
|
||||||
if not prop:
|
if not prop:
|
||||||
return 'Value'
|
return 'Value'
|
||||||
@@ -209,78 +236,80 @@ resources:
|
|||||||
id_pattern_prefix = '%s-prop'
|
id_pattern_prefix = '%s-prop'
|
||||||
id_pattern = id_pattern_prefix + '-' + prop_key
|
id_pattern = id_pattern_prefix + '-' + prop_key
|
||||||
|
|
||||||
definition = self._section(parent, prop_key, id_pattern)
|
definition = self._prop_section(parent, prop_key, id_pattern)
|
||||||
|
|
||||||
self._status_str(prop.support_status, definition)
|
self._status_str(prop.support_status, definition)
|
||||||
|
|
||||||
if not prop.implemented:
|
if not prop.implemented:
|
||||||
para = nodes.paragraph('', _('Not implemented.'))
|
para = nodes.line('', _('Not implemented.'))
|
||||||
note = nodes.note('', para)
|
note = nodes.note('', para)
|
||||||
definition.append(note)
|
definition.append(note)
|
||||||
return
|
return
|
||||||
|
|
||||||
if sub_prop and prop.type != properties.Schema.LIST and prop.type\
|
if sub_prop and prop.type not in (properties.Schema.LIST,
|
||||||
!= properties.Schema.MAP:
|
properties.Schema.MAP):
|
||||||
if prop.required:
|
if prop.required:
|
||||||
para = nodes.paragraph('', _('Required.'))
|
para = nodes.line('', _('Required.'))
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
else:
|
else:
|
||||||
para = nodes.paragraph('', _('Optional.'))
|
para = nodes.line('', _('Optional.'))
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
|
|
||||||
if prop.description:
|
if prop.description:
|
||||||
para = nodes.paragraph('', prop.description)
|
para = nodes.line('', prop.description)
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
|
|
||||||
type = nodes.paragraph('', _('%s value expected.') % prop.type)
|
type = nodes.line('', _('%s value expected.') % prop.type)
|
||||||
definition.append(type)
|
definition.append(type)
|
||||||
|
|
||||||
if upd_para is not None:
|
if upd_para is not None:
|
||||||
definition.append(upd_para)
|
definition.append(upd_para)
|
||||||
else:
|
else:
|
||||||
if prop.update_allowed:
|
if prop.update_allowed:
|
||||||
upd_para = nodes.paragraph(
|
upd_para = nodes.line(
|
||||||
'', _('Can be updated without replacement.'))
|
'', _('Can be updated without replacement.'))
|
||||||
definition.append(upd_para)
|
definition.append(upd_para)
|
||||||
elif prop.immutable:
|
elif prop.immutable:
|
||||||
upd_para = nodes.paragraph('', _('Updates are not supported. '
|
upd_para = nodes.line('', _('Updates are not supported. '
|
||||||
'Resource update will fail on '
|
'Resource update will fail on '
|
||||||
'any attempt to update this '
|
'any attempt to update this '
|
||||||
'property.'))
|
'property.'))
|
||||||
definition.append(upd_para)
|
definition.append(upd_para)
|
||||||
else:
|
else:
|
||||||
upd_para = nodes.paragraph('', _('Updates cause replacement.'))
|
upd_para = nodes.line('', _('Updates cause replacement.'))
|
||||||
definition.append(upd_para)
|
definition.append(upd_para)
|
||||||
|
|
||||||
if prop.default is not None:
|
if prop.default is not None:
|
||||||
para = nodes.paragraph('', _('Defaults to "%s".') % prop.default)
|
para = nodes.line('', _('Defaults to '))
|
||||||
|
default = nodes.literal('', json.dumps(prop.default))
|
||||||
|
para.append(default)
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
|
|
||||||
for constraint in prop.constraints:
|
for constraint in prop.constraints:
|
||||||
para = nodes.paragraph('', str(constraint))
|
para = nodes.line('', str(constraint))
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
|
|
||||||
sub_schema = None
|
sub_schema = None
|
||||||
if prop.schema and prop.type == properties.Schema.MAP:
|
if prop.schema and prop.type == properties.Schema.MAP:
|
||||||
para = nodes.paragraph()
|
para = nodes.line()
|
||||||
emph = nodes.emphasis('', _('Map properties:'))
|
emph = nodes.emphasis('', _('Map properties:'))
|
||||||
para.append(emph)
|
para.append(emph)
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
sub_schema = prop.schema
|
sub_schema = prop.schema
|
||||||
|
|
||||||
elif prop.schema and prop.type == properties.Schema.LIST:
|
elif prop.schema and prop.type == properties.Schema.LIST:
|
||||||
para = nodes.paragraph()
|
para = nodes.line()
|
||||||
emph = nodes.emphasis('', _('List contents:'))
|
emph = nodes.emphasis('', _('List contents:'))
|
||||||
para.append(emph)
|
para.append(emph)
|
||||||
definition.append(para)
|
definition.append(para)
|
||||||
sub_schema = prop.schema
|
sub_schema = prop.schema
|
||||||
|
|
||||||
if sub_schema:
|
if sub_schema:
|
||||||
|
indent = nodes.definition_list()
|
||||||
|
definition.append(indent)
|
||||||
for _key, _prop in sorted(sub_schema.items(),
|
for _key, _prop in sorted(sub_schema.items(),
|
||||||
key=cmp_to_key(self.cmp_prop)):
|
key=cmp_to_key(self.cmp_prop)):
|
||||||
if _prop.support_status.status != support.HIDDEN:
|
if _prop.support_status.status != support.HIDDEN:
|
||||||
indent = nodes.block_quote()
|
|
||||||
definition.append(indent)
|
|
||||||
self.contribute_property(
|
self.contribute_property(
|
||||||
indent, _key, _prop, upd_para, id_pattern,
|
indent, _key, _prop, upd_para, id_pattern,
|
||||||
sub_prop=True)
|
sub_prop=True)
|
||||||
@@ -297,20 +326,24 @@ resources:
|
|||||||
if required_props:
|
if required_props:
|
||||||
section = self._section(
|
section = self._section(
|
||||||
parent, _('Required Properties'), '%s-props-req')
|
parent, _('Required Properties'), '%s-props-req')
|
||||||
|
definition_list = nodes.definition_list()
|
||||||
|
section.append(definition_list)
|
||||||
|
|
||||||
for prop_key, prop in sorted(required_props.items(),
|
for prop_key, prop in sorted(required_props.items(),
|
||||||
key=cmp_to_key(self.cmp_prop)):
|
key=cmp_to_key(self.cmp_prop)):
|
||||||
self.contribute_property(section, prop_key, prop)
|
self.contribute_property(definition_list, prop_key, prop)
|
||||||
|
|
||||||
optional_props = dict((k, v) for k, v in props.items()
|
optional_props = dict((k, v) for k, v in props.items()
|
||||||
if not v.required)
|
if not v.required)
|
||||||
if optional_props:
|
if optional_props:
|
||||||
section = self._section(
|
section = self._section(
|
||||||
parent, _('Optional Properties'), '%s-props-opt')
|
parent, _('Optional Properties'), '%s-props-opt')
|
||||||
|
definition_list = nodes.definition_list()
|
||||||
|
section.append(definition_list)
|
||||||
|
|
||||||
for prop_key, prop in sorted(optional_props.items(),
|
for prop_key, prop in sorted(optional_props.items(),
|
||||||
key=cmp_to_key(self.cmp_prop)):
|
key=cmp_to_key(self.cmp_prop)):
|
||||||
self.contribute_property(section, prop_key, prop)
|
self.contribute_property(definition_list, prop_key, prop)
|
||||||
|
|
||||||
def contribute_attributes(self, parent):
|
def contribute_attributes(self, parent):
|
||||||
if not self.attrs_schemata:
|
if not self.attrs_schemata:
|
||||||
@@ -319,7 +352,7 @@ resources:
|
|||||||
for prop_key, prop in sorted(self.attrs_schemata.items()):
|
for prop_key, prop in sorted(self.attrs_schemata.items()):
|
||||||
if prop.support_status.status != support.HIDDEN:
|
if prop.support_status.status != support.HIDDEN:
|
||||||
description = prop.description
|
description = prop.description
|
||||||
attr_section = self._section(
|
attr_section = self._prop_section(
|
||||||
section, prop_key, '%s-attr-' + prop_key)
|
section, prop_key, '%s-attr-' + prop_key)
|
||||||
|
|
||||||
self._status_str(prop.support_status, attr_section)
|
self._status_str(prop.support_status, attr_section)
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
License for the specific language governing permissions and limitations
|
License for the specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
|
|
||||||
|
:tocdepth: 2
|
||||||
|
|
||||||
CloudFormation Compatible Resource Types
|
CloudFormation Compatible Resource Types
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
.. integratedrespages:: AWS::
|
.. integratedrespages:: AWS::
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
License for the specific language governing permissions and limitations
|
License for the specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
|
|
||||||
|
:tocdepth: 2
|
||||||
|
|
||||||
Contributed Heat Resource Types
|
Contributed Heat Resource Types
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
License for the specific language governing permissions and limitations
|
License for the specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
|
|
||||||
|
:tocdepth: 2
|
||||||
|
|
||||||
OpenStack Resource Types
|
OpenStack Resource Types
|
||||||
------------------------
|
------------------------
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
License for the specific language governing permissions and limitations
|
License for the specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
|
|
||||||
|
:tocdepth: 2
|
||||||
|
|
||||||
Unsupported Heat Resource Types
|
Unsupported Heat Resource Types
|
||||||
===============================
|
===============================
|
||||||
|
|||||||
Reference in New Issue
Block a user