Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.60] - 2026-01-27

### Fixed
- check user status in an organization before making api requests which may fail if the user didn't accept the invitation yet
- when showing the list of organizations, show the user status and disable the selection of organizations where the status is not active

## [v1.0.59] - 2026-01-23

### Added
Expand Down
7 changes: 4 additions & 3 deletions src/entity/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
)

type Org struct {
Id uuid.ClientId
Role enum.ClientUserRoleCodeEnum
Name types.String
Id uuid.ClientId
Role enum.ClientUserRoleCodeEnum
Name types.String
Status enum.ClientUserStatusEnum
}

var OrgFields = entityTemplateFields[Org]()
7 changes: 4 additions & 3 deletions src/entity/repository/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func GetOrgById(

func orgFromEsSearch(esClientUser output.ClientUserExtraWithClientLight) entity.Org {
return entity.Org{
Id: esClientUser.ClientId,
Name: esClientUser.Client.AccountName,
Role: esClientUser.RoleCode,
Id: esClientUser.ClientId,
Name: esClientUser.Client.AccountName,
Status: esClientUser.Status,
Role: esClientUser.RoleCode,
}
}
3 changes: 3 additions & 0 deletions src/entity/repository/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func GetAllProjects(

var projects []entity.Project
for _, org := range orgs {
if !org.Status.IsActive() {
continue
}
esFilter := body.EsFilter{
Search: []body.EsSearchItem{
{
Expand Down
36 changes: 35 additions & 1 deletion src/uxBlock/models/selector/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ func (m *Model) Update(msg tea.Msg) (*Model, tea.Cmd) {
case key.Matches(keyMsg, m.keyMap.End):
m.End()
case key.Matches(keyMsg, m.keyMap.Select):
if m.isCursorOnDisabled() {
return m, nil
}
if !m.multi {
m.Select()
}
Expand Down Expand Up @@ -226,6 +229,9 @@ func (m *Model) Select() {
return
}
selectedRow := m.filteredBody.Rows()[m.cursor]
if selectedRow.IsDisabled() {
return
}
if m.multi {
if _, ok := m.selected[selectedRow.Index()]; ok {
delete(m.selected, selectedRow.Index())
Expand All @@ -239,6 +245,9 @@ func (m *Model) Select() {

func (m *Model) SelectAll(deselect bool) {
for _, r := range m.filteredBody.Rows() {
if r.IsDisabled() {
continue
}
if !deselect {
m.selected[r.Index()] = struct{}{}
} else {
Expand Down Expand Up @@ -274,6 +283,23 @@ func (m *Model) isSelected(row int) bool {
return selected
}

func (m *Model) isRowDisabled(displayRow, maxRows int) bool {
page := m.cursor / maxRows
actualIndex := page*maxRows + displayRow
rows := m.filteredBody.Rows()
if actualIndex >= len(rows) {
return false
}
return rows[actualIndex].IsDisabled()
}

func (m *Model) isCursorOnDisabled() bool {
if !m.hasResults() {
return true
}
return m.filteredBody.Rows()[m.cursor].IsDisabled()
}

func (m *Model) View() string {
rows := m.filteredBody.Rows()
totalRows := len(rows)
Expand Down Expand Up @@ -304,7 +330,15 @@ func (m *Model) View() string {
if row == ltable.HeaderRow {
return styles.TableRow()
}
if row == m.cursor%maxRows && !m.filterField.Focused() {
isActive := row == m.cursor%maxRows && !m.filterField.Focused()
isDisabled := m.isRowDisabled(row, maxRows)
if isDisabled && isActive {
return styles.TableRowDisabledActive()
}
if isDisabled {
return styles.TableRowDisabled()
}
if isActive {
return styles.TableRowActive()
}
return styles.TableRow()
Expand Down
14 changes: 12 additions & 2 deletions src/uxBlock/models/table/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ func (b *Body) Rows() []*Row {
}

type Row struct {
index int
cells []Cell
index int
cells []Cell
disabled bool
}

func NewRow(cells ...Cell) *Row {
Expand Down Expand Up @@ -127,6 +128,15 @@ func (r *Row) Cells() []Cell {
return r.cells
}

func (r *Row) SetDisabled(disabled bool) *Row {
r.disabled = disabled
return r
}

func (r *Row) IsDisabled() bool {
return r.disabled
}

type Cell struct {
text string
style lipgloss.Style
Expand Down
15 changes: 15 additions & 0 deletions src/uxBlock/styles/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ func TableRowActive() lipgloss.Style {
PaddingRight(1)
}

func TableRowDisabled() lipgloss.Style {
return DefaultStyle().
Foreground(lipgloss.ANSIColor(245)).
PaddingLeft(1).
PaddingRight(1)
}

func TableRowDisabledActive() lipgloss.Style {
return DefaultStyle().
Foreground(lipgloss.ANSIColor(245)).
Background(lipgloss.ANSIColor(236)).
PaddingLeft(1).
PaddingRight(1)
}

var helpStyle = DefaultStyle().
Foreground(HelpColor)

Expand Down
20 changes: 12 additions & 8 deletions src/uxHelpers/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,21 @@ func PrintOrgSelector(
return orgs[selected], nil
}

func createOrgTableRows(projects []entity.Org) (*table.Row, *table.Body) {
header := table.NewRowFromStrings("ID", "Name", "Role")
func createOrgTableRows(orgs []entity.Org) (*table.Row, *table.Body) {
header := table.NewRowFromStrings("ID", "Name", "Role", "Status")

body := table.NewBody()
for _, project := range projects {
body.AddStringsRow(
string(project.Id),
project.Name.String(),
project.Role.Native(),
for _, org := range orgs {
row := table.NewRowFromStrings(
string(org.Id),
org.Name.String(),
org.Role.Native(),
org.Status.String(),
)
if !org.Status.IsActive() {
row.SetDisabled(true)
}
body.AddRow(row)
}

return header, body
}