]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1745] path of merged index for group configurable
authorOlivier Lamy <olamy@apache.org>
Sun, 21 Apr 2013 23:36:42 +0000 (23:36 +0000)
committerOlivier Lamy <olamy@apache.org>
Sun, 21 Apr 2013 23:36:42 +0000 (23:36 +0000)
path configurable tru the ui

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1470365 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/repositories.html

index 992a68ec39b8cef619a6efb904ba04e762a59401..d47fc23a2f51924797427024e119d3d381b8e857 100644 (file)
@@ -311,6 +311,7 @@ repository.groups.available.repositories=Available Repositories
 repository.groups.list=Repository Groups
 repository-groups.grid.tab.title=Repository Groups
 repository.group.delete.confirm=Are you sure to delete Repository Group {0} ?
+repository.group.mergedIndexPath=Merged Index Path
 
 #roles
 roles.bulk.save.confirm=Are you sure to update {0} Role(s)
index 6b124d6a4002ff3580b8b7d5c3a161bd8c5ca414..e63d0f2d88a63ed9387af3c1d4da33ff3e090420 100644 (file)
@@ -740,7 +740,6 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
 
         });
 
-
       });
   };
 
index 98cdd932383e9121bc129dda37f843d052226de7..cfa68350dc0ef314870ad0ee8e2bfa9e8bee703d 100644 (file)
@@ -20,7 +20,7 @@ define("archiva.repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","j
   ,"knockout.simpleGrid","knockout.sortable"],
 function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
 
-  RepositoryGroup=function(id,repositories){
+  RepositoryGroup=function(id,repositories,mergedIndexPath){
 
     var self=this;
 
@@ -28,6 +28,10 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
     this.id=ko.observable(id);
     this.id.subscribe(function(newValue){self.modified(true)});
 
+    //private String mergedIndexPath = "/.indexer";
+    this.mergedIndexPath=ko.observable(mergedIndexPath?mergedIndexPath:".indexer");
+    this.mergedIndexPath.subscribe(function(newValue){self.modified(true)});
+
     // private List<String> repositories;
     this.repositories=ko.observableArray(repositories);
     this.repositories.subscribe(function(newValue){self.modified(true)});
@@ -192,6 +196,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
             repositoryGroupViewModel.renderSortableChoosed(self);
             repositoryGroupViewModel.renderSortableAvailables(self);
             mainContent.find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit"));
+            repositoryGroupValidator();
           }
         });
     }
@@ -206,32 +211,39 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
     }
 
     this.saveRepositoryGroup=function(repositoryGroup){
-        clearUserMessages();
-        var userMessages=$("#user-messages");
-        userMessages.html(mediumSpinnerImg());
-        $("#repository-group-save" ).button('loading');
-        $.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup",
-          {
-            type: "POST",
-            contentType: 'application/json',
-            data:ko.toJSON(repositoryGroup),
-            dataType: 'json',
-            success: function(data) {
-              $.log("update repositoryGroup id:"+repositoryGroup.id());
-              var message=$.i18n.prop('repository.group.updated',repositoryGroup.id());
-              displaySuccessMessage(message);
-              repositoryGroup.modified(false);
-            },
-            error: function(data) {
-              var res = $.parseJSON(data.responseText);
-              displayRestError(res);
-            },
-            complete:function(data){
-              $("#repository-group-save" ).button('reset');
-              removeMediumSpinnerImg(userMessages);
-            }
+      if(valid==false){
+        $.log("saveRepositoryGroup, valid:"+valid);
+        return;
+      }
+      clearUserMessages();
+      var userMessages=$("#user-messages");
+      userMessages.html(mediumSpinnerImg());
+      var valid = $("#main-content").find("#repository-group-edit-form" ).valid();
+
+
+      $("#repository-group-save" ).button('loading');
+      $.ajax("restServices/archivaServices/repositoryGroupService/updateRepositoryGroup",
+        {
+          type: "POST",
+          contentType: 'application/json',
+          data:ko.toJSON(repositoryGroup),
+          dataType: 'json',
+          success: function(data) {
+            $.log("update repositoryGroup id:"+repositoryGroup.id());
+            var message=$.i18n.prop('repository.group.updated',repositoryGroup.id());
+            displaySuccessMessage(message);
+            repositoryGroup.modified(false);
+          },
+          error: function(data) {
+            var res = $.parseJSON(data.responseText);
+            displayRestError(res);
+          },
+          complete:function(data){
+            $("#repository-group-save" ).button('reset');
+            removeMediumSpinnerImg(userMessages);
           }
-        );
+        }
+      );
 
     }
 
@@ -359,6 +371,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
   }
 
   activateRepositoryGroupEditTab=function(){
+    $.log("activateRepositoryGroupEditTab");
     var mainContent = $("#main-content");
 
     mainContent.find("#repository-groups-view-tabs-content div[class*='tab-pane']").removeClass("active");
@@ -366,6 +379,27 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
 
     mainContent.find("#repository-groups-edit").addClass("active");
     mainContent.find("#repository-groups-view-tabs-li-edit").addClass("active");
+
+
+  }
+
+  repositoryGroupValidator=function(){
+    $.log("validator");
+    var theForm=$("#main-content").find("#repository-group-edit-form");
+    var validator = theForm.validate({
+        rules: {
+            id: {
+              required: true
+              },
+            mergedIndexPath:{
+              required:true
+            }
+        },
+        showErrors: function(validator, errorMap, errorList) {
+           customShowError("#main-content #repository-group-edit-form",validator,errorMap,errorMap);
+        }
+    });
+    return validator;
   }
 
   mapRepositoryGroups=function(data){
@@ -379,7 +413,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) {
   }
 
   mapRepositoryGroup=function(data){
-    return new RepositoryGroup(data.id, mapStringArray(data.repositories));
+    return new RepositoryGroup(data.id, mapStringArray(data.repositories),data.mergedIndexPath);
   }
 
 });
index 6b0bc0ac3463810f38a32d61d33e2e2cf6f7a51f..013b1c85fbfc22bf9058f76bfeb9789ea954edd7 100644 (file)
 
 <script id="repository-group-edit-tmpl" type="text/html">
   <div class="row-fluid">
-    {{if update}}
-    <div class="dotted span8">
-      <blockquote>
-        ${repositoryGroup.id}
-        <br/>
-        <a href="${window.archivaRuntimeInfo.baseUrl}/repository/${repositoryGroup.id()}" target="_blank">
-          ${applicationUrl}/repository/${repositoryGroup.id()}
-        </a>
-      </blockquote>
-    </div>
-    {{else}}
+
     <div class="dotted span8">
       <form id="repository-group-edit-form" class="well">
         <fieldset id="repository-group-edit-fieldset">
           <div class="control-group">
             <label class="control-label" for="id">${$.i18n.prop('id')}</label>
-
             <div class="controls">
               <input type="text" class="input-medium required" id="id" name="id" size="15"
                      data-bind="value: repositoryGroup.id,css:{'uneditable-input': update},readonly:update"/>
             </div>
           </div>
+          <div class="control-group">
+            <label class="control-label" for="mergedIndexPath">${$.i18n.prop('repository.group.mergedIndexPath')}</label>
+              <div class="controls">
+                <input type="text" class="input-large required" id="mergedIndexPath" name="mergedIndexPath"
+                       data-bind="value: repositoryGroup.mergedIndexPath"/>
+              </div>
+          </div>
+          <div>
+            <a href="${window.archivaRuntimeInfo.baseUrl}/repository/${repositoryGroup.id()}" target="_blank">
+            {{if repositoryGroup.id()}}
+              ${applicationUrl}/repository/${repositoryGroup.id()}
+            {{/if}}
+            </a>
+          </div>
         </fieldset>
       </form>
     </div>
-    {{/if}}
+
     {{if repositoryGroup.modified()}}
     <div class="span3">
       <a href="#" class="btn btn-warning" data-loading-text="${$.i18n.prop('common.loading')}"