mirror of https://github.com/apache/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
This commit is contained in:
parent
ac900f8e4b
commit
5e282f9cbb
|
@ -19,20 +19,32 @@
|
||||||
define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout"
|
define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout"
|
||||||
,"knockout.simpleGrid","knockout.sortable","archiva.proxy-connectors"], function() {
|
,"knockout.simpleGrid","knockout.sortable","archiva.proxy-connectors"], function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ProxyConnectorRulesViewModel=function(proxyConnectorRules,proxyConnectors){
|
ProxyConnectorRulesViewModel=function(proxyConnectorRules,proxyConnectors){
|
||||||
var self=this;
|
var self=this;
|
||||||
this.proxyConnectorRules=ko.observableArray(proxyConnectorRules);
|
this.proxyConnectorRules=ko.observableArray(proxyConnectorRules?proxyConnectorRules:[]);
|
||||||
this.proxyConnectors=proxyConnectors;
|
this.proxyConnectors=proxyConnectors;
|
||||||
|
|
||||||
// FIXME get that from a REST service
|
// FIXME get that from a REST service
|
||||||
// FIXME i18n
|
// 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(){
|
this.displayGrid=function(){
|
||||||
var mainContent = $("#main-content");
|
var mainContent = $("#main-content");
|
||||||
|
|
||||||
|
$.each(self.proxyConnectorRules(), function(index, value) {
|
||||||
|
value.ruleType=self.findRuleType(value);
|
||||||
|
});
|
||||||
|
|
||||||
this.gridViewModel = new ko.simpleGrid.viewModel({
|
this.gridViewModel = new ko.simpleGrid.viewModel({
|
||||||
data: self.proxyConnectorRules,
|
data: self.proxyConnectorRules,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
|
@ -78,6 +90,8 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
|
||||||
displaySuccessMessage(message);
|
displaySuccessMessage(message);
|
||||||
proxyConnectorRule.modified(false);
|
proxyConnectorRule.modified(false);
|
||||||
if(add){
|
if(add){
|
||||||
|
// add rule type for image
|
||||||
|
proxyConnectorRule.ruleType=self.findRuleType(proxyConnectorRule);
|
||||||
self.proxyConnectorRules.push(proxyConnectorRule);
|
self.proxyConnectorRules.push(proxyConnectorRule);
|
||||||
}
|
}
|
||||||
activateProxyConnectorRulesGridTab();
|
activateProxyConnectorRulesGridTab();
|
||||||
|
@ -108,7 +122,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
|
||||||
}
|
}
|
||||||
|
|
||||||
this.deleteProxyConnectorRule=function(proxyConnectorRule){
|
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());
|
$("#user-messages" ).html(mediumSpinnerImg());
|
||||||
$.ajax("restServices/archivaServices/proxyConnectorRuleService/deleteProxyConnectorRule",
|
$.ajax("restServices/archivaServices/proxyConnectorRuleService/deleteProxyConnectorRule",
|
||||||
{
|
{
|
||||||
|
@ -127,7 +141,7 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra
|
||||||
},
|
},
|
||||||
complete:function(data){
|
complete:function(data){
|
||||||
removeMediumSpinnerImg("#user-messages");
|
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);
|
self.modified(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.ruleType=null;
|
||||||
|
|
||||||
//private ProxyConnectorRuleType proxyConnectorRuleType;
|
//private ProxyConnectorRuleType proxyConnectorRuleType;
|
||||||
this.proxyConnectorRuleType=ko.observable(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){
|
this.proxyConnectors.subscribe(function(newValue){
|
||||||
self.modified(true);
|
self.modified(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.ruleType=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapProxyConnectorRule=function(data){
|
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");
|
mainContent.find("#proxy-connectors-rules-view-tabs-edit").addClass("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
RuleType=function(type,label){
|
RuleType=function(type,label,image){
|
||||||
this.type=type;
|
this.type=type;
|
||||||
this.label=label;
|
this.label=label;
|
||||||
|
this.image=image;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1287,7 +1287,7 @@
|
||||||
{{each(i, row) itemsOnCurrentPage()}}
|
{{each(i, row) itemsOnCurrentPage()}}
|
||||||
<tr data-bind="css:{ 'modified': row.modified()}">
|
<tr data-bind="css:{ 'modified': row.modified()}">
|
||||||
<td>${row.pattern()}</td>
|
<td>${row.pattern()}</td>
|
||||||
<td>${row.proxyConnectorRuleType()}</td>
|
<td><img src="${row.ruleType.image}" title="${row.ruleType.label}"></img></td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
{{each(j,proxyConnector) row.proxyConnectors()}}
|
{{each(j,proxyConnector) row.proxyConnectors()}}
|
||||||
|
@ -1297,14 +1297,14 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" data-bind="click: function(){ editProxyConnectorRule(row) }">
|
<a href="#" data-bind="click: function(){ editProxyConnectorRule(row) }">
|
||||||
<span class="btn btn-primary">
|
<span class="btn btn-primary" data-loading-text="${$.i18n.prop('common.loading')}">
|
||||||
<i class="icon-pencil icon-white"/>
|
<i class="icon-pencil icon-white"/>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a data-bind="click: function(){ removeProxyConnectorRule(row) }" data-loading-text="${$.i18n.prop('common.loading')}">
|
<a data-bind="click: function(){ removeProxyConnectorRule(row) }" data-loading-text="${$.i18n.prop('common.loading')}">
|
||||||
<span class="btn btn-danger">
|
<span class="btn btn-danger" data-loading-text="${$.i18n.prop('common.loading')}">
|
||||||
<i class="icon-trash icon-white"/>
|
<i class="icon-trash icon-white"/>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue