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

View File

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

View File

@ -2,7 +2,7 @@
<div class="page-content repository"> <div class="page-content repository">
{{template "repo/header" .}} {{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>
</div> </div>

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="build-view-container"> <div class="action-view-container">
<div class="build-view-left"> <div class="action-view-left">
<div class="build-info-summary"> <div class="action-info-summary">
{{ buildInfo.title }} {{ runInfo.title }}
</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">
@ -10,7 +10,7 @@
<!-- {{ 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" :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-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,13 +23,13 @@
</button> </button>
</a> </a>
</div> </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 Cancel
</button> </button>
</div> </div>
</div> </div>
<div class="build-view-right"> <div class="action-view-right">
<div class="job-info-header"> <div class="job-info-header">
<div class="job-info-header-title"> <div class="job-info-header-title">
{{ currentJobInfo.title }} {{ currentJobInfo.title }}
@ -83,7 +83,7 @@ import AnsiToHTML from 'ansi-to-html';
const {csrfToken} = window.config; const {csrfToken} = window.config;
const sfc = { const sfc = {
name: 'RepoBuildView', name: 'RepoActionView',
components: { components: {
SvgIcon, SvgIcon,
}, },
@ -99,7 +99,7 @@ const sfc = {
currentJobStepsStates: [], currentJobStepsStates: [],
// provided by backend // provided by backend
buildInfo: {}, runInfo: {},
allJobGroups: [], allJobGroups: [],
currentJobInfo: {}, currentJobInfo: {},
currentJobSteps: [], currentJobSteps: [],
@ -154,7 +154,7 @@ const sfc = {
}, },
// rerun a job // rerun a job
rerunJob(idx) { rerunJob(idx) {
fetch(`${this.buildInfo.htmlurl}/jobs/${idx}/rerun`, { fetch(`${this.runInfo.htmlurl}/jobs/${idx}/rerun`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -165,7 +165,7 @@ const sfc = {
}, },
// cancel a run // cancel a run
cancelRun() { cancelRun() {
fetch(`${this.buildInfo.htmlurl}/cancel`, { fetch(`${this.runInfo.htmlurl}/cancel`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', '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 // * 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'}, runInfo: {title: 'The Demo Build'},
allJobGroups: [ allJobGroups: [
{ {
summary: 'Job Group Foo', summary: 'Job Group Foo',
@ -339,8 +339,8 @@ const sfc = {
export default sfc; export default sfc;
export function initRepositoryBuildView() { export function initRepositoryActionView() {
const el = document.getElementById('repo-build-view'); const el = document.getElementById('repo-action-view');
if (!el) return; if (!el) return;
const view = createApp(sfc, { const view = createApp(sfc, {
@ -354,22 +354,22 @@ export function initRepositoryBuildView() {
<style scoped lang="less"> <style scoped lang="less">
.build-view-container { .action-view-container {
display: flex; display: flex;
height: calc(100vh - 226px); // fine tune this value to make the main view has full height 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%; width: 20%;
overflow-y: scroll; overflow-y: scroll;
margin-left: 10px; margin-left: 10px;
} }
.build-info-summary { .action-info-summary {
font-size: 150%; font-size: 150%;
margin: 5px 0; margin: 5px 0;
} }
@ -401,9 +401,9 @@ export function initRepositoryBuildView() {
// ================ // ================
// build view right // action view right
.build-view-right { .action-view-right {
flex: 1; flex: 1;
background-color: #262626; background-color: #262626;
color: #d6d6d6; color: #d6d6d6;

View File

@ -90,7 +90,7 @@ import {initRepoCommentForm, initRepository} from './features/repo-legacy.js';
import {initFormattingReplacements} from './features/formatting.js'; import {initFormattingReplacements} from './features/formatting.js';
import {initMcaptcha} from './features/mcaptcha.js'; import {initMcaptcha} from './features/mcaptcha.js';
import {initCopyContent} from './features/copycontent.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 // 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. // script appears at the end of <body> and rendered HTML is accessible at that point.
@ -188,7 +188,7 @@ $(document).ready(() => {
initRepoTopicBar(); initRepoTopicBar();
initRepoWikiForm(); initRepoWikiForm();
initRepository(); initRepository();
initRepositoryBuildView(); initRepositoryActionView();
initCommitStatuses(); initCommitStatuses();
initMcaptcha(); initMcaptcha();