mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Fixes
This commit is contained in:
parent
e845a71ac5
commit
5d87b98344
@ -37,6 +37,8 @@ export function addRequest (requestGroupId = null) {
|
|||||||
const request = buildRequest({name: 'My Request'});
|
const request = buildRequest({name: 'My Request'});
|
||||||
dispatch({type: types.REQUEST_ADD, request});
|
dispatch({type: types.REQUEST_ADD, request});
|
||||||
|
|
||||||
|
// HACK: Add request to group right away. Not sure how to get around this
|
||||||
|
// TODO: Make this not need to know about RequestGroup actions
|
||||||
if (requestGroupId) {
|
if (requestGroupId) {
|
||||||
const id = requestGroupId;
|
const id = requestGroupId;
|
||||||
const requestId = request.id;
|
const requestId = request.id;
|
||||||
@ -90,7 +92,9 @@ export function updateRequest (requestPatch) {
|
|||||||
export function duplicateRequest (oldRequest, requestGroupId) {
|
export function duplicateRequest (oldRequest, requestGroupId) {
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
dispatch(loadStart());
|
dispatch(loadStart());
|
||||||
const request = buildRequest(Object.assign({}, oldRequest, {id: null}));
|
const request = buildRequest(
|
||||||
|
Object.assign({}, oldRequest, {id: null, name: `${oldRequest.name} Copy`})
|
||||||
|
);
|
||||||
dispatch({type: types.REQUEST_ADD, request});
|
dispatch({type: types.REQUEST_ADD, request});
|
||||||
|
|
||||||
if (requestGroupId) {
|
if (requestGroupId) {
|
||||||
|
@ -59,7 +59,7 @@ class Sidebar extends Component {
|
|||||||
const isActive = activeRequest && filteredRequests.find(r => r.id == activeRequest.id);
|
const isActive = activeRequest && filteredRequests.find(r => r.id == activeRequest.id);
|
||||||
|
|
||||||
let folderIconClass = 'fa-folder';
|
let folderIconClass = 'fa-folder';
|
||||||
let expanded = activeFilter || !requestGroup.collapsed;
|
let expanded = !requestGroup.collapsed;
|
||||||
folderIconClass += !expanded ? '' : '-open';
|
folderIconClass += !expanded ? '' : '-open';
|
||||||
folderIconClass += isActive ? '' : '-o';
|
folderIconClass += isActive ? '' : '-o';
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class App extends Component {
|
|||||||
<div className="grid grid-collapse">
|
<div className="grid grid-collapse">
|
||||||
<section id="request-pane" className="pane col tall">
|
<section id="request-pane" className="pane col tall">
|
||||||
<div className="grid-v">
|
<div className="grid-v">
|
||||||
<header className="pane__header bg-super-light">
|
<header className="pane__header">
|
||||||
<RequestUrlBar
|
<RequestUrlBar
|
||||||
onUrlChange={updateRequestUrl}
|
onUrlChange={updateRequestUrl}
|
||||||
onMethodChange={updateRequestMethod}
|
onMethodChange={updateRequestMethod}
|
||||||
@ -106,7 +106,7 @@ class App extends Component {
|
|||||||
const activeRequest = requests.all.find(r => r.id === requests.active);
|
const activeRequest = requests.all.find(r => r.id === requests.active);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid">
|
<div className="grid bg-super-dark">
|
||||||
<Sidebar
|
<Sidebar
|
||||||
activateRequest={actions.activateRequest}
|
activateRequest={actions.activateRequest}
|
||||||
changeFilter={actions.changeFilter}
|
changeFilter={actions.changeFilter}
|
||||||
@ -133,9 +133,6 @@ App.propTypes = {
|
|||||||
changeFilter: PropTypes.func.isRequired,
|
changeFilter: PropTypes.func.isRequired,
|
||||||
updateRequestMethod: PropTypes.func.isRequired,
|
updateRequestMethod: PropTypes.func.isRequired,
|
||||||
toggleRequestGroup: PropTypes.func.isRequired
|
toggleRequestGroup: PropTypes.func.isRequired
|
||||||
}).isRequired,
|
|
||||||
sidebar: PropTypes.shape({
|
|
||||||
|
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
requests: PropTypes.shape({
|
requests: PropTypes.shape({
|
||||||
all: PropTypes.array.isRequired,
|
all: PropTypes.array.isRequired,
|
||||||
@ -151,7 +148,6 @@ function mapStateToProps (state) {
|
|||||||
return {
|
return {
|
||||||
actions: state.actions,
|
actions: state.actions,
|
||||||
requests: state.requests,
|
requests: state.requests,
|
||||||
sidebar: state.sidebar,
|
|
||||||
requestGroups: state.requestGroups,
|
requestGroups: state.requestGroups,
|
||||||
loading: state.loading
|
loading: state.loading
|
||||||
};
|
};
|
||||||
@ -163,8 +159,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
{},
|
{},
|
||||||
bindActionCreators(GlobalActions, dispatch),
|
bindActionCreators(GlobalActions, dispatch),
|
||||||
bindActionCreators(RequestActions, dispatch),
|
bindActionCreators(RequestActions, dispatch),
|
||||||
bindActionCreators(RequestGroupActions, dispatch),
|
bindActionCreators(RequestGroupActions, dispatch)
|
||||||
bindActionCreators(SidebarActions, dispatch)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: $line-height-sm;
|
|
||||||
line-height: $line-height-sm;
|
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@ -32,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
& > button {
|
& > button {
|
||||||
padding: 0 $padding-md;
|
padding: $padding-sm;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -23,13 +23,11 @@ export default function (state = initialState, action) {
|
|||||||
const settings = settingsReducer(state.settings, action);
|
const settings = settingsReducer(state.settings, action);
|
||||||
const requests = requestsReducer(state.requests, action);
|
const requests = requestsReducer(state.requests, action);
|
||||||
const requestGroups = requestGroupsReducer(state.requestGroups, action);
|
const requestGroups = requestGroupsReducer(state.requestGroups, action);
|
||||||
const sidebar = requestGroupsReducer(state.sidebar, action);
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
settings,
|
settings,
|
||||||
requests,
|
requests,
|
||||||
requestGroups,
|
requestGroups
|
||||||
sidebar
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -38,29 +38,45 @@ function requestGroupsReducer (state = [], action) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
case types.REQUEST_GROUP_ADD_CHILD_REQUEST:
|
||||||
|
return state.map(rg => {
|
||||||
|
if (rg.id === action.id) {
|
||||||
|
rg.children = [
|
||||||
|
{type: 'Request', id: action.requestId},
|
||||||
|
...rg.children
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return rg;
|
||||||
|
});
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (state = initialState, action) {
|
export default function (state = initialState, action) {
|
||||||
|
let all;
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
||||||
case types.REQUEST_GROUP_ADD:
|
case types.REQUEST_GROUP_ADD:
|
||||||
let all = requestGroupsReducer(state.all, action);
|
all = requestGroupsReducer(state.all, action);
|
||||||
return Object.assign({}, state, {all});
|
return Object.assign({}, state, {all});
|
||||||
|
|
||||||
case types.REQUEST_GROUP_DELETE:
|
case types.REQUEST_GROUP_DELETE:
|
||||||
// TODO: Remove from collapsed as well
|
// TODO: Remove from collapsed as well
|
||||||
let all = state.all.filter(rg => rg.id !== action.id);
|
all = state.all.filter(rg => rg.id !== action.id);
|
||||||
|
return Object.assign({}, state, {all});
|
||||||
|
|
||||||
|
case types.REQUEST_GROUP_ADD_CHILD_REQUEST:
|
||||||
|
all = requestGroupsReducer(state.all, action);
|
||||||
return Object.assign({}, state, {all});
|
return Object.assign({}, state, {all});
|
||||||
|
|
||||||
case types.REQUEST_GROUP_TOGGLE:
|
case types.REQUEST_GROUP_TOGGLE:
|
||||||
let all = requestGroupsReducer(state.all, action);
|
all = requestGroupsReducer(state.all, action);
|
||||||
return Object.assign({}, state, {all});
|
return Object.assign({}, state, {all});
|
||||||
|
|
||||||
case types.REQUEST_GROUP_UPDATE:
|
case types.REQUEST_GROUP_UPDATE:
|
||||||
let all = requestGroupsReducer(state.all, action);
|
all = requestGroupsReducer(state.all, action);
|
||||||
return Object.assign({}, state, {all});
|
return Object.assign({}, state, {all});
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
const initialState = {
|
|
||||||
children: []
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function (state = initialState, action) {
|
|
||||||
switch (action.type) {
|
|
||||||
default:
|
|
||||||
return state
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user