Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature multiple sources #256

Merged
merged 12 commits into from
Oct 11, 2018
Merged

Feature multiple sources #256

merged 12 commits into from
Oct 11, 2018

Conversation

bencefr
Copy link
Contributor

@bencefr bencefr commented Sep 17, 2018

This PR adds a new section to the the SettingsView where users can add multiple apps.json URLs for external app sources. nRFConnect creates a new directory .nrfconnect-apps/external which will be the root of storing these apps.
There's an extra requirement for any additional apps.json, to specify _source string member as the source name which will create a new directory under external.
New command line argument source has been introduced to be able to specify the source which works together with open-official-app. This change is also added to desktop shortcuts.
Jest tests and snapshots are updated.

Copy link
Contributor

@chunfantasy chunfantasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good solution for multi sources!

@@ -46,7 +46,9 @@ const AvailableAppItem = ({
isDisabled,
}) => (
<div className="core-app-management-item list-group-item">
<h4 className="list-group-item-heading">{app.displayName || app.name}</h4>
<h4 className="list-group-item-heading">{app.displayName || app.name}
<span className="list-group-item-heading-sourcetag">{app.source}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe s/sourcetag/source-tag ?

<table className="core-settings-sources"><tbody>
{
Object.keys(sourcesJS)
.filter(name => name !== 'official')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation is automatic, can't force it other way.

import * as SettingsActions from '../actions/settingsActions';

const InitialState = Record({
shouldCheckForUpdatesAtStartup: true,
isUpdateCheckCompleteDialogVisible: false,
isLoading: false,
sources: Map({}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, why use Map for sources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because a simple key, value container is needed there and this one works.

main/apps.js Outdated
.catch(error => {
throw new Error(`Unable to download apps list: ${error.message}. If you ` +
'are using a proxy server, you may need to configure it as described on ' +
'https://github.com/NordicSemiconductor/pc-nrfconnect-core');
})
.then(appsJson => {
const source = appsJson._source; // eslint-disable-line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to remove '_'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underscore comes from Json which is intentional as a meta tag, I'll comment about it.

main/settings.js Outdated
if (sourcesData !== null) {
return;
}
let sources = parseJSONFile(config.getSourcesJsonPath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about s/parseJSONFile/parseJsonFile since all the other places are written as 'Json'

Copy link
Contributor

@chunfantasy chunfantasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bencefr bencefr merged commit 0bf2056 into master Oct 11, 2018
@bencefr bencefr deleted the feature/multiple-sources branch November 14, 2018 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants