Skip to content

Commit

Permalink
Delete reload action from management
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Feb 2, 2021
1 parent e75f2f8 commit b4b985e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import { SearchSessionsMgmtAPI } from '../../lib/api';
import { UISession } from '../../types';
import { DeleteButton } from './delete_button';
import { ExtendButton } from './extend_button';
import { ReloadButton } from './reload_button';
import { ACTION, OnActionComplete } from './types';

export const getAction = (
api: SearchSessionsMgmtAPI,
actionType: string,
{ id, name, expires, reloadUrl }: UISession,
{ id, name, expires }: UISession,
onActionComplete: OnActionComplete
): IClickActionDescriptor | null => {
switch (actionType) {
Expand All @@ -28,13 +27,6 @@ export const getAction = (
label: <DeleteButton api={api} id={id} name={name} onActionComplete={onActionComplete} />,
};

case ACTION.RELOAD:
return {
iconType: 'refresh',
textColor: 'default',
label: <ReloadButton api={api} reloadUrl={reloadUrl} />,
};

case ACTION.EXTEND:
return {
iconType: extendSessionIcon,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export type OnActionComplete = () => void;
export enum ACTION {
EXTEND = 'extend',
DELETE = 'delete',
RELOAD = 'reload',
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ describe('Search Sessions Management API', () => {
Array [
Object {
"actions": Array [
"reload",
"extend",
"delete",
],
Expand Down Expand Up @@ -166,32 +165,6 @@ describe('Search Sessions Management API', () => {
});
});

describe('reload', () => {
beforeEach(() => {
sessionsClient.find = jest.fn().mockImplementation(async () => {
return {
saved_objects: [
{
id: 'hello-pizza-123',
attributes: { name: 'Veggie', appId: 'pizza', status: SearchSessionStatus.COMPLETE },
},
],
} as SavedObjectsFindResponse;
});
});

test('send cancel calls the cancel endpoint with a session ID', async () => {
const api = new SearchSessionsMgmtAPI(sessionsClient, mockConfig, {
urls: mockUrls,
notifications: mockCoreStart.notifications,
application: mockCoreStart.application,
});
await api.reloadSearchSession('www.myurl.com');

expect(mockCoreStart.application.navigateToUrl).toHaveBeenCalledWith('www.myurl.com');
});
});

describe('extend', () => {
beforeEach(() => {
sessionsClient.find = jest.fn().mockImplementation(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type UrlGeneratorsStart = SharePluginStart['urlGenerators'];

function getActions(status: SearchSessionStatus) {
const actions: ACTION[] = [];
actions.push(ACTION.RELOAD);
if (status === SearchSessionStatus.IN_PROGRESS || status === SearchSessionStatus.COMPLETE) {
actions.push(ACTION.EXTEND);
actions.push(ACTION.DELETE);
Expand Down

0 comments on commit b4b985e

Please sign in to comment.