mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-27 15:54:36 +02:00
view logs
This commit is contained in:
parent
9193b72d17
commit
c623e9a279
@ -147,10 +147,11 @@ const sfc = {
|
|||||||
d = Math.floor(d / unitValues[i]);
|
d = Math.floor(d / unitValues[i]);
|
||||||
}
|
}
|
||||||
parts.push(d);
|
parts.push(d);
|
||||||
let res = '';
|
let res = '', resCount = 0;
|
||||||
for (let i = parts.length - 1; i >= 0; i--) {
|
for (let i = parts.length - 1; i >= 0 && resCount < 2; i--) {
|
||||||
if (parts[i] > 0) {
|
if (parts[i] > 0) {
|
||||||
res += parts[i] + unitNames[i] + ' ';
|
res += parts[i] + unitNames[i] + ' ';
|
||||||
|
resCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!res) return '0s';
|
if (!res) return '0s';
|
||||||
@ -185,24 +186,27 @@ const sfc = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// the respData has the fields
|
// the respData has the following fields:
|
||||||
// stateData: it's stored into Vue data and used to update the UI state
|
// * stateData: it will be stored into Vue data and used to update the UI state
|
||||||
// logsData: the logs in it will be appended to the UI manually, no touch to Vue data
|
// * logsData: the logs in it will be appended to the UI manually, no touch to Vue data
|
||||||
fetchMockData(reqData) {
|
fetchMockData(reqData) {
|
||||||
const stateData = {
|
const stateData = {
|
||||||
buildInfo: {title: 'The Demo Build'},
|
buildInfo: {title: 'The Demo Build'},
|
||||||
allJobGroups: [
|
allJobGroups: [
|
||||||
{
|
{
|
||||||
summary: 'Job Group Foo',
|
summary: 'Job Group Foo',
|
||||||
jobs: [{id: 1, name: 'Job A', status: 'success'}, {id: 2, name: 'Job B', status: 'error'}]
|
jobs: [
|
||||||
|
{id: 1, name: 'Job A', status: 'success'},
|
||||||
|
{id: 2, name: 'Job B', status: 'error'},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
summary: 'Job Group Bar',
|
summary: 'Job Group Bar',
|
||||||
jobs: [{id: 3, name: 'Job X', status: 'skipped'}, {id: 4, name: 'Job Y', status: 'waiting'}, {
|
jobs: [
|
||||||
id: 5,
|
{id: 3, name: 'Job X', status: 'skipped'},
|
||||||
name: 'Job Z',
|
{id: 4, name: 'Job Y', status: 'waiting'},
|
||||||
status: 'running'
|
{id: 5, name: 'Job Z', status: 'running'},
|
||||||
}]
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
currentJobInfo: {title: 'the job title', detail: 'succeeded 3 hours ago in 11s'},
|
currentJobInfo: {title: 'the job title', detail: 'succeeded 3 hours ago in 11s'},
|
||||||
@ -211,7 +215,7 @@ const sfc = {
|
|||||||
{summary: 'Job Step 2', duration: 2, status: 'error'},
|
{summary: 'Job Step 2', duration: 2, status: 'error'},
|
||||||
{summary: 'Job Step 3', duration: 64, status: 'skipped'},
|
{summary: 'Job Step 3', duration: 64, status: 'skipped'},
|
||||||
{summary: 'Job Step 4', duration: 3600 + 60, status: 'waiting'},
|
{summary: 'Job Step 4', duration: 3600 + 60, status: 'waiting'},
|
||||||
{summary: 'Job Step 5', duration: 86400 + 1, status: 'running'},
|
{summary: 'Job Step 5', duration: 86400 + 60 + 1, status: 'running'},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const logsData = {
|
const logsData = {
|
||||||
@ -220,11 +224,11 @@ const sfc = {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// prepare mock data for logs
|
||||||
for (const reqCursor of reqData.stepLogCursors) {
|
for (const reqCursor of reqData.stepLogCursors) {
|
||||||
if (!reqCursor.expanded) continue;
|
if (!reqCursor.expanded) continue; // backend can decide whether send logs for a step
|
||||||
// if (reqCursor.cursor > 100) continue;
|
// if (reqCursor.cursor > 100) continue;
|
||||||
const stepIndex = reqCursor.stepIndex;
|
let cursor = reqCursor.cursor; // use cursor to send remaining logs
|
||||||
let cursor = reqCursor.cursor;
|
|
||||||
const lines = [];
|
const lines = [];
|
||||||
for (let i = 0; i < 110; i++) {
|
for (let i = 0; i < 110; i++) {
|
||||||
lines.push({
|
lines.push({
|
||||||
@ -234,8 +238,9 @@ const sfc = {
|
|||||||
});
|
});
|
||||||
cursor++;
|
cursor++;
|
||||||
}
|
}
|
||||||
logsData.streamingLogs.push({stepIndex, cursor, lines});
|
logsData.streamingLogs.push({stepIndex: reqCursor.stepIndex, cursor, lines});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {stateData, logsData};
|
return {stateData, logsData};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -414,12 +419,12 @@ export function initRepositoryBuildView() {
|
|||||||
}
|
}
|
||||||
log-time {
|
log-time {
|
||||||
color: #777;
|
color: #777;
|
||||||
margin-left: 16px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
log-msg {
|
log-msg {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
margin-left: 16px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user