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

[dashboard] sort projects by activity #6073

Merged
merged 1 commit into from
Oct 7, 2021
Merged

Conversation

JanKoehnlein
Copy link
Contributor

Description

Project list is now sorted by most recent pre-build

Related Issue(s)

Fixes #6062

How to test

  1. Create a project with a pre-build
  2. in the same team, create a project without a pre-build -> project should appear after the first one in the projects list
  3. go to configuration and start a prebuild -> project should move before the first one in the projects list

Release Notes

Projects in the dashboard are now sorted by most recent pre-build

@iQQBot
Copy link
Contributor

iQQBot commented Oct 6, 2021

I think it should be a server side sort, otherwise it may not be handled when there is paging ?

@AlexTugarev
Copy link
Member

I think it should be a server side sort, otherwise it may not be handled when there is paging ?

in a following iteration, and yes that sounds reasonable.

currently, the last prebuild infos are fetched by the frontend async, which makes it hard to move the sorting to the api server.

AFAIC, pagination is not in scope of this issue/pr.

@AlexTugarev
Copy link
Member

AlexTugarev commented Oct 7, 2021

/werft run

👍 started the job as gitpod-build-jk-sort-projects-by-activity.2

@@ -73,6 +73,10 @@ export default function () {
return true;
}

function hasNewerPrebuild(p0: Project, p1: Project): number {
return moment(lastPrebuilds.get(p1.id)?.info?.startedAt || '1970-01-01').diff(moment(lastPrebuilds.get(p0.id)?.info?.startedAt || '1970-01-01'));
Copy link
Member

Choose a reason for hiding this comment

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

nit: a.startedAt.localeCompare(b.startetAt) works as well and doesn't require momentjs

@AlexTugarev
Copy link
Member

/lgtm

works as advertised!

@roboquat
Copy link
Contributor

roboquat commented Oct 7, 2021

LGTM label has been added.

Git tree hash: 4bb4052379ec509ffcbbf40172a78d9e3ddb400e

@roboquat
Copy link
Contributor

roboquat commented Oct 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlexTugarev

Associated issue: #6062

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit fd2cbb7 into main Oct 7, 2021
@roboquat roboquat deleted the jk/sort-projects-by-activity branch October 7, 2021 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort projects by activity
4 participants