templateToRows converts a list of templates to a list of templateTableRow for outputting.
(templates ...codersdk.Template)
| 94 | // templateToRows converts a list of templates to a list of templateTableRow for |
| 95 | // outputting. |
| 96 | func templatesToRows(templates ...codersdk.Template) []templateTableRow { |
| 97 | rows := make([]templateTableRow, len(templates)) |
| 98 | for i, template := range templates { |
| 99 | rows[i] = templateTableRow{ |
| 100 | Template: template, |
| 101 | Name: template.Name, |
| 102 | CreatedAt: template.CreatedAt.Format("January 2, 2006"), |
| 103 | LastUpdated: template.UpdatedAt.Format("January 2, 2006"), |
| 104 | OrganizationID: template.OrganizationID, |
| 105 | OrganizationName: template.OrganizationName, |
| 106 | Provisioner: template.Provisioner, |
| 107 | ActiveVersionID: template.ActiveVersionID, |
| 108 | UsedBy: pretty.Sprint(cliui.DefaultStyles.Fuchsia, formatActiveDevelopers(template.ActiveUserCount)), |
| 109 | DefaultTTL: (time.Duration(template.DefaultTTLMillis) * time.Millisecond), |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | return rows |
| 114 | } |
no test coverage detected