Skip to content

Commit

Permalink
Implement Dashboard URL
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Aug 12, 2024
1 parent efc7032 commit ac8c61a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/pmorie/go-open-service-broker-client v0.0.0-20180330214919-dca737037ce6
github.com/sabhiram/go-gitignore v0.0.0-20171017070213-362f9845770f
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa
github.com/tsuru/go-tsuruclient v0.0.0-20240802204705-a93c2a18a794
github.com/tsuru/go-tsuruclient v0.0.0-20240812213541-df5e446efabf
github.com/tsuru/tablecli v0.0.0-20190131152944-7ded8a3383c6
github.com/tsuru/tsuru v0.0.0-20240703132558-bfd1d9c89602
golang.org/x/net v0.25.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ github.com/tsuru/config v0.0.0-20201023175036-375aaee8b560 h1:fniQ/BmYAHdnNmY333
github.com/tsuru/config v0.0.0-20201023175036-375aaee8b560/go.mod h1:mj6t8JKWU51GScTT50XRmDj65T5XhTyNvO5FUNV5zS4=
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa h1:JlLQP1xa13a994p/Aau2e3K9xXYaHNoNvTDVIMHSUa4=
github.com/tsuru/gnuflag v0.0.0-20151217162021-86b8c1b864aa/go.mod h1:UibOSvkMFKRe/eiwktAPAvQG8L+p8nYsECJvu3Dgw7I=
github.com/tsuru/go-tsuruclient v0.0.0-20240802204705-a93c2a18a794 h1:3TdjKGfvCOaZIrWrxkMIaxqQ+qNLzmWiZXDkW1kY/xY=
github.com/tsuru/go-tsuruclient v0.0.0-20240802204705-a93c2a18a794/go.mod h1:qwh/KJ6ypa2GISRI79XFOHhnSjGOe1cZVPHF3nfrf18=
github.com/tsuru/go-tsuruclient v0.0.0-20240812213541-df5e446efabf h1:Jwxn42PtNz2bbOYKwQWFUMlo3sYy2LIYEDFcEPej7M0=
github.com/tsuru/go-tsuruclient v0.0.0-20240812213541-df5e446efabf/go.mod h1:qwh/KJ6ypa2GISRI79XFOHhnSjGOe1cZVPHF3nfrf18=
github.com/tsuru/tablecli v0.0.0-20190131152944-7ded8a3383c6 h1:1XDdWFAjIbCSG1OjN9v9KdWhuM8UtYlFcfHe/Ldkchk=
github.com/tsuru/tablecli v0.0.0-20190131152944-7ded8a3383c6/go.mod h1:ztYpOhW+u1k21FEqp7nZNgpWbr0dUKok5lgGCZi+1AQ=
github.com/tsuru/tsuru v0.0.0-20240703132558-bfd1d9c89602 h1:HiF99OFCkd2F0DwyMzBDStxm43rtrK8sBnVA2ZyfIZ4=
Expand Down
7 changes: 7 additions & 0 deletions tsuru/client/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ type app struct {
Routers []apptypes.AppRouter
AutoScale []tsuru.AutoScaleSpec

DashboardURL string
InternalAddresses []appInternalAddress
UnitsMetrics []unitMetrics
VolumeBinds []volumeTypes.VolumeBind
Expand Down Expand Up @@ -657,6 +658,9 @@ const simplifiedFormat = `{{ if .Error -}}
Error: {{ .Error }}
{{ end -}}
Application: {{.Name}}
{{ if .DashboardURL -}}
Dashboard: {{ .DashboardURL }}
{{- end }}
{{- if .Description }}
Description: {{.Description}}
{{- end }}
Expand Down Expand Up @@ -686,6 +690,9 @@ const fullFormat = `{{ if .Error -}}
Error: {{ .Error }}
{{ end -}}
Application: {{.Name}}
{{ if .DashboardURL -}}
Dashboard: {{ .DashboardURL }}
{{- end }}
{{- if .Description }}
Description: {{.Description}}
{{- end }}
Expand Down
10 changes: 7 additions & 3 deletions tsuru/client/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ const jobInfoFormat = `Job: {{.Job.Name}}
{{- with .Job.Description }}
Description: {{.}}
{{- end }}
{{- with .DashboardURL }}
Dashboard: {{.}}
{{- end }}
Teams: {{.Teams}}
Created by: {{.Job.Owner}}
Pool: {{.Job.Pool}}
Expand Down Expand Up @@ -243,9 +246,10 @@ func (c *JobInfo) Run(ctx *cmd.Context) error {

teams := renderTeams(jobInfo.Job)
err = tmpl.Execute(&buf, struct {
Job tsuru.Job
Teams string
}{jobInfo.Job, teams})
Job tsuru.Job
DashboardURL string
Teams string
}{Job: jobInfo.Job, DashboardURL: jobInfo.DashboardURL, Teams: teams})
if err != nil {
return err
}
Expand Down

0 comments on commit ac8c61a

Please sign in to comment.