4687 |
26 Feb 18 |
nicklas |
var Cleanup = function() |
4687 |
26 Feb 18 |
nicklas |
2 |
{ |
4687 |
26 Feb 18 |
nicklas |
var cleanup = {}; |
4687 |
26 Feb 18 |
nicklas |
var debug = 0; |
4687 |
26 Feb 18 |
nicklas |
5 |
|
4687 |
26 Feb 18 |
nicklas |
cleanup.initPage = function() |
4687 |
26 Feb 18 |
nicklas |
7 |
{ |
4687 |
26 Feb 18 |
nicklas |
// Navigation |
4687 |
26 Feb 18 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
4687 |
26 Feb 18 |
nicklas |
10 |
|
4687 |
26 Feb 18 |
nicklas |
// Final registration |
4687 |
26 Feb 18 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', cleanup.submit); |
4687 |
26 Feb 18 |
nicklas |
13 |
|
4687 |
26 Feb 18 |
nicklas |
var url = '../Admin.servlet?ID='+App.getSessionId(); |
4687 |
26 Feb 18 |
nicklas |
url += '&cmd=GetSecondayAnalysisCleanupCount'; |
4687 |
26 Feb 18 |
nicklas |
Wizard.showLoadingAnimation('Checking for items in the trashcan...'); |
4687 |
26 Feb 18 |
nicklas |
Wizard.asyncJsonRequest(url, cleanup.countDone); |
4687 |
26 Feb 18 |
nicklas |
18 |
} |
4687 |
26 Feb 18 |
nicklas |
19 |
|
4687 |
26 Feb 18 |
nicklas |
cleanup.countDone = function(response) |
4687 |
26 Feb 18 |
nicklas |
21 |
{ |
4687 |
26 Feb 18 |
nicklas |
var countDerivedBioAssays = response.countDerivedBioAssays; |
4687 |
26 Feb 18 |
nicklas |
var countDerivedBioAssayChildren = response.countDerivedBioAssayChildren; |
4687 |
26 Feb 18 |
nicklas |
var countRawBioAssays = response.countRawBioAssays; |
4687 |
26 Feb 18 |
nicklas |
Doc.element('countDerivedBioAssays').innerHTML = countDerivedBioAssays; |
4687 |
26 Feb 18 |
nicklas |
Doc.element('countRawBioAssays').innerHTML = countRawBioAssays; |
4687 |
26 Feb 18 |
nicklas |
Doc.element('countDerivedBioAssayChildren').innerHTML = countDerivedBioAssayChildren; |
5581 |
21 Aug 19 |
nicklas |
Doc.element('countFiles').innerHTML = response.countFiles; |
4687 |
26 Feb 18 |
nicklas |
Doc.show('step-1'); |
4687 |
26 Feb 18 |
nicklas |
30 |
|
4687 |
26 Feb 18 |
nicklas |
if (countRawBioAssays > 0 || countDerivedBioAssays > 0) |
4687 |
26 Feb 18 |
nicklas |
32 |
{ |
4687 |
26 Feb 18 |
nicklas |
Doc.show('goregister'); |
4687 |
26 Feb 18 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Ok, I\'m sure. Let\'s delete them!'); |
4687 |
26 Feb 18 |
nicklas |
35 |
} |
4687 |
26 Feb 18 |
nicklas |
36 |
} |
4687 |
26 Feb 18 |
nicklas |
37 |
|
4687 |
26 Feb 18 |
nicklas |
38 |
|
4687 |
26 Feb 18 |
nicklas |
cleanup.submit = function() |
4687 |
26 Feb 18 |
nicklas |
40 |
{ |
4687 |
26 Feb 18 |
nicklas |
// Get permission information |
4687 |
26 Feb 18 |
nicklas |
var url = '../Admin.servlet?ID='+App.getSessionId(); |
4687 |
26 Feb 18 |
nicklas |
url += '&cmd=SecondaryAnalysisCleanup'; |
4687 |
26 Feb 18 |
nicklas |
44 |
|
4687 |
26 Feb 18 |
nicklas |
Wizard.showLoadingAnimation('Deleting...', 'secondary-cleanup-progress'); |
4687 |
26 Feb 18 |
nicklas |
Wizard.asyncJsonRequest(url, cleanup.deleteDone, 'POST'); |
4687 |
26 Feb 18 |
nicklas |
47 |
} |
4687 |
26 Feb 18 |
nicklas |
48 |
|
4687 |
26 Feb 18 |
nicklas |
cleanup.deleteDone = function(response) |
4687 |
26 Feb 18 |
nicklas |
50 |
{ |
4687 |
26 Feb 18 |
nicklas |
Wizard.showFinalMessage(response.messages); |
4687 |
26 Feb 18 |
nicklas |
52 |
} |
4687 |
26 Feb 18 |
nicklas |
53 |
|
4687 |
26 Feb 18 |
nicklas |
return cleanup; |
4687 |
26 Feb 18 |
nicklas |
55 |
}(); |
4687 |
26 Feb 18 |
nicklas |
56 |
|
4687 |
26 Feb 18 |
nicklas |
Doc.onLoad(Cleanup.initPage); |
4687 |
26 Feb 18 |
nicklas |
58 |
|