1
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-04-18 00:47:48 -04:00

chore: lint front

This commit is contained in:
Jason Song 2022-11-25 22:26:10 +08:00
parent 02fac6b5f0
commit 6af809d0bd
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5
2 changed files with 20 additions and 17 deletions

View File

@ -6,11 +6,11 @@
</div> </div>
<div class="job-group-section" v-for="(jobGroup, i) in allJobGroups" :key="i"> <div class="job-group-section" v-for="(jobGroup, i) in allJobGroups" :key="i">
<!-- <div class="job-group-summary">--> <!-- <div class="job-group-summary">-->
<!-- {{ jobGroup.summary }}--> <!-- {{ jobGroup.summary }}-->
<!-- </div>--> <!-- </div>-->
<div class="job-brief-list"> <div class="job-brief-list">
<a class="job-brief-item" v-for="(job, index) in jobGroup.jobs" :key="job.id" v-bind:href="buildInfo.htmlurl+'/jobs/'+index"> <a class="job-brief-item" v-for="(job, index) in jobGroup.jobs" :key="job.id" :href="buildInfo.htmlurl+'/jobs/'+index">
<SvgIcon name="octicon-check-circle-fill" class="green" v-if="job.status === 'success'"/> <SvgIcon name="octicon-check-circle-fill" class="green" v-if="job.status === 'success'"/>
<SvgIcon name="octicon-skip" class="ui text grey" v-else-if="job.status === 'skipped'"/> <SvgIcon name="octicon-skip" class="ui text grey" v-else-if="job.status === 'skipped'"/>
<SvgIcon name="octicon-clock" class="ui text yellow" v-else-if="job.status === 'waiting'"/> <SvgIcon name="octicon-clock" class="ui text yellow" v-else-if="job.status === 'waiting'"/>
@ -23,7 +23,9 @@
</button> </button>
</a> </a>
</div> </div>
<button class="ui fluid tiny basic red button" @click="cancelRun()" v-if="buildInfo.cancelable">Cancel</button> <button class="ui fluid tiny basic red button" @click="cancelRun()" v-if="buildInfo.cancelable">
Cancel
</button>
</div> </div>
</div> </div>
@ -75,8 +77,8 @@
<script> <script>
import {SvgIcon} from '../svg.js'; import {SvgIcon} from '../svg.js';
import Vue, {createApp} from 'vue'; import {createApp} from 'vue';
import AnsiToHTML from `ansi-to-html`; import AnsiToHTML from 'ansi-to-html';
const {csrfToken} = window.config; const {csrfToken} = window.config;
@ -152,7 +154,7 @@ const sfc = {
}, },
// rerun a job // rerun a job
rerunJob(idx) { rerunJob(idx) {
fetch(this.buildInfo.htmlurl+'/jobs/'+idx+'/rerun', { fetch(`${this.buildInfo.htmlurl}/jobs/${idx}/rerun`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -163,7 +165,7 @@ const sfc = {
}, },
// cancel a run // cancel a run
cancelRun() { cancelRun() {
fetch(this.buildInfo.htmlurl+'/cancel', { fetch(`${this.buildInfo.htmlurl}/cancel`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -186,7 +188,7 @@ const sfc = {
let res = '', resCount = 0; let res = '', resCount = 0;
for (let i = parts.length - 1; i >= 0 && resCount < 2; 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++; resCount++;
} }
} }
@ -204,7 +206,7 @@ const sfc = {
el.appendChild(elLineNum); el.appendChild(elLineNum);
const elLogTime = document.createElement('log-time'); const elLogTime = document.createElement('log-time');
elLogTime.innerText = new Date(line.t*1000).toISOString(); elLogTime.innerText = new Date(line.t * 1000).toISOString();
el.appendChild(elLogTime); el.appendChild(elLogTime);
const elLogMsg = document.createElement('log-msg'); const elLogMsg = document.createElement('log-msg');
@ -269,8 +271,8 @@ const sfc = {
for (let i = 0; i < 110; i++) { for (let i = 0; i < 110; i++) {
lines.push({ lines.push({
ln: cursor, // demo only, use cursor for line number ln: cursor, // demo only, use cursor for line number
m: ' '.repeat(i % 4) + `\x1B[1;3;31mDemo Log\x1B[0m, tag test <br>, hello world ${Date.now()}, cursor: ${cursor}`, m: `${' '.repeat(i % 4)}\x1B[1;3;31mDemo Log\x1B[0m, tag test <br>, hello world ${Date.now()}, cursor: ${cursor}`,
t: Date.now()/1000, // use second as unit t: Date.now() / 1000, // use second as unit
}); });
cursor++; cursor++;
} }
@ -341,8 +343,8 @@ export function initRepositoryBuildView() {
if (!el) return; if (!el) return;
const view = createApp(sfc, { const view = createApp(sfc, {
jobIndex: el.getAttribute("data-job-index"), jobIndex: el.getAttribute('data-job-index'),
runIndex: el.getAttribute("data-run-index"), runIndex: el.getAttribute('data-run-index'),
}); });
view.mount(el); view.mount(el);
} }

View File

@ -3,7 +3,7 @@
.runner-container { .runner-container {
padding-bottom: 30px; padding-bottom: 30px;
.runner-ops > a { .runner-ops > a {
margin-left: 0.5em; margin-left: .5em;
} }
.runner-ops-delete { .runner-ops-delete {
color: var(--color-red-light); color: var(--color-red-light);
@ -37,7 +37,8 @@
background-color: var(--color-blue); background-color: var(--color-blue);
color: var(--color-white); color: var(--color-white);
} }
.task-status-cancelled, .task-status-blocked { .task-status-cancelled,
.task-status-blocked {
background-color: var(--color-yellow); background-color: var(--color-yellow);
color: var(--color-white); color: var(--color-white);
} }