feat(plugins): progress on plugins page

This commit is contained in:
Torkel Ödegaard 2016-03-08 12:31:37 +01:00
parent f80c2406a8
commit db98632078
4 changed files with 112 additions and 203 deletions

View File

@ -7,7 +7,7 @@ export class PluginEditCtrl {
model: any;
pluginIcon: string;
pluginId: any;
includedPanels: any;
includes: any;
readmeHtml: any;
includedDatasources: any;
tabIndex: number;
@ -24,14 +24,17 @@ export class PluginEditCtrl {
init() {
return this.backendSrv.get(`/api/org/plugins/${this.pluginId}/settings`).then(result => {
this.model = result;
this.includedPanels = _.where(result.includes, {type: 'panel'});
this.includedDatasources = _.where(result.includes, {type: 'datasource'});
this.pluginIcon = this.getPluginIcon(this.model.type);
this.model.dependencies.plugins.forEach(plug => {
plug.icon = this.getPluginIcon(plug.type);
});
this.includes = _.map(result.includes, plug => {
plug.icon = this.getPluginIcon(plug.type);
return plug;
});
return this.initReadme();
});
}
@ -50,6 +53,7 @@ export class PluginEditCtrl {
case 'datasource': return 'icon-gf icon-gf-datasources';
case 'panel': return 'icon-gf icon-gf-panel';
case 'app': return 'icon-gf icon-gf-apps';
case 'page': return 'icon-gf icon-gf-share';
}
}

View File

@ -1,208 +1,100 @@
<navbar title="Plugins" title-url="plugins" icon="icon-gf icon-gf-apps">
<a href="plugins" class="navbar-page-btn">
{{ctrl.model.name}}
</a>
<a href="plugins" class="navbar-page-btn">
{{ctrl.model.name}}
</a>
</navbar>
<div class="page-container" ng-init="ctrl.init()">
<div class="plugin-header">
<span ng-show="ctrl.model.info.logos.large" class="plugin-header-logo">
<img src="{{ctrl.model.info.logos.large}}">
</span>
<div class="plugin-header-info-block">
<h1 class="plugin-header-name">{{ctrl.model.name}}</h1>
<div class="plugin-header-author">By {{ctrl.model.info.author.name}}</div>
<div class="plugin-header-stamps">
<span class="plugin-header-stamps-type">
<i class="{{ctrl.pluginIcon}}"></i> {{ctrl.model.type}}
</span>
</div>
</div>
</div>
<div class="page-header">
<div class="plugin-header">
<span ng-show="ctrl.model.info.logos.large" class="plugin-header-logo">
<img src="{{ctrl.model.info.logos.large}}">
</span>
<ul class="nav nav-tabs nav-tabs-alt">
<li ng-repeat="tab in ::['Overview', 'Details', 'Config']" ng-class="{active: ctrl.tabIndex === $index}">
<a ng-click="ctrl.tabIndex= $index">
{{::tab}}
</a>
</li>
</ul>
<div class="page-body">
<div class="tab-content page-content-with-sidebar" ng-if="ctrl.tabIndex === 0">
<div ng-bind-html="ctrl.readmeHtml">
<div class="plugin-header-info-block">
<h1 class="plugin-header-name">{{ctrl.model.name}}</h1>
<div class="plugin-header-author">By {{ctrl.model.info.author.name}}</div>
<div class="plugin-header-stamps">
<span class="plugin-header-stamps-type">
<i class="{{ctrl.pluginIcon}}"></i> {{ctrl.model.type}}
</span>
</div>
</div>
</div>
</div>
<div class="tab-content page-content-with-sidebar" ng-if="ctrl.tabIndex === 1">
Details
</div>
<ul class="gf-tabs">
<li class="gf-tabs-item" ng-repeat="tab in ::['Overview', 'Config']">
<a class="gf-tabs-link" ng-click="ctrl.tabIndex = $index" ng-class="{active: ctrl.tabIndex === $index}">
{{::tab}}
</a>
</li>
</ul>
<div class="tab-content page-content-with-sidebar" ng-if="ctrl.tabIndex === 2">
<div class="gf-form-inline">
<div class="gf-form">
<editor-checkbox text="Enabled" model="ctrl.model.enabled" change="ctrl.toggleEnabled()"></editor-checkbox>
</div>
<div class="gf-form">
<editor-checkbox text="Pinned" model="ctrl.model.pinned" change="ctrl.togglePinned()"></editor-checkbox>
</div>
</div>
</div>
<div ng-if="ctrl.model.pluginId">
<plugin-component type="app-config-ctrl"></plugin-component>
<div class="clearfix"></div>
<button type="submit" class="btn btn-success" ng-click="ctrl.update()">Save</button>
</div>
<div class="page-body">
<div class="tab-content page-content-with-sidebar" ng-if="ctrl.tabIndex === 0">
<div ng-bind-html="ctrl.readmeHtml" class="plugin-markdown-readme">
</div>
</div>
</div>
<div class="tab-content page-content-with-sidebar" ng-if="ctrl.tabIndex === 1">
<div class="gf-form-inline">
<div class="gf-form">
<editor-checkbox text="Enabled" model="ctrl.model.enabled" change="ctrl.toggleEnabled()"></editor-checkbox>
</div>
<div class="gf-form">
<editor-checkbox text="Pinned" model="ctrl.model.pinned" change="ctrl.togglePinned()"></editor-checkbox>
</div>
</div>
<aside class="page-sidebar">
<section class="page-sidebar-section">
<h4>Version</h4>
<span>{{ctrl.model.info.version}}</span>
</section>
<section class="page-sidebar-section" ng-show="ctrl.model.type === 'app'">
<h5>Includes</h4>
<ul class="ui-list">
<li ng-show="!ctrl.includedPanels.length"><em>None</em></li>
<li ng-repeat="panel in ctrl.includedPanels">
{{panel.name}}
</li>
<li ng-repeat="ds in ctrl.includedDatasources">
{{ds.name}}
</li>
<li ng-repeat="page in ctrl.model.pages">
<a href="plugins/{{ctrl.pluginId}}/page/{{page.slug}}" class="external-link">{{page.name}}</a>
</li>
</ul>
</section>
<section class="page-sidebar-section">
<h5>Dependencies</h4>
<ul class="ui-list">
<li>
<span class="plugin-dependency-icon">
<img src="public/img/grafana_icon.svg"></img>
</span>
<span class="plugin-dependency-name">
Grafana
</span>
<span class="plugin-dependency-version">
{{ctrl.model.dependencies.grafanaVersion}}
</span>
</li>
<li ng-repeat="plugDep in ctrl.model.dependencies.plugins">
<span class="plugin-dependency-icon">
<i class="{{plugDep.icon}}"></i>
</span>
<span class="plugin-dependency-name">
{{plugDep.name}}
</span>
<span class="plugin-dependency-version">
{{plugDep.version}}
</span>
</li>
</ul>
</section>
<section class="page-sidebar-section">
<h5>Links</h4>
<ul class="ui-list">
<li ng-repeat="link in ctrl.model.info.links">
<a href="{{link.url}}" class="external-link" target="_blank">{{link.name}}</a>
</li>
</ul>
</section>
</aside>
</div>
<div ng-if="ctrl.model.pluginId">
<plugin-component type="app-config-ctrl"></plugin-component>
<div class="clearfix"></div>
<button type="submit" class="btn btn-success" ng-click="ctrl.update()">Save</button>
</div>
</div>
<aside class="page-sidebar">
<section class="page-sidebar-section">
<h4>Version</h4>
<span>{{ctrl.model.info.version}}</span>
</section>
<section class="page-sidebar-section" ng-show="ctrl.model.type === 'app'">
<h5>Includes</h4>
<ul class="ui-list plugin-info-list">
<li ng-repeat="plug in ctrl.includes" class="plugin-info-list-item">
<i class="{{plug.icon}}"></i>
{{plug.name}}
</li>
<li ng-repeat="page in ctrl.model.pages" class="plugin-info-list-item">
<i class="icon-gf icon-gf-share"></i>
<a href="plugins/{{ctrl.pluginId}}/page/{{page.slug}}">{{page.name}}</a>
</li>
</ul>
</section>
<section class="page-sidebar-section">
<h5>Dependencies</h4>
<ul class="ui-list plugin-info-list">
<li class="plugin-info-list-item">
<img src="public/img/grafana_icon.svg"></img>
Grafana {{ctrl.model.dependencies.grafanaVersion}}
</li>
<li ng-repeat="plugDep in ctrl.model.dependencies.plugins" class="plugin-info-list-item">
<i class="{{plugDep.icon}}"></i>
{{plugDep.name}} {{plugDep.version}}
</li>
</ul>
</section>
<section class="page-sidebar-section">
<h5>Links</h4>
<ul class="ui-list">
<li ng-repeat="link in ctrl.model.info.links">
<a href="{{link.url}}" class="external-link" target="_blank">{{link.name}}</a>
</li>
</ul>
</section>
</aside>
</div>
</div>
</div>
<!-- <div class="app&#45;edit&#45;description"> -->
<!-- {{ctrl.model.info.description}}<br> -->
<!-- <span style="small"> -->
<!-- Version: {{ctrl.model.info.version}} &#38;nbsp; &#38;nbsp; Updated: {{ctrl.model.info.updated}} -->
<!-- </span> -->
<!-- </div> -->
<!-- -->
<!-- </div> -->
<!-- <div class="flex&#45;column"> -->
<!-- <ul class="app&#45;edit&#45;links"> -->
<!-- <li> -->
<!-- By <a href="{{ctrl.model.info.author.url}}" class="external&#45;link" target="_blank">{{ctrl.model.info.author.name}}</a> -->
<!-- </li> -->
<!-- <li ng&#45;repeat="link in ctrl.model.info.links"> -->
<!-- <a href="{{link.url}}" class="external&#45;link" target="_blank">{{link.name}}</a> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </div> -->
<!-- <section class="simple&#45;box"> -->
<!-- <h3 class="simple&#45;box&#45;header">Included with app:</h3> -->
<!-- <div class="flex&#45;container"> -->
<!-- <div class="simple&#45;box&#45;body simple&#45;box&#45;column"> -->
<!-- <div class="simple&#45;box&#45;column&#45;header"> -->
<!-- <i class="fa fa&#45;th&#45;large"></i> -->
<!-- Dashboards -->
<!-- </div> -->
<!-- <ul> -->
<!-- <li><em class="small">None</em></li> -->
<!-- </ul> -->
<!-- </div> -->
<!-- <div class="simple&#45;box&#45;body simple&#45;box&#45;column"> -->
<!-- <div class="simple&#45;box&#45;column&#45;header"> -->
<!-- <i class="fa fa&#45;line&#45;chart"></i> -->
<!-- Panels -->
<!-- </div> -->
<!-- <ul> -->
<!-- <li ng&#45;show="!ctrl.includedPanels.length"><em class="small">None</em></li> -->
<!-- <li ng&#45;repeat="panel in ctrl.includedPanels"> -->
<!-- {{panel.name}} -->
<!-- </li> -->
<!-- </ul> -->
<!-- </div> -->
<!-- <div class="simple&#45;box&#45;body simple&#45;box&#45;column"> -->
<!-- <div class="simple&#45;box&#45;column&#45;header"> -->
<!-- <i class="fa fa&#45;database"></i> -->
<!-- Datasources -->
<!-- </div> -->
<!-- <ul> -->
<!-- <li ng&#45;show="!ctrl.includedDatasources.length"><em class="small">None</em></li> -->
<!-- <li ng&#45;repeat="ds in ctrl.includedDatasources"> -->
<!-- {{ds.name}} -->
<!-- </li> -->
<!-- </ul> -->
<!-- </div> -->
<!-- <div class="simple&#45;box&#45;body simple&#45;box&#45;column"> -->
<!-- <div class="simple&#45;box&#45;column&#45;header"> -->
<!-- <i class="fa fa&#45;files&#45;o"></i> -->
<!-- Pages -->
<!-- </div> -->
<!-- <ul> -->
<!-- <li ng&#45;repeat="page in ctrl.model.pages"> -->
<!-- <a href="apps/{{ctrl.appId}}/page/{{page.slug}}" class="external&#45;link">{{page.name}}</a> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </div> -->
<!-- -->
<!-- </div> -->
<!-- </section> -->
<!-- -->
<!-- <section class="simple&#45;box"> -->
<!-- <h3 class="simple&#45;box&#45;header">Dependencies:</h3> -->
<!-- <div class="simple&#45;box&#45;body"> -->
<!-- Grafana 2.6.x -->
<!-- </div> -->
<!-- </section> -->
<!-- -->
<!-- <section class="simple&#45;box"> -->
<!-- <h3 class="simple&#45;box&#45;header">Configuration:</h3> -->
<!-- <div class="simple&#45;box&#45;body"> -->
<!-- <div ng&#45;if="ctrl.model.appId"> -->
<!-- <plugin&#45;component type="app&#45;config&#45;ctrl"></plugin&#45;component> -->
<!-- <div class="clearfix"></div> -->
<!-- <button type="submit" class="btn btn&#45;success" ng&#45;click="ctrl.update()">Save</button> -->
<!-- </div> -->
<!-- </div> -->
<!-- </section> -->
<!-- -->
<!-- -->
<!-- </div> -->

View File

@ -143,8 +143,8 @@ $caret-width-lg: $caret-width !default;
// Page
$page-sidebar-width: 10rem;
$page-sidebar-margin: 5rem;
$page-sidebar-width: 11rem;
$page-sidebar-margin: 4rem;
// Links
// -------------------------

View File

@ -15,7 +15,7 @@
}
.plugin-header-info-block {
padding-top: $spacer;
float: left;
}
.plugin-header-author {
@ -26,10 +26,23 @@
text-transform: uppercase;
}
.plugin-dependency-icon {
.plugin-info-list-item {
img {
width: 16px;
}
white-space: nowrap;
max-width: $page-sidebar-width;
text-overflow: ellipsis;
overflow: hidden;
}
.plugin-markdown-readme {
img {
max-width: 100%;
}
ul {
padding-left: $spacer*1.5;
}
}
// .app-edit-logo-box {