mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7422: Deployment UI changes 7424: Deployment UI changes 7426: Created 'More Actions' menu for user sandboxes and moved various actions into it 7428: Server config UI 7433: Added ability to deploy a workflow sandbox to a test server 7434: Fixed confusing comment 7442: Enabled users with contributor and reviewer roles to reserve a test server and deploy to it 7443: Preparation for auto deployment git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8362 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,3 +1,158 @@
|
||||
Alfresco.DeploymentMonitor = function(ids, pollingFreq, failedMsg, successMsg)
|
||||
{
|
||||
this.ids = ids;
|
||||
this.url = getContextPath() + "/ajax/invoke/DeploymentProgressBean.getStatus?ids=" + this.ids;
|
||||
this.pollingFreq = pollingFreq;
|
||||
this.failedMsg = failedMsg;
|
||||
this.successMsg = successMsg;
|
||||
}
|
||||
|
||||
Alfresco.DeploymentMonitor.prototype =
|
||||
{
|
||||
ids: null,
|
||||
url: null,
|
||||
pollingFreq: 5,
|
||||
failedMsg: null,
|
||||
successMsg: null,
|
||||
|
||||
retrieveDeploymentStatus: function()
|
||||
{
|
||||
YAHOO.util.Connect.asyncRequest('GET', this.url,
|
||||
{
|
||||
success: this.processResults,
|
||||
failure: this.handleError,
|
||||
scope: this
|
||||
},
|
||||
null);
|
||||
},
|
||||
|
||||
processResults: function(ajaxResponse)
|
||||
{
|
||||
var xml = ajaxResponse.responseXML.documentElement;
|
||||
var statuses = xml.getElementsByTagName('target-server');
|
||||
var noInProgress = statuses.length;
|
||||
if (noInProgress > 0)
|
||||
{
|
||||
for (var x = 0; x < noInProgress; x++)
|
||||
{
|
||||
var target = statuses[x];
|
||||
var id = target.getAttribute('id');
|
||||
var finished = target.getAttribute('finished');
|
||||
var url = target.getAttribute('url');
|
||||
var reason = target.getAttribute('reason');
|
||||
if (finished == 'true')
|
||||
{
|
||||
var successful = target.getAttribute('successful');
|
||||
var icon = document.getElementById(id + '_icon');
|
||||
if (icon != null)
|
||||
{
|
||||
var image = (successful == 'true') ? 'successful' : 'failed';
|
||||
icon.src = '/alfresco/images/icons/deploy_' + image + '.gif';
|
||||
}
|
||||
|
||||
var statusElem = document.getElementById(id + '_status');
|
||||
if (statusElem != null)
|
||||
{
|
||||
var msg = (successful == 'true') ? this.successMsg : this.failedMsg;
|
||||
statusElem.innerHTML = msg;
|
||||
}
|
||||
|
||||
var msgElem = document.getElementById(id + '_msg');
|
||||
if (msgElem != null)
|
||||
{
|
||||
if (successful == 'true')
|
||||
{
|
||||
if (url != null && url.length > 0)
|
||||
{
|
||||
msgElem.innerHTML = "<a target='new' href='" + url + "'>" + url + "</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (reason != null && reason.length > 0)
|
||||
{
|
||||
msgElem.innerHTML = "<span style='color: #e00028'>" + reason + "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// there are still outstanding deployments, refresh in a few seconds
|
||||
setTimeout('Alfresco.monitor.retrieveDeploymentStatus()', this.pollingFreq);
|
||||
}
|
||||
},
|
||||
|
||||
handleError: function(ajaxResponse)
|
||||
{
|
||||
handleErrorYahoo(ajaxResponse.status + ' ' + ajaxResponse.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
var deployActionButtonPressed = false;
|
||||
|
||||
Alfresco.checkDeployConfigPage = function()
|
||||
{
|
||||
// make sure the relevant fields are visible for current deploy type
|
||||
Alfresco.deployServerTypeChanged();
|
||||
|
||||
// make sure add/edit button is disabled if no host has been supplied
|
||||
Alfresco.checkDeployConfigButtonState();
|
||||
|
||||
var button = document.getElementById('wizard:wizard-body:deployActionButton');
|
||||
if (button != null)
|
||||
{
|
||||
document.getElementById("wizard").onsubmit = Alfresco.validateDeployConfig;
|
||||
button.onclick = function() {deployActionButtonPressed = true; clear_wizard();}
|
||||
document.getElementById('wizard:wizard-body:deployServerHost').focus();
|
||||
}
|
||||
}
|
||||
|
||||
Alfresco.checkDeployConfigButtonState = function()
|
||||
{
|
||||
var host = document.getElementById('wizard:wizard-body:deployServerHost');
|
||||
var button = document.getElementById('wizard:wizard-body:deployActionButton');
|
||||
|
||||
if (button != null)
|
||||
{
|
||||
if (host != null && host.value.length == 0)
|
||||
{
|
||||
button.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
button.disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Alfresco.validateDeployConfig = function()
|
||||
{
|
||||
if (deployActionButtonPressed)
|
||||
{
|
||||
deployActionButtonPressed = false;
|
||||
|
||||
var valid = true;
|
||||
var port = document.getElementById('wizard:wizard-body:deployServerPort');
|
||||
|
||||
if (port != null && port.value.length > 0)
|
||||
{
|
||||
if (isNaN(port.value))
|
||||
{
|
||||
alert(MSG_PORT_MUST_BE_NUMBER);
|
||||
port.focus();
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Alfresco.deployServerTypeChanged = function()
|
||||
{
|
||||
var typeDropDown = document.getElementById('wizard:wizard-body:deployServerType');
|
||||
@@ -33,4 +188,29 @@ Alfresco.deployServerTypeChanged = function()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Alfresco.toggleDeploymentDetails = function(icon, server)
|
||||
{
|
||||
var currentState = icon.className;
|
||||
var detailsDiv = document.getElementById(server + '-deployment-details');
|
||||
if (currentState == 'collapsed')
|
||||
{
|
||||
icon.src = getContextPath() + '/images/icons/expanded.gif';
|
||||
icon.className = 'expanded';
|
||||
if (detailsDiv != null)
|
||||
{
|
||||
detailsDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
icon.src = getContextPath() + '/images/icons/collapsed.gif';
|
||||
icon.className = 'collapsed';
|
||||
if (detailsDiv != null)
|
||||
{
|
||||
detailsDiv.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user