Skip to content

Commit

Permalink
feat: adding experimental rearrangeEndpoints property
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodek committed Nov 10, 2019
1 parent daabc15 commit 692c21f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion demo/standalone/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class ApicApplication extends DemoBase {
return html`<api-console-app
app
redirecturi="https://auth.advancedrestclient.com/oauth-popup.html"
oauth2clientid="821776164331-rserncqpdsq32lmbf5cfeolgcoujb6fm.apps.googleusercontent.com">
oauth2clientid="821776164331-rserncqpdsq32lmbf5cfeolgcoujb6fm.apps.googleusercontent.com"
rearrangeEndpoints
>
<anypoint-icon-button
slot="toolbar"
aria-label="Activate to open API selection menu"
Expand Down
16 changes: 14 additions & 2 deletions src/ApiConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,13 @@ export class ApiConsole extends AmfHelperMixin(LitElement) {
}

_navigationTemplate() {
const { amf, noAttribution } = this;
const { amf, noAttribution, rearrangeEndpoints } = this;
return html`<div class="drawer-content-wrapper">
<api-navigation
.amf="${amf}"
summary
endpointsopened
?rearrangeendpoints="${rearrangeEndpoints}"
@api-navigation-selection-changed="${this._apiNavigationOcurred}"></api-navigation>
${noAttribution ? '' : attributionTpl}
</div>`;
Expand Down Expand Up @@ -485,7 +486,17 @@ export class ApiConsole extends AmfHelperMixin(LitElement) {
/**
* Enables compatibility with Anypoint components.
*/
compatibility: { type: Boolean }
compatibility: { type: Boolean },
/**
* This property is passed to the `api-navigation` component.
*
* When this value is set, the navigation component sorts the list
* of endpoints based on the `path` value of the endpoint, keeping the order
* of which endpoint was first in the list, relative to each other.
*
* **This is an experimental option and may dissapear without warning.**
*/
rearrangeEndpoints: { type: Boolean },
};
}

Expand Down Expand Up @@ -763,5 +774,6 @@ export class ApiConsole extends AmfHelperMixin(LitElement) {

_closeDrawer() {
this.navigationOpened = false;
this.dispatchEvent(new CustomEvent('navigation-close'));
}
}

0 comments on commit 692c21f

Please sign in to comment.