Skip to content

Commit

Permalink
Merge pull request #49 from Fgerthoffert/develop
Browse files Browse the repository at this point in the history
First draft for a specs board
  • Loading branch information
Fgerthoffert authored Oct 16, 2019
2 parents a9c96d9 + 5234e0e commit bb31670
Show file tree
Hide file tree
Showing 11 changed files with 307 additions and 6 deletions.
9 changes: 8 additions & 1 deletion cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ export default abstract class extends Command {
roadmap: {
jqlInitiatives: 'type = initiative',
forecastWeeks: 26,
teams: ['Team 1, Team 2']
teams: ['Team 1, Team 2'],
specsStates: [
'PM Kickoff',
'PM Elaboration',
'Design',
'DM Review',
'Execution'
]
}
};

Expand Down
54 changes: 53 additions & 1 deletion cli/src/commands/roadmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,41 @@ export default class Roadmap extends Command {
closedIssuesByWeekAndInitiative
);

const issuesWithLabels = this.getIssuesWithLabels(issuesTree, treeRoot);
const specsState = userConfig.roadmap.specsStates.map((state: string) => {
return {
name: state,
list: issuesWithLabels
.filter((issue: any) => {
if (
issue.fields.labels.find(
(label: string) =>
getStrippedLabel(label) === getStrippedLabel(state)
) !== undefined
) {
return true;
} else {
return false;
}
})
.map((issue: any) => {
return {
id: issue.id,
key: issue.key,
fields: issue.fields,
host: issue.host,
points: issue.points
};
})
};
});
// FINAL STAGE
const roadmapArtifact = {
updatedAt: new Date().toJSON(),
byTeam: closedIssuesByWeekAndTeam,
byInitiative: closedIssuesByWeekAndInitiative,
byFutureInitiative: futureCompletion
byFutureInitiative: futureCompletion,
bySpecsState: specsState
};

this.showArtifactsTable(roadmapArtifact, type);
Expand Down Expand Up @@ -172,6 +201,23 @@ export default class Roadmap extends Command {
return jsonObject;
};

getIssuesWithLabels = (issuesTree: any, node: any) => {
const issues = [];
for (const initiative of issuesTree.childrenIterator(node)) {
for (const epic of issuesTree.childrenIterator(initiative)) {
if (epic.fields.labels.length > 0) {
issues.push(epic);
}
for (const story of issuesTree.childrenIterator(epic)) {
if (story.fields.labels.length > 0) {
issues.push(story);
}
}
}
}
return issues;
};

showArtifactsTable = (roadmapArtifact: any, type: string) => {
const columnsByTeam: any = {
name: {
Expand Down Expand Up @@ -383,3 +429,9 @@ export default class Roadmap extends Command {
);
};
}

const getStrippedLabel = (label: string) => {
return String(label)
.replace(/[^a-z0-9+]+/gi, '')
.toLowerCase();
};
1 change: 1 addition & 0 deletions cli/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,5 @@ export interface IConfigRoadmap {
jqlInitiatives: string;
teams: Array<string>;
forecastWeeks: number;
specsStates: Array<string>;
}
2 changes: 1 addition & 1 deletion cli/src/utils/data/fetchChildren.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const fetchChildren = async (
const issuesJira = await jiraSearchIssues(
userConfig.jira,
'issuekey in childIssuesOf(' + issueKey + ')',
'summary,status,labels,' +
'summary,status,labels,assignee,' +
userConfig.jira.fields.points +
',' +
userConfig.jira.fields.originalPoints +
Expand Down
6 changes: 6 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
"@material-ui/core": "^4.3.3",
"@material-ui/icons": "^4.2.1",
"@nivo/heatmap": "^0.59.2",
"@primer/components": "^14.4.0",
"@rematch/core": "^1.1.0",
"@types/auth0": "^2.9.21",
"@types/auth0-js": "^9.10.6",
"@types/chart.js": "^2.8.4",
"@types/colornames": "^1.1.1",
"@types/cytoscape": "^3.8.2",
"@types/jest": "24.0.18",
"@types/node": "12.7.2",
Expand All @@ -21,10 +23,12 @@
"@types/socket.io-client": "^1.4.32",
"axios": "^0.19.0",
"chart.js": "^2.8.0",
"colornames": "^1.1.1",
"cytoscape": "^3.10.0",
"cytoscape-cose-bilkent": "^4.1.0",
"cytoscape-popper": "^1.0.4",
"date-fns": "^2.2.1",
"font-color-contrast": "^1.0.3",
"install": "^0.13.0",
"loglevel": "^1.6.3",
"material-color-hash": "^0.1.6",
Expand All @@ -34,11 +38,13 @@
"react-bootstrap": "^1.0.0-beta.12",
"react-cytoscapejs": "^1.2.0",
"react-dom": "^16.9.0",
"react-moment": "^0.9.6",
"react-redux": "^7.1.1",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.1",
"socket.io-client": "^2.2.0",
"styled-components": "^4.4.0",
"tippy": "0.0.0",
"tippy.js": "^4.3.5",
"typescript": "3.5.3"
Expand Down
8 changes: 5 additions & 3 deletions ui/src/components/Charts/Nivo/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export const getCompletionColor = (
value: any,
completionWeeks: any
) => {
const prct = Math.round(
(value * 100) / completionWeeks[data.xKey].totalCount
);
let prct = 0;
if (completionWeeks[data.xKey] !== undefined) {
prct = Math.round((value * 100) / completionWeeks[data.xKey].totalCount);
}

if (prct < 20) {
return 'rgb(247, 252, 185)';
} else if (prct >= 20 && prct < 40) {
Expand Down
109 changes: 109 additions & 0 deletions ui/src/components/Issue/IssueCompact.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import React, { FC } from 'react';
import { makeStyles, createStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid/Grid';
import { Avatar, CounterLabel } from '@primer/components';
import Tooltip from '@material-ui/core/Tooltip';

const useStyles = makeStyles(() =>
createStyles({
root: {
flexGrow: 1,
padding: '5px'
},
repoName: {
color: '#586069!important',
fontSize: '14px',
marginRight: '5px',
textDecoration: 'none'
},
issueTitle: {
fontSize: '14px',
color: '#000000!important',
textDecoration: 'none'
},
issueSubTitle: {
textDecoration: 'none',
fontSize: '10px',
color: '#586069!important'
}
})
);

const IssueCompact: FC<any> = ({ issue }) => {
const classes = useStyles();
return (
<Paper className={classes.root} elevation={1}>
<Grid
container
direction='row'
justify='flex-start'
alignItems='flex-start'
spacing={1}
>
<Grid item>
<Tooltip title={issue.fields.issuetype.name}>
<Avatar mb={0} src={issue.fields.issuetype.iconUrl} size={20} />
</Tooltip>
</Grid>
<Grid item xs={12} sm container>
<a
href={issue.host + '/browse/' + issue.key}
className={classes.repoName}
target='_blank'
rel='noopener noreferrer'
>
{issue.key}
</a>
</Grid>
{issue.fields.assignee !== null && (
<Grid item>
<Tooltip title={issue.fields.assignee.displayName}>
<Avatar
mb={0}
src={issue.fields.assignee.avatarUrls['48x48']}
size={24}
/>
</Tooltip>
</Grid>
)}
</Grid>
<Grid
container
direction='row'
justify='flex-start'
alignItems='flex-start'
spacing={1}
>
<Grid item xs={12} sm container>
<a
href={issue.host + '/browse/' + issue.key}
className={classes.issueTitle}
target='_blank'
rel='noopener noreferrer'
>
{issue.fields.summary}
</a>
</Grid>
</Grid>
<Grid
container
direction='row'
justify='flex-start'
alignItems='flex-end'
spacing={1}
>
<Grid item xs={12} sm container className={classes.issueSubTitle}>
<span>Workflow: {issue.fields.status.name}</span>
</Grid>
<Grid item>
<Tooltip title='Story points'>
<CounterLabel>{issue.points}</CounterLabel>
</Tooltip>
</Grid>
</Grid>
</Paper>
);
};

export default IssueCompact;
25 changes: 25 additions & 0 deletions ui/src/models/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,31 @@ export const global = createModel({
this.setAuth0Initialized(true);
} else {
await setAuth0Config();
/*
try {
const response = await window.Auth0.getTokenSilently();
console.log(response);
} catch (error) {
console.error(error);
}
console.log(window.Auth0);
*/
/*
const test = window.Auth0.checkSession(
{
scope: 'openid profile email'
},
function(err: any, authResult: any) {
// err if automatic parseHash fails
if (err !== undefined && err) {
console.error(err);
return;
}
console.log(authResult);
}
);
*/

this.setAuth0Initialized(true);
}
}
Expand Down
Loading

0 comments on commit bb31670

Please sign in to comment.