Skip to content

Commit

Permalink
Remove refresh button from run details page
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyjbauer committed Mar 29, 2019
1 parent 5e4d4f3 commit 3c7f648
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 44 deletions.
52 changes: 9 additions & 43 deletions frontend/src/pages/RunDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,6 @@ describe('RunDetails', () => {
expect(lastCall.pageTitle).toMatchSnapshot();
});

it('has a refresh button, clicking it calls get run API again', async () => {
tree = shallow(<RunDetails {...generateProps()} />);
await getRunSpy;
await TestUtils.flushPromises();
const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
expect(refreshBtn).toBeDefined();
expect(getRunSpy).toHaveBeenCalledTimes(1);
await refreshBtn!.action();
expect(getRunSpy).toHaveBeenCalledTimes(2);
});

it('has a clone button, clicking it navigates to new run page', async () => {
tree = shallow(<RunDetails {...generateProps()} />);
await getRunSpy;
Expand Down Expand Up @@ -555,7 +542,7 @@ describe('RunDetails', () => {
expect(tree).toMatchSnapshot();
});

it('keeps side pane open and on same tab when refresh is clicked', async () => {
it('keeps side pane open and on same tab when page is refreshed', async () => {
testRun.pipeline_runtime!.workflow_manifest = JSON.stringify({
status: { nodes: { node1: { id: 'node1', }, }, },
});
Expand All @@ -567,11 +554,8 @@ describe('RunDetails', () => {
expect(tree.state('selectedNodeDetails')).toHaveProperty('id', 'node1');
expect(tree.state('sidepanelSelectedTab')).toEqual(2);

const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
expect(getRunSpy).toHaveBeenCalledTimes(2);
await (tree.instance() as RunDetails).refresh();
expect (getRunSpy).toHaveBeenCalledTimes(2);
expect(tree.state('selectedNodeDetails')).toHaveProperty('id', 'node1');
expect(tree.state('sidepanelSelectedTab')).toEqual(2);
});
Expand All @@ -593,10 +577,7 @@ describe('RunDetails', () => {
expect(tree.state('selectedNodeDetails')).toHaveProperty('id', 'node1');
expect(tree.state('sidepanelSelectedTab')).toEqual(2);

const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
await (tree.instance() as RunDetails).refresh();
expect(getRunSpy).toHaveBeenCalledTimes(2);
expect(tree.state('selectedNodeDetails')).toHaveProperty('id', 'node1');
expect(tree.state('sidepanelSelectedTab')).toEqual(2);
Expand All @@ -619,10 +600,7 @@ describe('RunDetails', () => {
expect(thirdCall.pageTitle).toMatchSnapshot();

testRun.run!.status = 'Failed';
const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
await (tree.instance() as RunDetails).refresh();
const fourthCall = updateToolbarSpy.mock.calls[3][0];
expect(fourthCall.pageTitle).toMatchSnapshot();
});
Expand All @@ -640,10 +618,7 @@ describe('RunDetails', () => {
expect(tree.state('sidepanelSelectedTab')).toEqual(2);

getPodLogsSpy.mockImplementationOnce(() => 'new test logs');
const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
await (tree.instance() as RunDetails).refresh();
expect(tree).toMatchSnapshot();
});

Expand All @@ -666,10 +641,7 @@ describe('RunDetails', () => {
});

testRun.run!.status = 'Failed';
const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
await (tree.instance() as RunDetails).refresh();
expect(tree.state()).toMatchObject({
logsBannerAdditionalInfo: '',
logsBannerMessage: '',
Expand All @@ -690,10 +662,7 @@ describe('RunDetails', () => {
testRun.pipeline_runtime!.workflow_manifest = JSON.stringify({
status: { nodes: { node1: { id: 'node1', phase: 'Succeeded', message: 'some node message' } } },
});
const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
await (tree.instance() as RunDetails).refresh();
expect(tree.state('selectedNodeDetails')).toHaveProperty('phaseMessage',
'This step is in Succeeded state with this message: some node message');
});
Expand All @@ -713,10 +682,7 @@ describe('RunDetails', () => {
testRun.pipeline_runtime!.workflow_manifest = JSON.stringify({
status: { nodes: { node1: { id: 'node1' } } },
});
const instance = tree.instance() as RunDetails;
const refreshBtn = instance.getInitialToolbarState().actions.find(
b => b.title === 'Refresh');
await refreshBtn!.action();
await (tree.instance() as RunDetails).refresh();
expect(tree.state('selectedNodeDetails')).toHaveProperty('phaseMessage', undefined);
});

Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/RunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class RunDetails extends Page<RunDetailsProps, RunDetailsState> {
true,
() => this.refresh()
),
buttons.refresh(this.refresh.bind(this)),
],
breadcrumbs: [{ displayName: 'Experiments', href: RoutePage.EXPERIMENTS }],
pageTitle: this.props.runId!,
Expand Down

0 comments on commit 3c7f648

Please sign in to comment.