Skip to content

Commit 14593a8

Browse files
committed
fix: fetch data with url
1 parent 1c87be2 commit 14593a8

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

routers/web/repo/actions/view.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ func View(ctx *context_module.Context) {
3030
jobIndex := ctx.ParamsInt64("job")
3131
ctx.Data["RunIndex"] = runIndex
3232
ctx.Data["JobIndex"] = jobIndex
33+
ctx.Data["ActionsURL"] = ctx.Repo.RepoLink + "/actions"
3334

34-
job, _ := getRunJobs(ctx, runIndex, jobIndex)
35-
if ctx.Written() {
35+
if getRunJobs(ctx, runIndex, jobIndex); ctx.Written() {
3636
return
3737
}
38-
run := job.Run
39-
ctx.Data["Build"] = run
4038

4139
ctx.HTML(http.StatusOK, tplViewActions)
4240
}

templates/repo/actions/view.tmpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
<div class="page-content repository">
44
{{template "repo/header" .}}
5-
<div id="repo-action-view" data-run-index="{{.RunIndex}}" data-job-index="{{.JobIndex}}">
6-
</div>
7-
5+
<div id="repo-action-view" data-run-index="{{.RunIndex}}" data-job-index="{{.JobIndex}}" data-actions-url="{{.ActionsURL}}"></div>
86
</div>
97

108
{{template "base/footer" .}}

web_src/js/components/RepoActionView.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const sfc = {
7878
props: {
7979
runIndex: Number,
8080
jobIndex: Number,
81+
actionsURL: String,
8182
},
8283
8384
data() {
@@ -214,7 +215,7 @@ const sfc = {
214215
// * stateData: it will be stored into Vue data and used to update the UI state
215216
// * logsData: the logs in it will be appended to the UI manually, no touch to Vue data
216217
async fetchJobData(reqData) {
217-
const resp = await fetch(``, {
218+
const resp = await fetch(`${this.actionsURL}/runs/${this.runIndex}/jobs/${this.jobIndex}`, {
218219
method: 'POST',
219220
headers: {
220221
'Content-Type': 'application/json',
@@ -271,8 +272,9 @@ export function initRepositoryActionView() {
271272
if (!el) return;
272273
273274
const view = createApp(sfc, {
274-
jobIndex: el.getAttribute('data-job-index'),
275275
runIndex: el.getAttribute('data-run-index'),
276+
jobIndex: el.getAttribute('data-job-index'),
277+
actionsURL: el.getAttribute('data-actions-url'),
276278
});
277279
view.mount(el);
278280
}

0 commit comments

Comments
 (0)