Convert ZaqarActions to named exports

* avoid using 'this' in thunk

Change-Id: I94e8c618469d1ee04c8493ba189044de45fc5b67
This commit is contained in:
Jiri Tomasek 2018-09-11 15:15:56 -06:00
parent ea437a5f58
commit 555db647d4
16 changed files with 357 additions and 454 deletions

View File

@ -17,7 +17,7 @@
import { mockStore } from './utils';
import * as ErrorActions from '../../js/actions/ErrorActions';
import HeatApiService from '../../js/services/HeatApiService';
import StacksActions from '../../js/actions/StacksActions';
import * as StacksActions from '../../js/actions/StacksActions';
describe('StacksActions', () => {
describe('fetchStacks (success)', () => {

View File

@ -17,7 +17,7 @@
import { fromJS, Map, OrderedMap } from 'immutable';
import { StacksState, Stack } from '../../js/immutableRecords/stacks';
import StacksActions from '../../js/actions/StacksActions';
import * as StacksActions from '../../js/actions/StacksActions';
import stacksReducer from '../../js/reducers/stacksReducer';
describe('stacksReducer state', () => {

View File

@ -21,151 +21,113 @@ import HeatApiService from '../services/HeatApiService';
import StacksConstants from '../constants/StacksConstants';
import { stackSchema } from '../normalizrSchemas/stacks';
export default {
fetchStacksPending() {
return {
type: StacksConstants.FETCH_STACKS_PENDING
};
},
export const fetchStacksPending = () => ({
type: StacksConstants.FETCH_STACKS_PENDING
});
fetchStacksSuccess(data) {
return {
type: StacksConstants.FETCH_STACKS_SUCCESS,
payload: data
};
},
export const fetchStacksSuccess = data => ({
type: StacksConstants.FETCH_STACKS_SUCCESS,
payload: data
});
fetchStacksFailed() {
return {
type: StacksConstants.FETCH_STACKS_FAILED
};
},
export const fetchStacksFailed = () => ({
type: StacksConstants.FETCH_STACKS_FAILED
});
fetchStacks(planName) {
return (dispatch, getState) => {
dispatch(this.fetchStacksPending());
return dispatch(HeatApiService.getStacks())
.then(response =>
Promise.all(
response.stacks.map(stack =>
dispatch(HeatApiService.getStack(stack.stack_name, stack.id))
)
)
export const fetchStacks = planName => dispatch => {
dispatch(fetchStacksPending());
return dispatch(HeatApiService.getStacks())
.then(response =>
Promise.all(
response.stacks.map(stack =>
dispatch(HeatApiService.getStack(stack.stack_name, stack.id))
)
.then(responses => {
const stacks =
normalize(responses.map(r => r.stack), [stackSchema]).entities
.stacks || {};
dispatch(this.fetchStacksSuccess(stacks));
})
.catch(error => {
dispatch(handleErrors(error, 'Stacks could not be loaded'));
dispatch(this.fetchStacksFailed());
});
};
},
fetchResourcesPending() {
return {
type: StacksConstants.FETCH_RESOURCES_PENDING
};
},
fetchResourcesSuccess(resources) {
return {
type: StacksConstants.FETCH_RESOURCES_SUCCESS,
payload: resources
};
},
fetchResourcesFailed() {
return {
type: StacksConstants.FETCH_RESOURCES_FAILED
};
},
fetchResources(stackName, stackId) {
return dispatch => {
dispatch(this.fetchResourcesPending());
dispatch(HeatApiService.getResources(stackName, stackId))
.then(({ resources }) =>
dispatch(this.fetchResourcesSuccess(resources))
)
.catch(error => {
dispatch(handleErrors(error, 'Stack Resources could not be loaded'));
dispatch(this.fetchResourcesFailed());
});
};
},
fetchResourceSuccess(resource) {
return {
type: StacksConstants.FETCH_RESOURCE_SUCCESS,
payload: resource
};
},
fetchResourceFailed(resourceName) {
return {
type: StacksConstants.FETCH_RESOURCE_FAILED,
payload: resourceName
};
},
fetchResourcePending() {
return {
type: StacksConstants.FETCH_RESOURCE_PENDING
};
},
fetchResource(stack, resourceName) {
return dispatch => {
dispatch(this.fetchResourcePending());
dispatch(HeatApiService.getResource(stack, resourceName))
.then(({ resource }) => {
dispatch(this.fetchResourceSuccess(resource));
})
.catch(error => {
dispatch(handleErrors(error, 'Stack Resource could not be loaded'));
dispatch(this.fetchResourceFailed(resourceName));
});
};
},
fetchEnvironmentSuccess(stack, environment) {
return {
type: StacksConstants.FETCH_STACK_ENVIRONMENT_SUCCESS,
payload: { environment, stack }
};
},
fetchEnvironmentFailed(stack) {
return {
type: StacksConstants.FETCH_STACK_ENVIRONMENT_FAILED,
payload: { stack }
};
},
fetchEnvironmentPending(stack) {
return {
type: StacksConstants.FETCH_STACK_ENVIRONMENT_PENDING,
payload: { stack }
};
},
fetchEnvironment(stack) {
return dispatch => {
dispatch(this.fetchEnvironmentPending(stack));
dispatch(HeatApiService.getEnvironment(stack))
.then(response => {
dispatch(this.fetchEnvironmentSuccess(stack, response));
})
.catch(error => {
dispatch(
handleErrors(error, 'Stack Environment could not be loaded')
);
dispatch(this.fetchEnvironmentFailed(stack));
});
};
}
)
)
.then(responses => {
const stacks =
normalize(responses.map(r => r.stack), [stackSchema]).entities.stacks ||
{};
dispatch(fetchStacksSuccess(stacks));
})
.catch(error => {
dispatch(handleErrors(error, 'Stacks could not be loaded'));
dispatch(fetchStacksFailed());
});
};
export const fetchResourcesPending = () => ({
type: StacksConstants.FETCH_RESOURCES_PENDING
});
export const fetchResourcesSuccess = resources => ({
type: StacksConstants.FETCH_RESOURCES_SUCCESS,
payload: resources
});
export const fetchResourcesFailed = () => ({
type: StacksConstants.FETCH_RESOURCES_FAILED
});
export const fetchResources = (stackName, stackId) => dispatch => {
dispatch(fetchResourcesPending());
dispatch(HeatApiService.getResources(stackName, stackId))
.then(({ resources }) => dispatch(fetchResourcesSuccess(resources)))
.catch(error => {
dispatch(handleErrors(error, 'Stack Resources could not be loaded'));
dispatch(fetchResourcesFailed());
});
};
export const fetchResourceSuccess = resource => ({
type: StacksConstants.FETCH_RESOURCE_SUCCESS,
payload: resource
});
export const fetchResourceFailed = resourceName => ({
type: StacksConstants.FETCH_RESOURCE_FAILED,
payload: resourceName
});
export const fetchResourcePending = () => ({
type: StacksConstants.FETCH_RESOURCE_PENDING
});
export const fetchResource = (stack, resourceName) => dispatch => {
dispatch(fetchResourcePending());
dispatch(HeatApiService.getResource(stack, resourceName))
.then(({ resource }) => {
dispatch(fetchResourceSuccess(resource));
})
.catch(error => {
dispatch(handleErrors(error, 'Stack Resource could not be loaded'));
dispatch(fetchResourceFailed(resourceName));
});
};
export const fetchEnvironmentSuccess = (stack, environment) => ({
type: StacksConstants.FETCH_STACK_ENVIRONMENT_SUCCESS,
payload: { environment, stack }
});
export const fetchEnvironmentFailed = stack => ({
type: StacksConstants.FETCH_STACK_ENVIRONMENT_FAILED,
payload: { stack }
});
export const fetchEnvironmentPending = stack => ({
type: StacksConstants.FETCH_STACK_ENVIRONMENT_PENDING,
payload: { stack }
});
export const fetchEnvironment = stack => dispatch => {
dispatch(fetchEnvironmentPending(stack));
dispatch(HeatApiService.getEnvironment(stack))
.then(response => {
dispatch(fetchEnvironmentSuccess(stack, response));
})
.catch(error => {
dispatch(handleErrors(error, 'Stack Environment could not be loaded'));
dispatch(fetchEnvironmentFailed(stack));
});
};

View File

@ -41,7 +41,7 @@ import {
fetchAvailableRolesFinished,
selectRolesFinished
} from './RolesActions';
import StacksActions from './StacksActions';
import { fetchStacksSuccess, fetchResources } from './StacksActions';
import { stackSchema } from '../normalizrSchemas/stacks';
import MistralConstants from '../constants/MistralConstants';
import ZaqarWebSocketService from '../services/ZaqarWebSocketService';
@ -56,245 +56,222 @@ import {
} from './DeploymentActions';
import { fetchNetworksFinished } from './NetworksActions';
export default {
handleAuthenticationSuccess(message, dispatch) {
message = get(message, ['body', 'message']);
export const handleAuthenticationSuccess = (message, dispatch) => {
message = get(message, ['body', 'message']);
if (message === 'Authentified.') {
dispatch(authenticated());
dispatch(flushMessages());
}
},
messageReceived(message) {
return (dispatch, getState) => {
this.handleAuthenticationSuccess(message, dispatch);
const { type, payload } = message.body;
switch (type) {
case MistralConstants.BAREMETAL_REGISTER_OR_UPDATE:
dispatch(
handleWorkflowMessage(
payload.execution.id,
nodesRegistrationFinished
)
);
break;
case MistralConstants.BAREMETAL_INTROSPECT:
dispatch(
handleWorkflowMessage(
payload.execution_id,
nodesIntrospectionFinished
)
);
break;
case MistralConstants.BAREMETAL_INTROSPECT_INTERNAL:
dispatch(
handleWorkflowMessage(
payload.execution_id,
nodeIntrospectionFinished
)
);
break;
case MistralConstants.BAREMETAL_PROVIDE:
dispatch(
handleWorkflowMessage(payload.execution_id, provideNodesFinished)
);
break;
case MistralConstants.BAREMETAL_MANAGE:
dispatch(
handleWorkflowMessage(payload.execution_id, manageNodesFinished)
);
break;
case MistralConstants.VALIDATIONS_RUN: {
// TODO(jtomasek): this conditional is a workaround for proper handling
// of a message notifying that validation workflow has started. In that
// case we want to keep original polling interval.
// Ideally, validation workflow would send a message with
// different type rather than sending the same type on start and end
let pollTimeout;
if (payload.status === 'RUNNING') {
pollTimeout = 30000;
}
dispatch(
handleWorkflowMessage(payload.execution.id, undefined, pollTimeout)
);
break;
}
case MistralConstants.PLAN_CREATE: {
dispatch(
handleWorkflowMessage(payload.execution_id, createPlanFinished)
);
break;
}
case MistralConstants.PLAN_UPDATE: {
dispatch(
handleWorkflowMessage(payload.execution_id, updatePlanFinished)
);
break;
}
case MistralConstants.DEPLOYMENT_DEPLOY_PLAN: {
if (payload.deployment_status === deploymentStates.DEPLOYING) {
const { message, plan_name, deployment_status } = payload;
dispatch(
getDeploymentStatusSuccess(plan_name, {
status: deployment_status,
message
})
);
} else {
dispatch(
handleWorkflowMessage(payload.execution_id, deploymentFinished)
);
}
break;
}
case MistralConstants.HEAT_STACKS_LIST: {
const stacks =
normalize(payload.stacks, [stackSchema]).entities.stacks || {};
dispatch(StacksActions.fetchStacksSuccess(stacks));
// TODO(jtomasek): It would be nicer if we could identify that
// stack has changed in the component and fetch resources there
const { isFetchingResources } = getState().stacks;
const currentStack = getCurrentStack(getState());
if (!isFetchingResources && currentStack) {
const { stack_name, id } = currentStack;
dispatch(StacksActions.fetchResources(stack_name, id));
}
}
case MistralConstants.CONFIG_DOWNLOAD_DEPLOY: {
const { message, plan_name, deployment_status } = payload;
// respond only to messages notifying on deployment_status
if (deployment_status) {
dispatch(
getDeploymentStatusSuccess(plan_name, {
status: deployment_status,
message
})
);
}
break;
}
case MistralConstants.ANSIBLE_PLAYBOOK_DEPLOY_STEPS: {
const { message, plan_name } = payload;
dispatch(configDownloadMessage(plan_name, message));
break;
}
case MistralConstants.UNDEPLOY_PLAN: {
if (payload.deployment_status === deploymentStates.UNDEPLOYING) {
const { message, plan_name, deployment_status } = payload;
dispatch(
getDeploymentStatusSuccess(plan_name, {
status: deployment_status,
message
})
);
} else {
dispatch(
handleWorkflowMessage(payload.execution_id, undeployFinished)
);
}
break;
}
case MistralConstants.RECOVER_DEPLOYMENT_STATUS:
dispatch(
handleWorkflowMessage(
payload.execution.id,
recoverDeploymentStatusFinished
)
);
break;
case MistralConstants.GET_DEPLOYMENT_FAILURES:
dispatch(
handleWorkflowMessage(
payload.execution.id,
getDeploymentFailuresFinished
)
);
break;
case MistralConstants.PLAN_EXPORT: {
dispatch(
handleWorkflowMessage(payload.execution_id, exportPlanFinished)
);
break;
}
case MistralConstants.DOWNLOAD_LOGS: {
dispatch(
handleWorkflowMessage(payload.execution.id, downloadLogsFinished)
);
break;
}
case MistralConstants.LIST_AVAILABLE_ROLES: {
dispatch(
handleWorkflowMessage(
payload.execution.id,
fetchAvailableRolesFinished
)
);
break;
}
// TODO(jtomasek): change this back once underlining tripleo-common patch is fixed
case MistralConstants.SELECT_ROLES: {
// case 'tripleo.roles.v1.select_roles': {
dispatch(
handleWorkflowMessage(payload.execution.id, selectRolesFinished)
);
break;
}
case MistralConstants.NETWORK_LIST: {
dispatch(
handleWorkflowMessage(payload.execution.id, fetchNetworksFinished)
);
break;
}
default:
break;
}
};
},
postMessage(queueName, body, ttl = 3600) {
return (dispatch, getState) => {
const message = {
queue_name: queueName,
messages: [
{
body,
ttl
}
]
};
// Drop the message on the floor when there is no `store`
if (!getState) {
return;
}
if (!getState().logger.authenticated) {
dispatch(queueMessage(message));
return;
}
dispatch(ZaqarWebSocketService.sendMessage('message_post', message));
};
if (message === 'Authentified.') {
dispatch(authenticated());
dispatch(flushMessages());
}
};
export const messageReceived = message => (dispatch, getState) => {
handleAuthenticationSuccess(message, dispatch);
const { type, payload } = message.body;
switch (type) {
case MistralConstants.BAREMETAL_REGISTER_OR_UPDATE:
dispatch(
handleWorkflowMessage(payload.execution.id, nodesRegistrationFinished)
);
break;
case MistralConstants.BAREMETAL_INTROSPECT:
dispatch(
handleWorkflowMessage(payload.execution_id, nodesIntrospectionFinished)
);
break;
case MistralConstants.BAREMETAL_INTROSPECT_INTERNAL:
dispatch(
handleWorkflowMessage(payload.execution_id, nodeIntrospectionFinished)
);
break;
case MistralConstants.BAREMETAL_PROVIDE:
dispatch(
handleWorkflowMessage(payload.execution_id, provideNodesFinished)
);
break;
case MistralConstants.BAREMETAL_MANAGE:
dispatch(
handleWorkflowMessage(payload.execution_id, manageNodesFinished)
);
break;
case MistralConstants.VALIDATIONS_RUN: {
// TODO(jtomasek): this conditional is a workaround for proper handling
// of a message notifying that validation workflow has started. In that
// case we want to keep original polling interval.
// Ideally, validation workflow would send a message with
// different type rather than sending the same type on start and end
let pollTimeout;
if (payload.status === 'RUNNING') {
pollTimeout = 30000;
}
dispatch(
handleWorkflowMessage(payload.execution.id, undefined, pollTimeout)
);
break;
}
case MistralConstants.PLAN_CREATE: {
dispatch(handleWorkflowMessage(payload.execution_id, createPlanFinished));
break;
}
case MistralConstants.PLAN_UPDATE: {
dispatch(handleWorkflowMessage(payload.execution_id, updatePlanFinished));
break;
}
case MistralConstants.DEPLOYMENT_DEPLOY_PLAN: {
if (payload.deployment_status === deploymentStates.DEPLOYING) {
const { message, plan_name, deployment_status } = payload;
dispatch(
getDeploymentStatusSuccess(plan_name, {
status: deployment_status,
message
})
);
} else {
dispatch(
handleWorkflowMessage(payload.execution_id, deploymentFinished)
);
}
break;
}
case MistralConstants.HEAT_STACKS_LIST: {
const stacks =
normalize(payload.stacks, [stackSchema]).entities.stacks || {};
dispatch(fetchStacksSuccess(stacks));
// TODO(jtomasek): It would be nicer if we could identify that
// stack has changed in the component and fetch resources there
const { isFetchingResources } = getState().stacks;
const currentStack = getCurrentStack(getState());
if (!isFetchingResources && currentStack) {
const { stack_name, id } = currentStack;
dispatch(fetchResources(stack_name, id));
}
}
case MistralConstants.CONFIG_DOWNLOAD_DEPLOY: {
const { message, plan_name, deployment_status } = payload;
// respond only to messages notifying on deployment_status
if (deployment_status) {
dispatch(
getDeploymentStatusSuccess(plan_name, {
status: deployment_status,
message
})
);
}
break;
}
case MistralConstants.ANSIBLE_PLAYBOOK_DEPLOY_STEPS: {
const { message, plan_name } = payload;
dispatch(configDownloadMessage(plan_name, message));
break;
}
case MistralConstants.UNDEPLOY_PLAN: {
if (payload.deployment_status === deploymentStates.UNDEPLOYING) {
const { message, plan_name, deployment_status } = payload;
dispatch(
getDeploymentStatusSuccess(plan_name, {
status: deployment_status,
message
})
);
} else {
dispatch(handleWorkflowMessage(payload.execution_id, undeployFinished));
}
break;
}
case MistralConstants.RECOVER_DEPLOYMENT_STATUS:
dispatch(
handleWorkflowMessage(
payload.execution.id,
recoverDeploymentStatusFinished
)
);
break;
case MistralConstants.GET_DEPLOYMENT_FAILURES:
dispatch(
handleWorkflowMessage(
payload.execution.id,
getDeploymentFailuresFinished
)
);
break;
case MistralConstants.PLAN_EXPORT: {
dispatch(handleWorkflowMessage(payload.execution_id, exportPlanFinished));
break;
}
case MistralConstants.DOWNLOAD_LOGS: {
dispatch(
handleWorkflowMessage(payload.execution.id, downloadLogsFinished)
);
break;
}
case MistralConstants.LIST_AVAILABLE_ROLES: {
dispatch(
handleWorkflowMessage(payload.execution.id, fetchAvailableRolesFinished)
);
break;
}
// TODO(jtomasek): change this back once underlining tripleo-common patch is fixed
case MistralConstants.SELECT_ROLES: {
// case 'tripleo.roles.v1.select_roles': {
dispatch(
handleWorkflowMessage(payload.execution.id, selectRolesFinished)
);
break;
}
case MistralConstants.NETWORK_LIST: {
dispatch(
handleWorkflowMessage(payload.execution.id, fetchNetworksFinished)
);
break;
}
default:
break;
}
};
export const postMessage = (queueName, body, ttl = 3600) => (
dispatch,
getState
) => {
const message = {
queue_name: queueName,
messages: [
{
body,
ttl
}
]
};
// Drop the message on the floor when there is no `store`
if (!getState) {
return;
}
if (!getState().logger.authenticated) {
dispatch(queueMessage(message));
return;
}
dispatch(ZaqarWebSocketService.sendMessage('message_post', message));
};

View File

@ -28,7 +28,7 @@ import { GlobalLoader } from './ui/Loader';
import NavBar from './NavBar';
import Nodes from './nodes/Nodes';
import Plans from './plan/Plans.js';
import StacksActions from '../actions/StacksActions';
import { fetchStacks } from '../actions/StacksActions';
import { fetchPlans } from '../actions/PlansActions';
import { fetchWorkflowExecutions } from '../actions/WorkflowExecutionsActions';
import ZaqarWebSocketService from '../services/ZaqarWebSocketService';
@ -94,7 +94,7 @@ AuthenticatedContent.propTypes = {
};
const mapDispatchToProps = (dispatch, ownProps) => ({
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchStacks: () => dispatch(fetchStacks()),
fetchPlans: () => dispatch(fetchPlans()),
fetchWorkflowExecutions: () => dispatch(fetchWorkflowExecutions()),
initializeZaqarConnection: () => dispatch(ZaqarWebSocketService.init())

View File

@ -34,7 +34,7 @@ import {
import InlineNotification from '../ui/InlineNotification';
import { Loader } from '../ui/Loader';
import { sanitizeMessage } from '../../utils';
import StacksActions from '../../actions/StacksActions';
import { fetchStacks } from '../../actions/StacksActions';
import { startUndeploy } from '../../actions/DeploymentActions';
import StackResources from './StackResources';
@ -126,7 +126,7 @@ const mapStateToProps = (state, props) => ({
const mapDispatchToProps = (dispatch, { planName }) => ({
undeployPlan: () => dispatch(startUndeploy(planName)),
fetchStacks: () => dispatch(StacksActions.fetchStacks())
fetchStacks: () => dispatch(fetchStacks())
});
export default injectIntl(

View File

@ -147,8 +147,6 @@ class DeploymentProgress extends React.Component {
DeploymentProgress.propTypes = {
completeResourcesCount: PropTypes.number,
deploymentStatus: PropTypes.object.isRequired,
fetchResources: PropTypes.func.isRequired,
fetchStacks: PropTypes.func.isRequired,
intl: PropTypes.object,
isFetchingStacks: PropTypes.bool.isRequired,
planName: PropTypes.string.isRequired,
@ -172,10 +170,4 @@ const mapStateToProps = (state, props) => ({
stacksLoaded: state.stacks.isLoaded
});
const mapDispatchToProps = (dispatch, { planName }) => ({
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchResources: (stackName, stackId) =>
dispatch(StacksActions.fetchResources(stackName, stackId))
});
export default connect(mapStateToProps, mapDispatchToProps)(DeploymentProgress);
export default connect(mapStateToProps)(DeploymentProgress);

View File

@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
import React, { Component, Fragment } from 'react';
import StackResourcesTable from './StackResourcesTable';
import StacksActions from '../../actions/StacksActions';
import { fetchResources } from '../../actions/StacksActions';
const messages = defineMessages({
title: {
@ -75,8 +75,7 @@ const mapStateToProps = state => ({
isFetchingResources: state.stacks.isFetchingResources
});
const mapDispatchToProps = (dispatch, { stack }) => ({
fetchResources: () =>
dispatch(StacksActions.fetchResources(stack.stack_name, stack.id))
fetchResources: () => dispatch(fetchResources(stack.stack_name, stack.id))
});
export default connect(mapStateToProps, mapDispatchToProps)(StackResources);

View File

@ -136,8 +136,6 @@ class UndeployProgress extends React.Component {
UndeployProgress.propTypes = {
deploymentStatus: PropTypes.object.isRequired,
fetchResources: PropTypes.func.isRequired,
fetchStacks: PropTypes.func.isRequired,
intl: PropTypes.object,
isFetchingStacks: PropTypes.bool.isRequired,
planName: PropTypes.string.isRequired,
@ -158,10 +156,4 @@ const mapStateToProps = (state, props) => ({
stacksLoaded: state.stacks.isLoaded
});
const mapDispatchToProps = (dispatch, { planName }) => ({
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchResources: (stackName, stackId) =>
dispatch(StacksActions.fetchResources(stackName, stackId))
});
export default connect(mapStateToProps, mapDispatchToProps)(UndeployProgress);
export default connect(mapStateToProps)(UndeployProgress);

View File

@ -24,7 +24,6 @@ import { deploymentStatusMessages } from '../../constants/DeploymentConstants';
import { getCurrentPlanDeploymentStatus } from '../../selectors/deployment';
import InlineNotification from '../ui/InlineNotification';
import { sanitizeMessage } from '../../utils';
import StacksActions from '../../actions/StacksActions';
const messages = defineMessages({
deleteDeployment: {
@ -75,12 +74,4 @@ const mapStateToProps = (state, props) => ({
deploymentStatus: getCurrentPlanDeploymentStatus(state)
});
const mapDispatchToProps = (dispatch, { planName }) => ({
deleteStack: () => {
dispatch(StacksActions.deleteStack(planName, ''));
}
});
export default injectIntl(
connect(mapStateToProps, mapDispatchToProps)(DeploymentFailure)
);
export default injectIntl(connect(mapStateToProps)(DeploymentFailure));

View File

@ -31,7 +31,7 @@ import {
getCreateCompleteResources
} from '../../selectors/stacks';
import { InlineLoader, Loader } from '../ui/Loader';
import StacksActions from '../../actions/StacksActions';
import { fetchStacks, fetchResources } from '../../actions/StacksActions';
const messages = defineMessages({
initializingDeployment: {
@ -177,12 +177,6 @@ const mapStateToProps = (state, props) => ({
resourcesCount: state.stacks.resources.size
});
const mapDispatchToProps = (dispatch, { planName }) => ({
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchResources: (stackName, stackId) =>
dispatch(StacksActions.fetchResources(stackName, stackId))
});
export default injectIntl(
connect(mapStateToProps, mapDispatchToProps)(DeploymentProgress)
connect(mapStateToProps, { fetchStacks, fetchResources })(DeploymentProgress)
);

View File

@ -32,7 +32,11 @@ import InlineNotification from '../ui/InlineNotification';
import OvercloudInfo from '../deployment/OvercloudInfo';
import { Loader } from '../ui/Loader';
import { startUndeploy } from '../../actions/DeploymentActions';
import StacksActions from '../../actions/StacksActions';
import {
fetchStacks,
fetchEnvironment,
fetchResource
} from '../../actions/StacksActions';
class DeploymentSuccess extends React.Component {
componentDidMount() {
@ -108,11 +112,10 @@ const mapStateToProps = state => ({
const mapDispatchToProps = dispatch => ({
undeployPlan: planName => dispatch(startUndeploy(planName)),
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchStackEnvironment: stack =>
dispatch(StacksActions.fetchEnvironment(stack)),
fetchStacks: () => dispatch(fetchStacks()),
fetchStackEnvironment: stack => dispatch(fetchEnvironment(stack)),
fetchStackResource: (stack, resourceName) =>
dispatch(StacksActions.fetchResource(stack, resourceName))
dispatch(fetchResource(stack, resourceName))
});
export default injectIntl(

View File

@ -31,7 +31,7 @@ import {
getDeleteCompleteResources
} from '../../selectors/stacks';
import { InlineLoader, Loader } from '../ui/Loader';
import StacksActions from '../../actions/StacksActions';
import { fetchStacks, fetchResources } from '../../actions/StacksActions';
const messages = defineMessages({
initializingUndeploy: {
@ -172,12 +172,6 @@ const mapStateToProps = (state, props) => ({
resourcesCount: state.stacks.resources.size
});
const mapDispatchToProps = (dispatch, { planName }) => ({
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchResources: (stackName, stackId) =>
dispatch(StacksActions.fetchResources(stackName, stackId))
});
export default injectIntl(
connect(mapStateToProps, mapDispatchToProps)(UndeployProgress)
connect(mapStateToProps, { fetchStacks, fetchResources })(UndeployProgress)
);

View File

@ -35,7 +35,7 @@ import NodesListView from './NodesListView/NodesListView';
import NodesToolbar from './NodesToolbar/NodesToolbar';
import NodesTableView from './NodesTableView';
import RegisterNodesDialog from './registerNodes/RegisterNodesDialog';
import StacksActions from '../../actions/StacksActions';
import { fetchStacks } from '../../actions/StacksActions';
const messages = defineMessages({
loadingNodes: {
@ -180,11 +180,10 @@ const mapStateToProps = state => ({
stacksLoaded: state.stacks.isLoaded
});
const mapDispatchToProps = dispatch => ({
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
fetchNodes: () => dispatch(fetchNodes()),
fetchNodeIntrospectionData: nodeId =>
dispatch(fetchNodeIntrospectionData(nodeId))
});
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Nodes));
export default injectIntl(
connect(mapStateToProps, {
fetchStacks,
fetchNodes,
fetchNodeIntrospectionData
})(Nodes)
);

View File

@ -21,7 +21,7 @@ import {
getDefaultZaqarQueue,
getLoggingZaqarQueue
} from '../selectors/appConfig';
import ZaqarActions from '../actions/ZaqarActions';
import { messageReceived } from '../actions/ZaqarActions';
import { notify } from '../actions/NotificationActions';
// We're using `console` here to avoid circular imports.
@ -65,7 +65,7 @@ export default {
this.socket.onmessage = evt => {
const data = JSON.parse(evt.data);
dispatch(ZaqarActions.messageReceived(data));
dispatch(messageReceived(data));
};
};
},

View File

@ -14,7 +14,7 @@
* under the License.
*/
import ZaqarActions from '../../../actions/ZaqarActions';
import { postMessage } from '../../../actions/ZaqarActions';
import Adapter from './BaseAdapter';
export default class ZaqarAdapter extends Adapter {
@ -62,7 +62,7 @@ export default class ZaqarAdapter extends Adapter {
const loggingQueue =
(window.tripleOUiConfig || {})['logger-zaqar-queue'] ||
'tripleo-ui-logging';
this._dispatch(ZaqarActions.postMessage(loggingQueue, msg));
this._dispatch(postMessage(loggingQueue, msg));
}
debug(...args) {