File tree Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Expand file tree Collapse file tree 3 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,40 @@ type ActionRunner struct {
52
52
Deleted timeutil.TimeStamp `xorm:"deleted"`
53
53
}
54
54
55
- func (r * ActionRunner ) OwnType () string {
55
+ // RunnerType defines the runner type
56
+ type RunnerType int //revive:disable-line:exported
57
+
58
+ const (
59
+ // RunnerTypeGlobal defines a global runner
60
+ RunnerTypeGlobal RunnerType = iota
61
+
62
+ // RunnerTypeOrganization defines an organization runner
63
+ RunnerTypeOrganization
64
+
65
+ // RunnerTypeRepository defines a repository runner
66
+ RunnerTypeRepository
67
+ )
68
+
69
+ func (r * ActionRunner ) Type () RunnerType {
56
70
if r .RepoID != 0 {
57
- return fmt . Sprintf ( "Repo(%s)" , r . Repo . FullName ())
71
+ return RunnerTypeRepository
58
72
}
59
73
if r .OwnerID != 0 {
60
- return fmt .Sprintf ("Org(%s)" , r .Owner .Name )
74
+ return RunnerTypeOrganization
75
+ }
76
+ return RunnerTypeGlobal
77
+ }
78
+
79
+ func (r RunnerType ) String () string {
80
+ switch r {
81
+ case RunnerTypeGlobal :
82
+ return "Global"
83
+ case RunnerTypeOrganization :
84
+ return "Organization"
85
+ case RunnerTypeRepository :
86
+ return "Repository"
61
87
}
62
- return "Global"
88
+ return fmt . Sprintf ( "Unknown Type %d" , r )
63
89
}
64
90
65
91
func (r * ActionRunner ) Status () runnerv1.RunnerStatus {
Original file line number Diff line number Diff line change 25
25
</div>
26
26
<div class="field gt-dib gt-mr-4 disabled">
27
27
<label>{{.locale.Tr "actions.runners.owner_type"}}</label>
28
- <span>{{.Runner.OwnType }}</span>
28
+ <span>{{.Runner.Type.String }}</span>
29
29
</div>
30
30
</div>
31
31
Original file line number Diff line number Diff line change 65
65
<td>{{.ID}}</td>
66
66
<td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td>
67
67
<td>{{.Version}}</td>
68
- <td>{{.OwnType }}</td>
68
+ <td>{{.Type.String }}</td>
69
69
<td class="runner-tags">
70
70
{{range .AllLabels}}<span class="ui label">{{.}}</span>{{end}}
71
71
</td>
You can’t perform that action at this time.
0 commit comments