Some stuff

This commit is contained in:
Gregory Schier committed 2016-07-21 09:33:35 -07:00
1 parent 329656f0e2
commit ea579f4d03
9 files changed
+69 -36

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"private": true,
"name": "insomnia",
"version": "3.0.0-beta.1",
"version": "3.0.3",
"productName": "Insomnia",
"description": "The best REST API Client",
"homepage": "http://insomnia.rest",
+31 -16
View File
@@ -7,19 +7,28 @@ import ModalHeader from './base/ModalHeader';
import ModalFooter from './base/ModalFooter';
import ModalComponent from './lib/ModalComponent';
import {CHANGELOG_URL} from '../lib/constants';
import {getVersion} from '../lib/appInfo';
class ChangelogModal extends ModalComponent {
constructor (props) {
super(props);
this.state = {
startVersion: null,
startVersion: getVersion(),
changelog: null
};
}
show (startVersion) {
show (startVersion = null) {
super.show();
if (startVersion) {
this.setState({startVersion});
}
}
componentDidMount () {
super.componentDidMount();
request.get(CHANGELOG_URL, (err, response) => {
if (err) {
console.error('Failed to load changelog', err);
@@ -34,7 +43,7 @@ class ChangelogModal extends ModalComponent {
return;
}
this.setState({changelog, startVersion});
this.setState({changelog});
});
}
@@ -52,21 +61,27 @@ class ChangelogModal extends ModalComponent {
} else {
html = [];
changelog.map(change => {
let startIndex = changelog.findIndex(c => c.version === startVersion);
if (startIndex < 0) {
startIndex = 0;
console.error(`Failed to find changelog version for ${startVersion}`)
}
changelog.slice(startIndex).map((change, i) => {
html = [
...html,
<h1 key="changes">v{change.version} Changes</h1>
<h1 key={`changes.${i}`}>v{change.version} Changes</h1>
];
if (change.summary) {
if (!Array.isArray(change.summary)) {
html = [
...html,
<p key="summary">{change.summary}</p>
<p key={`summary.${i}`}>{change.summary}</p>
]
} else {
html = [
...html,
<p key="summary"><strong>{change.summary[0]}</strong></p>,
<p key={`summary.${i}`}><strong>{change.summary[0]}</strong></p>,
...change.summary.slice(1).map((text, i) => <p key={`summary[${i}]`}>{text}</p>)
]
}
@@ -75,8 +90,8 @@ class ChangelogModal extends ModalComponent {
if (change.major && change.major.length) {
html = [
...html,
<h3 key="major">Noteworthy</h3>,
<ul key="major.list">
<h3 key={`major.${i}`}>Noteworthy</h3>,
<ul key={`major.${i}.list`}>
{change.major.map((text, i) => <li key={i}>{text}</li>)}
</ul>
];
@@ -85,26 +100,26 @@ class ChangelogModal extends ModalComponent {
if (change.fixes && change.fixes.length) {
html = [
...html,
<h3 key="fixes">Fixes</h3>,
<ul key="fixes.list">
<h3 key={`fixes.${i}`}>Fixes</h3>,
<ul key={`fixes.${i}.list`}>
{change.fixes.map(text => <li>{text}</li>)}
</ul>
</ul>
];
}
if (change.minor && change.minor.length) {
html = [
...html,
<h3 key="minor">Minor Changes</h3>,
<ul key="minor.list">
<h3 key={`minor.${i}`}>Minor Changes</h3>,
<ul key={`minor.${i}.list`}>
{change.minor.map((text, i) => <li key={i}>{text}</li>)}
</ul>
</ul>
];
}
html = [
...html,
<hr key="hr"/>
<hr key={`hr.${i}`}/>
]
});
}
+25 -5
View File
@@ -40,12 +40,11 @@ class SettingsTabs extends Component {
}
render () {
const {entities} = this.props;
const {entities, selectedIndex} = this.props;
const settings = entities.settings[Object.keys(entities.settings)[0]];
return (
<Tabs>
<Tabs selectedIndex={selectedIndex >= 0 ? selectedIndex : 0}>
<TabList>
<Tab>
<button>General</button>
@@ -211,7 +210,10 @@ SettingsTabs.propTypes = {
importFile: PropTypes.func.isRequired,
exportFile: PropTypes.func.isRequired,
})
})
}),
// Optional
selectedIndex: PropTypes.number
};
function mapStateToProps (state) {
@@ -240,7 +242,25 @@ const ConnectedSettingsTabs = connect(
class SettingsModal extends ModalComponent {
constructor (props) {
super(props);
this.state = {
selectedIndex: 0
}
}
show (selectedIndex = 0) {
super.show();
if (selectedIndex >= 0) {
this.setState({selectedIndex});
} else {
this.setState({selectedIndex: 0});
}
}
render () {
const {selectedIndex} = this.state;
return (
<Modal ref="modal" tall={true} {...this.props}>
@@ -250,7 +270,7 @@ class SettingsModal extends ModalComponent {
<span className="faint txt-sm">v{getVersion()}</span>
</ModalHeader>
<ModalBody>
<ConnectedSettingsTabs />
<ConnectedSettingsTabs selectedIndex={selectedIndex} />
</ModalBody>
<ModalFooter className="pad text-right">
<div className="relative">
+2 -2
View File
@@ -157,6 +157,6 @@ function targetCollect (connect, monitor) {
};
}
const source = DragSource('SIDEBAR_REQUEST_GROUP_ROW', dragSource, sourceCollect)(SidebarRequestGroupRow);
const target = DropTarget('SIDEBAR_REQUEST_GROUP_ROW', dragTarget, targetCollect)(source);
const source = DragSource('SIDEBAR_ROW_2', dragSource, sourceCollect)(SidebarRequestGroupRow);
const target = DropTarget('SIDEBAR_ROW_2', dragTarget, targetCollect)(source);
export default target;
+1 -1
View File
@@ -145,7 +145,7 @@ class WorkspaceDropdown extends Component {
<DropdownDivider name="Insomnia"/>
<li>
<button onClick={e => SettingsModal.show()}>
<button onClick={e => SettingsModal.show(1)}>
<i className="fa fa-share"></i> Import/Export
</button>
</li>
+2 -1
View File
@@ -91,9 +91,10 @@
&.sidebar__row--dragging-above::before {
position: absolute;
height: 0;
right: 0;
left: 0;
border-bottom: 2px dotted lighten($surprise, 5);
content: " ";
width: 100%;
display: block
}
}
+2 -1
View File
@@ -12,13 +12,14 @@ import './css/lib/chrome/platform_app.css'
import './css/lib/fontawesome/css/font-awesome.css'
import {initStore} from './redux/initstore';
import {initDB} from './database';
import {getVersion} from './lib/appInfo';
// Don't inject component styles (use our own)
Tabs.setUseDefaultStyles(false);
export const store = createStore();
console.log('-- Loading App --');
console.log(`-- Loading App v${getVersion()} --`);
initDB()
.then(() => initStore(store.dispatch))
+2 -6
View File
@@ -31,9 +31,7 @@ function importRequestGroup (iRequestGroup, parentId, exportFormat) {
parentId,
name: iRequestGroup.name,
environment: (iRequestGroup.environments || {}).base || {},
meta: {
collapsed: true
}
metaCollapsed: true
}).then(requestGroup => {
// Sometimes (maybe all the time, I can't remember) requests will be nested
if (iRequestGroup.hasOwnProperty('requests')) {
@@ -49,9 +47,7 @@ function importRequestGroup (iRequestGroup, parentId, exportFormat) {
parentId,
name: iRequestGroup.name,
environment: iRequestGroup.environment,
meta: {
collapsed: true
}
metaCollapsed: true
});
} else {
console.error(`Unknown export format ${exportFormat}`)
+3 -3
View File
@@ -4,12 +4,12 @@
echo "-- STARTING PACKAGING PROCESS... --"
cp assets/* build/
echo "-- PACKAGING MAC --"
node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --mac
echo "-- PACKAGING WINDOWS --"
node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --win
echo "-- PACKAGING MAC --"
node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --mac
# TODO: This
#echo "-- PACKAGING LINUX --"
#node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --linux