Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Implement parameters list + more template list columns#2359

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/param_list
Jun 15, 2022

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedJun 15, 2022
edited
Loading

I am using this for debugging, figured I'd throw it in a quick branch.

What this does

Adds a way to list parameter values for a scope. Really helpful for debugging the param things I am messing with.I hide the cmd by default right now, as it lists theparameter_values, notparameter_schemes.. I think the cli should somehow distinguish the two, but don't know at the moment.

No actual values are returned from the cli, just the name + meta data.

I also added more columns templates list if they specify the columns. I needed this for debugging too.

Param list (hidden by default)

$ coder parameters list workspace my-workspaceNAME          SOURCE SCHEME  DESTINATION SCHEME    docker_image  data           provisioner_variable

Template columns

$ ./coder templates list -c name -c active_version_id                                                                                                                                                                                              NAME    ACTIVE VERSION ID                     docker  8898efde-8f95-4cdd-8ea8-fee121510361

@EmyrkEmyrk requested a review froma team as acode ownerJune 15, 2022 16:39
@EmyrkEmyrk requested a review fromjohnstcnJune 15, 2022 18:05
Copy link
Member

@Kira-PilotKira-Pilot left a comment

Choose a reason for hiding this comment

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

someone with more Go experience should review but 👍 from the FE. BTW, if you mergemain in again, that chromatic CI check should clear up.

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

This looks really useful!

Comment on lines 6 to 9
"github.com/google/uuid"
"golang.org/x/xerrors"

"github.com/spf13/cobra"
Copy link
Member

Choose a reason for hiding this comment

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

nit: imports

Comment on lines +33 to +54
funcdisplayParameters(filterColumns []string,params...codersdk.Parameter)string {
tableWriter:=cliui.Table()
header:= table.Row{"id","scope","scope id","name","source scheme","destination scheme","created at","updated at"}
tableWriter.AppendHeader(header)
tableWriter.SetColumnConfigs(cliui.FilterTableColumns(header,filterColumns))
tableWriter.SortBy([]table.SortBy{{
Name:"name",
}})
for_,param:=rangeparams {
tableWriter.AppendRow(table.Row{
param.ID.String(),
param.Scope,
param.ScopeID.String(),
param.Name,
param.SourceScheme,
param.DestinationScheme,
param.CreatedAt,
param.UpdatedAt,
})
}
returntableWriter.Render()
}
Copy link
Member

Choose a reason for hiding this comment

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

I like this approach of abstracting the presentation logic from the command logic; makes it more re-usable later.

Emyrk reacted with thumbs up emoji
Comment on lines +49 to +77
funcdisplayTemplates(filterColumns []string,templates...codersdk.Template)string {
tableWriter:=cliui.Table()
header:= table.Row{
"Name","Created At","Last Updated","Organization ID","Provisioner",
"Active Version ID","Used By","Max TTL","Min Autostart"}
tableWriter.AppendHeader(header)
tableWriter.SetColumnConfigs(cliui.FilterTableColumns(header,filterColumns))
tableWriter.SortBy([]table.SortBy{{
Name:"name",
}})
for_,template:=rangetemplates {
suffix:=""
iftemplate.WorkspaceOwnerCount!=1 {
suffix="s"
}
tableWriter.AppendRow(table.Row{
template.Name,
template.CreatedAt.Format("January 2, 2006"),
template.UpdatedAt.Format("January 2, 2006"),
template.OrganizationID.String(),
template.Provisioner,
template.ActiveVersionID.String(),
cliui.Styles.Fuschia.Render(fmt.Sprintf("%d developer%s",template.WorkspaceOwnerCount,suffix)),
(time.Duration(template.MaxTTLMillis)*time.Millisecond).String(),
(time.Duration(template.MinAutostartIntervalMillis)*time.Millisecond).String(),
})
}
returntableWriter.Render()
}
Copy link
Member

Choose a reason for hiding this comment

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

👍

@EmyrkEmyrk merged commit75205f5 intomainJun 15, 2022
@EmyrkEmyrk deleted the stevenmasley/param_list branchJune 15, 2022 23:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@Kira-PilotKira-PilotKira-Pilot approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Emyrk@johnstcn@Kira-Pilot

[8]ページ先頭

©2009-2025 Movatter.jp