]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1714] using LDAP can be configurable with the ui
authorOlivier Lamy <olamy@apache.org>
Fri, 23 Nov 2012 16:28:29 +0000 (16:28 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 23 Nov 2012 16:28:29 +0000 (16:28 +0000)
implements ui part for updating values.

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

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html

index 31559507a44b7e8640582999c9c7d62b4adf9703..a0c14ee0a4a0ec44e7f3a364fee085d768d6e1b3 100644 (file)
@@ -1147,7 +1147,70 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
         ko.applyBindings( statisticsReportViewModel, mainContent.get( 0 ) );
         ko.applyBindings( healthReportViewModel, mainContent.get( 0 ) );
       }
-    })
+    });
+  }
+
+
+  ArchivaRuntimeConfiguration=function(userManagerImpl){
+    this.userManagerImpl=ko.observable(userManagerImpl);
+  }
+
+  ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration){
+    this.archivaRuntimeConfiguration=ko.observable(archivaRuntimeConfiguration);
+    self=this;
+
+    saveArchivaRuntimeConfiguration=function(){
+      $.log("saveArchivaRuntimeConfiguration");
+
+
+      clearUserMessages();
+      var userMessages=$("#user-messages");
+      userMessages.html(mediumSpinnerImg());
+      $("#repository-group-save" ).button('loading');
+      $.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration",
+        {
+          type: "PUT",
+          contentType: 'application/json',
+          data:ko.toJSON(self.archivaRuntimeConfiguration),
+          dataType: 'json',
+          success: function(data) {
+            var message=$.i18n.prop('archiva-runtime-configuration.updated');
+            displaySuccessMessage(message);
+          },
+          error: function(data) {
+            var res = $.parseJSON(data.responseText);
+            displayRestError(res);
+          },
+          complete:function(data){
+            removeMediumSpinnerImg(userMessages);
+          }
+        }
+      );
+
+    }
+  }
+
+  displayRuntimeConfiguration=function(){
+    $.log("displayRuntimeConfiguration");
+    var mainContent = $("#main-content");
+    mainContent.html(mediumSpinnerImg());
+
+
+    $.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration", {
+      type: "GET",
+      dataType: 'json',
+      success: function(data) {
+        var archivaRuntimeConfiguration = mapArchivaRuntimeConfiguration(data);
+        var archivaRuntimeConfigurationViewModel = new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration);
+        mainContent.html( $( "#runtime-configuration-main" ).tmpl( ) );
+        ko.applyBindings(archivaRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
+      }
+    });
+
+  }
+
+  mapArchivaRuntimeConfiguration=function(data){
+    return new ArchivaRuntimeConfiguration(data.userManagerImpl);
   }
 
 });
\ No newline at end of file
index b201776ff4a548007bec2e13424ec9c768fcf77b..67fe5278c464e3fe2d8c889ee11e3a4e9e05d7e1 100644 (file)
@@ -195,6 +195,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
         {  text : $.i18n.prop('menu.system-status')            , id: "menu-system-status-list-a"          , href: "#status"           , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus()}},
         {  text : $.i18n.prop('menu.appearance-configuration') , id: "menu-appearance-list-a"             , href: "#appearance"       , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayAppearanceConfiguration()}},
         {  text : $.i18n.prop('menu.ui-configuration')         , id: "menu-ui-configuration-list-a"       , href: "#uiconfig"         , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}},
+        {  text : $.i18n.prop('menu.runtime-configuration')    , id: "menu-runtime-configuration-list-a"  , href: "#runtimeconfig"    , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration()}},
         {  text : $.i18n.prop('menu.reports')                  , id: "menu-report-list-a"                 , href: "#reports"         , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}}
       ]);
       
index 77d2f61d04270bd8c924af78b63259c4c2cb58b9..918d85617b976912fa5e8b8e956c199525fcf492 100644 (file)
     {{/each}}
     </tbody>
 </script>
+
+<script type="text/html" id="runtime-configuration-main">
+  <div class="page-header">
+    <h2>${$.i18n.prop('runtime-configuration.title')}</h2>
+  </div>
+  <div id="runtime-configuration-content" data-bind='template: {name:"runtime-configuration-content-tmpl"}'>
+
+  </div>
+</script>
+
+<script type="text/html" id="runtime-configuration-content-tmpl">
+  <div class="well">
+    <form class="form-horizontal" id="runtime-configuration-form-id">
+      <fieldset id="form-runtime-configuration">
+        <div class="control-group">
+          <label for="userManagerImpl" class="control-label">
+            ${$.i18n.prop('runtime-configuration.usermanager.label')}
+          </label>
+          <div class="controls">
+            <input type="text" id="userManagerImpl" name="userManagerImpl" class="input-small required"
+                    data-bind="value: archivaRuntimeConfiguration().userManagerImpl"/>
+          </div>
+        </div>
+        <button data-bind="click: saveArchivaRuntimeConfiguration" class="btn">${$.i18n.prop('save')}</button>
+      </fieldset>
+    </form>
+  </div>
+</script>