From 31373864564c822e0f3fd0e50b520a60105fbde9 Mon Sep 17 00:00:00 2001 From: bupd Date: Sun, 26 May 2024 22:59:14 +0530 Subject: [PATCH] add: ID to the list table Signed-off-by: bupd add: ProjectID to the table Signed-off-by: bupd add: UserID to user list Signed-off-by: bupd --- pkg/views/project/list/view.go | 2 ++ pkg/views/user/list/view.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pkg/views/project/list/view.go b/pkg/views/project/list/view.go index 0cf10be9..fd8a69a8 100644 --- a/pkg/views/project/list/view.go +++ b/pkg/views/project/list/view.go @@ -13,6 +13,7 @@ import ( ) var columns = []table.Column{ + {Title: "ID", Width: 6}, {Title: "Project Name", Width: 12}, {Title: "Access Level", Width: 12}, {Title: "Type", Width: 12}, @@ -35,6 +36,7 @@ func ListProjects(projects []*models.Project) { } createdTime, _ := utils.FormatCreatedTime(project.CreationTime.String()) rows = append(rows, table.Row{ + strconv.FormatInt(int64(project.ProjectID), 10), // ProjectID project.Name, // Project Name accessLevel, // Access Level projectType, // Type diff --git a/pkg/views/user/list/view.go b/pkg/views/user/list/view.go index 5dc527e4..b036a24d 100644 --- a/pkg/views/user/list/view.go +++ b/pkg/views/user/list/view.go @@ -3,6 +3,7 @@ package list import ( "fmt" "os" + "strconv" "github.com/charmbracelet/bubbles/table" tea "github.com/charmbracelet/bubbletea" @@ -12,6 +13,7 @@ import ( ) var columns = []table.Column{ + {Title: "ID", Width: 6}, {Title: "Name", Width: 16}, {Title: "Administrator", Width: 16}, {Title: "Email", Width: 20}, @@ -27,6 +29,7 @@ func ListUsers(users []*models.UserResp) { } createdTime, _ := utils.FormatCreatedTime(user.CreationTime.String()) rows = append(rows, table.Row{ + strconv.FormatInt(int64(user.UserID), 10), // UserID user.Username, isAdmin, user.Email,