Merge "Add permalinks to task detail popup"
This commit is contained in:
commit
459ee2f1d3
|
@ -60,6 +60,20 @@ function hasInterestingKeys (obj, keys) {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeTaskPath (path) {
|
||||||
|
return path.join('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
function taskPathMatches (ref, test) {
|
||||||
|
if (test.length < ref.length)
|
||||||
|
return false
|
||||||
|
for (let i=0; i < ref.length; i++) {
|
||||||
|
if (ref[i] !== test[i])
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
class TaskOutput extends React.Component {
|
class TaskOutput extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
data: PropTypes.object,
|
data: PropTypes.object,
|
||||||
|
@ -180,6 +194,8 @@ class HostTask extends React.Component {
|
||||||
task: PropTypes.object,
|
task: PropTypes.object,
|
||||||
host: PropTypes.object,
|
host: PropTypes.object,
|
||||||
errorIds: PropTypes.object,
|
errorIds: PropTypes.object,
|
||||||
|
taskPath: PropTypes.array,
|
||||||
|
displayPath: PropTypes.array,
|
||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -201,13 +217,16 @@ class HostTask extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
const { host } = this.props
|
const { host, taskPath, displayPath } = this.props
|
||||||
|
|
||||||
hostTaskStats(this.state, host)
|
hostTaskStats(this.state, host)
|
||||||
|
|
||||||
|
if (taskPathMatches(taskPath, displayPath))
|
||||||
|
this.state.showModal = true
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { hostname, task, host, errorIds } = this.props
|
const { hostname, task, host, taskPath, errorIds } = this.props
|
||||||
|
|
||||||
const ai = []
|
const ai = []
|
||||||
if (this.state.skipped) {
|
if (this.state.skipped) {
|
||||||
|
@ -244,6 +263,7 @@ class HostTask extends React.Component {
|
||||||
)
|
)
|
||||||
|
|
||||||
const expand = errorIds.has(task.task.id)
|
const expand = errorIds.has(task.task.id)
|
||||||
|
|
||||||
let name = task.task.name
|
let name = task.task.name
|
||||||
if (!name) {
|
if (!name) {
|
||||||
name = host.action
|
name = host.action
|
||||||
|
@ -286,7 +306,13 @@ class HostTask extends React.Component {
|
||||||
>
|
>
|
||||||
<Icon type="pf" name="close" />
|
<Icon type="pf" name="close" />
|
||||||
</button>
|
</button>
|
||||||
<Modal.Title>{hostname}</Modal.Title>
|
<Modal.Title>{hostname}
|
||||||
|
<span className="zuul-console-modal-header-link">
|
||||||
|
<a href={'#'+makeTaskPath(taskPath)}>
|
||||||
|
<Icon type="fa" name="link" title="Permalink" />
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<TaskOutput data={host}/>
|
<TaskOutput data={host}/>
|
||||||
|
@ -301,13 +327,17 @@ class PlayBook extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
playbook: PropTypes.object,
|
playbook: PropTypes.object,
|
||||||
errorIds: PropTypes.object,
|
errorIds: PropTypes.object,
|
||||||
|
taskPath: PropTypes.array,
|
||||||
|
displayPath: PropTypes.array,
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { playbook, errorIds } = this.props
|
const { playbook, errorIds, taskPath, displayPath } = this.props
|
||||||
|
|
||||||
const expandAll = (playbook.phase === 'run')
|
const expandAll = (playbook.phase === 'run')
|
||||||
const expand = (expandAll || errorIds.has(playbook.phase + playbook.index))
|
const expand = (expandAll ||
|
||||||
|
errorIds.has(playbook.phase + playbook.index) ||
|
||||||
|
taskPathMatches(taskPath, displayPath))
|
||||||
|
|
||||||
const ai = []
|
const ai = []
|
||||||
if (playbook.trusted) {
|
if (playbook.trusted) {
|
||||||
|
@ -340,7 +370,10 @@ class PlayBook extends React.Component {
|
||||||
<Row key={idx2+hostname}>
|
<Row key={idx2+hostname}>
|
||||||
<Col sm={12}>
|
<Col sm={12}>
|
||||||
<HostTask hostname={hostname}
|
<HostTask hostname={hostname}
|
||||||
task={task} host={host} errorIds={errorIds}/>
|
taskPath={taskPath.concat([
|
||||||
|
idx.toString(), idx2.toString(), hostname])}
|
||||||
|
displayPath={displayPath} task={task} host={host}
|
||||||
|
errorIds={errorIds}/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
))))}
|
))))}
|
||||||
|
@ -354,6 +387,7 @@ class PlayBook extends React.Component {
|
||||||
class Console extends React.Component {
|
class Console extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
output: PropTypes.array,
|
output: PropTypes.array,
|
||||||
|
displayPath: PropTypes.array,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -394,13 +428,14 @@ class Console extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { output } = this.props
|
const { output, displayPath } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<ListView key="playbooks" className="zuul-console">
|
<ListView key="playbooks" className="zuul-console">
|
||||||
{output.map((playbook, idx) => (
|
{output.map((playbook, idx) => (
|
||||||
<PlayBook key={idx} playbook={playbook} errorIds={this.errorIds}/>))}
|
<PlayBook key={idx} playbook={playbook} taskPath={[idx.toString()]}
|
||||||
|
displayPath={displayPath} errorIds={this.errorIds}/>))}
|
||||||
</ListView>
|
</ListView>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
|
|
|
@ -226,6 +226,11 @@ pre.version {
|
||||||
{
|
{
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
.zuul-console-modal-header-link
|
||||||
|
{
|
||||||
|
margin-left: 2em;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
.zuul-console-task-detail
|
.zuul-console-task-detail
|
||||||
{
|
{
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|
|
@ -42,6 +42,8 @@ class BuildConsolePage extends Refreshable {
|
||||||
render () {
|
render () {
|
||||||
const { remoteData } = this.props
|
const { remoteData } = this.props
|
||||||
const build = remoteData.builds[this.props.match.params.buildId]
|
const build = remoteData.builds[this.props.match.params.buildId]
|
||||||
|
const hash = this.props.location.hash.substring(1).split('/')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div style={{float: 'right'}}>
|
<div style={{float: 'right'}}>
|
||||||
|
@ -49,7 +51,7 @@ class BuildConsolePage extends Refreshable {
|
||||||
</div>
|
</div>
|
||||||
{build && build.output &&
|
{build && build.output &&
|
||||||
<Build build={build} active='console'>
|
<Build build={build} active='console'>
|
||||||
<Console output={build.output}/>
|
<Console output={build.output} displayPath={hash.length>0?hash:undefined}/>
|
||||||
</Build>}
|
</Build>}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue