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

Adds threshold filter to the new home view #3718

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nzaytsev
Copy link
Contributor

@nzaytsev nzaytsev commented Nov 7, 2024

Description

Screen.Recording.2024-11-07.at.13.40.33.mov

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@nzaytsev nzaytsev linked an issue Nov 7, 2024 that may be closed by this pull request
@nzaytsev nzaytsev force-pushed the features/3706-filtering-of-branches-in-home-view branch 2 times, most recently from 7beb06e to a52d3fb Compare November 7, 2024 06:32
@nzaytsev nzaytsev requested review from d13 and eamodio November 7, 2024 06:33
Copy link
Member

@d13 d13 left a comment

Choose a reason for hiding this comment

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

Please be sure to separate the owner changes to another branch as we will not be shipping that this release.

Comment on lines 71 to 79
@gl-change=${(e: CustomEvent<{ threshold: OverviewRecentThreshold }>) => {
if (!this._overviewState.filter.stale || !this._overviewState.filter.recent) {
return;
}
this._ipc.sendCommand(SetOverviewFilter, {
stale: this._overviewState.filter.stale,
recent: { ...this._overviewState.filter.recent, threshold: e.detail.threshold },
});
}}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: move the event handler to a private method for readability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 37 to 57
@property({ type: Array }) options: (OverviewRecentThreshold | OverviewStaleThreshold)[] | undefined;
private selectDateFilter(threshold: OverviewRecentThreshold | OverviewStaleThreshold) {
const event = new CustomEvent('gl-change', {
detail: { threshold: threshold },
});
this.dispatchEvent(event);
}

private renderOption(option: OverviewRecentThreshold | OverviewStaleThreshold) {
switch (option) {
case 'OneDay':
return '1 day';
case 'OneWeek':
return '1 week';
case 'OneMonth':
return '1 month';
case 'OneYear':
return '1 year';
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Option labels should be passed in as part of the options:
{ label: string; value: OverviewRecentThreshold | OverviewStaleThreshold}[]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

},
stale: {
threshold: 'OneYear',
show: true,
Copy link
Member

Choose a reason for hiding this comment

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

Stale should be false by default. We don't want to ship stale until post-release of v16.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

Comment on lines +23 to +27
display: flex;
justify-content: space-between;
gap: 8px;
Copy link
Member

Choose a reason for hiding this comment

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

This style is shared with heading that don't have nested <spans>, please make a modifier class to apply the flexbox.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

splitted

@@ -40,8 +43,7 @@ export class GlBranchSection extends LitElement {
override render() {
return html`
<div class="section">
<h3 class="section-heading">${this.label}</h3>
<slot></slot>
<h3 class="section-heading"><span>${this.label}</span><slot></slot></h3>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<h3 class="section-heading"><span>${this.label}</span><slot></slot></h3>
<h3 class="section-heading"><span>${this.label}</span><slot name="heading-actions"></slot></h3>
<slot></slot>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

const { repository } = overview;
return html`
<div class="repository">
<gl-branch-section
label="Recent (${repository.branches.recent.length})"
.branches=${repository.branches.recent}
></gl-branch-section>
>
<gl-branch-threshold-filter
Copy link
Member

Choose a reason for hiding this comment

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

See named-slot comment in branch-section.ts.

Suggested change
<gl-branch-threshold-filter
<gl-branch-threshold-filter slot="heading-actions"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 22 to 23
@customElement('gl-branch-owner-filter')
export class GlBranchOwnerFilter extends GlElement {
Copy link
Member

Choose a reason for hiding this comment

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

Please split out all owner functionality as we will work on this post-release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@nzaytsev nzaytsev force-pushed the features/3706-filtering-of-branches-in-home-view branch 2 times, most recently from 5b082d1 to b7c74ae Compare November 8, 2024 08:58
@nzaytsev nzaytsev force-pushed the features/3706-filtering-of-branches-in-home-view branch from b7c74ae to 4f5e3cb Compare November 8, 2024 09:16
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.

Filtering of branches in Home view
2 participants