PR#4154: Reformat watchlogs.js indentation for consistency
Merges #4154 https://pagure.io/koji/pull-request/4154 Related #4187 https://pagure.io/koji/issue/4187
This commit is contained in:
commit
dc3eeded53
7 changed files with 135 additions and 108 deletions
27
.editorconfig
Normal file
27
.editorconfig
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Topmost editorconfig for project, don't ascend
|
||||
# to parent directories when scanning configs
|
||||
root = true
|
||||
|
||||
# All files: UTF-8 with Unix-style newlines,
|
||||
# no trailing whitespace, and a final newline
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
# JavaScript, CSS, Python, shell: 4-space indents
|
||||
[{**/*.{js,css,py,sh},runtests,cli/koji,vm/kojivmd}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Makefile: tab indents
|
||||
[**/Makefile]
|
||||
indent_style = tab
|
||||
tab_width = 8
|
||||
|
||||
# CHTML: 2-space indents
|
||||
[**/*.chtml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ case "$1" in
|
|||
[ -f /var/lock/subsys/kojira ] && restart || :
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ case "$1" in
|
|||
graceful
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|graceful}"
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|graceful}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
<tr>
|
||||
<th>Tags using this external repo</th>
|
||||
<td>
|
||||
#if $len($repoTags)
|
||||
#for $tag in $repoTags
|
||||
<a href="taginfo?tagID=$tag.tag_id">$util.escapeHTML($tag.tag_name)</a><br/>
|
||||
#end for
|
||||
#else
|
||||
No tags
|
||||
#end if
|
||||
#if $len($repoTags)
|
||||
#for $tag in $repoTags
|
||||
<a href="taginfo?tagID=$tag.tag_id">$util.escapeHTML($tag.tag_name)</a><br/>
|
||||
#end for
|
||||
#else
|
||||
No tags
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -10,24 +10,24 @@
|
|||
#if $tag
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<table class="nested">
|
||||
<tr><td>
|
||||
<table class="nested">
|
||||
<tr><td>
|
||||
<strong>Inherited</strong>:
|
||||
</td><td>
|
||||
</td><td>
|
||||
<select name="inherited" class="filterlist" onchange="javascript: window.location = 'packages?inherited=' + this.value + '$util.passthrough_except($self, 'inherited')';">
|
||||
<option value="1" #if $inherited then 'selected="selected"' else ''#>yes</option>
|
||||
<option value="0" #if not $inherited then 'selected="selected"' else ''#>no</option>
|
||||
</select>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<strong>With blocked</strong>:
|
||||
</td><td>
|
||||
</td><td>
|
||||
<select name="blocked" class="filterlist" onchange="javascript: window.location = 'packages?blocked=' + this.value + '$util.passthrough_except($self, 'blocked')';">
|
||||
<option value="1" #if $blocked then 'selected="selected"' else ''#>yes</option>
|
||||
<option value="0" #if not $blocked then 'selected="selected"' else ''#>no</option>
|
||||
</select>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</tr>
|
||||
#end if
|
||||
<tr>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
#else
|
||||
<a href="packages?prefix=$char$util.passthrough($self, 'userID', 'tagID', 'order', 'inherited', 'blocked')">$char</a>
|
||||
#end if
|
||||
|
|
||||
|
|
||||
#end for
|
||||
#if $prefix
|
||||
<a href="packages?${util.passthrough($self, 'userID', 'tagID', 'order', 'inherited', 'blocked')[1:]}">all</a>
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@
|
|||
<tr>
|
||||
<th>External repos</th>
|
||||
<td>
|
||||
#for $external_repo in $external_repos
|
||||
<a href="externalrepoinfo?extrepoID=$external_repo.external_repo_id">$util.escapeHTML($external_repo.external_repo_name)</a> [$external_repo.merge_mode]
|
||||
#if $external_repo.tag_id != $tag.id
|
||||
<span class="smaller">(inherited from <a href="taginfo?tagID=$external_repo.tag_id">$util.escapeHTML($external_repo.tag_name)</a>)</span>
|
||||
#end if
|
||||
<br/>
|
||||
#end for
|
||||
#for $external_repo in $external_repos
|
||||
<a href="externalrepoinfo?extrepoID=$external_repo.external_repo_id">$util.escapeHTML($external_repo.external_repo_name)</a> [$external_repo.merge_mode]
|
||||
#if $external_repo.tag_id != $tag.id
|
||||
<span class="smaller">(inherited from <a href="taginfo?tagID=$external_repo.tag_id">$util.escapeHTML($external_repo.tag_name)</a>)</span>
|
||||
#end if
|
||||
<br/>
|
||||
#end for
|
||||
</td>
|
||||
</tr>
|
||||
#end if
|
||||
|
|
|
|||
|
|
@ -39,62 +39,62 @@ function maybeScroll(origHeight) {
|
|||
function handleStatus(event) {
|
||||
req = event.target;
|
||||
if (req.readyState != 4) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (req.status == 200) {
|
||||
if (req.responseText.length > 0) {
|
||||
var lines = req.responseText.split("\n");
|
||||
var line = lines[0];
|
||||
var data = line.split(":");
|
||||
// var taskID = parseInt(data[0]);
|
||||
var state = data[1];
|
||||
var logs = {};
|
||||
for (var i = 1; i < lines.length; i++) {
|
||||
data = lines[i].split(":");
|
||||
var filename = data[0] + ":" + data[1];
|
||||
var filesize = parseInt(data[2]);
|
||||
if (filename.indexOf(".log") != -1) {
|
||||
logs[filename] = filesize;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// task may not have started yet
|
||||
var state = "UNKNOWN";
|
||||
var logs = {};
|
||||
}
|
||||
currentInfo = {state: state, logs: logs};
|
||||
if (!(state == "FREE" || state == "OPEN" ||
|
||||
state == "ASSIGNED" || state == "UNKNOWN")) {
|
||||
// remove tasks from the task list that are no longer running
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
if (tasks[i] == currentTaskID) {
|
||||
tasks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (req.responseText.length > 0) {
|
||||
var lines = req.responseText.split("\n");
|
||||
var line = lines[0];
|
||||
var data = line.split(":");
|
||||
// var taskID = parseInt(data[0]);
|
||||
var state = data[1];
|
||||
var logs = {};
|
||||
for (var i = 1; i < lines.length; i++) {
|
||||
data = lines[i].split(":");
|
||||
var filename = data[0] + ":" + data[1];
|
||||
var filesize = parseInt(data[2]);
|
||||
if (filename.indexOf(".log") != -1) {
|
||||
logs[filename] = filesize;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// task may not have started yet
|
||||
var state = "UNKNOWN";
|
||||
var logs = {};
|
||||
}
|
||||
currentInfo = {state: state, logs: logs};
|
||||
if (!(state == "FREE" || state == "OPEN" ||
|
||||
state == "ASSIGNED" || state == "UNKNOWN")) {
|
||||
// remove tasks from the task list that are no longer running
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
if (tasks[i] == currentTaskID) {
|
||||
tasks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currentInfo = {state: "UNKNOWN", logs: {}};
|
||||
popupError("Error checking status of task " + currentTaskID + ": " + req.statusText);
|
||||
currentInfo = {state: "UNKNOWN", logs: {}};
|
||||
popupError("Error checking status of task " + currentTaskID + ": " + req.statusText);
|
||||
}
|
||||
currentLogs = [];
|
||||
for (var logname in currentInfo.logs) {
|
||||
currentLogs.push(logname);
|
||||
currentLogs.push(logname);
|
||||
}
|
||||
processLog();
|
||||
}
|
||||
|
||||
function getStatus() {
|
||||
if (tasksToProcess.length == 0) {
|
||||
if (errorCount > MAX_ERRORS) {
|
||||
return;
|
||||
} else {
|
||||
if (headerElement != null) {
|
||||
headerElement.appendChild(document.createTextNode("."));
|
||||
}
|
||||
setTimeout(checkTasks, 5000);
|
||||
return;
|
||||
}
|
||||
if (errorCount > MAX_ERRORS) {
|
||||
return;
|
||||
} else {
|
||||
if (headerElement != null) {
|
||||
headerElement.appendChild(document.createTextNode("."));
|
||||
}
|
||||
setTimeout(checkTasks, 5000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
currentTaskID = tasksToProcess.shift();
|
||||
|
|
@ -106,27 +106,27 @@ function getStatus() {
|
|||
|
||||
function checkTasks() {
|
||||
if (tasks.length == 0) {
|
||||
docHeight = document.body.clientHeight;
|
||||
docHeight = document.body.clientHeight;
|
||||
logElement.appendChild(document.createTextNode("\n==> Task has completed <==\n"));
|
||||
maybeScroll(docHeight);
|
||||
} else {
|
||||
tasksToProcess = [];
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
tasksToProcess.push(tasks[i]);
|
||||
}
|
||||
getStatus();
|
||||
tasksToProcess = [];
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
tasksToProcess.push(tasks[i]);
|
||||
}
|
||||
getStatus();
|
||||
}
|
||||
}
|
||||
|
||||
function processLog() {
|
||||
if (currentLogs.length == 0) {
|
||||
getStatus();
|
||||
return;
|
||||
getStatus();
|
||||
return;
|
||||
}
|
||||
currentLog = currentLogs.shift();
|
||||
var taskOffsets = offsets[currentTaskID];
|
||||
if (!(currentLog in taskOffsets)) {
|
||||
taskOffsets[currentLog] = 0;
|
||||
taskOffsets[currentLog] = 0;
|
||||
}
|
||||
outputLog();
|
||||
}
|
||||
|
|
@ -135,47 +135,47 @@ function outputLog() {
|
|||
var currentOffset = offsets[currentTaskID][currentLog];
|
||||
var currentSize = currentInfo.logs[currentLog];
|
||||
if (currentSize > currentOffset) {
|
||||
var chunkSize = CHUNK_SIZE;
|
||||
if ((currentSize - currentOffset) < chunkSize) {
|
||||
chunkSize = currentSize - currentOffset;
|
||||
}
|
||||
var req = new XMLHttpRequest();
|
||||
var data = currentLog.split(':');
|
||||
var volume = data[0];
|
||||
var filename = data[1];
|
||||
req.open("GET", baseURL + "/getfile?taskID=" + currentTaskID + "&name=" + filename +
|
||||
var chunkSize = CHUNK_SIZE;
|
||||
if ((currentSize - currentOffset) < chunkSize) {
|
||||
chunkSize = currentSize - currentOffset;
|
||||
}
|
||||
var req = new XMLHttpRequest();
|
||||
var data = currentLog.split(':');
|
||||
var volume = data[0];
|
||||
var filename = data[1];
|
||||
req.open("GET", baseURL + "/getfile?taskID=" + currentTaskID + "&name=" + filename +
|
||||
"&volume=" + volume + "&offset=" + currentOffset + "&size=" + chunkSize, true);
|
||||
req.onreadystatechange = handleLog;
|
||||
req.send(null);
|
||||
if (headerElement != null) {
|
||||
logElement.removeChild(headerElement);
|
||||
headerElement = null;
|
||||
}
|
||||
req.onreadystatechange = handleLog;
|
||||
req.send(null);
|
||||
if (headerElement != null) {
|
||||
logElement.removeChild(headerElement);
|
||||
headerElement = null;
|
||||
}
|
||||
} else {
|
||||
processLog();
|
||||
processLog();
|
||||
}
|
||||
}
|
||||
|
||||
function handleLog(event) {
|
||||
req = event.target;
|
||||
if (req.readyState != 4) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (req.status == 200) {
|
||||
content = req.responseText;
|
||||
offsets[currentTaskID][currentLog] += content.length;
|
||||
if (content.length > 0) {
|
||||
docHeight = document.body.clientHeight;
|
||||
currlog = currentTaskID + ":" + currentLog;
|
||||
if (currlog != lastlog) {
|
||||
logElement.appendChild(document.createTextNode("\n==> " + currlog + " <==\n"));
|
||||
lastlog = currlog;
|
||||
}
|
||||
logElement.appendChild(document.createTextNode(content));
|
||||
maybeScroll(docHeight);
|
||||
}
|
||||
content = req.responseText;
|
||||
offsets[currentTaskID][currentLog] += content.length;
|
||||
if (content.length > 0) {
|
||||
docHeight = document.body.clientHeight;
|
||||
currlog = currentTaskID + ":" + currentLog;
|
||||
if (currlog != lastlog) {
|
||||
logElement.appendChild(document.createTextNode("\n==> " + currlog + " <==\n"));
|
||||
lastlog = currlog;
|
||||
}
|
||||
logElement.appendChild(document.createTextNode(content));
|
||||
maybeScroll(docHeight);
|
||||
}
|
||||
} else {
|
||||
popupError("Error retrieving " + currentLog + " for task " + currentTaskID + ": " + req.statusText);
|
||||
popupError("Error retrieving " + currentLog + " for task " + currentTaskID + ": " + req.statusText);
|
||||
}
|
||||
outputLog();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue