Files
web-doc-editor/js/ui/task/SystemUpdateTask.js
Peter Kokot f06fee3640 Sync final newlines
This patch adds some missing newlines and trims multiple final newlines
into a single newline.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-02 03:44:40 +02:00

126 lines
3.9 KiB
JavaScript

Ext.namespace('ui','ui.task','ui.task._SystemUpdateTask');
ui.task._SystemUpdateTask.refresh_ui = function()
{
Ext.get('wizard-step-3').replaceClass('wizard-step-before', 'wizard-step-working');
PhDOE.reloadAllStore();
Ext.get('wizard-step-3').replaceClass('wizard-step-working', 'wizard-step-done');
// Re-enable Finish button
Ext.getCmp('btn-start-refresh').setIconClass('iconFinishRefresh');
Ext.getCmp('btn-start-refresh').setText(_('Finish !'));
Ext.getCmp('btn-start-refresh').setHandler(function()
{
Ext.getCmp('sys-update-win').close();
});
Ext.getCmp('btn-start-refresh').enable();
// Re-enable TaskPing
ui.task.PingTask.getInstance().delay(30000);
// Re-enable win's close button
Ext.getCmp('sys-update-win').tools.close.setVisible(true);
};
ui.task._SystemUpdateTask.poll_apply_tool = new Ext.util.DelayedTask(function()
{
XHR({
params : {
task : 'checkLockFile',
lockFile : 'project_' + PhDOE.project + '_lock_apply_tools'
},
success : function()
{
ui.task._SystemUpdateTask.poll_apply_tool.delay(5000);
},
failure : function(r)
{
var o = Ext.util.JSON.decode(r.responseText);
if (o && o.success === false) {
Ext.get('wizard-step-2').replaceClass('wizard-step-working', 'wizard-step-done');
new ui.task._SystemUpdateTask.refresh_ui();
} else {
ui.task._SystemUpdateTask.poll_apply_tool.delay(5000);
}
}
});
});
ui.task._SystemUpdateTask.apply_tool = function()
{
Ext.get('wizard-step-2').replaceClass('wizard-step-before', 'wizard-step-working');
XHR({
params : {
task: 'applyTools'
},
success : function()
{
Ext.get('wizard-step-2').replaceClass('wizard-step-working', 'wizard-step-done');
new ui.task._SystemUpdateTask.refresh_ui();
},
failure : function()
{
ui.task._SystemUpdateTask.poll_apply_tool.delay(5000);
}
});
};
ui.task._SystemUpdateTask.vcs_poll = new Ext.util.DelayedTask(function()
{
XHR({
params : {
task : 'checkLockFile',
lockFile : 'project_' + PhDOE.project + '_lock_update_repository'
},
success : function()
{
ui.task._SystemUpdateTask.vcs_poll.delay(5000);
},
failure : function(r)
{
var o = Ext.util.JSON.decode(r.responseText);
if (o && o.success === false) {
Ext.get('wizard-step-1').replaceClass('wizard-step-working', 'wizard-step-done');
Ext.get('wizard-step-1.1').replaceClass('wizard-show', 'wizard-wait');
new ui.task._SystemUpdateTask.apply_tool();
} else {
ui.task._SystemUpdateTask.vcs_poll.delay(5000);
}
}
});
});
ui.task.SystemUpdateTask = function()
{
ui.task.PingTask.getInstance().cancel();
Ext.get('wizard-step-1').replaceClass('wizard-step-before', 'wizard-step-working');
Ext.get('wizard-step-1.1').replaceClass('wizard-wait', 'wizard-show');
XHR({
params : { task : 'updateRepository' },
success : function()
{
Ext.get('wizard-step-1').replaceClass('wizard-step-working', 'wizard-step-done');
Ext.get('wizard-step-1.1').replaceClass('wizard-show', 'wizard-wait');
new ui.task._SystemUpdateTask.apply_tool();
},
failure: function(r)
{
var o = Ext.util.JSON.decode(r.responseText);
if (o && o.success === false) {
Ext.getCmp('sys-update-win').close();
PhDOE.winForbidden(o.type);
} else {
ui.task._SystemUpdateTask.vcs_poll.delay(5000);
}
}
});
};