Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for rad init UI issue on a small terminal #8068

Conversation

vishwahiremat
Copy link
Contributor

Description

  • Removed hard coded values for width and height for list model.
  • Dynamically change the width or height of the list model depending on the terminal dimensions.

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).

Fixes: #6492

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
  • If applicable, design document has been reviewed and approved by Radius maintainers/approvers.
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.

Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
@@ -26,9 +26,9 @@ import (
"github.com/charmbracelet/x/ansi"
)

const listHeight = 14
// const listHeight = 8
Copy link
Contributor

@sk593 sk593 Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be deleted or are they being used to denote specific values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted these lines in my latest PR.

Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
sk593
sk593 previously approved these changes Nov 18, 2024
@radius-functional-tests
Copy link

radius-functional-tests bot commented Nov 18, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository vishwahiremat/radius
Commit ref 1b4081a
Unique ID func88913982fb
Image tag pr-func88913982fb
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func88913982fb
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func88913982fb
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func88913982fb
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func88913982fb
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func88913982fb
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

Copy link
Contributor

@kachawla kachawla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing, looks good apart from a minor comment.

@@ -92,7 +88,7 @@ func NewListModel(choices []string, promptMsg string) ListModel {
items[i] = item(choice)
}

l := list.New(items, itemHandler{}, defaultWidth, listHeight)
l := list.New(items, itemHandler{}, 0, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's add a comment here about 0 values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comments

@@ -134,6 +130,7 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.width = msg.Width
m.List.SetSize(msg.Width, msg.Height-((3*msg.Height)/4))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, let's add a comment for quick description why we are doing this since it might not be obvious from the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments

Signed-off-by: Vishwanath Hiremath <vhiremath@microsoft.com>
@@ -134,6 +131,9 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.width = msg.Width
// setting the width and height of the list model as terminal dimensions changes.
// setting the height to 25% of the height of the terminal height.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 25% specifically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to change the dimension of the list model as terminal dimensions changes, and I am setting it to 25% because i figured its close to the existing size of the list model on a full terminal window.

@radius-functional-tests
Copy link

radius-functional-tests bot commented Nov 19, 2024

Radius functional test overview

🔍 Go to test action run

Name Value
Repository vishwahiremat/radius
Commit ref 15c39ea
Unique ID func9cba7370fe
Image tag pr-func9cba7370fe
Click here to see the list of tools in the current test run
  • gotestsum 1.12.0
  • KinD: v0.20.0
  • Dapr: 1.12.0
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func9cba7370fe
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func9cba7370fe
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func9cba7370fe
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func9cba7370fe
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func9cba7370fe
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@vishwahiremat vishwahiremat merged commit c1237c2 into radius-project:main Nov 19, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rad init UI can be cut off on a small terminal
3 participants