Skip to content

Commit

Permalink
wip: public nkey
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed May 28, 2024
1 parent dd2b736 commit 514bcb2
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/web/adapters/db/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (db *database) CreateAccount(ctx context.Context, account *models.Account)

// GetAccount ...
func (db *database) GetAccount(ctx context.Context, account *models.Account) error {
return db.conn.WithContext(ctx).Preload("SigningKeyGroups").Preload("SigningKeyGroups.Key").Preload("Key").First(account).Error
return db.conn.WithContext(ctx).Preload("SigningKeyGroups").Preload("SigningKeyGroups.Key").Preload("Key").Preload("Token").First(account).Error
}

// UpdateAccount ...
Expand Down
2 changes: 1 addition & 1 deletion internal/web/adapters/db/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (db *database) CreateOperator(ctx context.Context, operator *models.Operato

// GetOperator ...
func (db *database) GetOperator(ctx context.Context, operator *models.Operator) error {
return db.conn.WithContext(ctx).Preload("Accounts").Preload("SigningKeyGroups").Preload("SigningKeyGroups.Key").Preload("Key").First(operator).Error
return db.conn.WithContext(ctx).Preload("Accounts").Preload("SigningKeyGroups").Preload("SigningKeyGroups.Key").Preload("Key").Preload("Token").First(operator).Error
}

// UpdateOperator ...
Expand Down
40 changes: 40 additions & 0 deletions internal/web/controllers/accounts/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/zeiss/fiber-htmx/components/cards"
"github.com/zeiss/fiber-htmx/components/dropdowns"
"github.com/zeiss/fiber-htmx/components/icons"
"github.com/zeiss/fiber-htmx/components/tooltips"
"github.com/zeiss/typhoon/internal/api/models"
"github.com/zeiss/typhoon/internal/utils"
"github.com/zeiss/typhoon/internal/web/components"
Expand Down Expand Up @@ -150,6 +151,45 @@ func (l *ShowAccountControllerImpl) Get() error {
),
),
),
cards.CardBordered(
cards.CardProps{},
cards.Body(
cards.BodyProps{},
cards.Title(
cards.TitleProps{},
htmx.Text("Details"),
),
htmx.Div(
htmx.ClassNames{
"flex": true,
"flex-col": true,
"py-2": true,
},
htmx.H4(
htmx.ClassNames{
"text-gray-500": true,
},
htmx.Text("Public NKey"),
tooltips.Tooltip(
tooltips.TooltipProps{
ClassNames: htmx.ClassNames{
"tooltip-right": true,
},
DataTip: "Public NKey is the public key of the account",
},
icons.InformationCircleOutline(
icons.IconProps{},
),
),
),
htmx.H3(
htmx.Text(
acc.Key.ID,
),
),
),
),
),
cards.CardBordered(
cards.CardProps{},
cards.Body(
Expand Down
2 changes: 0 additions & 2 deletions internal/web/controllers/operators/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ func (l *ShowOperatorControllerImpl) Get() error {
),
),
),

cards.CardBordered(
cards.CardProps{},
cards.Body(
Expand Down Expand Up @@ -203,7 +202,6 @@ func (l *ShowOperatorControllerImpl) Get() error {
),
),
),

cards.CardBordered(
cards.CardProps{},
cards.Body(
Expand Down
41 changes: 40 additions & 1 deletion internal/web/controllers/users/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/zeiss/fiber-htmx/components/cards"
"github.com/zeiss/fiber-htmx/components/dropdowns"
"github.com/zeiss/fiber-htmx/components/icons"
"github.com/zeiss/fiber-htmx/components/tooltips"
"github.com/zeiss/typhoon/internal/api/models"
"github.com/zeiss/typhoon/internal/web/components"
"github.com/zeiss/typhoon/internal/web/ports"
Expand Down Expand Up @@ -156,8 +157,46 @@ func (l *ShowUserControllerImpl) Get() error {
),
),
),
cards.CardBordered(
cards.CardProps{},
cards.Body(
cards.BodyProps{},
cards.Title(
cards.TitleProps{},
htmx.Text("Details"),
),
htmx.Div(
htmx.ClassNames{
"flex": true,
"flex-col": true,
"py-2": true,
},
htmx.H4(
htmx.ClassNames{
"text-gray-500": true,
},
htmx.Text("Public NKey"),
tooltips.Tooltip(
tooltips.TooltipProps{
ClassNames: htmx.ClassNames{
"tooltip-right": true,
},
DataTip: "Public NKey is the public key of the user",
},
icons.InformationCircleOutline(
icons.IconProps{},
),
),
),
htmx.H3(
htmx.Text(
user.Key.ID,
),
),
),
),
),
),
),
)

}

0 comments on commit 514bcb2

Please sign in to comment.