Skip to content

Commit

Permalink
Merge branch 'release/v3.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Sep 3, 2020
2 parents 183d585 + 9708c17 commit 66b7e57
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 515 deletions.
3 changes: 1 addition & 2 deletions app/modules/account/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ function* watchLoadAccountInfo() {
} catch (err) {
if (
!(
err instanceof jsonrpc.JsonRpcError &&
err.data.includes('Error: You are not')
err instanceof jsonrpc.JsonRpcError && err.data.includes('Error: You are not')
)
) {
yield put(notifyError('Could not load PIO Account information', err));
Expand Down
4 changes: 2 additions & 2 deletions app/modules/core/containers/file-explorer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ class FileExplorer extends React.Component {
{this.props.devices.map(item => (
<li key={item.path}>
<Icon type="hdd" />
<a onClick={() => this.onDidChangeRoot(item.path)}>
{item.name || item.path}
<a onClick={() => this.onDidChangeRoot(item.path)} title={item.name}>
{item.path}
</a>
</li>
))}
Expand Down
7 changes: 0 additions & 7 deletions app/modules/core/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ export function title(str) {
return str[0].toUpperCase() + str.slice(1);
}

export function lastLine(text) {
return text
.trim()
.split('\n')
.slice(-1)[0];
}

export function cmpSort(a, b) {
if (a < b) {
return -1;
Expand Down
4 changes: 0 additions & 4 deletions app/modules/core/sagas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ function* watchNotifyError() {
/Please install Git client/g,
'https://github.com/platformio/platformio-core/issues/2811'
],
[
/Detected unknown package/g,
'https://github.com/platformio/platformio-core/issues/3116'
],
[
/Error: You are not connected to the Internet/g,
'https://github.com/platformio/platformio-core/issues/1348'
Expand Down
8 changes: 4 additions & 4 deletions app/modules/library/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const loadLibUpdates = () => createAction(LOAD_LIB_UPDATES);

export const installLibrary = (storageDir, lib, onEnd = null) =>
createAction(INSTALL_LIBRARY, { storageDir, lib, onEnd });
export const uninstallLibrary = (storageDir, pkgDir, onEnd = null) =>
createAction(UNINSTALL_LIBRARY, { storageDir, pkgDir, onEnd });
export const updateLibrary = (storageDir, pkgDir, onEnd = null) =>
createAction(UPDATE_LIBRARY, { storageDir, pkgDir, onEnd });
export const uninstallLibrary = (storage, pkg, onEnd = null) =>
createAction(UNINSTALL_LIBRARY, { storage, pkg, onEnd });
export const updateLibrary = (storage, pkg, onEnd = null) =>
createAction(UPDATE_LIBRARY, { storage, pkg, onEnd });
128 changes: 23 additions & 105 deletions app/modules/library/components/detail-main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,11 @@
* limitations under the License.
*/

import * as path from '../../core/path';

import {
Button,
Col,
Dropdown,
Icon,
Menu,
Popconfirm,
Row,
Select,
Tabs,
Tooltip
} from 'antd';
import { Button, Col, Icon, Row, Select, Tabs, Tooltip } from 'antd';

import LibraryDetailExamplesBlock from '../containers/detail-examples-block';
import LibraryDetailHeadersBlock from '../containers/detail-headers-block';
import LibraryDetailInstallationBlock from '../containers/detail-installation-block';
import LibraryDetailManifestBlock from '../containers/detail-manifest-block';
import LibraryInstallAdvancedModal from '../containers/install-advanced-modal';
import PropTypes from 'prop-types';
import React from 'react';
Expand All @@ -43,6 +29,7 @@ export default class LibraryDetailMain extends React.Component {
static propTypes = {
data: PropTypes.shape({
id: PropTypes.number,
ownername: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
homepage: PropTypes.string,
Expand All @@ -61,10 +48,8 @@ export default class LibraryDetailMain extends React.Component {
__pkg_dir: PropTypes.string
}),
osOpenUrl: PropTypes.func.isRequired,
osRevealFile: PropTypes.func.isRequired,
searchLibrary: PropTypes.func.isRequired,
installLibrary: PropTypes.func.isRequired,
uninstallLibrary: PropTypes.func.isRequired,
showInstalledLibraries: PropTypes.func.isRequired
};

Expand Down Expand Up @@ -117,24 +102,6 @@ export default class LibraryDetailMain extends React.Component {
);
}

onDidUninstall() {
this.setState({
uninstalling: true
});
this.props.uninstallLibrary(
path.dirname(this.props.data.__pkg_dir),
this.props.data.__pkg_dir,
err => {
this.setState({
uninstalling: false
});
if (!err) {
this.props.showInstalledLibraries();
}
}
);
}

onDidAuthorSearch(name) {
this.props.searchLibrary(`author:"${name}"`);
}
Expand All @@ -153,18 +120,18 @@ export default class LibraryDetailMain extends React.Component {

getLibraryForInstall() {
const latestVersion = this.props.data.versions.length
? this.props.data.versions[this.props.data.versions.length - 1].name
? this.props.data.versions[0].name
: '';
if (
this.state.selectedVersion &&
(!latestVersion || this.state.selectedVersion !== latestVersion)
) {
return `id=${this.props.data.id}@${this.state.selectedVersion}`;
return `${this.props.data.ownername}/${this.props.data.name}@${this.state.selectedVersion}`;
}
if (latestVersion.match(/^\d+\.\d+\.\d+$/)) {
return `id=${this.props.data.id}@^${latestVersion}`;
if (latestVersion.match(/^[\d\.]+$/)) {
return `${this.props.data.ownername}/${this.props.data.name}@^${latestVersion}`;
}
return `id=${this.props.data.id}`;
return `${this.props.data.ownername}/${this.props.data.name}`;
}

renderQuickInstallation(versions) {
Expand All @@ -190,18 +157,13 @@ export default class LibraryDetailMain extends React.Component {
</Select>
</li>
<li>
<Dropdown.Button
<Button
type="primary"
overlay={
<Menu onClick={::this.onDidInstallTo}>
<Menu.Item key="">Install to...</Menu.Item>
</Menu>
}
disabled={this.state.installing}
onClick={::this.onDidInstall}
onClick={::this.onDidInstallTo}
>
<Icon type="download" /> Install
</Dropdown.Button>
<Icon type="download" /> Add to Project
</Button>
</li>
<li>|</li>
<li>
Expand Down Expand Up @@ -230,54 +192,24 @@ export default class LibraryDetailMain extends React.Component {
{this.props.data.version}
</Tooltip>
</li>
<li>
<Button.Group>
<Button
type="primary"
icon="folder"
onClick={() => this.props.osRevealFile(this.props.data.__pkg_dir)}
>
Reveal
</Button>
<Popconfirm
title="Are you sure?"
okText="Yes"
cancelText="No"
onConfirm={::this.onDidUninstall}
>
<Button
type="primary"
icon="delete"
loading={this.state.uninstalling}
disabled={this.state.uninstalling}
>
Uninstall
</Button>
</Popconfirm>
</Button.Group>
</li>
</ul>
);
}

render() {
let versions = null;
if (this.props.data.versions) {
versions = this.props.data.versions
.slice(0)
.reverse()
.map(item => {
item.component = (
<span>
<strong>{item.name}</strong>{' '}
<small>
released{' '}
{humanize.relativeTime(new Date(item.released).getTime() / 1000)}
</small>
</span>
);
return item;
});
versions = this.props.data.versions.slice(0).map(item => {
item.component = (
<span>
<strong>{item.name}</strong>{' '}
<small>
released {humanize.relativeTime(new Date(item.released).getTime() / 1000)}
</small>
</span>
);
return item;
});
}
const authors = this.props.data.authors;
return (
Expand Down Expand Up @@ -329,17 +261,6 @@ export default class LibraryDetailMain extends React.Component {
>
<LibraryDetailHeadersBlock data={this.props.data} />
</Tabs.TabPane>
<Tabs.TabPane
tab={
<span>
<Icon type="edit" />
Manifest
</span>
}
key="manifest"
>
<LibraryDetailManifestBlock {...this.props} />
</Tabs.TabPane>
<Tabs.TabPane
tab={
<span>
Expand Down Expand Up @@ -433,10 +354,7 @@ export default class LibraryDetailMain extends React.Component {
}
>
Registry
</a>{' '}
<small>
<kbd>ID: {this.props.data.id}</kbd>
</small>
</a>
</div>
)}
{this.props.data.homepage && (
Expand Down
35 changes: 1 addition & 34 deletions app/modules/library/components/stats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import { Button, Col, Divider, Icon, Row, Tooltip } from 'antd';

import LibraryInstallAdvancedModal from '../containers/install-advanced-modal';
import PropTypes from 'prop-types';
import React from 'react';
import humanize from 'humanize';
Expand All @@ -37,13 +36,6 @@ export default class LibraryStats extends React.Component {
showLibrary: PropTypes.func.isRequired
};

constructor() {
super(...arguments);
this.state = {
advancedVisible: false
};
}

getKeywordBtnSize(index) {
if (index < 10) {
return 'large';
Expand All @@ -63,25 +55,9 @@ export default class LibraryStats extends React.Component {
);
}

onDidAdvanced() {
this.setState({
advancedVisible: true
});
}

onDidCancelAdvanced() {
this.setState({
advancedVisible: false
});
}

render() {
return (
<div>
<LibraryInstallAdvancedModal
visible={this.state.advancedVisible}
onCancel={::this.onDidCancelAdvanced}
/>
<div className="text-right">
<Button.Group>
<Button
Expand All @@ -93,16 +69,7 @@ export default class LibraryStats extends React.Component {
All Libraries
</Button>
<Button ghost type="primary" icon="file-add" onClick={::this.onDidRegister}>
Register
</Button>
<Button
ghost
type="primary"
icon="download"
disabled={this.state.advancedVisible}
onClick={::this.onDidAdvanced}
>
Install
Publish
</Button>
</Button.Group>
</div>
Expand Down
14 changes: 11 additions & 3 deletions app/modules/library/components/storage-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class LibraryStorageItem extends React.Component {
item: PropTypes.shape({
name: PropTypes.string.isRequired,
version: PropTypes.string.isRequired,
versionWanted: PropTypes.string,
versionLatest: PropTypes.string,
description: PropTypes.string,
url: PropTypes.string,
Expand Down Expand Up @@ -172,11 +173,18 @@ export default class LibraryStorageItem extends React.Component {
type="primary"
icon="cloud-download-o"
loading={this.state.actionInProgress}
disabled={this.state.actionInProgress}
disabled={
this.state.actionInProgress ||
this.props.item.versionWanted !== this.props.item.versionLatest
}
onClick={e => this.onDidUninstallOrUpdateItem(e, 'update')}
>
{this.props.item.versionLatest
? `Update to ${this.props.item.versionLatest}`
{this.props.item.versionWanted
? `Update to ${this.props.item.versionLatest}${
this.props.item.versionWanted !== this.props.item.versionLatest
? ' (incompatible)'
: ''
}`
: 'Update'}
</Button>
) : (
Expand Down
8 changes: 4 additions & 4 deletions app/modules/library/components/storage-items.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export default class LibraryStorageItems extends React.Component {
return this.props.item.items;
}

onDidUninstallOrUpdateItem(item, cmd, onEnd) {
(cmd === 'uninstall' ? this.props.uninstallLibrary : this.props.updateLibrary)(
this.props.item.path,
item.__pkg_dir,
onDidUninstallOrUpdateItem(item, action, onEnd) {
(action === 'uninstall' ? this.props.uninstallLibrary : this.props.updateLibrary)(
this.props.item,
item,
onEnd
);
}
Expand Down
Loading

0 comments on commit 66b7e57

Please sign in to comment.