-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jira): improve setup UI for transition ids
* Show user issue transitions before asking for the ids. * Wait for an issue to ask for the id. * Export some constants so status can be referenciated from outside.
- Loading branch information
Showing
6 changed files
with
144 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,49 @@ | ||
"use strict"; | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = { | ||
BACKLOG: 10000, | ||
SELECTED_FOR_DEVELOPMENT: 10001, | ||
IN_PROGRESS: 3, | ||
CODE_REVIEW: 10005 | ||
}; | ||
exports.status = undefined; | ||
|
||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
|
||
var _ramda = require('ramda'); | ||
|
||
var _ramda2 = _interopRequireDefault(_ramda); | ||
|
||
var _util = require('../../util'); | ||
|
||
var _reporter = require('../../reporter'); | ||
|
||
var _reporter2 = _interopRequireDefault(_reporter); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var status = exports.status = { | ||
BACKLOG: 'BACKLOG', | ||
IN_PROGRESS: 'IN_PROGRESS', | ||
IN_REVIEW: 'IN_PREVIEW', | ||
SELECTED_FOR_DEVELOPMENT: 'SELECTED_FOR_DEVELOPMENT' | ||
}; | ||
|
||
exports['default'] = _ramda2['default'].curryN(2, function (config, issue) { | ||
var askForStatus = _ramda2['default'].composeP(config.update(['jira', 'status']), _ramda2['default'].compose(_util.wrapInPromise, function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 4), | ||
BACKLOG = _ref2[0], | ||
SELECTED_FOR_DEVELOPMENT = _ref2[1], | ||
IN_PROGRESS = _ref2[2], | ||
IN_REVIEW = _ref2[3]; | ||
|
||
return { | ||
BACKLOG: BACKLOG, SELECTED_FOR_DEVELOPMENT: SELECTED_FOR_DEVELOPMENT, IN_PROGRESS: IN_PROGRESS, IN_REVIEW: IN_REVIEW | ||
}; | ||
}), _ramda2['default'].compose(_util.wrapInPromise, JSON.parse), _ramda2['default'].compose(_util.wrapInPromise, _ramda2['default'].concat('['), _ramda2['default'].concat(_ramda2['default'].__, ']')), _ramda2['default'].compose(_reporter2['default'].question, _ramda2['default'].always({ | ||
question: 'What are the ids for the transitions that represent\n' + 'Backlog, to do, in progress, in review (enter a comma separated list)?' | ||
}), _reporter2['default'].info, _ramda2['default'].concat('These are the possible transitions found for the issue:\n'))); | ||
|
||
return _ramda2['default'].ifElse(_ramda2['default'].compose(_ramda2['default'].either(_ramda2['default'].isNil, _ramda2['default'].isEmpty), _ramda2['default'].invoker(1, 'get')(['jira', 'status'])), _ramda2['default'].partial(_ramda2['default'].compose(askForStatus, _ramda2['default'].join('\n'), _ramda2['default'].map(function (_ref3) { | ||
var name = _ref3.name, | ||
id = _ref3.id; | ||
return ' * ' + name + ': ' + id; | ||
}), _ramda2['default'].map(_ramda2['default'].prop('to')), _ramda2['default'].prop('transitions')), [issue]), _ramda2['default'].compose(_util.wrapInPromise, _ramda2['default'].invoker(1, 'get')(['jira', 'status'])))(config); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import R from 'ramda'; | ||
import { wrapInPromise } from '../../util'; | ||
import reporter from '../../reporter'; | ||
|
||
export const status = { | ||
BACKLOG: 'BACKLOG', | ||
IN_PROGRESS: 'IN_PROGRESS', | ||
IN_REVIEW: 'IN_PREVIEW', | ||
SELECTED_FOR_DEVELOPMENT: 'SELECTED_FOR_DEVELOPMENT' | ||
}; | ||
|
||
export default R.curryN(2, (config, issue) => { | ||
const askForStatus = R.composeP( | ||
config.update(['jira', 'status']), | ||
R.compose( | ||
wrapInPromise, | ||
([BACKLOG, SELECTED_FOR_DEVELOPMENT, IN_PROGRESS, IN_REVIEW]) => ({ | ||
BACKLOG, SELECTED_FOR_DEVELOPMENT, IN_PROGRESS, IN_REVIEW | ||
}) | ||
), | ||
R.compose(wrapInPromise, JSON.parse), | ||
R.compose(wrapInPromise, R.concat('['), R.concat(R.__, ']')), | ||
R.compose( | ||
reporter.question, | ||
R.always({ | ||
question: 'What are the ids for the transitions that represent\n' + | ||
'Backlog, to do, in progress, in review (enter a comma separated list)?' | ||
}), | ||
reporter.info, | ||
R.concat('These are the possible transitions found for the issue:\n'), | ||
) | ||
); | ||
|
||
return R.ifElse( | ||
R.compose( | ||
R.either(R.isNil, R.isEmpty), R.invoker(1, 'get')(['jira', 'status']) | ||
), | ||
R.partial(R.compose( | ||
askForStatus, | ||
R.join('\n'), | ||
R.map(({ name, id }) => ` * ${name}: ${id}`), | ||
R.map(R.prop('to')), | ||
R.prop('transitions') | ||
), [issue]), | ||
R.compose(wrapInPromise, R.invoker(1, 'get')(['jira', 'status'])) | ||
)(config); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters