chore: rename to action

This commit is contained in:
Jason Song 2022-12-09 15:29:26 +08:00
parent 266a122ba2
commit 10ebbeca2f
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5
6 changed files with 29 additions and 29 deletions

View File

@ -50,11 +50,11 @@ type ViewRequest struct {
type ViewResponse struct {
StateData struct {
BuildInfo struct {
RunInfo struct {
HTMLURL string `json:"htmlurl"`
Title string `json:"title"`
Cancelable bool `json:"cancelable"`
} `json:"buildInfo"`
} `json:"runInfo"`
AllJobGroups []ViewGroup `json:"allJobGroups"`
CurrentJobInfo struct {
Title string `json:"title"`
@ -108,9 +108,9 @@ func ViewPost(ctx *context_module.Context) {
run := current.Run
resp := &ViewResponse{}
resp.StateData.BuildInfo.Title = run.Title
resp.StateData.BuildInfo.HTMLURL = run.HTMLURL()
resp.StateData.BuildInfo.Cancelable = !run.Status.IsDone()
resp.StateData.RunInfo.Title = run.Title
resp.StateData.RunInfo.HTMLURL = run.HTMLURL()
resp.StateData.RunInfo.Cancelable = !run.Status.IsDone()
respJobs := make([]*ViewJob, len(jobs))
for i, v := range jobs {

View File

@ -41,7 +41,7 @@
</div>
</div>
</div>
{{template "repo/actions/build_list" .}}
{{template "repo/actions/runs_list" .}}
</div>
</div>
</div>

View File

@ -2,7 +2,7 @@
<div class="page-content repository">
{{template "repo/header" .}}
<div id="repo-build-view" data-run-index="{{.RunIndex}}" data-job-index="{{.JobIndex}}">
<div id="repo-action-view" data-run-index="{{.RunIndex}}" data-job-index="{{.JobIndex}}">
</div>
</div>

View File

@ -1,8 +1,8 @@
<template>
<div class="build-view-container">
<div class="build-view-left">
<div class="build-info-summary">
{{ buildInfo.title }}
<div class="action-view-container">
<div class="action-view-left">
<div class="action-info-summary">
{{ runInfo.title }}
</div>
<div class="job-group-section" v-for="(jobGroup, i) in allJobGroups" :key="i">
@ -10,7 +10,7 @@
<!-- {{ jobGroup.summary }}-->
<!-- </div>-->
<div class="job-brief-list">
<a class="job-brief-item" v-for="(job, index) in jobGroup.jobs" :key="job.id" :href="buildInfo.htmlurl+'/jobs/'+index">
<a class="job-brief-item" v-for="(job, index) in jobGroup.jobs" :key="job.id" :href="runInfo.htmlurl+'/jobs/'+index">
<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-clock" class="ui text yellow" v-else-if="job.status === 'waiting'"/>
@ -23,13 +23,13 @@
</button>
</a>
</div>
<button class="ui fluid tiny basic red button" @click="cancelRun()" v-if="buildInfo.cancelable">
<button class="ui fluid tiny basic red button" @click="cancelRun()" v-if="runInfo.cancelable">
Cancel
</button>
</div>
</div>
<div class="build-view-right">
<div class="action-view-right">
<div class="job-info-header">
<div class="job-info-header-title">
{{ currentJobInfo.title }}
@ -83,7 +83,7 @@ import AnsiToHTML from 'ansi-to-html';
const {csrfToken} = window.config;
const sfc = {
name: 'RepoBuildView',
name: 'RepoActionView',
components: {
SvgIcon,
},
@ -99,7 +99,7 @@ const sfc = {
currentJobStepsStates: [],
// provided by backend
buildInfo: {},
runInfo: {},
allJobGroups: [],
currentJobInfo: {},
currentJobSteps: [],
@ -154,7 +154,7 @@ const sfc = {
},
// rerun a job
rerunJob(idx) {
fetch(`${this.buildInfo.htmlurl}/jobs/${idx}/rerun`, {
fetch(`${this.runInfo.htmlurl}/jobs/${idx}/rerun`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -165,7 +165,7 @@ const sfc = {
},
// cancel a run
cancelRun() {
fetch(`${this.buildInfo.htmlurl}/cancel`, {
fetch(`${this.runInfo.htmlurl}/cancel`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -230,7 +230,7 @@ const sfc = {
// * logsData: the logs in it will be appended to the UI manually, no touch to Vue data
fetchMockData(reqData) {
const stateData = {
buildInfo: {title: 'The Demo Build'},
runInfo: {title: 'The Demo Build'},
allJobGroups: [
{
summary: 'Job Group Foo',
@ -339,8 +339,8 @@ const sfc = {
export default sfc;
export function initRepositoryBuildView() {
const el = document.getElementById('repo-build-view');
export function initRepositoryActionView() {
const el = document.getElementById('repo-action-view');
if (!el) return;
const view = createApp(sfc, {
@ -354,22 +354,22 @@ export function initRepositoryBuildView() {
<style scoped lang="less">
.build-view-container {
.action-view-container {
display: flex;
height: calc(100vh - 226px); // fine tune this value to make the main view has full height
}
// ================
// build view left
// action view left
.build-view-left {
.action-view-left {
width: 20%;
overflow-y: scroll;
margin-left: 10px;
}
.build-info-summary {
.action-info-summary {
font-size: 150%;
margin: 5px 0;
}
@ -401,9 +401,9 @@ export function initRepositoryBuildView() {
// ================
// build view right
// action view right
.build-view-right {
.action-view-right {
flex: 1;
background-color: #262626;
color: #d6d6d6;

View File

@ -90,7 +90,7 @@ import {initRepoCommentForm, initRepository} from './features/repo-legacy.js';
import {initFormattingReplacements} from './features/formatting.js';
import {initMcaptcha} from './features/mcaptcha.js';
import {initCopyContent} from './features/copycontent.js';
import {initRepositoryBuildView} from './components/RepoBuildView.vue';
import {initRepositoryActionView} from './components/RepoActionView.vue';
// Run time-critical code as soon as possible. This is safe to do because this
// script appears at the end of <body> and rendered HTML is accessible at that point.
@ -188,7 +188,7 @@ $(document).ready(() => {
initRepoTopicBar();
initRepoWikiForm();
initRepository();
initRepositoryBuildView();
initRepositoryActionView();
initCommitStatuses();
initMcaptcha();