Skip to content

Commit 66b7e57

Browse files
committed
Merge branch 'release/v3.3.0'
2 parents 183d585 + 9708c17 commit 66b7e57

20 files changed

+245
-515
lines changed

Diff for: app/modules/account/sagas.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ function* watchLoadAccountInfo() {
8383
} catch (err) {
8484
if (
8585
!(
86-
err instanceof jsonrpc.JsonRpcError &&
87-
err.data.includes('Error: You are not')
86+
err instanceof jsonrpc.JsonRpcError && err.data.includes('Error: You are not')
8887
)
8988
) {
9089
yield put(notifyError('Could not load PIO Account information', err));

Diff for: app/modules/core/containers/file-explorer.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ class FileExplorer extends React.Component {
346346
{this.props.devices.map(item => (
347347
<li key={item.path}>
348348
<Icon type="hdd" />
349-
<a onClick={() => this.onDidChangeRoot(item.path)}>
350-
{item.name || item.path}
349+
<a onClick={() => this.onDidChangeRoot(item.path)} title={item.name}>
350+
{item.path}
351351
</a>
352352
</li>
353353
))}

Diff for: app/modules/core/helpers.js

-7
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ export function title(str) {
8080
return str[0].toUpperCase() + str.slice(1);
8181
}
8282

83-
export function lastLine(text) {
84-
return text
85-
.trim()
86-
.split('\n')
87-
.slice(-1)[0];
88-
}
89-
9083
export function cmpSort(a, b) {
9184
if (a < b) {
9285
return -1;

Diff for: app/modules/core/sagas.jsx

-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ function* watchNotifyError() {
8484
/Please install Git client/g,
8585
'https://github.com/platformio/platformio-core/issues/2811'
8686
],
87-
[
88-
/Detected unknown package/g,
89-
'https://github.com/platformio/platformio-core/issues/3116'
90-
],
9187
[
9288
/Error: You are not connected to the Internet/g,
9389
'https://github.com/platformio/platformio-core/issues/1348'

Diff for: app/modules/library/actions.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const loadLibUpdates = () => createAction(LOAD_LIB_UPDATES);
3838

3939
export const installLibrary = (storageDir, lib, onEnd = null) =>
4040
createAction(INSTALL_LIBRARY, { storageDir, lib, onEnd });
41-
export const uninstallLibrary = (storageDir, pkgDir, onEnd = null) =>
42-
createAction(UNINSTALL_LIBRARY, { storageDir, pkgDir, onEnd });
43-
export const updateLibrary = (storageDir, pkgDir, onEnd = null) =>
44-
createAction(UPDATE_LIBRARY, { storageDir, pkgDir, onEnd });
41+
export const uninstallLibrary = (storage, pkg, onEnd = null) =>
42+
createAction(UNINSTALL_LIBRARY, { storage, pkg, onEnd });
43+
export const updateLibrary = (storage, pkg, onEnd = null) =>
44+
createAction(UPDATE_LIBRARY, { storage, pkg, onEnd });

Diff for: app/modules/library/components/detail-main.jsx

+23-105
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as path from '../../core/path';
18-
19-
import {
20-
Button,
21-
Col,
22-
Dropdown,
23-
Icon,
24-
Menu,
25-
Popconfirm,
26-
Row,
27-
Select,
28-
Tabs,
29-
Tooltip
30-
} from 'antd';
17+
import { Button, Col, Icon, Row, Select, Tabs, Tooltip } from 'antd';
3118

3219
import LibraryDetailExamplesBlock from '../containers/detail-examples-block';
3320
import LibraryDetailHeadersBlock from '../containers/detail-headers-block';
3421
import LibraryDetailInstallationBlock from '../containers/detail-installation-block';
35-
import LibraryDetailManifestBlock from '../containers/detail-manifest-block';
3622
import LibraryInstallAdvancedModal from '../containers/install-advanced-modal';
3723
import PropTypes from 'prop-types';
3824
import React from 'react';
@@ -43,6 +29,7 @@ export default class LibraryDetailMain extends React.Component {
4329
static propTypes = {
4430
data: PropTypes.shape({
4531
id: PropTypes.number,
32+
ownername: PropTypes.string.isRequired,
4633
name: PropTypes.string.isRequired,
4734
description: PropTypes.string.isRequired,
4835
homepage: PropTypes.string,
@@ -61,10 +48,8 @@ export default class LibraryDetailMain extends React.Component {
6148
__pkg_dir: PropTypes.string
6249
}),
6350
osOpenUrl: PropTypes.func.isRequired,
64-
osRevealFile: PropTypes.func.isRequired,
6551
searchLibrary: PropTypes.func.isRequired,
6652
installLibrary: PropTypes.func.isRequired,
67-
uninstallLibrary: PropTypes.func.isRequired,
6853
showInstalledLibraries: PropTypes.func.isRequired
6954
};
7055

@@ -117,24 +102,6 @@ export default class LibraryDetailMain extends React.Component {
117102
);
118103
}
119104

120-
onDidUninstall() {
121-
this.setState({
122-
uninstalling: true
123-
});
124-
this.props.uninstallLibrary(
125-
path.dirname(this.props.data.__pkg_dir),
126-
this.props.data.__pkg_dir,
127-
err => {
128-
this.setState({
129-
uninstalling: false
130-
});
131-
if (!err) {
132-
this.props.showInstalledLibraries();
133-
}
134-
}
135-
);
136-
}
137-
138105
onDidAuthorSearch(name) {
139106
this.props.searchLibrary(`author:"${name}"`);
140107
}
@@ -153,18 +120,18 @@ export default class LibraryDetailMain extends React.Component {
153120

154121
getLibraryForInstall() {
155122
const latestVersion = this.props.data.versions.length
156-
? this.props.data.versions[this.props.data.versions.length - 1].name
123+
? this.props.data.versions[0].name
157124
: '';
158125
if (
159126
this.state.selectedVersion &&
160127
(!latestVersion || this.state.selectedVersion !== latestVersion)
161128
) {
162-
return `id=${this.props.data.id}@${this.state.selectedVersion}`;
129+
return `${this.props.data.ownername}/${this.props.data.name}@${this.state.selectedVersion}`;
163130
}
164-
if (latestVersion.match(/^\d+\.\d+\.\d+$/)) {
165-
return `id=${this.props.data.id}@^${latestVersion}`;
131+
if (latestVersion.match(/^[\d\.]+$/)) {
132+
return `${this.props.data.ownername}/${this.props.data.name}@^${latestVersion}`;
166133
}
167-
return `id=${this.props.data.id}`;
134+
return `${this.props.data.ownername}/${this.props.data.name}`;
168135
}
169136

170137
renderQuickInstallation(versions) {
@@ -190,18 +157,13 @@ export default class LibraryDetailMain extends React.Component {
190157
</Select>
191158
</li>
192159
<li>
193-
<Dropdown.Button
160+
<Button
194161
type="primary"
195-
overlay={
196-
<Menu onClick={::this.onDidInstallTo}>
197-
<Menu.Item key="">Install to...</Menu.Item>
198-
</Menu>
199-
}
200162
disabled={this.state.installing}
201-
onClick={::this.onDidInstall}
163+
onClick={::this.onDidInstallTo}
202164
>
203-
<Icon type="download" /> Install
204-
</Dropdown.Button>
165+
<Icon type="download" /> Add to Project
166+
</Button>
205167
</li>
206168
<li>|</li>
207169
<li>
@@ -230,54 +192,24 @@ export default class LibraryDetailMain extends React.Component {
230192
{this.props.data.version}
231193
</Tooltip>
232194
</li>
233-
<li>
234-
<Button.Group>
235-
<Button
236-
type="primary"
237-
icon="folder"
238-
onClick={() => this.props.osRevealFile(this.props.data.__pkg_dir)}
239-
>
240-
Reveal
241-
</Button>
242-
<Popconfirm
243-
title="Are you sure?"
244-
okText="Yes"
245-
cancelText="No"
246-
onConfirm={::this.onDidUninstall}
247-
>
248-
<Button
249-
type="primary"
250-
icon="delete"
251-
loading={this.state.uninstalling}
252-
disabled={this.state.uninstalling}
253-
>
254-
Uninstall
255-
</Button>
256-
</Popconfirm>
257-
</Button.Group>
258-
</li>
259195
</ul>
260196
);
261197
}
262198

263199
render() {
264200
let versions = null;
265201
if (this.props.data.versions) {
266-
versions = this.props.data.versions
267-
.slice(0)
268-
.reverse()
269-
.map(item => {
270-
item.component = (
271-
<span>
272-
<strong>{item.name}</strong>{' '}
273-
<small>
274-
released{' '}
275-
{humanize.relativeTime(new Date(item.released).getTime() / 1000)}
276-
</small>
277-
</span>
278-
);
279-
return item;
280-
});
202+
versions = this.props.data.versions.slice(0).map(item => {
203+
item.component = (
204+
<span>
205+
<strong>{item.name}</strong>{' '}
206+
<small>
207+
released {humanize.relativeTime(new Date(item.released).getTime() / 1000)}
208+
</small>
209+
</span>
210+
);
211+
return item;
212+
});
281213
}
282214
const authors = this.props.data.authors;
283215
return (
@@ -329,17 +261,6 @@ export default class LibraryDetailMain extends React.Component {
329261
>
330262
<LibraryDetailHeadersBlock data={this.props.data} />
331263
</Tabs.TabPane>
332-
<Tabs.TabPane
333-
tab={
334-
<span>
335-
<Icon type="edit" />
336-
Manifest
337-
</span>
338-
}
339-
key="manifest"
340-
>
341-
<LibraryDetailManifestBlock {...this.props} />
342-
</Tabs.TabPane>
343264
<Tabs.TabPane
344265
tab={
345266
<span>
@@ -433,10 +354,7 @@ export default class LibraryDetailMain extends React.Component {
433354
}
434355
>
435356
Registry
436-
</a>{' '}
437-
<small>
438-
<kbd>ID: {this.props.data.id}</kbd>
439-
</small>
357+
</a>
440358
</div>
441359
)}
442360
{this.props.data.homepage && (

Diff for: app/modules/library/components/stats.jsx

+1-34
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

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

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

40-
constructor() {
41-
super(...arguments);
42-
this.state = {
43-
advancedVisible: false
44-
};
45-
}
46-
4739
getKeywordBtnSize(index) {
4840
if (index < 10) {
4941
return 'large';
@@ -63,25 +55,9 @@ export default class LibraryStats extends React.Component {
6355
);
6456
}
6557

66-
onDidAdvanced() {
67-
this.setState({
68-
advancedVisible: true
69-
});
70-
}
71-
72-
onDidCancelAdvanced() {
73-
this.setState({
74-
advancedVisible: false
75-
});
76-
}
77-
7858
render() {
7959
return (
8060
<div>
81-
<LibraryInstallAdvancedModal
82-
visible={this.state.advancedVisible}
83-
onCancel={::this.onDidCancelAdvanced}
84-
/>
8561
<div className="text-right">
8662
<Button.Group>
8763
<Button
@@ -93,16 +69,7 @@ export default class LibraryStats extends React.Component {
9369
All Libraries
9470
</Button>
9571
<Button ghost type="primary" icon="file-add" onClick={::this.onDidRegister}>
96-
Register
97-
</Button>
98-
<Button
99-
ghost
100-
type="primary"
101-
icon="download"
102-
disabled={this.state.advancedVisible}
103-
onClick={::this.onDidAdvanced}
104-
>
105-
Install
72+
Publish
10673
</Button>
10774
</Button.Group>
10875
</div>

Diff for: app/modules/library/components/storage-item.jsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class LibraryStorageItem extends React.Component {
2525
item: PropTypes.shape({
2626
name: PropTypes.string.isRequired,
2727
version: PropTypes.string.isRequired,
28+
versionWanted: PropTypes.string,
2829
versionLatest: PropTypes.string,
2930
description: PropTypes.string,
3031
url: PropTypes.string,
@@ -172,11 +173,18 @@ export default class LibraryStorageItem extends React.Component {
172173
type="primary"
173174
icon="cloud-download-o"
174175
loading={this.state.actionInProgress}
175-
disabled={this.state.actionInProgress}
176+
disabled={
177+
this.state.actionInProgress ||
178+
this.props.item.versionWanted !== this.props.item.versionLatest
179+
}
176180
onClick={e => this.onDidUninstallOrUpdateItem(e, 'update')}
177181
>
178-
{this.props.item.versionLatest
179-
? `Update to ${this.props.item.versionLatest}`
182+
{this.props.item.versionWanted
183+
? `Update to ${this.props.item.versionLatest}${
184+
this.props.item.versionWanted !== this.props.item.versionLatest
185+
? ' (incompatible)'
186+
: ''
187+
}`
180188
: 'Update'}
181189
</Button>
182190
) : (

Diff for: app/modules/library/components/storage-items.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export default class LibraryStorageItems extends React.Component {
5353
return this.props.item.items;
5454
}
5555

56-
onDidUninstallOrUpdateItem(item, cmd, onEnd) {
57-
(cmd === 'uninstall' ? this.props.uninstallLibrary : this.props.updateLibrary)(
58-
this.props.item.path,
59-
item.__pkg_dir,
56+
onDidUninstallOrUpdateItem(item, action, onEnd) {
57+
(action === 'uninstall' ? this.props.uninstallLibrary : this.props.updateLibrary)(
58+
this.props.item,
59+
item,
6060
onEnd
6161
);
6262
}

0 commit comments

Comments
 (0)