Skip to content

Commit aa28e0b

Browse files
committed
feat(angela): add porter detail
1 parent 25ff53d commit aa28e0b

File tree

17 files changed

+505
-38
lines changed

17 files changed

+505
-38
lines changed

cmd/wire_gen.go

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/golang-jwt/jwt/v5 v5.2.2
2828
github.com/google/go-querystring v1.1.0
2929
github.com/google/uuid v1.6.0
30-
github.com/google/wire v0.6.0
30+
github.com/google/wire v0.7.0
3131
github.com/gorilla/feeds v1.2.0
3232
github.com/hashicorp/consul/api v1.32.1
3333
github.com/improbable-eng/grpc-web v0.15.0

go.sum

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+m
180180
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
181181
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
182182
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
183-
github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE=
184-
github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
185183
github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw=
186184
github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
187185
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
@@ -340,14 +338,13 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
340338
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
341339
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
342340
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
343-
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
344341
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
345342
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
346343
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
347344
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
348345
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
349-
github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI=
350-
github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA=
346+
github.com/google/wire v0.7.0 h1:JxUKI6+CVBgCO2WToKy/nQk0sS+amI9z9EjVmdaocj4=
347+
github.com/google/wire v0.7.0/go.mod h1:n6YbUQD9cPKTnHXEBN2DXlOp/mVADhVErcMFb0v3J18=
351348
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
352349
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
353350
github.com/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc=
@@ -699,8 +696,6 @@ github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
699696
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
700697
github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08=
701698
github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU=
702-
github.com/shirou/gopsutil/v4 v4.24.12 h1:qvePBOk20e0IKA1QXrIIU+jmk+zEiYVVx06WjBRlZo4=
703-
github.com/shirou/gopsutil/v4 v4.24.12/go.mod h1:DCtMPAad2XceTeIAbGyVfycbYQNBGk2P8cvDi7/VN9o=
704699
github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM=
705700
github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U=
706701
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
@@ -757,13 +752,9 @@ github.com/temoto/robotstxt v1.1.2/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr
757752
github.com/tinylib/msgp v1.3.0 h1:ULuf7GPooDaIlbyvgAxBV/FI7ynli6LZ1/nVUNu+0ww=
758753
github.com/tinylib/msgp v1.3.0/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
759754
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
760-
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
761-
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
762755
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
763756
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
764757
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
765-
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
766-
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
767758
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
768759
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
769760
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@@ -871,7 +862,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
871862
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
872863
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
873864
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
874-
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
875865
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
876866
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
877867
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
@@ -898,7 +888,6 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91
898888
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
899889
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
900890
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
901-
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
902891
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
903892
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
904893
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
@@ -931,7 +920,6 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
931920
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
932921
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
933922
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
934-
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
935923
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
936924
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
937925
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
@@ -1008,9 +996,7 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1008996
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1009997
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1010998
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1011-
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1012999
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1013-
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
10141000
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
10151001
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
10161002
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
@@ -1025,7 +1011,6 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
10251011
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
10261012
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
10271013
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
1028-
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
10291014
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
10301015
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
10311016
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
@@ -1068,7 +1053,6 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
10681053
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
10691054
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
10701055
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
1071-
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
10721056
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
10731057
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
10741058
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=

internal/biz/bizsupervisor/bizsupervisor.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/tuihub/librarian/internal/lib/libapp"
77
"github.com/tuihub/librarian/internal/lib/libauth"
88
"github.com/tuihub/librarian/internal/lib/libidgenerator"
9+
"github.com/tuihub/librarian/internal/model/modelsupervisor"
910

1011
"github.com/google/wire"
1112
)
@@ -38,3 +39,7 @@ func NewSupervisor(
3839
id: id,
3940
}
4041
}
42+
43+
func (s *Supervisor) GetFeatureSummary() *modelsupervisor.ServerFeatureSummary {
44+
return s.repo.GetFeatureSummary()
45+
}

internal/biz/biztiphereth/porter.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ func (t *Tiphereth) ListPorters(
2424
return porters, total, nil
2525
}
2626

27+
func (t *Tiphereth) GetPorter(
28+
ctx context.Context,
29+
id model.InternalID,
30+
) (*modelsupervisor.PorterInstance, error) {
31+
if libauth.FromContextAssertUserType(ctx, model.UserTypeAdmin) == nil {
32+
return nil, bizutils.NoPermissionError()
33+
}
34+
porter, err := t.repo.GetPorter(ctx, id)
35+
if err != nil {
36+
return nil, pb.ErrorErrorReasonUnspecified("%s", err.Error())
37+
}
38+
return porter, nil
39+
}
40+
2741
func (t *Tiphereth) UpdatePorterStatus(
2842
ctx context.Context,
2943
id model.InternalID,

internal/data/tiphereth.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,17 @@ func (t *TipherethRepo) ListPorters(
351351
return converter.ToBizPorterList(p), int64(count), nil
352352
}
353353

354+
func (t *TipherethRepo) GetPorter(
355+
ctx context.Context,
356+
id model.InternalID,
357+
) (*modelsupervisor.PorterInstance, error) {
358+
p, err := t.data.db.PorterInstance.Get(ctx, id)
359+
if err != nil {
360+
return nil, err
361+
}
362+
return converter.ToBizPorter(p), nil
363+
}
364+
354365
func (t *TipherethRepo) UpdatePorterStatus(
355366
ctx context.Context,
356367
id model.InternalID,
@@ -406,6 +417,30 @@ func (t *TipherethRepo) ListPorterContexts(
406417
return converter.ToBizPorterContextList(p), int64(count), nil
407418
}
408419

420+
func (t *TipherethRepo) ListPorterContextsByGlobalName(
421+
ctx context.Context,
422+
userID model.InternalID,
423+
globalName string,
424+
paging model.Paging,
425+
) ([]*modelsupervisor.PorterContext, int64, error) {
426+
q := t.data.db.PorterContext.Query().Where(
427+
portercontext.HasOwnerWith(user.IDEQ(userID)),
428+
portercontext.GlobalNameEQ(globalName),
429+
)
430+
count, err := q.Count(ctx)
431+
if err != nil {
432+
return nil, 0, err
433+
}
434+
p, err := q.
435+
Limit(paging.ToLimit()).
436+
Offset(paging.ToOffset()).
437+
All(ctx)
438+
if err != nil {
439+
return nil, 0, err
440+
}
441+
return converter.ToBizPorterContextList(p), int64(count), nil
442+
}
443+
409444
func (t *TipherethRepo) UpdatePorterContext(
410445
ctx context.Context,
411446
userID model.InternalID,

internal/service/angelaweb/angela_web.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/tuihub/librarian/internal/biz/bizangela"
1313
"github.com/tuihub/librarian/internal/biz/bizgebura"
14+
"github.com/tuihub/librarian/internal/biz/bizsupervisor"
1415
"github.com/tuihub/librarian/internal/biz/biztiphereth"
1516
"github.com/tuihub/librarian/internal/conf"
1617
"github.com/tuihub/librarian/internal/lib/libapp"
@@ -63,6 +64,7 @@ func NewAngelaWeb(
6364
a *bizangela.Angela,
6465
t *biztiphereth.Tiphereth,
6566
g *bizgebura.Gebura,
67+
s *bizsupervisor.Supervisor,
6668
userCountCache *libcache.Key[model.UserCount],
6769
observer *libobserve.Observe,
6870
) *AngelaWeb {
@@ -111,7 +113,7 @@ func NewAngelaWeb(
111113

112114
res := &AngelaWeb{
113115
apiHandler: api.NewHandler(a, t, g, userCountCache, observer),
114-
pageBuilder: page.NewBuilder(settings, a, t, g, digests, userCountCache),
116+
pageBuilder: page.NewBuilder(settings, a, t, g, s, digests, userCountCache),
115117
auth: auth,
116118
app: app,
117119
addr: net.JoinHostPort(c.Admin.Host, strconv.Itoa(int(c.Admin.Port))),

internal/service/angelaweb/internal/api/porter.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@ func (h *Handler) ListPorters(c *fiber.Ctx) error {
4747
})
4848
}
4949

50+
func (h *Handler) GetPorter(c *fiber.Ctx) error {
51+
idStr := c.Params("id")
52+
id, err := strconv.ParseInt(idStr, 10, 64)
53+
if err != nil {
54+
return c.Status(http.StatusBadRequest).JSON(fiber.Map{"message": "Invalid ID"})
55+
}
56+
57+
porter, err := h.t.GetPorter(c.UserContext(), model.InternalID(id))
58+
if err != nil {
59+
return c.Status(http.StatusInternalServerError).JSON(fiber.Map{"message": "Error fetching porter"})
60+
}
61+
62+
return c.JSON(fiber.Map{
63+
"porter": porter,
64+
})
65+
}
66+
5067
func (h *Handler) UpdatePorterStatus(c *fiber.Ctx) error {
5168
idStr := c.Params("id")
5269
id, err := strconv.ParseInt(idStr, 10, 64)

internal/service/angelaweb/internal/page/page.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/tuihub/librarian/internal/biz/bizangela"
88
"github.com/tuihub/librarian/internal/biz/bizgebura"
9+
"github.com/tuihub/librarian/internal/biz/bizsupervisor"
910
"github.com/tuihub/librarian/internal/biz/biztiphereth"
1011
"github.com/tuihub/librarian/internal/conf"
1112
"github.com/tuihub/librarian/internal/lib/libapp"
@@ -26,6 +27,7 @@ type Builder struct {
2627
a *bizangela.Angela
2728
t *biztiphereth.Tiphereth
2829
g *bizgebura.Gebura
30+
s *bizsupervisor.Supervisor
2931
configDigests []*conf.ConfigDigest
3032
userCountCache *libcache.Key[model.UserCount]
3133
}
@@ -35,6 +37,7 @@ func NewBuilder(
3537
a *bizangela.Angela,
3638
t *biztiphereth.Tiphereth,
3739
g *bizgebura.Gebura,
40+
s *bizsupervisor.Supervisor,
3841
configDigests []*conf.ConfigDigest,
3942
userCountCache *libcache.Key[model.UserCount],
4043
) *Builder {
@@ -43,6 +46,7 @@ func NewBuilder(
4346
a: a,
4447
t: t,
4548
g: g,
49+
s: s,
4650
configDigests: configDigests,
4751
userCountCache: userCountCache,
4852
}
@@ -116,10 +120,12 @@ func (b *Builder) Dashboard(c *fiber.Ctx) error {
116120
if err != nil {
117121
return c.Status(http.StatusInternalServerError).SendString(fiberi18n.MustLocalize(c, "ErrorFetchingData"))
118122
}
123+
featureSummary := b.s.GetFeatureSummary()
119124

120125
return c.Render("dashboard", addCommonData(c, fiber.Map{
121-
"Title": "Dashboard",
122-
"UserCount": userCount.Count,
126+
"Title": "Dashboard",
127+
"UserCount": userCount.Count,
128+
"FeatureSummary": featureSummary,
123129
}))
124130
}
125131

@@ -187,6 +193,24 @@ func (b *Builder) PorterList(c *fiber.Ctx) error {
187193
}))
188194
}
189195

196+
func (b *Builder) PorterDetail(c *fiber.Ctx) error {
197+
idStr := c.Params("id")
198+
id, err := strconv.ParseInt(idStr, 10, 64)
199+
if err != nil {
200+
return c.Status(http.StatusBadRequest).SendString("Invalid ID")
201+
}
202+
203+
porter, err := b.t.GetPorter(c.UserContext(), model.InternalID(id))
204+
if err != nil {
205+
return c.Status(http.StatusInternalServerError).SendString(fiberi18n.MustLocalize(c, "ErrorFetchingPorters"))
206+
}
207+
208+
return c.Render("porter_detail", addCommonData(c, fiber.Map{
209+
"Title": "PorterDetail",
210+
"Porter": porter,
211+
}))
212+
}
213+
190214
func (b *Builder) ConfigList(c *fiber.Ctx) error {
191215
// Get server instance summary
192216
serverInfo, err := b.a.GetServerInstanceSummary(c.UserContext())

internal/service/angelaweb/locales/en.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,32 @@ ErrorDeletingUser = "Error deleting user"
7575
# Plugin Management
7676
NoPluginData = "No plugin data available"
7777
Plugin = "Plugin"
78+
PorterDetail = "Plugin Detail"
79+
PorterInformation = "Plugin Information"
80+
BinaryInformation = "Binary Information"
81+
FeatureSummary = "Feature Summary"
82+
ContextJSONSchema = "Context JSON Schema"
83+
PorterContexts = "Plugin Contexts"
84+
GlobalName = "Global Name"
85+
Version = "Version"
86+
SourceCodeAddress = "Source Code Address"
87+
BuildVersion = "Build Version"
88+
BuildDate = "Build Date"
89+
ConnectionStatusMessage = "Connection Status Message"
90+
AccountPlatforms = "Account Platforms"
91+
AppInfoSources = "App Info Sources"
92+
FeedSources = "Feed Sources"
93+
NotifyDestinations = "Notify Destinations"
94+
FeedItemActions = "Feed Item Actions"
95+
FeedGetters = "Feed Getters"
96+
FeedSetters = "Feed Setters"
97+
ContextJSON = "Context JSON"
98+
ShowContext = "Show Context"
99+
NoContextData = "No context data available"
100+
HandleStatus = "Handle Status"
101+
Blocked = "Blocked"
102+
Copy = "Copy"
103+
Copied = "Copied"
78104

79105
# Common Messages
80106
OperationFailed = "Operation failed"

0 commit comments

Comments
 (0)