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: Enhance table builder logic #2043

Merged
merged 3 commits into from
Jun 25, 2021

Conversation

pawelpasterz
Copy link
Contributor

@pawelpasterz pawelpasterz commented Jun 23, 2021

Fixes #1893

Test Plan

How do we know the code works?

  1. Run ./gradlew flankFullRun
  2. Run flank firebase test android models list
  3. You should see OS_VERSION_IDS column aligned to the left
  4. You should see RESOLUTION column centered by x mark

@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2021

Timestamp: 2021-06-25 07:36:30
Buildscan url for ubuntu-workflow run 970638350
https://gradle.com/s/in6pskxooznjq

@pawelpasterz pawelpasterz marked this pull request as ready for review June 24, 2021 04:21
Copy link
Contributor

@jan-goral jan-goral left a comment

Choose a reason for hiding this comment

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

My proposition is to change Alignment to Align just because is shorter.

@pawelpasterz pawelpasterz force-pushed the 1893-enhance-alignment-feature-in-table-builder branch from de07d2f to f031c40 Compare June 24, 2021 09:17
Copy link
Contributor

@Sloox Sloox left a comment

Choose a reason for hiding this comment

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

Minor comment, else looks good!

@@ -145,3 +157,11 @@ private fun DataWithSize.center() = String.format(
)

inline fun TableColumn.applyColorsUsing(mapper: (String) -> SystemOutColor) = copy(dataColor = data.map(mapper))

// RESOLUTION column needs dedicated alignment logic and data pre-processing
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a todo or something that has been achieved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not a todo, it's just a short info why we have additional method here

@pawelpasterz pawelpasterz force-pushed the 1893-enhance-alignment-feature-in-table-builder branch from c448769 to 1018578 Compare June 24, 2021 12:45
@@ -12,16 +12,19 @@ data class TableColumn(
val header: String,
val data: List<String>,
val dataColor: List<SystemOutColor> = listOf(),
val columnSize: Int = ((data + header).maxByOrNull { it.length }?.length ?: 0) + DEFAULT_COLUMN_PADDING
val columnSize: Int = ((data + header).maxByOrNull { it.length }?.length ?: 0) + DEFAULT_COLUMN_PADDING,
val align: Align
Copy link
Contributor

Choose a reason for hiding this comment

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

As @piotradamczyk5 mentioned, Align.LEFT could set as default, also here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jan-gogo @piotradamczyk5
IMO it's clearer to force explicit alignment set up and I do not fully agree with you.
On the other hand I don't have very strong opinion about it and I'm in minority in that case, so sure, I'll change it 👍🏻

@pawelpasterz pawelpasterz merged commit e4ed3f1 into master Jun 25, 2021
@pawelpasterz pawelpasterz deleted the 1893-enhance-alignment-feature-in-table-builder branch June 25, 2021 11:17
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flank models list ugly OS_VERSION_IDS column format
4 participants