瀏覽代碼

feat(pluginslist): minor update

Torkel Ödegaard 9 年之前
父節點
當前提交
451a8bef39

+ 5 - 0
public/app/features/plugins/partials/plugin_edit.html

@@ -55,6 +55,11 @@
       <section class="page-sidebar-section">
       <section class="page-sidebar-section">
         <h4>Version</h4>
         <h4>Version</h4>
         <span>{{ctrl.model.info.version}}</span>
         <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>
       <section class="page-sidebar-section" ng-show="ctrl.model.type === 'app'">
       <section class="page-sidebar-section" ng-show="ctrl.model.type === 'app'">
         <h5>Includes</h4>
         <h5>Includes</h4>

+ 3 - 4
public/app/plugins/panel/pluginlist/module.html

@@ -1,9 +1,8 @@
 <div class="pluginlist">
 <div class="pluginlist">
 	<div class="pluginlist-section" ng-repeat="category in ctrl.viewModel">
 	<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}}
 			{{category.header}}
-		</h5>
+		</h6>
 		<div class="pluginlist-item" ng-repeat="plugin in category.list">
 		<div class="pluginlist-item" ng-repeat="plugin in category.list">
 			<a class="pluginlist-link pluginlist-link-{{plugin.state}}" href="plugins/{{plugin.id}}/edit">
 			<a class="pluginlist-link pluginlist-link-{{plugin.state}}" href="plugins/{{plugin.id}}/edit">
 				<img ng-src="{{plugin.info.logos.small}}" class="pluginlist-image">
 				<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">
 				<span class="pluginlist-message pluginlist-message--update" ng-show="plugin.hasUpdate">
 					Update available!
 					Update available!
 				</span>
 				</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
 					Enable now
 				</span>
 				</span>
 				<span class="pluginlist-message pluginlist-message--no-update" ng-show="plugin.enabled && !plugin.hasUpdate">
 				<span class="pluginlist-message pluginlist-message--no-update" ng-show="plugin.enabled && !plugin.hasUpdate">

+ 4 - 23
public/app/plugins/panel/pluginlist/module.ts

@@ -26,6 +26,7 @@ class DashListCtrl extends PanelCtrl {
       {header: "Installed Panels", list: [], type: 'panel'},
       {header: "Installed Panels", list: [], type: 'panel'},
       {header: "Installed Datasources", list: [], type: 'datasource'},
       {header: "Installed Datasources", list: [], type: 'datasource'},
     ];
     ];
+
     this.update();
     this.update();
   }
   }
 
 
@@ -42,30 +43,10 @@ class DashListCtrl extends PanelCtrl {
       this.viewModel[2].list = _.filter(plugins, {type: 'datasource'});
       this.viewModel[2].list = _.filter(plugins, {type: 'datasource'});
 
 
       for (let plugin of this.pluginList) {
       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';
           plugin.state = 'has-update';
+        } else if (!plugin.enabled) {
+          plugin.state = 'not-enabled';
         }
         }
       }
       }
     });
     });

+ 1 - 1
public/sass/components/_panel_pluginlist.scss

@@ -29,7 +29,7 @@
 }
 }
 
 
 .pluginlist-title {
 .pluginlist-title {
-    margin-right: $spacer / 3;
+  margin-right: $spacer / 3;
 }
 }
 
 
 .pluginlist-version {
 .pluginlist-version {