mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
46d3719b99
* Maybe working POC * Change to use remote url * Other URL too * Some logic * Got the push part working * Made some updates * Fix * Update * Add status code check * Stuff * Implemented new sync api * A bit more robust * Debounce changes * Change timeout * Some fixes * Remove .less * Better error handling * Fix base url * Support for created vs updated docs * Try silent * Silence removal too * Small fix after merge * Fix test * Stuff * Implement key generation algorithm * Tidy * stuff * A bunch of stuff for the new API * Integrated the session stuff * Stuff * Just started on encryption * Lots of updates to encryption * Finished createResourceGroup function * Full encryption/decryption working (I think) * Encrypt localstorage with sessionID * Some more * Some extra checks * Now uses separate DB. Still needs to be simplified a LOT * Fix deletion bug * Fixed unicode bug with encryption * Simplified and working * A bunch of polish * Some stuff * Removed some workspace meta properties * Migrated a few more meta properties * Small changes * Fix body scrolling and url cursor jumping * Removed duplication of webpack port * Remove workspaces reduces * Some small fixes * Added sync modal and opt-in setting * Good start to sync flow * Refactored modal footer css * Update sync status * Sync logger * A bit better logging * Fixed a bunch of sync-related bugs * Fixed signup form button * Gravatar component * Split sync modal into tabs * Tidying * Some more error handling * start sending 'user agent * Login/signup error handling * Use real UUIDs * Fixed tests * Remove unused function * Some extra checks * Moved cloud sync setting to about page * Some small changes * Some things
161 lines
4.0 KiB
JavaScript
161 lines
4.0 KiB
JavaScript
import React, {Component} from 'react';
|
|
import request from 'request';
|
|
|
|
import Modal from '../base/Modal';
|
|
import ModalBody from '../base/ModalBody';
|
|
import ModalHeader from '../base/ModalHeader';
|
|
import ModalFooter from '../base/ModalFooter';
|
|
import {CHANGELOG_URL} from '../../../backend/constants';
|
|
import {getAppVersion} from '../../../backend/appInfo';
|
|
|
|
class ChangelogModal extends Component {
|
|
constructor (props) {
|
|
super(props);
|
|
this.state = {
|
|
startVersion: getAppVersion(),
|
|
changelog: null
|
|
};
|
|
}
|
|
|
|
show (startVersion = null) {
|
|
this.modal.show();
|
|
|
|
if (startVersion) {
|
|
this.setState({startVersion});
|
|
}
|
|
}
|
|
|
|
componentDidMount () {
|
|
request.get(CHANGELOG_URL, (err, response) => {
|
|
if (err) {
|
|
console.warn('Failed to load changelog', err);
|
|
return;
|
|
}
|
|
|
|
if (response.statusCode !== 200) {
|
|
console.warn(
|
|
'Failed to fetch changelog',
|
|
response.statusCode,
|
|
response.body
|
|
);
|
|
return;
|
|
}
|
|
|
|
let changelog;
|
|
try {
|
|
changelog = JSON.parse(response.body);
|
|
} catch (e) {
|
|
console.error('Failed to parse changelog', e);
|
|
return;
|
|
}
|
|
|
|
this.setState({changelog});
|
|
});
|
|
}
|
|
|
|
shouldComponentUpdate (nextProps, nextState) {
|
|
return nextState !== this.state;
|
|
}
|
|
|
|
render () {
|
|
const {changelog, startVersion} = this.state;
|
|
|
|
let html;
|
|
|
|
if (!changelog) {
|
|
html = [
|
|
<div key="spinner" className="txt-lg">
|
|
<i className="fa fa-refresh fa-spin"></i>
|
|
</div>
|
|
];
|
|
} else {
|
|
html = [];
|
|
|
|
let startIndex = changelog.findIndex(c => c.version === startVersion);
|
|
if (startIndex < 0) {
|
|
startIndex = 0;
|
|
console.warn(`Failed to find changelog version for ${startVersion}`)
|
|
}
|
|
|
|
changelog.slice(startIndex).map((change, i) => {
|
|
html = [
|
|
...html,
|
|
<h1 key={`changes.${i}`}>v{change.version} Changes</h1>
|
|
];
|
|
if (change.summary) {
|
|
if (!Array.isArray(change.summary)) {
|
|
html = [
|
|
...html,
|
|
<p key={`summary.${i}`}
|
|
dangerouslySetInnerHTML={{__html: change.summary}}/>
|
|
]
|
|
} else {
|
|
html = [
|
|
...html,
|
|
<p key={`summary.${i}`}><strong
|
|
dangerouslySetInnerHTML={{__html: change.summary[0]}}/></p>,
|
|
...change.summary.slice(1).map(
|
|
(text, j) => <p key={`summary.${i}[${j}]`}
|
|
dangerouslySetInnerHTML={{__html: text}}/>
|
|
)
|
|
]
|
|
}
|
|
}
|
|
|
|
if (change.major && change.major.length) {
|
|
html = [
|
|
...html,
|
|
<h3 key={`major.${i}`}>Noteworthy</h3>,
|
|
<ul key={`major.${i}.list`}>
|
|
{change.major.map((text, i) => <li key={i}>{text}</li>)}
|
|
</ul>
|
|
];
|
|
}
|
|
|
|
if (change.fixes && change.fixes.length) {
|
|
html = [
|
|
...html,
|
|
<h3 key={`fixes.${i}`}>Fixes</h3>,
|
|
<ul key={`fixes.${i}.list`}>
|
|
{change.fixes.map((text, j) => <li key={j}>{text}</li>)}
|
|
</ul>
|
|
];
|
|
}
|
|
|
|
if (change.minor && change.minor.length) {
|
|
html = [
|
|
...html,
|
|
<h3 key={`minor.${i}`}>Minor Changes</h3>,
|
|
<ul key={`minor.${i}.list`}>
|
|
{change.minor.map((text, i) => <li key={i}>{text}</li>)}
|
|
</ul>
|
|
];
|
|
}
|
|
|
|
html = [
|
|
...html,
|
|
<hr key={`hr.${i}`}/>
|
|
]
|
|
});
|
|
}
|
|
|
|
return (
|
|
<Modal ref={m => this.modal = m} {...this.props}>
|
|
<ModalHeader>Insomnia Changelog</ModalHeader>
|
|
<ModalBody className="pad changelog">
|
|
{html}
|
|
</ModalBody>
|
|
<ModalFooter>
|
|
<button className="btn" onClick={e => this.modal.hide()}>
|
|
Close
|
|
</button>
|
|
</ModalFooter>
|
|
</Modal>
|
|
);
|
|
}
|
|
}
|
|
|
|
ChangelogModal.propTypes = {};
|
|
|
|
export default ChangelogModal;
|