Author: tveronezi
Date: Thu Jun 14 18:09:49 2012
New Revision: 1350353
URL: http://svn.apache.org/viewvc?rev=1350353&view=rev
Log:
https://issues.apache.org/jira/browse/TOMEE-228
* loading deployed names
* deployed apps panel is using the Panel bbar
* moved deployed apps code to an external js file
Added:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/panels/Applications.js
Modified:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/servlet/DeployServlet.java
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationController.js
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationModel.js
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/ApplicationViewApps.js
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/components/Panel.js
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html
Modified:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/servlet/DeployServlet.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/servlet/DeployServlet.java?rev=1350353&r1=1350352&r2=1350353&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/servlet/DeployServlet.java
(original)
+++
openejb/trunk/openejb/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/servlet/DeployServlet.java
Thu Jun 14 18:09:49 2012
@@ -17,9 +17,12 @@
package org.apache.tomee.webapp.servlet;
+import org.apache.openejb.AppContext;
import org.apache.openejb.assembler.Deployer;
import org.apache.openejb.assembler.DeployerEjb;
import org.apache.openejb.assembler.classic.AppInfo;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.spi.ContainerSystem;
import org.apache.openejb.util.LogCategory;
import org.apache.openejb.util.Logger;
import org.apache.tomee.webapp.JsonExecutor;
@@ -30,6 +33,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
public class DeployServlet extends HttpServlet {
@@ -56,4 +61,22 @@ public class DeployServlet extends HttpS
}
});
}
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
+ JsonExecutor.execute(req, resp, new JsonExecutor.Executor() {
+ @Override
+ public void call(Map<String, Object> json) throws Exception {
+ final ContainerSystem containerSystem =
SystemInstance.get().getComponent(ContainerSystem.class);
+ final List<AppContext> apps = containerSystem.getAppContexts();
+
+ final List<String> uids = new ArrayList<String>();
+ json.put("uids", uids);
+
+ for (AppContext appContext : apps) {
+ uids.add(appContext.getId());
+ }
+ }
+ });
+ }
}
Modified:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationController.js
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationController.js?rev=1350353&r1=1350352&r2=1350353&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationController.js
(original)
+++
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationController.js
Thu Jun 14 18:09:49 2012
@@ -45,7 +45,7 @@ TOMEE.ApplicationController = function (
channel.bind('default.ajax.error.handler.triggered', function (params) {
TOMEE.ErrorPanel({
- channel: channel
+ channel:channel
}).show(params);
});
@@ -151,8 +151,11 @@ TOMEE.ApplicationController = function (
});
channel.bind('app.deployment.result', function (params) {
- //TODO Implement me
- throw "app.deployment.result not implemented";
+ model.loadDeployedApps();
+ });
+
+ channel.bind('app.new.deployment.data', function (params) {
+ appsView.loadDeployeApps(params);
});
})();
@@ -217,6 +220,7 @@ TOMEE.ApplicationController = function (
model.loadJndi({
path:['']
});
+ model.loadDeployedApps();
return {
Modified:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationModel.js
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationModel.js?rev=1350353&r1=1350352&r2=1350353&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationModel.js
(original)
+++
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/ApplicationModel.js
Thu Jun 14 18:09:49 2012
@@ -74,6 +74,15 @@ TOMEE.ApplicationModel = function (cfg)
}
});
},
+ loadDeployedApps: function() {
+ request({
+ method:'GET',
+ url:TOMEE.baseURL('deploy'),
+ success:function (data) {
+ channel.send('app.new.deployment.data', data);
+ }
+ });
+ },
loadSystemInfo:function (callback) {
request({
method:'GET',
Modified:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/ApplicationViewApps.js
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/ApplicationViewApps.js?rev=1350353&r1=1350352&r2=1350353&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/ApplicationViewApps.js
(original)
+++
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/ApplicationViewApps.js
Thu Jun 14 18:09:49 2012
@@ -45,104 +45,9 @@ TOMEE.ApplicationViewApps = function (cf
]
});
- var deployments = (function () {
- var panel = TOMEE.components.Panel({
- title:TOMEE.I18N.get('application.deployments'),
- avoidOverflow:true
- });
-
-
- var table = TOMEE.components.Table({
- channel:channel,
- columns:['appName']
- });
-
- var map = TOMEE.el.getElMap({
- elName:'main',
- tag:'div',
- attributes:{
- style:'height: 220px;'
- },
- children:[
- table
- ]
- });
-
- var content = panel.getContentEl();
- content.append(map.main);
-
- var fileForm = null;
- (function () {
- var fileUploadedHandler = function (event) {
- fileForm.myFrame.unbind('load', fileUploadedHandler);
- var text = TOMEE.utils.getSafe(function () {
- return
fileForm.myFrame.contents().first()[0].body.innerText;
- }, '');
-
- var json = jQuery.parseJSON(text);
-
- channel.send('deploy.file.uploaded', json);
- };
-
- var frameId = TOMEE.Sequence.next('uploadFrame');
- fileForm = TOMEE.el.getElMap({
- elName:'main',
- tag:'form',
- attributes:{
- style:'background-color:#EEE; border-top: 1px solid
#E5E5E5; height: 30px;margin-bottom: 0px;',
- method:'post',
- enctype:'multipart/form-data',
- action:TOMEE.baseURL('upload'),
- target:frameId
- },
- children:[
- {
- elName:'myFrame',
- tag:'iframe',
- attributes:{
- id:frameId,
- style:'display: none'
- }
- },
- {
- elName:'fileField',
- tag:'input',
- attributes:{
- style:'padding-left: 5px; float: left; position:
relative;',
- type:'file',
- name:'file'
- },
- listeners:{
- 'change':function (event) {
- fileForm.myFrame.bind('load',
fileUploadedHandler);
- fileForm.main.submit();
- }
- }
- }
- ]
- });
-
- content.append(fileForm.main);
- })();
-
- return {
- getEl:function () {
- return panel.getEl();
- },
- load:function (data) {
- table.load(data, function (bean) {
- return [bean.name, bean.value];
- });
- },
- setHeight: function(height) {
- panel.setHeight(height);
-
- var myHeight = panel.getContentEl().height() -
TOMEE.el.getBorderSize(panel.getContentEl()) - (2 *
TOMEE.el.getBorderSize(fileForm.main)) - fileForm.fileField.height();
- map.main.height(myHeight);
- }
- };
- })();
-
+ var deployments = TOMEE.Applications({
+ channel:channel
+ });
var log = (function () {
var panel = TOMEE.components.Panel({
@@ -156,7 +61,7 @@ TOMEE.ApplicationViewApps = function (cf
getEl:function () {
return panel.getEl();
},
- setHeight: function(height) {
+ setHeight:function (height) {
panel.setHeight(height);
}
};
@@ -183,6 +88,9 @@ TOMEE.ApplicationViewApps = function (cf
getEl:function () {
return elMapContent.main;
},
- setHeight:setHeight
+ setHeight:setHeight,
+ loadDeployeApps:function (data) {
+ deployments.loadDeployeApps(data);
+ }
};
};
\ No newline at end of file
Modified:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/components/Panel.js
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/components/Panel.js?rev=1350353&r1=1350352&r2=1350353&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/components/Panel.js
(original)
+++
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/components/Panel.js
Thu Jun 14 18:09:49 2012
@@ -97,6 +97,19 @@ TOMEE.components.Panel = function (cfg)
};
if (cfg.bbar) {
(function () {
+
+ var style = 'margin-bottom: 0px;'
+ var formAttributes = {
+ style:style
+ };
+ if (cfg.bbarFormAttributes) {
+ formAttributes = cfg.bbarFormAttributes;
+ if (!formAttributes.style) {
+ formAttributes.style = style;
+ }
+ }
+
+
var childrenDiv = [];
var footerCfg = {
elName:'footer',
@@ -104,11 +117,10 @@ TOMEE.components.Panel = function (cfg)
cls:'modal-footer',
children:[
{
+ elName:'bbarForm',
tag:'form',
cls:'form-inline',
- attributes:{
- style:'margin-bottom: 0px;'
- },
+ attributes:formAttributes,
children:childrenDiv
}
]
@@ -190,6 +202,9 @@ TOMEE.components.Panel = function (cfg)
};
return {
+ getBbarForm:function () {
+ return map.bbarForm;
+ },
setTitle:function (title) {
map['appName'].html(title);
},
Added:
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/panels/Applications.js
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/panels/Applications.js?rev=1350353&view=auto
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/panels/Applications.js
(added)
+++
openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/application/js/view/panels/Applications.js
Thu Jun 14 18:09:49 2012
@@ -0,0 +1,111 @@
+/**
+ *
+ * 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.
+ */
+
+TOMEE.Applications = function (cfg) {
+ "use strict";
+
+ var channel = cfg.channel;
+
+ var frameId = TOMEE.Sequence.next('uploadFrame');
+
+ var panel = TOMEE.components.Panel({
+ title:TOMEE.I18N.get('application.deployments'),
+ avoidOverflow:true,
+ bbar:[
+ {
+ elName:'myFrame',
+ tag:'iframe',
+ attributes:{
+ id:frameId,
+ style:'display: none'
+ }
+ },
+ {
+ elName:'fileField',
+ tag:'input',
+ attributes:{
+ //style:'padding-left: 5px; float: left; position:
relative;',
+ type:'file',
+ name:'file'
+ },
+ listeners:{
+ 'change':function (event) {
+ panel.getElement('myFrame').bind('load',
fileUploadedHandler);
+ panel.getBbarForm().submit();
+ }
+ }
+ }
+ ],
+ bbarFormAttributes:{
+ method:'post',
+ enctype:'multipart/form-data',
+ action:TOMEE.baseURL('upload'),
+ target:frameId
+ }
+ });
+
+ var table = TOMEE.components.Table({
+ channel:channel,
+ columns:['appName']
+ });
+
+ var map = TOMEE.el.getElMap({
+ elName:'main',
+ tag:'div',
+ attributes:{
+ style:'height: 220px;'
+ },
+ children:[
+ {
+ el:table.getEl()
+ }
+ ]
+ });
+
+ var content = panel.getContentEl();
+ content.append(map.main);
+
+
+ var fileUploadedHandler = function (event) {
+ panel.getElement('myFrame').unbind('load', fileUploadedHandler);
+ var text = TOMEE.utils.getSafe(function () {
+ return
panel.getElement('myFrame').contents().first()[0].body.innerText;
+ }, '');
+
+ var json = jQuery.parseJSON(text);
+
+ channel.send('deploy.file.uploaded', json);
+ };
+
+ return {
+ getEl:function () {
+ return panel.getEl();
+ },
+ loadDeployeApps:function (data) {
+ table.load(data.uids, function (bean) {
+ return bean;
+ });
+ },
+ setHeight:function (height) {
+ panel.setHeight(height);
+
+ var myHeight = panel.getContentEl().height() -
TOMEE.el.getBorderSize(panel.getContentEl());
+ map.main.height(myHeight);
+ }
+ };
+};
\ No newline at end of file
Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html?rev=1350353&r1=1350352&r2=1350353&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html
(original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/index.html Thu Jun
14 18:09:49 2012
@@ -39,6 +39,7 @@
<script src="application/js/view/panels/JndiClass.js"></script>
<script src="application/js/view/panels/Saved.js"></script>
<script src="application/js/view/panels/Console.js"></script>
+ <script src="application/js/view/panels/Applications.js"></script>
</head>
<body></body>