mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +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'});
|
||||
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) {
|
||||
const id = requestGroupId;
|
||||
const requestId = request.id;
|
||||
@ -90,7 +92,9 @@ export function updateRequest (requestPatch) {
|
||||
export function duplicateRequest (oldRequest, requestGroupId) {
|
||||
return (dispatch) => {
|
||||
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});
|
||||
|
||||
if (requestGroupId) {
|
||||
|
@ -59,7 +59,7 @@ class Sidebar extends Component {
|
||||
const isActive = activeRequest && filteredRequests.find(r => r.id == activeRequest.id);
|
||||
|
||||
let folderIconClass = 'fa-folder';
|
||||
let expanded = activeFilter || !requestGroup.collapsed;
|
||||
let expanded = !requestGroup.collapsed;
|
||||
folderIconClass += !expanded ? '' : '-open';
|
||||
folderIconClass += isActive ? '' : '-o';
|
||||
|
||||
|
@ -30,7 +30,7 @@ class App extends Component {
|
||||
<div className="grid grid-collapse">
|
||||
<section id="request-pane" className="pane col tall">
|
||||
<div className="grid-v">
|
||||
<header className="pane__header bg-super-light">
|
||||
<header className="pane__header">
|
||||
<RequestUrlBar
|
||||
onUrlChange={updateRequestUrl}
|
||||
onMethodChange={updateRequestMethod}
|
||||
@ -106,7 +106,7 @@ class App extends Component {
|
||||
const activeRequest = requests.all.find(r => r.id === requests.active);
|
||||
|
||||
return (
|
||||
<div className="grid">
|
||||
<div className="grid bg-super-dark">
|
||||
<Sidebar
|
||||
activateRequest={actions.activateRequest}
|
||||
changeFilter={actions.changeFilter}
|
||||
@ -133,9 +133,6 @@ App.propTypes = {
|
||||
changeFilter: PropTypes.func.isRequired,
|
||||
updateRequestMethod: PropTypes.func.isRequired,
|
||||
toggleRequestGroup: PropTypes.func.isRequired
|
||||
}).isRequired,
|
||||
sidebar: PropTypes.shape({
|
||||
|
||||
}).isRequired,
|
||||
requests: PropTypes.shape({
|
||||
all: PropTypes.array.isRequired,
|
||||
@ -151,7 +148,6 @@ function mapStateToProps (state) {
|
||||
return {
|
||||
actions: state.actions,
|
||||
requests: state.requests,
|
||||
sidebar: state.sidebar,
|
||||
requestGroups: state.requestGroups,
|
||||
loading: state.loading
|
||||
};
|
||||
@ -163,8 +159,7 @@ function mapDispatchToProps (dispatch) {
|
||||
{},
|
||||
bindActionCreators(GlobalActions, dispatch),
|
||||
bindActionCreators(RequestActions, dispatch),
|
||||
bindActionCreators(RequestGroupActions, dispatch),
|
||||
bindActionCreators(SidebarActions, dispatch)
|
||||
bindActionCreators(RequestGroupActions, dispatch)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
box-sizing: border-box;
|
||||
height: $line-height-sm;
|
||||
line-height: $line-height-sm;
|
||||
color: inherit;
|
||||
|
||||
&:hover {
|
||||
@ -32,7 +30,7 @@
|
||||
}
|
||||
|
||||
& > button {
|
||||
padding: 0 $padding-md;
|
||||
padding: $padding-sm;
|
||||
color: inherit;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
@ -23,13 +23,11 @@ export default function (state = initialState, action) {
|
||||
const settings = settingsReducer(state.settings, action);
|
||||
const requests = requestsReducer(state.requests, action);
|
||||
const requestGroups = requestGroupsReducer(state.requestGroups, action);
|
||||
const sidebar = requestGroupsReducer(state.sidebar, action);
|
||||
|
||||
return Object.assign({}, state, {
|
||||
settings,
|
||||
requests,
|
||||
requestGroups,
|
||||
sidebar
|
||||
requestGroups
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -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:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export default function (state = initialState, action) {
|
||||
let all;
|
||||
switch (action.type) {
|
||||
|
||||
case types.REQUEST_GROUP_ADD:
|
||||
let all = requestGroupsReducer(state.all, action);
|
||||
all = requestGroupsReducer(state.all, action);
|
||||
return Object.assign({}, state, {all});
|
||||
|
||||
case types.REQUEST_GROUP_DELETE:
|
||||
// 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});
|
||||
|
||||
case types.REQUEST_GROUP_TOGGLE:
|
||||
let all = requestGroupsReducer(state.all, action);
|
||||
all = requestGroupsReducer(state.all, action);
|
||||
return Object.assign({}, state, {all});
|
||||
|
||||
case types.REQUEST_GROUP_UPDATE:
|
||||
let all = requestGroupsReducer(state.all, action);
|
||||
all = requestGroupsReducer(state.all, action);
|
||||
return Object.assign({}, state, {all});
|
||||
|
||||
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