Azure API 管理中的问题模板Issue templates in Azure API Management

通过 Azure API 管理,用户能够使用一组用于配置内容的模板自定义开发人员门户页的内容。Azure API Management provides you the ability to customize the content of developer portal pages using a set of templates that configure their content. 使用 DotLiquid 语法和所选编辑器(例如 DotLiquid for Designers),以及提供的一组本地化字符串资源字形资源页面控件,即可根据这些模板的使用需要非常灵活地配置页面内容。Using DotLiquid syntax and the editor of your choice, such as DotLiquid for Designers, and a provided set of localized String resources, Glyph resources, and Page controls, you have great flexibility to configure the content of the pages as you see fit using these templates.

本部分中的模板可用于自定义开发人员门户中问题页面的内容。The templates in this section allow you to customize the content of the Issue pages in the developer portal.

备注

示例默认模板包含在后续文档中,但是会因持续改进而有所更改。Sample default templates are included in the following documentation, but are subject to change due to continuous improvements. 通过导航到所需单个模板,可在开发人员门户中查看实时的默认模板。You can view the live default templates in the developer portal by navigating to the desired individual templates. 如需详细了解如何使用模板,请参阅如何使用模板自定义 API 管理开发人员门户For more information about working with templates, see How to customize the API Management developer portal using templates.

备注

此文档内容与旧开发人员门户有关。This documentation content is about the legacy developer portal. 请参阅以下文章,了解有关新开发人员门户的内容:Refer to the following articles for content about the new developer portal:

可用性Availability

重要

此功能在 API 管理的“高级”、“标准”、“基本”和“开发人员”层中可用。This feature is available in the Premium, Standard, Basic and Developer tiers of API Management.

问题列表Issue list

问题列表模板可用于自定义开发人员门户中问题列表页的正文。The Issue list template allows you to customize the body of the issue list page in the developer portal.

问题列表(开发人员门户)Issue List Developer Portal

默认模板Default template

<div class="row">  
  <div class="col-md-9">  
    <h2>{% localized "IssuesStrings|WebIssuesIndexTitle" %}</h2>  
  </div>  
</div>  
<div class="row">  
  <div class="col-md-12">  
    {% if issues.size > 0 %}  
    <ul class="list-unstyled">  
      {% capture reportedBy %}{% localized "IssuesStrings|WebIssuesStatusReportedBy" %}{% endcapture %}  
      {% assign replaceString0 = '{0}' %}  
      {% assign replaceString1 = '{1}' %}  
      {% for issue in issues %}  
      <li>  
        <h3>  
          <a href="/issues/{{issue.id}}">{{issue.title}}</a>  
        </h3>  
        <p>{{issue.description}}</p>  
        <em>  
          {% capture state %}{{issue.issueState}}{% endcapture %}  
          {% capture devName %}{{issue.subscriptionDeveloperName}}{% endcapture %}  
          {% capture str1 %}{{ reportedBy | replace : replaceString0, state }}{% endcapture %}  
          {{ str1 | replace : replaceString1, devName }}  
          <span class="UtcDateElement">{{ issue.reportedOn | date: "r" }}</span>  
        </em>  
      </li>  
      {% endfor %}  
    </ul>  
    <paging-control></paging-control>  
    {% else %}  
    {% localized "CommonResources|NoItemsToDisplay" %}  
    {% endif %}  
    {% if canReportIssue %}  
    <a class="btn btn-primary" id="createIssue" href="/Issues/Create">{% localized "IssuesStrings|WebIssuesReportIssueButton" %}</a>  
    {% elsif isAuthenticated %}  
    <hr />  
    <p>{% localized "IssuesStrings|WebIssuesNoActiveSubscriptions" %}</p>  
    {% else %}  
    <hr />  
    <p>  
      {% capture signIntext %}{% localized "IssuesStrings|WebIssuesNotSignin" %}{% endcapture %}  
      {% capture link %}<a href="/signin">{% localized "IssuesStrings|WebIssuesSignIn" %}</a>{% endcapture %}  
      {{ signIntext | replace : replaceString0, link }}  
    </p>  
    {% endif %}  
  </div>  
</div>  

控制Controls

Issue list 模板可使用以下页面控件The Issue list template may use the following page controls.

数据模型Data model

属性Property 类型Type 说明Description
问题Issues 问题实体的集合。Collection of Issue entities. 对当前用户可见的问题。The issues visible to the current user.
分页Paging 分页实体。Paging entity. 应用程序集合的分页信息。The paging information for the applications collection.
IsAuthenticatedIsAuthenticated 布尔值boolean 当前用户是否登录到开发人员门户。Whether the current user is signed-in to the developer portal.
CanReportIssuesCanReportIssues 布尔值boolean 当前用户是否有权提出问题。Whether the current user has permissions to file an issue.
搜索Search 字符串string 此属性已弃用,不应使用。This property is deprecated and should not be used.

示例模板数据Sample template data

{  
    "Issues": [  
        {  
            "Id": "5702b68bb16653124c8f9ba7",  
            "ApiId": "570275f1b16653124c8f9ba3",  
            "Title": "I couldn't figure out how to connect my application to the API",  
            "Description": "I'm having trouble connecting my application to the backend API.",  
            "SubscriptionDeveloperName": "Clayton",  
            "IssueState": "Proposed",  
            "ReportedOn": "2016-04-04T18:46:35.64",  
            "Comments": null,  
            "Attachments": null,  
            "Services": null  
        }  
    ],  
    "Paging": {  
        "Page": 1,  
        "PageSize": 10,  
        "TotalItemCount": 1,  
        "ShowAll": false,  
        "PageCount": 1  
    },  
    "IsAuthenticated": true,  
    "CanReportIssue": true,  
    "Search": null  
}  

后续步骤Next steps

如需详细了解如何使用模板,请参阅如何使用模板自定义 API 管理开发人员门户For more information about working with templates, see How to customize the API Management developer portal using templates.