Merge pull request #4974 from jakemcdermott/switch-default-job-panel

Switch default job panel to output

Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
             https://github.com/jakemcdermott
This commit is contained in:
softwarefactory-project-zuul[bot]
2019-10-10 04:24:04 +00:00
committed by GitHub
4 changed files with 8 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ class LaunchButton extends React.Component {
); );
if (launchConfig.can_start_without_user_input) { if (launchConfig.can_start_without_user_input) {
const { data: job } = await JobTemplatesAPI.launch(resource.id); const { data: job } = await JobTemplatesAPI.launch(resource.id);
history.push(`/jobs/${job.id}/details`); history.push(`/jobs/${job.id}`);
} else { } else {
this.setState({ promptError: true }); this.setState({ promptError: true });
} }
@@ -95,7 +95,7 @@ class LaunchButton extends React.Component {
relaunchConfig.passwords_needed_to_start.length === 0 relaunchConfig.passwords_needed_to_start.length === 0
) { ) {
const { data: job } = await relaunch; const { data: job } = await relaunch;
history.push(`/jobs/${job.id}/details`); history.push(`/jobs/${job.id}`);
} else { } else {
this.setState({ promptError: true }); this.setState({ promptError: true });
} }

View File

@@ -29,7 +29,7 @@ describe('LaunchButton', () => {
); );
expect(wrapper).toHaveLength(1); expect(wrapper).toHaveLength(1);
}); });
test('redirects to details after successful launch', async done => { test('redirects to job after successful launch', async done => {
const history = { const history = {
push: jest.fn(), push: jest.fn(),
}; };
@@ -51,7 +51,7 @@ describe('LaunchButton', () => {
expect(JobTemplatesAPI.readLaunch).toHaveBeenCalledWith(1); expect(JobTemplatesAPI.readLaunch).toHaveBeenCalledWith(1);
await sleep(0); await sleep(0);
expect(JobTemplatesAPI.launch).toHaveBeenCalledWith(1); expect(JobTemplatesAPI.launch).toHaveBeenCalledWith(1);
expect(history.push).toHaveBeenCalledWith('/jobs/9000/details'); expect(history.push).toHaveBeenCalledWith('/jobs/9000');
done(); done();
}); });
test('displays error modal after unsuccessful launch', async done => { test('displays error modal after unsuccessful launch', async done => {

View File

@@ -69,8 +69,8 @@ class Job extends Component {
} }
const tabsArray = [ const tabsArray = [
{ name: i18n._(t`Details`), link: `${match.url}/details`, id: 0 }, { name: i18n._(t`Output`), link: `${match.url}/output`, id: 0 },
{ name: i18n._(t`Output`), link: `${match.url}/output`, id: 1 }, { name: i18n._(t`Details`), link: `${match.url}/details`, id: 1 },
]; ];
const CardHeader = styled(PFCardHeader)` const CardHeader = styled(PFCardHeader)`
@@ -132,7 +132,7 @@ class Job extends Component {
<Switch> <Switch>
<Redirect <Redirect
from="/jobs/:type/:id" from="/jobs/:type/:id"
to="/jobs/:type/:id/details" to="/jobs/:type/:id/output"
exact exact
/> />
{job && [ {job && [

View File

@@ -32,8 +32,8 @@ class Jobs extends Component {
const breadcrumbConfig = { const breadcrumbConfig = {
'/jobs': i18n._(t`Jobs`), '/jobs': i18n._(t`Jobs`),
[`/jobs/${type}/${job.id}`]: `${job.name}`, [`/jobs/${type}/${job.id}`]: `${job.name}`,
[`/jobs/${type}/${job.id}/details`]: i18n._(t`Details`),
[`/jobs/${type}/${job.id}/output`]: i18n._(t`Output`), [`/jobs/${type}/${job.id}/output`]: i18n._(t`Output`),
[`/jobs/${type}/${job.id}/details`]: i18n._(t`Details`),
}; };
this.setState({ breadcrumbConfig }); this.setState({ breadcrumbConfig });