1
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-04-08 17:05:45 +02:00

Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
Jason Song 2023-01-05 11:59:32 +08:00 committed by GitHub
parent 2ae7f5434c
commit b884772652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 32 deletions
options/locale
routers/web/shared/actions
services/repository
templates
web_src/js/components

@ -3253,7 +3253,7 @@ runners.labels = Labels
runners.latest_online = Last Online Time
runners.agent_labels = Agent Labels
runners.custom_labels = Custom Labels
runners.custom_labels_helper = Custom labels are labels that are not automatically added by the agent. They are added by the administrator. Use comma separated.
runners.custom_labels_helper = Custom labels are labels that are added manually by an administrator. A comma separates labels, whitespace at the start and end of each label are ignored.
runners.runner_title = Runner
runners.task_list = Recent jobs on this runner
runners.edit_runner = Edit Runner

@ -125,7 +125,7 @@ func RunnerDetailsEditPost(ctx *context.Context, runnerID, ownerID, repoID int64
}
if !runner.Editable(ownerID, repoID) {
err = errors.New("no permission to edit this runner")
ctx.NotFound("RunnerDetailsEditPost.Editable", err)
ctx.NotFound("RunnerDetailsEditPost.Editable", util.NewPermissionDeniedErrorf("no permission to edit this runner"))
return
}

@ -54,7 +54,7 @@ func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_mod
// deletes actions resource after the repo has been deleted, to avoid new tasks
if err := actions_service.DeleteResourceOfRepository(ctx, repo); err != nil {
log.Error("delete actions resource failed: %v", err)
return fmt.Errorf("delete actions resources failed: %w", err)
}
return packages_model.UnlinkRepositoryFromAllPackages(ctx, repo.ID)

@ -438,9 +438,9 @@
<div class="inline field">
<label>{{.locale.Tr "actions.actions"}}</label>
{{if .UnitTypeActions.UnitGlobalDisabled}}
<div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}">
<div class="ui checkbox tooltip disabled" data-content="{{.locale.Tr "repo.unit_disabled"}}">
{{else}}
<div class="ui checkbox">
<div class="ui checkbox">
{{end}}
<input class="enable-system" name="enable_actions" type="checkbox" {{if $isActionsEnabled}}checked{{end}}>
<label>{{.locale.Tr "repo.settings.actions_desc"}}</label>

@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content repository settings webhooks">
<div class="page-content repository settings runners">
{{template "repo/header" .}}
{{template "repo/settings/navbar" .}}
<div class="ui container">

@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content repository settings webhooks">
<div class="page-content repository settings runners">
{{template "repo/header" .}}
{{template "repo/settings/navbar" .}}
<div class="ui container">

@ -8,15 +8,15 @@
{{template "base/disable_form_autofill"}}
{{.CsrfTokenHtml}}
<div class="runner-basic-info">
<div class="field dib">
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.status"}}</label>
<span class="runner-status-{{if .Runner.IsOnline}}online{{else}}offline{{end}}">{{.Runner.StatusName}}</span>
</div>
<div class="field dib">
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.latest_online"}}</label>
<span>{{TimeSinceUnix .Runner.LastOnline $.locale}}</span>
</div>
<div class="field dib">
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.agent_labels"}}</label>
<span>
{{range .Runner.AgentLabels}}
@ -24,7 +24,7 @@
{{end}}
</span>
</div>
<div class="field dib">
<div class="field dib disabled">
<label>{{.locale.Tr "actions.runners.owner_type"}}</label>
<span>{{.Runner.OwnType}}</span>
</div>
@ -36,7 +36,7 @@
<label for="description">{{.locale.Tr "actions.runners.description"}}</label>
<input id="description" name="description" value="{{.Runner.Description}}">
</div>
<div class="field">
<div class="field tooltip" data-content="Labels are comma-separated. Whitespace at the beginning, end, and around the commas are ignored.">
<label for="custom_labels">{{.locale.Tr "actions.runners.custom_labels"}}</label>
<input id="custom_labels" name="custom_labels" value="{{Join .Runner.CustomLabels `,`}}">
<p class="help">{{.locale.Tr "actions.runners.custom_labels_helper"}}</p>

@ -46,9 +46,7 @@
<thead>
<tr>
<th data-sortt-asc="online" data-sortt-desc="offline">{{.locale.Tr "actions.runners.status"}}</th>
<th data-sortt-asc="alphabetically">
{{.locale.Tr "actions.runners.id"}}
</th>
<th data-sortt-asc="alphabetically">{{.locale.Tr "actions.runners.id"}}</th>
<th>{{.locale.Tr "actions.runners.owner_type"}}</th>
<th>{{.locale.Tr "actions.runners.labels"}}</th>
<th>{{.locale.Tr "actions.runners.latest_online"}}</th>

@ -8,9 +8,6 @@
<div class="action-view-body">
<div class="action-view-left">
<div class="job-group-section" v-for="(jobGroup, i) in allJobGroups" :key="i">
<!-- <div class="job-group-summary">-->
<!-- {{ jobGroup.summary }}-->
<!-- </div>-->
<div class="job-brief-list">
<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'"/>
@ -59,17 +56,6 @@
<!-- the log elements could be a lot, do not use v-if to destroy/reconstruct the DOM -->
<div class="job-step-logs" ref="elJobStepLogs" v-show="currentJobStepsStates[i].expanded">
<!--
possible layouts:
<div class="job-log-group">
<div class="job-log-group-summary"></div>
<div class="job-log-list">
<div class="job-log-line"></div>
</div>
</div>
-- or --
<div class="job-log-line"></div>
-->
</div>
</div>
</div>
@ -312,9 +298,6 @@ const sfc = {
const reqData = {stepLogCursors};
const respData = await this.fetchJobData(reqData);
// const respData = this.fetchMockData(reqData);
// console.log('loadJobData by request', reqData, ', get response ', respData);
// save the stateData to Vue data, then the UI will be updated
for (const [key, value] of Object.entries(respData.stateData)) {