From: Olivier Lamy Date: Wed, 3 Oct 2012 06:38:23 +0000 (+0000) Subject: use images for black/white list X-Git-Tag: archiva-1.4-M3~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5e282f9cbb112809eddce3bc94a5aa8cd9d42432;p=archiva.git use images for black/white list git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1393310 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js index ddd4110ce..3ba35ced9 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js @@ -19,20 +19,32 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout" ,"knockout.simpleGrid","knockout.sortable","archiva.proxy-connectors"], function() { - - ProxyConnectorRulesViewModel=function(proxyConnectorRules,proxyConnectors){ var self=this; - this.proxyConnectorRules=ko.observableArray(proxyConnectorRules); + this.proxyConnectorRules=ko.observableArray(proxyConnectorRules?proxyConnectorRules:[]); this.proxyConnectors=proxyConnectors; // FIXME get that from a REST service // FIXME i18n - this.ruleTypes=[new RuleType("WHITE_LIST"," white list"),new RuleType("BLACK_LIST"," black list")]; + this.ruleTypes=[new RuleType("BLACK_LIST","Black list","images/red-22-22.png"),new RuleType("WHITE_LIST","White list","images/green-22-22.png")]; + + this.findRuleType=function(proxyConnectorRule){ + var ruleType; + $.each(self.ruleTypes, function(index, value) { + if(value.type==proxyConnectorRule.proxyConnectorRuleType()){ + ruleType=value; + } + }); + return ruleType; + } this.displayGrid=function(){ var mainContent = $("#main-content"); + $.each(self.proxyConnectorRules(), function(index, value) { + value.ruleType=self.findRuleType(value); + }); + this.gridViewModel = new ko.simpleGrid.viewModel({ data: self.proxyConnectorRules, pageSize: 5, @@ -78,6 +90,8 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra displaySuccessMessage(message); proxyConnectorRule.modified(false); if(add){ + // add rule type for image + proxyConnectorRule.ruleType=self.findRuleType(proxyConnectorRule); self.proxyConnectorRules.push(proxyConnectorRule); } activateProxyConnectorRulesGridTab(); @@ -108,7 +122,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra } this.deleteProxyConnectorRule=function(proxyConnectorRule){ - //$("#proxy-connector-rule-delete-btn" ).button("loading"); + $("#main-content" ).find("proxy-connectors-rules-view-tabsTable").find(".btn").button("loading"); $("#user-messages" ).html(mediumSpinnerImg()); $.ajax("restServices/archivaServices/proxyConnectorRuleService/deleteProxyConnectorRule", { @@ -127,7 +141,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra }, complete:function(data){ removeMediumSpinnerImg("#user-messages"); - //$("#proxy-connector-rule-delete-btn" ).button("reset"); + $("#main-content" ).find("proxy-connectors-rules-view-tabsTable").find(".btn").button("reset"); } } ); @@ -211,6 +225,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra self.modified(true); }); + this.ruleType=null; //private ProxyConnectorRuleType proxyConnectorRuleType; this.proxyConnectorRuleType=ko.observable(proxyConnectorRuleType); @@ -223,6 +238,8 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra this.proxyConnectors.subscribe(function(newValue){ self.modified(true); }); + + this.ruleType=null; } mapProxyConnectorRule=function(data){ @@ -261,9 +278,10 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra mainContent.find("#proxy-connectors-rules-view-tabs-edit").addClass("active"); } - RuleType=function(type,label){ + RuleType=function(type,label,image){ this.type=type; this.label=label; + this.image=image; } }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html index 32e7d2570..6278fa5f1 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/repositories.html @@ -1287,7 +1287,7 @@ {{each(i, row) itemsOnCurrentPage()}} ${row.pattern()} - ${row.proxyConnectorRuleType()} +