Convert ZaqarActions to named exports
* avoid using 'this' in thunk Change-Id: I94e8c618469d1ee04c8493ba189044de45fc5b67
This commit is contained in:
parent
ea437a5f58
commit
555db647d4
@ -17,7 +17,7 @@
|
|||||||
import { mockStore } from './utils';
|
import { mockStore } from './utils';
|
||||||
import * as ErrorActions from '../../js/actions/ErrorActions';
|
import * as ErrorActions from '../../js/actions/ErrorActions';
|
||||||
import HeatApiService from '../../js/services/HeatApiService';
|
import HeatApiService from '../../js/services/HeatApiService';
|
||||||
import StacksActions from '../../js/actions/StacksActions';
|
import * as StacksActions from '../../js/actions/StacksActions';
|
||||||
|
|
||||||
describe('StacksActions', () => {
|
describe('StacksActions', () => {
|
||||||
describe('fetchStacks (success)', () => {
|
describe('fetchStacks (success)', () => {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import { fromJS, Map, OrderedMap } from 'immutable';
|
import { fromJS, Map, OrderedMap } from 'immutable';
|
||||||
|
|
||||||
import { StacksState, Stack } from '../../js/immutableRecords/stacks';
|
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';
|
import stacksReducer from '../../js/reducers/stacksReducer';
|
||||||
|
|
||||||
describe('stacksReducer state', () => {
|
describe('stacksReducer state', () => {
|
||||||
|
@ -21,29 +21,21 @@ import HeatApiService from '../services/HeatApiService';
|
|||||||
import StacksConstants from '../constants/StacksConstants';
|
import StacksConstants from '../constants/StacksConstants';
|
||||||
import { stackSchema } from '../normalizrSchemas/stacks';
|
import { stackSchema } from '../normalizrSchemas/stacks';
|
||||||
|
|
||||||
export default {
|
export const fetchStacksPending = () => ({
|
||||||
fetchStacksPending() {
|
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_STACKS_PENDING
|
type: StacksConstants.FETCH_STACKS_PENDING
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchStacksSuccess(data) {
|
export const fetchStacksSuccess = data => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_STACKS_SUCCESS,
|
type: StacksConstants.FETCH_STACKS_SUCCESS,
|
||||||
payload: data
|
payload: data
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchStacksFailed() {
|
export const fetchStacksFailed = () => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_STACKS_FAILED
|
type: StacksConstants.FETCH_STACKS_FAILED
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchStacks(planName) {
|
export const fetchStacks = planName => dispatch => {
|
||||||
return (dispatch, getState) => {
|
dispatch(fetchStacksPending());
|
||||||
dispatch(this.fetchStacksPending());
|
|
||||||
return dispatch(HeatApiService.getStacks())
|
return dispatch(HeatApiService.getStacks())
|
||||||
.then(response =>
|
.then(response =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
@ -54,118 +46,88 @@ export default {
|
|||||||
)
|
)
|
||||||
.then(responses => {
|
.then(responses => {
|
||||||
const stacks =
|
const stacks =
|
||||||
normalize(responses.map(r => r.stack), [stackSchema]).entities
|
normalize(responses.map(r => r.stack), [stackSchema]).entities.stacks ||
|
||||||
.stacks || {};
|
{};
|
||||||
dispatch(this.fetchStacksSuccess(stacks));
|
dispatch(fetchStacksSuccess(stacks));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch(handleErrors(error, 'Stacks could not be loaded'));
|
dispatch(handleErrors(error, 'Stacks could not be loaded'));
|
||||||
dispatch(this.fetchStacksFailed());
|
dispatch(fetchStacksFailed());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
|
||||||
fetchResourcesPending() {
|
export const fetchResourcesPending = () => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_RESOURCES_PENDING
|
type: StacksConstants.FETCH_RESOURCES_PENDING
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchResourcesSuccess(resources) {
|
export const fetchResourcesSuccess = resources => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_RESOURCES_SUCCESS,
|
type: StacksConstants.FETCH_RESOURCES_SUCCESS,
|
||||||
payload: resources
|
payload: resources
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchResourcesFailed() {
|
export const fetchResourcesFailed = () => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_RESOURCES_FAILED
|
type: StacksConstants.FETCH_RESOURCES_FAILED
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchResources(stackName, stackId) {
|
export const fetchResources = (stackName, stackId) => dispatch => {
|
||||||
return dispatch => {
|
dispatch(fetchResourcesPending());
|
||||||
dispatch(this.fetchResourcesPending());
|
|
||||||
dispatch(HeatApiService.getResources(stackName, stackId))
|
dispatch(HeatApiService.getResources(stackName, stackId))
|
||||||
.then(({ resources }) =>
|
.then(({ resources }) => dispatch(fetchResourcesSuccess(resources)))
|
||||||
dispatch(this.fetchResourcesSuccess(resources))
|
|
||||||
)
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch(handleErrors(error, 'Stack Resources could not be loaded'));
|
dispatch(handleErrors(error, 'Stack Resources could not be loaded'));
|
||||||
dispatch(this.fetchResourcesFailed());
|
dispatch(fetchResourcesFailed());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
|
||||||
fetchResourceSuccess(resource) {
|
export const fetchResourceSuccess = resource => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_RESOURCE_SUCCESS,
|
type: StacksConstants.FETCH_RESOURCE_SUCCESS,
|
||||||
payload: resource
|
payload: resource
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchResourceFailed(resourceName) {
|
export const fetchResourceFailed = resourceName => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_RESOURCE_FAILED,
|
type: StacksConstants.FETCH_RESOURCE_FAILED,
|
||||||
payload: resourceName
|
payload: resourceName
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchResourcePending() {
|
export const fetchResourcePending = () => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_RESOURCE_PENDING
|
type: StacksConstants.FETCH_RESOURCE_PENDING
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchResource(stack, resourceName) {
|
export const fetchResource = (stack, resourceName) => dispatch => {
|
||||||
return dispatch => {
|
dispatch(fetchResourcePending());
|
||||||
dispatch(this.fetchResourcePending());
|
|
||||||
dispatch(HeatApiService.getResource(stack, resourceName))
|
dispatch(HeatApiService.getResource(stack, resourceName))
|
||||||
.then(({ resource }) => {
|
.then(({ resource }) => {
|
||||||
dispatch(this.fetchResourceSuccess(resource));
|
dispatch(fetchResourceSuccess(resource));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch(handleErrors(error, 'Stack Resource could not be loaded'));
|
dispatch(handleErrors(error, 'Stack Resource could not be loaded'));
|
||||||
dispatch(this.fetchResourceFailed(resourceName));
|
dispatch(fetchResourceFailed(resourceName));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
|
||||||
fetchEnvironmentSuccess(stack, environment) {
|
export const fetchEnvironmentSuccess = (stack, environment) => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_STACK_ENVIRONMENT_SUCCESS,
|
type: StacksConstants.FETCH_STACK_ENVIRONMENT_SUCCESS,
|
||||||
payload: { environment, stack }
|
payload: { environment, stack }
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchEnvironmentFailed(stack) {
|
export const fetchEnvironmentFailed = stack => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_STACK_ENVIRONMENT_FAILED,
|
type: StacksConstants.FETCH_STACK_ENVIRONMENT_FAILED,
|
||||||
payload: { stack }
|
payload: { stack }
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchEnvironmentPending(stack) {
|
export const fetchEnvironmentPending = stack => ({
|
||||||
return {
|
|
||||||
type: StacksConstants.FETCH_STACK_ENVIRONMENT_PENDING,
|
type: StacksConstants.FETCH_STACK_ENVIRONMENT_PENDING,
|
||||||
payload: { stack }
|
payload: { stack }
|
||||||
};
|
});
|
||||||
},
|
|
||||||
|
|
||||||
fetchEnvironment(stack) {
|
export const fetchEnvironment = stack => dispatch => {
|
||||||
return dispatch => {
|
dispatch(fetchEnvironmentPending(stack));
|
||||||
dispatch(this.fetchEnvironmentPending(stack));
|
|
||||||
dispatch(HeatApiService.getEnvironment(stack))
|
dispatch(HeatApiService.getEnvironment(stack))
|
||||||
.then(response => {
|
.then(response => {
|
||||||
dispatch(this.fetchEnvironmentSuccess(stack, response));
|
dispatch(fetchEnvironmentSuccess(stack, response));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch(
|
dispatch(handleErrors(error, 'Stack Environment could not be loaded'));
|
||||||
handleErrors(error, 'Stack Environment could not be loaded')
|
dispatch(fetchEnvironmentFailed(stack));
|
||||||
);
|
|
||||||
dispatch(this.fetchEnvironmentFailed(stack));
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,7 @@ import {
|
|||||||
fetchAvailableRolesFinished,
|
fetchAvailableRolesFinished,
|
||||||
selectRolesFinished
|
selectRolesFinished
|
||||||
} from './RolesActions';
|
} from './RolesActions';
|
||||||
import StacksActions from './StacksActions';
|
import { fetchStacksSuccess, fetchResources } from './StacksActions';
|
||||||
import { stackSchema } from '../normalizrSchemas/stacks';
|
import { stackSchema } from '../normalizrSchemas/stacks';
|
||||||
import MistralConstants from '../constants/MistralConstants';
|
import MistralConstants from '../constants/MistralConstants';
|
||||||
import ZaqarWebSocketService from '../services/ZaqarWebSocketService';
|
import ZaqarWebSocketService from '../services/ZaqarWebSocketService';
|
||||||
@ -56,45 +56,34 @@ import {
|
|||||||
} from './DeploymentActions';
|
} from './DeploymentActions';
|
||||||
import { fetchNetworksFinished } from './NetworksActions';
|
import { fetchNetworksFinished } from './NetworksActions';
|
||||||
|
|
||||||
export default {
|
export const handleAuthenticationSuccess = (message, dispatch) => {
|
||||||
handleAuthenticationSuccess(message, dispatch) {
|
|
||||||
message = get(message, ['body', 'message']);
|
message = get(message, ['body', 'message']);
|
||||||
|
|
||||||
if (message === 'Authentified.') {
|
if (message === 'Authentified.') {
|
||||||
dispatch(authenticated());
|
dispatch(authenticated());
|
||||||
dispatch(flushMessages());
|
dispatch(flushMessages());
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
|
|
||||||
messageReceived(message) {
|
export const messageReceived = message => (dispatch, getState) => {
|
||||||
return (dispatch, getState) => {
|
handleAuthenticationSuccess(message, dispatch);
|
||||||
this.handleAuthenticationSuccess(message, dispatch);
|
|
||||||
const { type, payload } = message.body;
|
const { type, payload } = message.body;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MistralConstants.BAREMETAL_REGISTER_OR_UPDATE:
|
case MistralConstants.BAREMETAL_REGISTER_OR_UPDATE:
|
||||||
dispatch(
|
dispatch(
|
||||||
handleWorkflowMessage(
|
handleWorkflowMessage(payload.execution.id, nodesRegistrationFinished)
|
||||||
payload.execution.id,
|
|
||||||
nodesRegistrationFinished
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MistralConstants.BAREMETAL_INTROSPECT:
|
case MistralConstants.BAREMETAL_INTROSPECT:
|
||||||
dispatch(
|
dispatch(
|
||||||
handleWorkflowMessage(
|
handleWorkflowMessage(payload.execution_id, nodesIntrospectionFinished)
|
||||||
payload.execution_id,
|
|
||||||
nodesIntrospectionFinished
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MistralConstants.BAREMETAL_INTROSPECT_INTERNAL:
|
case MistralConstants.BAREMETAL_INTROSPECT_INTERNAL:
|
||||||
dispatch(
|
dispatch(
|
||||||
handleWorkflowMessage(
|
handleWorkflowMessage(payload.execution_id, nodeIntrospectionFinished)
|
||||||
payload.execution_id,
|
|
||||||
nodeIntrospectionFinished
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -127,16 +116,12 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MistralConstants.PLAN_CREATE: {
|
case MistralConstants.PLAN_CREATE: {
|
||||||
dispatch(
|
dispatch(handleWorkflowMessage(payload.execution_id, createPlanFinished));
|
||||||
handleWorkflowMessage(payload.execution_id, createPlanFinished)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MistralConstants.PLAN_UPDATE: {
|
case MistralConstants.PLAN_UPDATE: {
|
||||||
dispatch(
|
dispatch(handleWorkflowMessage(payload.execution_id, updatePlanFinished));
|
||||||
handleWorkflowMessage(payload.execution_id, updatePlanFinished)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +145,7 @@ export default {
|
|||||||
case MistralConstants.HEAT_STACKS_LIST: {
|
case MistralConstants.HEAT_STACKS_LIST: {
|
||||||
const stacks =
|
const stacks =
|
||||||
normalize(payload.stacks, [stackSchema]).entities.stacks || {};
|
normalize(payload.stacks, [stackSchema]).entities.stacks || {};
|
||||||
dispatch(StacksActions.fetchStacksSuccess(stacks));
|
dispatch(fetchStacksSuccess(stacks));
|
||||||
|
|
||||||
// TODO(jtomasek): It would be nicer if we could identify that
|
// TODO(jtomasek): It would be nicer if we could identify that
|
||||||
// stack has changed in the component and fetch resources there
|
// stack has changed in the component and fetch resources there
|
||||||
@ -168,7 +153,7 @@ export default {
|
|||||||
const currentStack = getCurrentStack(getState());
|
const currentStack = getCurrentStack(getState());
|
||||||
if (!isFetchingResources && currentStack) {
|
if (!isFetchingResources && currentStack) {
|
||||||
const { stack_name, id } = currentStack;
|
const { stack_name, id } = currentStack;
|
||||||
dispatch(StacksActions.fetchResources(stack_name, id));
|
dispatch(fetchResources(stack_name, id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,9 +187,7 @@ export default {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
dispatch(
|
dispatch(handleWorkflowMessage(payload.execution_id, undeployFinished));
|
||||||
handleWorkflowMessage(payload.execution_id, undeployFinished)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -228,9 +211,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MistralConstants.PLAN_EXPORT: {
|
case MistralConstants.PLAN_EXPORT: {
|
||||||
dispatch(
|
dispatch(handleWorkflowMessage(payload.execution_id, exportPlanFinished));
|
||||||
handleWorkflowMessage(payload.execution_id, exportPlanFinished)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,10 +224,7 @@ export default {
|
|||||||
|
|
||||||
case MistralConstants.LIST_AVAILABLE_ROLES: {
|
case MistralConstants.LIST_AVAILABLE_ROLES: {
|
||||||
dispatch(
|
dispatch(
|
||||||
handleWorkflowMessage(
|
handleWorkflowMessage(payload.execution.id, fetchAvailableRolesFinished)
|
||||||
payload.execution.id,
|
|
||||||
fetchAvailableRolesFinished
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -269,11 +247,12 @@ export default {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
|
||||||
|
|
||||||
postMessage(queueName, body, ttl = 3600) {
|
export const postMessage = (queueName, body, ttl = 3600) => (
|
||||||
return (dispatch, getState) => {
|
dispatch,
|
||||||
|
getState
|
||||||
|
) => {
|
||||||
const message = {
|
const message = {
|
||||||
queue_name: queueName,
|
queue_name: queueName,
|
||||||
messages: [
|
messages: [
|
||||||
@ -295,6 +274,4 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatch(ZaqarWebSocketService.sendMessage('message_post', message));
|
dispatch(ZaqarWebSocketService.sendMessage('message_post', message));
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ import { GlobalLoader } from './ui/Loader';
|
|||||||
import NavBar from './NavBar';
|
import NavBar from './NavBar';
|
||||||
import Nodes from './nodes/Nodes';
|
import Nodes from './nodes/Nodes';
|
||||||
import Plans from './plan/Plans.js';
|
import Plans from './plan/Plans.js';
|
||||||
import StacksActions from '../actions/StacksActions';
|
import { fetchStacks } from '../actions/StacksActions';
|
||||||
import { fetchPlans } from '../actions/PlansActions';
|
import { fetchPlans } from '../actions/PlansActions';
|
||||||
import { fetchWorkflowExecutions } from '../actions/WorkflowExecutionsActions';
|
import { fetchWorkflowExecutions } from '../actions/WorkflowExecutionsActions';
|
||||||
import ZaqarWebSocketService from '../services/ZaqarWebSocketService';
|
import ZaqarWebSocketService from '../services/ZaqarWebSocketService';
|
||||||
@ -94,7 +94,7 @@ AuthenticatedContent.propTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, ownProps) => ({
|
const mapDispatchToProps = (dispatch, ownProps) => ({
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
fetchStacks: () => dispatch(fetchStacks()),
|
||||||
fetchPlans: () => dispatch(fetchPlans()),
|
fetchPlans: () => dispatch(fetchPlans()),
|
||||||
fetchWorkflowExecutions: () => dispatch(fetchWorkflowExecutions()),
|
fetchWorkflowExecutions: () => dispatch(fetchWorkflowExecutions()),
|
||||||
initializeZaqarConnection: () => dispatch(ZaqarWebSocketService.init())
|
initializeZaqarConnection: () => dispatch(ZaqarWebSocketService.init())
|
||||||
|
@ -34,7 +34,7 @@ import {
|
|||||||
import InlineNotification from '../ui/InlineNotification';
|
import InlineNotification from '../ui/InlineNotification';
|
||||||
import { Loader } from '../ui/Loader';
|
import { Loader } from '../ui/Loader';
|
||||||
import { sanitizeMessage } from '../../utils';
|
import { sanitizeMessage } from '../../utils';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
import { fetchStacks } from '../../actions/StacksActions';
|
||||||
import { startUndeploy } from '../../actions/DeploymentActions';
|
import { startUndeploy } from '../../actions/DeploymentActions';
|
||||||
import StackResources from './StackResources';
|
import StackResources from './StackResources';
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ const mapStateToProps = (state, props) => ({
|
|||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { planName }) => ({
|
const mapDispatchToProps = (dispatch, { planName }) => ({
|
||||||
undeployPlan: () => dispatch(startUndeploy(planName)),
|
undeployPlan: () => dispatch(startUndeploy(planName)),
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks())
|
fetchStacks: () => dispatch(fetchStacks())
|
||||||
});
|
});
|
||||||
|
|
||||||
export default injectIntl(
|
export default injectIntl(
|
||||||
|
@ -147,8 +147,6 @@ class DeploymentProgress extends React.Component {
|
|||||||
DeploymentProgress.propTypes = {
|
DeploymentProgress.propTypes = {
|
||||||
completeResourcesCount: PropTypes.number,
|
completeResourcesCount: PropTypes.number,
|
||||||
deploymentStatus: PropTypes.object.isRequired,
|
deploymentStatus: PropTypes.object.isRequired,
|
||||||
fetchResources: PropTypes.func.isRequired,
|
|
||||||
fetchStacks: PropTypes.func.isRequired,
|
|
||||||
intl: PropTypes.object,
|
intl: PropTypes.object,
|
||||||
isFetchingStacks: PropTypes.bool.isRequired,
|
isFetchingStacks: PropTypes.bool.isRequired,
|
||||||
planName: PropTypes.string.isRequired,
|
planName: PropTypes.string.isRequired,
|
||||||
@ -172,10 +170,4 @@ const mapStateToProps = (state, props) => ({
|
|||||||
stacksLoaded: state.stacks.isLoaded
|
stacksLoaded: state.stacks.isLoaded
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { planName }) => ({
|
export default connect(mapStateToProps)(DeploymentProgress);
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
|
||||||
fetchResources: (stackName, stackId) =>
|
|
||||||
dispatch(StacksActions.fetchResources(stackName, stackId))
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(DeploymentProgress);
|
|
||||||
|
@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
|
|||||||
import React, { Component, Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
|
|
||||||
import StackResourcesTable from './StackResourcesTable';
|
import StackResourcesTable from './StackResourcesTable';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
import { fetchResources } from '../../actions/StacksActions';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
title: {
|
title: {
|
||||||
@ -75,8 +75,7 @@ const mapStateToProps = state => ({
|
|||||||
isFetchingResources: state.stacks.isFetchingResources
|
isFetchingResources: state.stacks.isFetchingResources
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch, { stack }) => ({
|
const mapDispatchToProps = (dispatch, { stack }) => ({
|
||||||
fetchResources: () =>
|
fetchResources: () => dispatch(fetchResources(stack.stack_name, stack.id))
|
||||||
dispatch(StacksActions.fetchResources(stack.stack_name, stack.id))
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(StackResources);
|
export default connect(mapStateToProps, mapDispatchToProps)(StackResources);
|
||||||
|
@ -136,8 +136,6 @@ class UndeployProgress extends React.Component {
|
|||||||
|
|
||||||
UndeployProgress.propTypes = {
|
UndeployProgress.propTypes = {
|
||||||
deploymentStatus: PropTypes.object.isRequired,
|
deploymentStatus: PropTypes.object.isRequired,
|
||||||
fetchResources: PropTypes.func.isRequired,
|
|
||||||
fetchStacks: PropTypes.func.isRequired,
|
|
||||||
intl: PropTypes.object,
|
intl: PropTypes.object,
|
||||||
isFetchingStacks: PropTypes.bool.isRequired,
|
isFetchingStacks: PropTypes.bool.isRequired,
|
||||||
planName: PropTypes.string.isRequired,
|
planName: PropTypes.string.isRequired,
|
||||||
@ -158,10 +156,4 @@ const mapStateToProps = (state, props) => ({
|
|||||||
stacksLoaded: state.stacks.isLoaded
|
stacksLoaded: state.stacks.isLoaded
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { planName }) => ({
|
export default connect(mapStateToProps)(UndeployProgress);
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
|
||||||
fetchResources: (stackName, stackId) =>
|
|
||||||
dispatch(StacksActions.fetchResources(stackName, stackId))
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(UndeployProgress);
|
|
||||||
|
@ -24,7 +24,6 @@ import { deploymentStatusMessages } from '../../constants/DeploymentConstants';
|
|||||||
import { getCurrentPlanDeploymentStatus } from '../../selectors/deployment';
|
import { getCurrentPlanDeploymentStatus } from '../../selectors/deployment';
|
||||||
import InlineNotification from '../ui/InlineNotification';
|
import InlineNotification from '../ui/InlineNotification';
|
||||||
import { sanitizeMessage } from '../../utils';
|
import { sanitizeMessage } from '../../utils';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
deleteDeployment: {
|
deleteDeployment: {
|
||||||
@ -75,12 +74,4 @@ const mapStateToProps = (state, props) => ({
|
|||||||
deploymentStatus: getCurrentPlanDeploymentStatus(state)
|
deploymentStatus: getCurrentPlanDeploymentStatus(state)
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { planName }) => ({
|
export default injectIntl(connect(mapStateToProps)(DeploymentFailure));
|
||||||
deleteStack: () => {
|
|
||||||
dispatch(StacksActions.deleteStack(planName, ''));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default injectIntl(
|
|
||||||
connect(mapStateToProps, mapDispatchToProps)(DeploymentFailure)
|
|
||||||
);
|
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
getCreateCompleteResources
|
getCreateCompleteResources
|
||||||
} from '../../selectors/stacks';
|
} from '../../selectors/stacks';
|
||||||
import { InlineLoader, Loader } from '../ui/Loader';
|
import { InlineLoader, Loader } from '../ui/Loader';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
import { fetchStacks, fetchResources } from '../../actions/StacksActions';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
initializingDeployment: {
|
initializingDeployment: {
|
||||||
@ -177,12 +177,6 @@ const mapStateToProps = (state, props) => ({
|
|||||||
resourcesCount: state.stacks.resources.size
|
resourcesCount: state.stacks.resources.size
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { planName }) => ({
|
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
|
||||||
fetchResources: (stackName, stackId) =>
|
|
||||||
dispatch(StacksActions.fetchResources(stackName, stackId))
|
|
||||||
});
|
|
||||||
|
|
||||||
export default injectIntl(
|
export default injectIntl(
|
||||||
connect(mapStateToProps, mapDispatchToProps)(DeploymentProgress)
|
connect(mapStateToProps, { fetchStacks, fetchResources })(DeploymentProgress)
|
||||||
);
|
);
|
||||||
|
@ -32,7 +32,11 @@ import InlineNotification from '../ui/InlineNotification';
|
|||||||
import OvercloudInfo from '../deployment/OvercloudInfo';
|
import OvercloudInfo from '../deployment/OvercloudInfo';
|
||||||
import { Loader } from '../ui/Loader';
|
import { Loader } from '../ui/Loader';
|
||||||
import { startUndeploy } from '../../actions/DeploymentActions';
|
import { startUndeploy } from '../../actions/DeploymentActions';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
import {
|
||||||
|
fetchStacks,
|
||||||
|
fetchEnvironment,
|
||||||
|
fetchResource
|
||||||
|
} from '../../actions/StacksActions';
|
||||||
|
|
||||||
class DeploymentSuccess extends React.Component {
|
class DeploymentSuccess extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -108,11 +112,10 @@ const mapStateToProps = state => ({
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
undeployPlan: planName => dispatch(startUndeploy(planName)),
|
undeployPlan: planName => dispatch(startUndeploy(planName)),
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
fetchStacks: () => dispatch(fetchStacks()),
|
||||||
fetchStackEnvironment: stack =>
|
fetchStackEnvironment: stack => dispatch(fetchEnvironment(stack)),
|
||||||
dispatch(StacksActions.fetchEnvironment(stack)),
|
|
||||||
fetchStackResource: (stack, resourceName) =>
|
fetchStackResource: (stack, resourceName) =>
|
||||||
dispatch(StacksActions.fetchResource(stack, resourceName))
|
dispatch(fetchResource(stack, resourceName))
|
||||||
});
|
});
|
||||||
|
|
||||||
export default injectIntl(
|
export default injectIntl(
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
getDeleteCompleteResources
|
getDeleteCompleteResources
|
||||||
} from '../../selectors/stacks';
|
} from '../../selectors/stacks';
|
||||||
import { InlineLoader, Loader } from '../ui/Loader';
|
import { InlineLoader, Loader } from '../ui/Loader';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
import { fetchStacks, fetchResources } from '../../actions/StacksActions';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
initializingUndeploy: {
|
initializingUndeploy: {
|
||||||
@ -172,12 +172,6 @@ const mapStateToProps = (state, props) => ({
|
|||||||
resourcesCount: state.stacks.resources.size
|
resourcesCount: state.stacks.resources.size
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { planName }) => ({
|
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
|
||||||
fetchResources: (stackName, stackId) =>
|
|
||||||
dispatch(StacksActions.fetchResources(stackName, stackId))
|
|
||||||
});
|
|
||||||
|
|
||||||
export default injectIntl(
|
export default injectIntl(
|
||||||
connect(mapStateToProps, mapDispatchToProps)(UndeployProgress)
|
connect(mapStateToProps, { fetchStacks, fetchResources })(UndeployProgress)
|
||||||
);
|
);
|
||||||
|
@ -35,7 +35,7 @@ import NodesListView from './NodesListView/NodesListView';
|
|||||||
import NodesToolbar from './NodesToolbar/NodesToolbar';
|
import NodesToolbar from './NodesToolbar/NodesToolbar';
|
||||||
import NodesTableView from './NodesTableView';
|
import NodesTableView from './NodesTableView';
|
||||||
import RegisterNodesDialog from './registerNodes/RegisterNodesDialog';
|
import RegisterNodesDialog from './registerNodes/RegisterNodesDialog';
|
||||||
import StacksActions from '../../actions/StacksActions';
|
import { fetchStacks } from '../../actions/StacksActions';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
loadingNodes: {
|
loadingNodes: {
|
||||||
@ -180,11 +180,10 @@ const mapStateToProps = state => ({
|
|||||||
stacksLoaded: state.stacks.isLoaded
|
stacksLoaded: state.stacks.isLoaded
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
export default injectIntl(
|
||||||
fetchStacks: () => dispatch(StacksActions.fetchStacks()),
|
connect(mapStateToProps, {
|
||||||
fetchNodes: () => dispatch(fetchNodes()),
|
fetchStacks,
|
||||||
fetchNodeIntrospectionData: nodeId =>
|
fetchNodes,
|
||||||
dispatch(fetchNodeIntrospectionData(nodeId))
|
fetchNodeIntrospectionData
|
||||||
});
|
})(Nodes)
|
||||||
|
);
|
||||||
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Nodes));
|
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
getDefaultZaqarQueue,
|
getDefaultZaqarQueue,
|
||||||
getLoggingZaqarQueue
|
getLoggingZaqarQueue
|
||||||
} from '../selectors/appConfig';
|
} from '../selectors/appConfig';
|
||||||
import ZaqarActions from '../actions/ZaqarActions';
|
import { messageReceived } from '../actions/ZaqarActions';
|
||||||
import { notify } from '../actions/NotificationActions';
|
import { notify } from '../actions/NotificationActions';
|
||||||
|
|
||||||
// We're using `console` here to avoid circular imports.
|
// We're using `console` here to avoid circular imports.
|
||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
|
|
||||||
this.socket.onmessage = evt => {
|
this.socket.onmessage = evt => {
|
||||||
const data = JSON.parse(evt.data);
|
const data = JSON.parse(evt.data);
|
||||||
dispatch(ZaqarActions.messageReceived(data));
|
dispatch(messageReceived(data));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ZaqarActions from '../../../actions/ZaqarActions';
|
import { postMessage } from '../../../actions/ZaqarActions';
|
||||||
import Adapter from './BaseAdapter';
|
import Adapter from './BaseAdapter';
|
||||||
|
|
||||||
export default class ZaqarAdapter extends Adapter {
|
export default class ZaqarAdapter extends Adapter {
|
||||||
@ -62,7 +62,7 @@ export default class ZaqarAdapter extends Adapter {
|
|||||||
const loggingQueue =
|
const loggingQueue =
|
||||||
(window.tripleOUiConfig || {})['logger-zaqar-queue'] ||
|
(window.tripleOUiConfig || {})['logger-zaqar-queue'] ||
|
||||||
'tripleo-ui-logging';
|
'tripleo-ui-logging';
|
||||||
this._dispatch(ZaqarActions.postMessage(loggingQueue, msg));
|
this._dispatch(postMessage(loggingQueue, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(...args) {
|
debug(...args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user