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

Show on the K2 dashboard when someone else is the issue owner #187

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#1.3.63
- Allow for code owners to be assigned when there is only one person assigned
- Show on the K2 dashboard if an issue has an owner, and you're not the owner
- Add a filter for issues not owned by you

#1.3.62
- Design improvements for light and dark mode.

Expand Down
2 changes: 1 addition & 1 deletion assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "K2 for GitHub",
"version": "1.3.62",
"version": "1.3.63",
"description": "Manage your Kernel Scheduling from directly inside GitHub",

"browser_specific_settings": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "k2-extension",
"version": "1.3.62",
"version": "1.3.63",
"description": "A Chrome Extension for Kernel Schedule",
"private": true,
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/js/component/list-item/ListItemIssue.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class ListItemIssue extends React.Component {
{'★ '}
</span>
)}
{this.issueHasOwner && !this.isCurrentUserOwner && (
<span>
{'☆ '}
</span>
)}
<a
href={this.props.issue.url}
className={this.getClassName()}
Expand Down
13 changes: 12 additions & 1 deletion src/js/component/panel/PanelIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ const propTypes = {
/** If there are no issues to list in the panel, hide the panel entirely */
hideOnEmpty: PropTypes.bool,

/** If the issue is on HOLD, hide it */
hideIfHeld: PropTypes.bool,

/** If the issue is under review, hide it */
hideIfUnderReview: PropTypes.bool,

/** If the issue is owned by someone else, hide it */
hideIfOwnedBySomeoneElse: PropTypes.bool,
};
const defaultProps = {
filters: {
Expand All @@ -42,15 +47,17 @@ const defaultProps = {
hideOnEmpty: false,
hideIfHeld: false,
hideIfUnderReview: false,
hideIfOwnedBySomeoneElse: false,
};

function PanelIssues(props) {
let filteredData = props.data;

if (props.hideIfHeld || props.hideIfUnderReview) {
if (props.hideIfHeld || props.hideIfUnderReview || props.hideIfOwnedBySomeoneElse) {
filteredData = _.filter(props.data, (item) => {
const isHeld = item.title.toLowerCase().indexOf('[hold') > -1 ? ' hold' : '';
const isUnderReview = _.find(item.labels, label => label.name.toLowerCase() === 'reviewing');
const isOwnedBySomeoneElse = item.issueHasOwner && !item.currentUserIsOwner;

if (isHeld && props.hideIfHeld) {
return false;
Expand All @@ -60,6 +67,10 @@ function PanelIssues(props) {
return false;
}

if (isOwnedBySomeoneElse && props.hideIfOwnedBySomeoneElse) {
return false;
}

return true;
});
}
Expand Down
8 changes: 1 addition & 7 deletions src/js/lib/pages/github/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ const refreshAssignees = () => {
// Always start by erasing whatever was drawn before (so it always starts from a clean slate)
$('.js-issue-assignees .k2-element').remove();

// Do nothing if there is only one person assigned. Owners can only be set when there are
// multiple assignees
if ($('.js-issue-assignees > p > span').length <= 1) {
return;
}

// Check if there is an owner for the issue
const ghDescription = $('.comment-body').text();
const regexResult = ghDescription.match(/Current Issue Owner:\s@(?<owner>\S+)/i);
Expand All @@ -97,7 +91,7 @@ const refreshAssignees = () => {
} else {
$(el).append(`
<button type="button" class="Button flex-md-order-2 m-0 k2-element k2-button k2-button-make-owner" data-owner="${assignee}">
</button>
`);
}
Expand Down
5 changes: 5 additions & 0 deletions src/js/module/dashboard/Legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ function Legend() {
{' '}
Issue owner
</div>
<div>
<span>☆</span>
{' '}
Issue is owned by someone else
</div>
<div className="issue">
<sup>I</sup>
{' '}
Expand Down
17 changes: 17 additions & 0 deletions src/js/module/dashboard/ListIssuesAssigned.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ class ListIssuesAssigned extends React.Component {

this.state = {shouldHideHeldIssues: false};
this.state = {shouldHideUnderReviewIssues: false};
this.state = {shouldHideOwnedBySomeoneElseIssues: false};
this.fetch = this.fetch.bind(this);
this.toggleHeldFilter = this.toggleHeldFilter.bind(this);
this.toggleUnderReviewFilter = this.toggleUnderReviewFilter.bind(this);
this.toggleOwnedBySomeoneElseFilter = this.toggleOwnedBySomeoneElseFilter.bind(this);
}

componentDidMount() {
Expand Down Expand Up @@ -56,6 +58,10 @@ class ListIssuesAssigned extends React.Component {
this.setState(prevState => ({shouldHideUnderReviewIssues: !prevState.shouldHideUnderReviewIssues}));
}

toggleOwnedBySomeoneElseFilter() {
this.setState(prevState => ({shouldHideOwnedBySomeoneElseIssues: !prevState.shouldHideOwnedBySomeoneElseIssues}));
}

render() {
if (!this.props.issues) {
return (
Expand Down Expand Up @@ -90,6 +96,12 @@ class ListIssuesAssigned extends React.Component {
Under Review
</label>
</div>
<div className="checkbox">
<label>
<input type="checkbox" name="shouldHideIfUnderReview" id="shouldHideIfUnderReview" onChange={this.toggleOwnedBySomeoneElseFilter} />
Owned by Someone Else
</label>
</div>
</form>
</div>
<div className="d-flex flex-row">
Expand All @@ -100,6 +112,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Hourly'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
<div className="col-3 pr-3">
Expand All @@ -109,6 +122,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Daily'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
<div className="col-3 pr-3">
Expand All @@ -118,6 +132,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Weekly'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
<div className="col-3">
Expand All @@ -127,6 +142,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.findWhere(issue.labels, {name: 'Monthly'}))}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
</div>
Expand All @@ -139,6 +155,7 @@ class ListIssuesAssigned extends React.Component {
data={_.pick(this.props.issues, issue => _.intersection(_.map(issue.labels, label => label.name), ['Hourly', 'Daily', 'Weekly', 'Monthly']).length === 0)}
hideIfHeld={this.state.shouldHideHeldIssues}
hideIfUnderReview={this.state.shouldHideUnderReviewIssues}
hideIfOwnedBySomeoneElse={this.state.shouldHideOwnedBySomeoneElseIssues}
/>
</div>
</div>
Expand Down
Loading