feat(plugins): added filter (type) tabs po plugin list view

pull/4360/head
Torkel Ödegaard 9 years ago
parent c504abb84d
commit 69c8bb1eb3
  1. 36
      public/app/features/plugins/partials/plugin_list.html
  2. 21
      public/app/features/plugins/plugin_list_ctrl.ts

@ -4,6 +4,26 @@
<div class="page-container"> <div class="page-container">
<div class="page-header"> <div class="page-header">
<h1>Plugins</h1> <h1>Plugins</h1>
<div class="page-header-tabs">
<ul class="gf-tabs">
<li class="gf-tabs-item">
<a class="gf-tabs-link" href="plugins?type=panel" ng-class="{active: ctrl.tabIndex === 0}">
Panels
</a>
</li>
<li class="gf-tabs-item">
<a class="gf-tabs-link" href="plugins?type=datasource" ng-class="{active: ctrl.tabIndex === 1}">
Data sources
</a>
</li>
<li class="gf-tabs-item">
<a class="gf-tabs-link" href="plugins?type=app" ng-class="{active: ctrl.tabIndex === 2}">
Apps
</a>
</li>
</ul>
</div>
</div> </div>
<table class="filter-table"> <table class="filter-table">
@ -31,12 +51,12 @@
</td> </td>
<td class="text-right"> <td class="text-right">
<a href="plugins/{{plugin.id}}/edit" class="btn btn-inverse btn-small"> <a href="plugins/{{plugin.id}}/edit" class="btn btn-inverse btn-small">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
Edit Edit
</a> </a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>

@ -4,11 +4,28 @@ import angular from 'angular';
export class PluginListCtrl { export class PluginListCtrl {
plugins: any[]; plugins: any[];
tabIndex: number;
/** @ngInject */ /** @ngInject */
constructor(private backendSrv: any) { constructor(private backendSrv: any, $location) {
this.tabIndex = 0;
this.backendSrv.get('api/plugins', {embedded: 0}).then(plugins => { var pluginType = $location.search().type || 'panel';
switch (pluginType) {
case "datasource": {
this.tabIndex = 1;
break;
}
case "app": {
this.tabIndex = 2;
break;
}
case "panel":
default:
this.tabIndex = 0;
}
this.backendSrv.get('api/plugins', {embedded: 0, type: pluginType}).then(plugins => {
this.plugins = plugins; this.plugins = plugins;
}); });
} }

Loading…
Cancel
Save