Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reqmgr2 code merge #5550

Merged
merged 1 commit into from
Dec 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions bin/wmstats-update-status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
from optparse import OptionParser
from WMCore.Services.WMStats.WMStatsWriter import WMStatsWriter

def updateRequestStatus(couchURL, requestList, status):
ww = WMStatsWriter(couchURL)
for request in requestList:
ww.updateRequestStatus(request, status)
print "%s is udated to %s" % (request, status)

if __name__ == "__main__":
parser = OptionParser()
parser.add_option("--url", dest = "url",
help = "type couch db url")
parser.add_option("--status", dest = "status",
help = "type purge or delete url")
parser.add_option("--requests", dest = "requests",
help = "type last seq")
(options, args) = parser.parse_args()
if options.url:
updateRequestStatus(options.url, options.requests, options.status)
11 changes: 7 additions & 4 deletions src/couchapps/ReqMgr/updates/updaterequest.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// update function
// input: valueKey (what to change), value - new value
function(doc, req)
{
function(doc, req) {
if (doc === null) {
return [null, "Error: document not found"];
};

function updateTransition() {
var currentTS = Math.round((new Date()).getTime() / 1000);
var statusObj = {"Status": doc.RequestStatus, "UpdateTime": currentTS};
var dn = doc.DN || null;
var statusObj = {"Status": doc.RequestStatus, "UpdateTime": currentTS, "DN": dn};

if (!doc.RequestTransition) {
doc.RequestTransition = new Array();
Expand All @@ -30,6 +30,9 @@ function(doc, req)
key == "InputDatasetTypes" ||
key == "InputDatasets" ||
key == "OutputDatasets" ||
key == "CustodialSites" ||
key == "NoneCustodialSites" ||
key == "AutoApproveSubscriptionSites" ||
key == "Teams") {

doc[key] = JSON.parse(newValues[key]);
Expand All @@ -42,4 +45,4 @@ function(doc, req)
}
}
return [doc, "OK"];
}
}
2 changes: 1 addition & 1 deletion src/couchapps/ReqMgr/views/bycampaign/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function(doc) {
if (doc.Campaign){
emit(doc.Camaign, null) ;
emit(doc.Campaign, null) ;
}
}
Binary file added src/html/ReqMgr/img/cms_logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/html/ReqMgr/javascript/ajax_utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function cleanConfirmation () {
var doc = document.getElementById('confirmation');
doc.innerHTML='';
doc.className='';
}
function ajaxRequest(path, parameters) {
// path is an URI binded to certain server method
// parameters is dict of parameters passed to the server function
new Ajax.Updater('response', path,
{ method: 'post' ,
parameters : parameters,
onCreate: function() {
var doc = document.getElementById('confirmation');
doc.innerHTML='Your request has been submitted';
doc.className='tools-alert tools-alert-blue confirmation shadow';
},
onException: function() {
var doc = document.getElementById('confirmation');
doc.innerHTML='ERROR! Your request has been failed';
doc.className='tools-alert tools-alert-red confirmation shadow';
setTimeout(cleanConfirmation, 5000);
},
onComplete : function(response) {
var doc = document.getElementById('confirmation');
if (response.status==200 || response.status==201) {
doc.innerHTML='SUCCESS! Your request has been processed with status '+response.status;
doc.className='tools-alert tools-alert-green confirmation shadow';
} else {
doc.innerHTML='WARNING! Your request has been processed with status '+response.status;
doc.className='tools-alert tools-alert-yellow confirmation shadow';
}
setTimeout(cleanConfirmation, 5000);
}
});
}
Loading