fix(my-joy-beta): add missing remove machine mutations

This commit is contained in:
Sérgio Ramos 2018-01-03 15:59:29 +00:00 committed by Sérgio Ramos
parent 8f786ae278
commit 4678addd7a
5 changed files with 15 additions and 23 deletions

View File

@ -44,7 +44,7 @@ export const Item = ({
onStart,
onStop,
onReboot,
onDelete
onRemove
}) => (
<TableTr>
<TableTd padding="0" paddingLeft={remcalc(12)} middle left>
@ -93,7 +93,7 @@ export const Item = ({
</PopoverItem>
<PopoverItem onClick={onReboot}>Reboot</PopoverItem>
<PopoverDivider />
<PopoverItem onClick={onDelete}>Delete</PopoverItem>
<PopoverItem onClick={onRemove}>Remove</PopoverItem>
</Popover>
</TableTd>
</PopoverContainer>

View File

@ -299,7 +299,7 @@ export default withTheme(
type="button"
loading={deleting}
disabled={instance.state === 'PROVISIONING'}
onClick={() => onAction('delete')}
onClick={() => onAction('remove')}
secondary
bold
right
@ -317,7 +317,7 @@ export default withTheme(
type="button"
loading={deleting}
disabled={instance.state === 'PROVISIONING'}
onClick={() => onAction('delete')}
onClick={() => onAction('remove')}
secondary
bold
right

View File

@ -24,11 +24,7 @@ import ListInstances from '@graphql/list-instances.gql';
import StopInstance from '@graphql/stop-instance.gql';
import StartInstance from '@graphql/start-instance.gql';
import RebootInstance from '@graphql/reboot-instance.gql';
import ResizeInstance from '@graphql/resize-instance.gql';
import EnableInstanceFw from '@graphql/enable-instance-fw.gql';
import DisableInstanceFw from '@graphql/disable-instance-fw.gql';
import CreateSnapshot from '@graphql/create-snapshot.gql';
import StartSnapshot from '@graphql/start-from-snapshot.gql';
import RemoveInstance from '@graphql/remove-instance.gql';
import ToolbarForm from '@components/instances/toolbar';
import Index from '@state/gen-index';
import parseError from '@state/parse-error';
@ -88,7 +84,7 @@ export const List = ({
const handleStart = selected => handleAction({ name: 'start', selected });
const handleStop = selected => handleAction({ name: 'stop', selected });
const handleReboot = selected => handleAction({ name: 'reboot', selected });
const handleDelete = selected => handleAction({ name: 'delete', selected });
const handleRemove = selected => handleAction({ name: 'remove', selected });
const _table = !loading ? (
<ReduxForm form={TABLE_FORM_NAME}>
@ -109,7 +105,7 @@ export const List = ({
onStart={() => handleStart([{ id }])}
onStop={() => handleStop([{ id }])}
onReboot={() => handleReboot([{ id }])}
onDelete={() => handleDelete([{ id }])}
onRemove={() => handleRemove([{ id }])}
/>
))}
</InstanceList>
@ -126,7 +122,7 @@ export const List = ({
onStart={() => handleStart(selected)}
onStop={() => handleStop(selected)}
onReboot={() => handleReboot(selected)}
onDelete={() => handleDelete(selected)}
onRemove={() => handleRemove(selected)}
/>
) : null;
@ -158,11 +154,7 @@ export default compose(
graphql(StopInstance, { name: 'stop' }),
graphql(StartInstance, { name: 'start' }),
graphql(RebootInstance, { name: 'reboot' }),
graphql(ResizeInstance, { name: 'resize' }),
graphql(EnableInstanceFw, { name: 'enableFw' }),
graphql(DisableInstanceFw, { name: 'disableFw' }),
graphql(CreateSnapshot, { name: 'createSnapshot' }),
graphql(StartSnapshot, { name: 'startSnapshot' }),
graphql(RemoveInstance, { name: 'remove' }),
graphql(ListInstances, {
options: () => ({
pollInterval: 1000
@ -231,7 +223,7 @@ export default compose(
starting: get(values, 'instance-list-starting', false),
stopping: get(values, 'instance-list-stoping', false),
rebooting: get(values, 'instance-list-rebooting', false),
deleting: get(values, 'instance-list-deleteing', false)
deleting: get(values, 'instance-list-removeing', false)
};
return {

View File

@ -18,7 +18,7 @@ import GetInstance from '@graphql/get-instance.gql';
import StartInstance from '@graphql/start-instance.gql';
import StopInstance from '@graphql/stop-instance.gql';
import RebootInstance from '@graphql/reboot-instance.gql';
import DeleteInstance from '@graphql/delete-instance.gql';
import RemoveInstance from '@graphql/remove-instance.gql';
import SummaryScreen from '@components/instances/summary';
import parseError from '@state/parse-error';
@ -80,7 +80,7 @@ export default compose(
graphql(StopInstance, { name: 'stop' }),
graphql(StartInstance, { name: 'start' }),
graphql(RebootInstance, { name: 'reboot' }),
graphql(DeleteInstance, { name: 'reboot' }),
graphql(RemoveInstance, { name: 'remove' }),
graphql(GetInstance, {
options: ({ match }) => ({
pollInterval: 1000,
@ -108,7 +108,7 @@ export default compose(
starting: state.values[`${id}-summary-starting`],
stopping: state.values[`${id}-summary-stoping`],
rebooting: state.values[`${id}-summary-rebooting`],
deleting: state.values[`${id}-summary-deleteing`],
deleting: state.values[`${id}-summary-removeing`],
mutationError: state.values[`${id}-summary-mutation-error`]
};
},
@ -135,7 +135,7 @@ export default compose(
})
);
if (!err && action === 'delete') {
if (!err && action === 'remove') {
const { history } = ownProps;
return history.push(`/instances/`);
}

View File

@ -1,4 +1,4 @@
mutation startInstance($id: ID!) {
mutation removeInstance($id: ID!) {
deleteMachine(id: $id) {
id
}