feat(pluginslist): minor update
This commit is contained in:
@@ -55,6 +55,11 @@
|
||||
<section class="page-sidebar-section">
|
||||
<h4>Version</h4>
|
||||
<span>{{ctrl.model.info.version}}</span>
|
||||
<div ng-show="ctrl.model.hasUpdate">
|
||||
<a href="https://grafana.net/plugins/{{ctrl.model.id}}" target="_blank">
|
||||
Update Available!
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<section class="page-sidebar-section" ng-show="ctrl.model.type === 'app'">
|
||||
<h5>Includes</h4>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<div class="pluginlist">
|
||||
<div class="pluginlist-section" ng-repeat="category in ctrl.viewModel">
|
||||
<h5 class="pluginlist-section-header">
|
||||
<i class="icon-gf icon-gf-{{category.type}} pluginlist-icon"></i>
|
||||
<h6 class="pluginlist-section-header">
|
||||
{{category.header}}
|
||||
</h5>
|
||||
</h6>
|
||||
<div class="pluginlist-item" ng-repeat="plugin in category.list">
|
||||
<a class="pluginlist-link pluginlist-link-{{plugin.state}}" href="plugins/{{plugin.id}}/edit">
|
||||
<img ng-src="{{plugin.info.logos.small}}" class="pluginlist-image">
|
||||
@@ -12,7 +11,7 @@
|
||||
<span class="pluginlist-message pluginlist-message--update" ng-show="plugin.hasUpdate">
|
||||
Update available!
|
||||
</span>
|
||||
<span class="pluginlist-message pluginlist-message--enable" ng-show="!plugin.enabled">
|
||||
<span class="pluginlist-message pluginlist-message--enable" ng-show="!plugin.enabled && !plugin.hasUpdate">
|
||||
Enable now
|
||||
</span>
|
||||
<span class="pluginlist-message pluginlist-message--no-update" ng-show="plugin.enabled && !plugin.hasUpdate">
|
||||
|
||||
@@ -26,6 +26,7 @@ class DashListCtrl extends PanelCtrl {
|
||||
{header: "Installed Panels", list: [], type: 'panel'},
|
||||
{header: "Installed Datasources", list: [], type: 'datasource'},
|
||||
];
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
@@ -42,30 +43,10 @@ class DashListCtrl extends PanelCtrl {
|
||||
this.viewModel[2].list = _.filter(plugins, {type: 'datasource'});
|
||||
|
||||
for (let plugin of this.pluginList) {
|
||||
if (!plugin.enabled) {
|
||||
plugin.state = 'not-enabled';
|
||||
}
|
||||
}
|
||||
|
||||
}).then(this.checkForUpdates.bind(this));
|
||||
}
|
||||
|
||||
checkForUpdates() {
|
||||
return this.backendSrv.get('api/gnet/plugins/repo').then(data => {
|
||||
var gNetPlugins = _.reduce(data.plugins, (memo, val) => {
|
||||
memo[val.id] = val;
|
||||
return memo;
|
||||
}, {});
|
||||
|
||||
for (let plugin of this.pluginList) {
|
||||
var source = gNetPlugins[plugin.id];
|
||||
if (!source) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (plugin.info.version !== source.versions[0].version) {
|
||||
plugin.hasUpdate = true;
|
||||
if (plugin.hasUpdate) {
|
||||
plugin.state = 'has-update';
|
||||
} else if (!plugin.enabled) {
|
||||
plugin.state = 'not-enabled';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
.pluginlist-title {
|
||||
margin-right: $spacer / 3;
|
||||
margin-right: $spacer / 3;
|
||||
}
|
||||
|
||||
.pluginlist-version {
|
||||
|
||||
Reference in New Issue
Block a user