From d556ce5072e1a3c16e512c63823738a1ff400ce0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 26 Mar 2012 22:50:15 +0000 Subject: [PATCH] cleanup small js files. defined a js files as a module for require js. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1305650 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/index.html | 38 ++--- .../main/webapp/js/archiva/general-admin.js | 4 +- .../src/main/webapp/js/archiva/main-tmpl.js | 5 +- .../src/main/webapp/js/archiva/main.js | 4 +- .../main/webapp/js/archiva/network-proxies.js | 2 +- .../webapp/js/archiva/proxy-connectors.js | 2 +- .../main/webapp/js/archiva/repositories.js | 2 +- .../webapp/js/archiva/repository-groups.js | 3 +- .../src/main/webapp/js/redback/operation.js | 34 ----- .../src/main/webapp/js/redback/permission.js | 38 ----- .../main/webapp/js/redback/redback-tmpl.js | 5 +- .../src/main/webapp/js/redback/redback.js | 144 +++++++++++++++++- .../src/main/webapp/js/redback/register.js | 121 --------------- .../src/main/webapp/js/redback/resource.js | 35 ----- .../src/main/webapp/js/redback/roles.js | 2 +- .../src/main/webapp/js/redback/user.js | 2 +- .../src/main/webapp/js/redback/users.js | 2 +- 17 files changed, 176 insertions(+), 267 deletions(-) delete mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/operation.js delete mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/permission.js delete mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js delete mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/resource.js diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index 9957610c6..bc921130e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -64,7 +64,18 @@ "jquery_json": "jquery.json-2.3.min", "knockout.simpleGrid": "knockout.simpleGrid", "knockout": "knockout-2.0.0.debug", - "knockout.sortable": "knockout-sortable" + "knockout.sortable": "knockout-sortable", + "redback": "redback/redback", + "general-admin":"archiva/general-admin", + "redback-templates": "redback/redback-tmpl", + "main-templates": "archiva/main-tmpl", + "repositories": "archiva/repositories", + "network-proxies": "archiva/network-proxies", + "proxy-connectors": "archiva/proxy-connectors", + "repository-groups": "archiva/repository-groups", + "roles": "redback/roles", + "user": "redback/user", + "users": "redback/users" } // file upload dependencies //.script("jquery.iframe-transport-1.4.js").wait() @@ -72,7 +83,7 @@ //.script("jquery.fileupload-ip-1.0.6.js").wait() //.script("jquery.fileupload-ui-6.6.3.js" ).wait() }); - require(['domReady','jquery','i18n','startup'], function (domReady) { + require(['order!domReady','order!jquery','order!i18n','order!startup'], function (domReady) { domReady.withResources(function () { loadi18n(); $.ajax( @@ -84,15 +95,6 @@ window.archivaJavascriptLog=data.javascriptLog; window.archivaRuntimeInfo=data; - require.config({ - baseUrl: "js/", - urlArgs: "_="+new Date().getTime(), - "paths": { - "redback": buildLoadJsUrl("redback/redback.js") - - } - }); - // CacheBust is for dev purpose use false in prod env ! var options = { AlwaysPreserveOrder:true, @@ -102,20 +104,6 @@ }; $LAB.setGlobalDefaults(options); $LAB - .script(buildLoadJsUrl("archiva/main-tmpl.js")).wait() - .script(buildLoadJsUrl("archiva/general-admin.js")) - .script(buildLoadJsUrl("archiva/repositories.js")).wait() - .script(buildLoadJsUrl("archiva/network-proxies.js")).wait() - .script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait() - .script(buildLoadJsUrl("redback/operation.js")).wait() - .script(buildLoadJsUrl("archiva/repository-groups.js")).wait() - .script(buildLoadJsUrl("redback/redback-tmpl.js")).wait() - .script(buildLoadJsUrl("redback/user.js")).wait() - .script(buildLoadJsUrl("redback/users.js")).wait() - .script(buildLoadJsUrl("redback/register.js")).wait() - .script(buildLoadJsUrl("redback/permission.js")).wait() - .script(buildLoadJsUrl("redback/resource.js")).wait() - .script(buildLoadJsUrl("redback/roles.js")).wait() .script(buildLoadJsUrl("archiva/main.js")); } }) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 649a00cfa..0d61fc5db 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("general-admin",["jquery","i18n","order!utils","order!jquery_tmpl","order!knockout","jquery_validate","bootstrap"] + , function() { //------------------------- // legacy path part @@ -822,4 +823,5 @@ $(function() { } }); } + }); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js index ed58c9d1b..fdc5d5325 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -require(["text!js/archiva/templates/menu.html"+appendTemplateUrl(), +define("main-templates",["text!js/archiva/templates/menu.html"+appendTemplateUrl(), "text!js/archiva/templates/message.html"+appendTemplateUrl(), "text!js/archiva/templates/modal.html"+appendTemplateUrl(), "text!js/archiva/templates/grids-generics.html"+appendTemplateUrl(), @@ -25,7 +25,8 @@ require(["text!js/archiva/templates/menu.html"+appendTemplateUrl(), "text!js/archiva/templates/proxy-connectors.html"+appendTemplateUrl(), "text!js/archiva/templates/repository-groups.html"+appendTemplateUrl(), "text!js/archiva/templates/search.html"+appendTemplateUrl(), - "text!js/archiva/templates/general-admin.html"+appendTemplateUrl()], + "text!js/archiva/templates/general-admin.html"+appendTemplateUrl(), + "jquery_tmpl","utils"], function(menu,message,modal,grids_generics,repositories,network_proxies,proxies_connectors, repository_groups,search,general_admin) { diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index 52796ee18..83a97777b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -17,10 +17,12 @@ * under the License. */ require( ["order!jquery","jquery_ui","jquery_cookie","bootstrap","order!archiva/search", - "jquery_validate","jquery_json","order!knockout","order!redback/redback"], + "jquery_validate","jquery_json","order!knockout","order!redback-templates","order!main-templates","order!roles", + "order!redback","general-admin","repositories","network-proxies","proxy-connectors","repository-groups"], function() { + // define a container object with various datas window.archivaModel = {}; diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js index eea73dddb..4b59fc445 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("network-proxies",["jquery","i18n","jquery_tmpl","bootstrap","jquery_validate"], function() { NetworkProxy=function(id,protocol,host,port,username,password,useNtlm){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js index 7961bac46..670b9aab7 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("proxy-connectors",["jquery","i18n","jquery_tmpl","bootstrap","jquery_validate"], function() { ProxyConnector=function(sourceRepoId,targetRepoId,proxyId,blackListPatterns,whiteListPatterns,policiesEntries,propertiesEntries, disabled,order){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js index 8c386d523..4f23a096f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("repositories",["jquery","i18n","jquery_tmpl","bootstrap","jquery_validate"], function() { // FIXME this must be dynamic if we do a plugin mechanism with dynamic repositories types // FIXME i18n diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js index 8707d9dae..f4614a956 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("repository-groups",["jquery","i18n","jquery_tmpl","bootstrap","jquery_validate","jquery_ui"], +function() { RepositoryGroup=function(id,repositories){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/operation.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/operation.js deleted file mode 100644 index 4ae29db61..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/operation.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -$(function() { - - - Operation=function(name) { - this.name=ko.observable(name); - } - - /** - * @param data Operation response from redback rest api - */ - mapOperation=function(data) { - return new Operation(data.name,null); - } - - -}); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/permission.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/permission.js deleted file mode 100644 index 7c668448d..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/permission.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -$(function() { - - - Permission=function(name,operation,resource) { - this.name=ko.observable(name); - this.operation=ko.observable(operation); - this.resource=ko.observable(resource); - } - - /** - * @param data Permission response from redback rest api - */ - mapPermission=function(data) { - return new Permission(data.name, - data.operation?mapOperation(data.operation):null, - data.resource?mapResource(data.resource):null); - } - - -}); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js index a604ae137..77cc757de 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js @@ -16,13 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -require(["text!js/redback/templates/user-edit.html"+appendTemplateUrl(), +define("redback-templates",["text!js/redback/templates/user-edit.html"+appendTemplateUrl(), "text!js/redback/templates/user-grids.html"+appendTemplateUrl(), "text!js/redback/templates/login.html"+appendTemplateUrl(), "text!js/redback/templates/register-form.html"+appendTemplateUrl(), "text!js/redback/templates/password-change-form.html"+appendTemplateUrl(), "text!js/redback/templates/user-edit-form.html"+appendTemplateUrl(), - "text!js/redback/templates/roles-tmpl.html"+appendTemplateUrl()], + "text!js/redback/templates/roles-tmpl.html"+appendTemplateUrl(), + "jquery_tmpl","utils"], function(useredit, usergrids, login,register,passwordchange,usereditform,roles) { var htmlFragment=$("#html-fragments"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js index 414796efb..fb0370a8b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("redback",["jquery","order!utils","jquery_validate","jquery_json","roles","user","users"], function() { // define a container object with various datas window.redbackModel = {userOperationNames:null,key:null,i18n:$.i18n.map}; @@ -50,4 +50,146 @@ $(function() { }); } + Operation=function(name) { + this.name=ko.observable(name); + } + + /** + * @param data Operation response from redback rest api + */ + mapOperation=function(data) { + return new Operation(data.name,null); + } + + Permission=function(name,operation,resource) { + this.name=ko.observable(name); + this.operation=ko.observable(operation); + this.resource=ko.observable(resource); + } + + /** + * @param data Permission response from redback rest api + */ + mapPermission=function(data) { + return new Permission(data.name, + data.operation?mapOperation(data.operation):null, + data.resource?mapResource(data.resource):null); + } + + Resource=function(identifier,pattern) { + this.identifier=ko.observable(identifier); + this.pattern=ko.observable(pattern); + } + + /** + * @param data Resource response from redback rest api + */ + mapResource=function(data) { + return new Resource(data.identifier,data.pattern); + } + + //--------------------------------------- + // register part + //--------------------------------------- + + /** + * open the register modal box + */ + registerBox=function(){ + if (window.modalRegisterWindow==null) { + window.modalRegisterWindow = $("#modal-register").modal({backdrop:'static',show:false}); + window.modalRegisterWindow.bind('hidden', function () { + $("#modal-register-err-message").hide(); + }) + } + window.modalRegisterWindow.modal('show'); + $("#user-register-form").validate({ + showErrors: function(validator, errorMap, errorList) { + customShowError("#user-register-form",validator,errorMap,errorMap); + } + }); + $("#modal-register").delegate("#modal-register-ok", "click keydown keypress", function(e) { + e.preventDefault(); + register(); + }); + //$("#modal-register").focus(); + } + + /** + * validate the register form and call REST service + */ + register=function(){ + $.log("register.js#register"); + var valid = $("#user-register-form").valid(); + if (!valid) { + return; + } + clearUserMessages(); + $("#modal-register-ok").attr("disabled","disabled"); + + $('#modal-register-footer').append(smallSpinnerImg()); + + var user = {}; + user.username = $("#user-register-form-username").val(); + user.fullName = $("#user-register-form-fullname").val(); + user.email = $("#user-register-form-email").val(); + jQuery.ajax({ + url: 'restServices/redbackServices/userService/registerUser', + data: JSON.stringify(user), + type: 'POST', + contentType: "application/json", + success: function(result){ + var registered = false; + if (result == "-1") { + registered = false; + } else { + registered = true; + } + + if (registered == true) { + window.modalRegisterWindow.modal('hide'); + $("#register-link").hide(); + // FIXME i18n + displaySuccessMessage("registered your key has been sent"); + } + }, + complete: function(){ + $("#modal-register-ok").removeAttr("disabled"); + removeSmallSpinnerImg(); + }, + error: function(result) { + var obj = jQuery.parseJSON(result.responseText); + displayRedbackError(obj); + window.modalRegisterWindow.modal('hide'); + } + }) + + } + + /** + * validate a registration key and go to change password key + * @param key + */ + validateKey=function(key,registration) { + // FIXME spinner display + $.ajax({ + url: 'restServices/redbackServices/userService/validateKey/'+key, + type: 'GET', + success: function(result){ + window.redbackModel.key=key; + $.log("validateKey#sucess"); + changePasswordBox(false,registration?registration:true,null); + }, + complete: function(){ + // hide spinner + }, + error: function(result) { + $.log("validateKey#error"); + var obj = jQuery.parseJSON(result.responseText); + $.log("validateKey#error response:"+obj); + displayRedbackError(obj); + } + }) + } + }); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js deleted file mode 100644 index 9b887f8af..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/register.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -$(function() { - - /** - * open the register modal box - */ - registerBox=function(){ - if (window.modalRegisterWindow==null) { - window.modalRegisterWindow = $("#modal-register").modal({backdrop:'static',show:false}); - window.modalRegisterWindow.bind('hidden', function () { - $("#modal-register-err-message").hide(); - }) - } - window.modalRegisterWindow.modal('show'); - $("#user-register-form").validate({ - showErrors: function(validator, errorMap, errorList) { - customShowError("#user-register-form",validator,errorMap,errorMap); - } - }); - $("#modal-register").delegate("#modal-register-ok", "click keydown keypress", function(e) { - e.preventDefault(); - register(); - }); - //$("#modal-register").focus(); - } - - /** - * validate the register form and call REST service - */ - register=function(){ - $.log("register.js#register"); - var valid = $("#user-register-form").valid(); - if (!valid) { - return; - } - clearUserMessages(); - $("#modal-register-ok").attr("disabled","disabled"); - - $('#modal-register-footer').append(smallSpinnerImg()); - - var user = {}; - user.username = $("#user-register-form-username").val(); - user.fullName = $("#user-register-form-fullname").val(); - user.email = $("#user-register-form-email").val(); - jQuery.ajax({ - url: 'restServices/redbackServices/userService/registerUser', - data: '{"user":'+JSON.stringify(user)+'}', - type: 'POST', - contentType: "application/json", - success: function(result){ - var registered = false; - if (result == "-1") { - registered = false; - } else { - registered = true; - } - - if (registered == true) { - window.modalRegisterWindow.modal('hide'); - $("#register-link").hide(); - // FIXME i18n - displaySuccessMessage("registered your key has been sent"); - } - }, - complete: function(){ - $("#modal-register-ok").removeAttr("disabled"); - removeSmallSpinnerImg(); - }, - error: function(result) { - var obj = jQuery.parseJSON(result.responseText); - displayRedbackError(obj); - window.modalRegisterWindow.modal('hide'); - } - }) - - } - - /** - * validate a registration key and go to change password key - * @param key - */ - validateKey=function(key,registration) { - // FIXME spinner display - $.ajax({ - url: 'restServices/redbackServices/userService/validateKey/'+key, - type: 'GET', - success: function(result){ - window.redbackModel.key=key; - $.log("validateKey#sucess"); - changePasswordBox(false,registration?registration:true,null); - }, - complete: function(){ - // hide spinner - }, - error: function(result) { - $.log("validateKey#error"); - var obj = jQuery.parseJSON(result.responseText); - $.log("validateKey#error response:"+obj); - displayRedbackError(obj); - } - }) - } - -}); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/resource.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/resource.js deleted file mode 100644 index 11bdd309a..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/resource.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -$(function() { - - - Resource=function(identifier,pattern) { - this.identifier=ko.observable(identifier); - this.pattern=ko.observable(pattern); - } - - /** - * @param data Resource response from redback rest api - */ - mapResource=function(data) { - return new Resource(data.identifier,data.pattern); - } - - -}); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js index 749678d87..2efdedc33 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("roles",["jquery","order!utils","i18n","jquery_validate","order!knockout","order!knockout.simpleGrid"], function() { Role = function(name,description,assignable,childRoleNames,parentRoleNames,users,parentsRolesUsers,permissions,otherUsers){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js index b6398d431..56e6e8474 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("user",["jquery","order!utils","i18n","jquery_validate","order!knockout","order!knockout.simpleGrid"], function() { /** * object model for user with some function to create/update/delete users diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js index c1e2b6ad1..6e54b2c61 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("users",["jquery","order!utils","i18n","jquery_validate","order!knockout","order!knockout.simpleGrid"], function() { /** * view model used for users grid -- 2.39.5