Skip to content

feat: store and display template owner#2228

Merged
AbhineetJain merged 7 commits into
mainfrom
abhineetjain/2151-template-owner-ui
Jun 10, 2022
Merged

feat: store and display template owner#2228
AbhineetJain merged 7 commits into
mainfrom
abhineetjain/2151-template-owner-ui

Conversation

@AbhineetJain
Copy link
Copy Markdown
Contributor

This PR stores the template owner in the database and displays that information in the UI.

Subtasks

  • add migrations to store owner_id in Templates table.
  • update the API calls to store owner_id and return owner_id and owner_name
  • display owner_name on Templates page
  • display owner_name on Template page
  • add new story
  • update unit tests

Fixes #2151

Screenshots

Templates page

Screen Shot 2022-06-09 at 11 07 33 PM

Template page

Screen Shot 2022-06-09 at 11 06 46 PM

@AbhineetJain AbhineetJain requested a review from a team as a code owner June 10, 2022 03:08
@AbhineetJain AbhineetJain requested a review from Emyrk June 10, 2022 03:08
Comment thread site/src/components/TemplateStats/TemplateStats.tsx
Comment thread site/src/testHelpers/entities.ts Outdated
max_ttl_ms: 604800000,
min_autostart_interval_ms: 3600000,
owner_id: "test-owner-id",
owner_name: "test_owner",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🥳

Copy link
Copy Markdown
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

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

FE looks good! ✔️

@AbhineetJain AbhineetJain requested a review from a team June 10, 2022 14:48
Copy link
Copy Markdown
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Looks good! There's just one gotcha that I think would be worth fixing, unfortunately fixing it requires some refactoring.

Comment thread coderd/templates.go Outdated
Copy link
Copy Markdown
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

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

Wait I'm confused, why does a template have a user as an owner?

Is it really an "owner" or just a "created_by" for audit log purposes?

@AbhineetJain
Copy link
Copy Markdown
Contributor Author

Wait I'm confused, why does a template have a user as an owner?

Is it really an "owner" or just a "created_by" for audit log purposes?

As per #2151, we want to identify the owner of the templates in the UI on account of them being minority users in an eventually grown Coder installation.

@AbhineetJain AbhineetJain requested a review from Emyrk June 10, 2022 19:03
@AbhineetJain AbhineetJain enabled auto-merge (squash) June 10, 2022 19:09
@AbhineetJain AbhineetJain merged commit 02d2aea into main Jun 10, 2022
@AbhineetJain AbhineetJain deleted the abhineetjain/2151-template-owner-ui branch June 10, 2022 19:24
Kira-Pilot added a commit that referenced this pull request Jun 14, 2022
* feat: update build url to @username/workspace/builds/buildnumber (#2234)

* update build url to @username/workspace/builds/buildnumber

* update errors thrown from the API

* add unit tests for the new API

* add t.parallel

* get username and workspace name from params

* fix: update icon (#2216)

* feat: Show template description in `coder template init` (#2238)

* fix: workspace schedule time displays (#2249)

Summary:

Various time displays weren't quite right.

Details:

- Display date (not just time) of upcoming workspace stop in workspace
page
- Fix ttlShutdownAt for various cases + tests
  - manual to non-manual
  - unchanged/unmodified
  - isBefore --> isSameOrBefore
  - use the delta (off by _ error)
- pluralize units in dayjs.add

* fix: Remove easter egg mentioning competitor (#2250)

This is more confusing than helpful!

* feat: Warn on coderd startup if access URL is localhost (#2248)

* feat: use custom wireguard reverse proxy for dev tunnel (#1975)

* fix: use correct link in create from template button (#2253)

* feat: store and display template creator (#2228)

* design commit

* add owner_id to templates table

* add owner information in apis and ui

* update minWidth for statItem

* rename owner to created_by

* missing refactor to created_by

* handle errors in fetching created_by names

* feat: update language on workspace page (#2220)

* fix: ensure config dir exists before reading tunnel config (#2259)

* fix(devtunnel): close `http.Server` before wireguard interface (#2263)

* fix: ensure `agentResource` is non-nil (#2261)

* chore: add hero image to OSS docs homepage (#2241)

* fix: Do not write 2 errors to api on template fetch error (#2285)

* feat: add tooltips to templates page

resolves #2242

Co-authored-by: Abhineet Jain <AbhineetJain@users.noreply.github.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: G r e y <grey@coder.com>
Co-authored-by: Kyle Carberry <kyle@coder.com>
Co-authored-by: David Wahler <david@coder.com>
Co-authored-by: Colin Adler <colin1adler@gmail.com>
Co-authored-by: Garrett Delfosse <garrett@coder.com>
Co-authored-by: Katie Horne <katie@coder.com>
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
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.

Templates view and template view should identify template owner

4 participants