-
Notifications
You must be signed in to change notification settings - Fork 829
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
Simplify and split config.json into defaultPreferences and buildConfig #633
Conversation
@jasonblais This is an example. https://circleci.com/gh/yuya-oc/desktop/449#artifacts // buildConfig.js
defaultTeams: [
{
name: 'example',
url: 'https://example.com'
},
{
name: 'google',
url: 'https://www.google.com'
}
], You would see two tabs at least. And they do not appear on the settings page. |
Ah right, makes sense. Thanks @yuya-oc, looks good to me. |
@yuya-oc @jasonblais looks good to me. It allows for the same functionality, thank you. |
@yuya-oc This one is ready to merge |
To avoid confusing, I'll wait the result of #600. |
(As part of this PR, we'll also restrict users from modifying servers via config.json when |
20d0e95
to
51e6d5f
Compare
Updated: https://circleci.com/gh/yuya-oc/desktop/486#artifacts
Now you can't modify servers by editing config.json. And I added a dialog to show error when the app is unusable.
|
@yuya-oc I get the attached dialog when opening the app with
|
My |
JSON error: It's weird. It means I had thought the white space is intended. Should we remove it? |
I removed For the dialog, does it appear for the end user when they launch the app, Please also help remove the white space in front of |
Should I create a ticket for the app to ignore the error related to |
Yes, so actual wrong config would be below. {
defaultTeams: [],
helpLink: 'https://docs.mattermost.com/help/apps/desktop-guide.html',
enableServerManagement: false
} I feel Ticket is not needed. It's easy to fix, so may I fix it on |
Yes, totally fine 👍 For the dialog, is there any way to inform the admin they made a mistake? Before they distribute it to their users. |
We can add a script to confirm buildConfig before build distributions. |
Is that something that would be a lot of work? Could it be done as part of #483? That way the end user would never be affected |
Not hard. Just writing a simple script outside of the app code. |
Cool, let's do that. So we'd have the following next steps
Final question on 1: when would the script be ran (is it automatic or would the admin run it) |
Both applicable. Probably automatic is effective to avoid mistake. For example, at the first step of |
@yuya-oc Sounds great, agree. Would the admin run |
Yeah, the commands generate .zip, .exe, ... packages. So the admin would always run them before distributing. |
Perfect 👍 |
Updated: https://circleci.com/gh/yuya-oc/desktop/491#artifacts |
a3966e7
to
f7a9f50
Compare
@yuya-oc Awesome, thanks! For some reason there are no artifacts on those links. Looks like the build may have stopped before the artifacts had built |
I've updated links. Please refer again. |
@yuya-oc I still see this |
@jasonblais Please reload this issue before open the link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuya-oc Thanks! The first link works, but the second still didn't have the artifacts for some reason https://circleci.com/gh/yuya-oc/desktop/492#artifacts
src/main.js
Outdated
dialog.showMessageBox({ | ||
type: 'error', | ||
title: 'Mattermost', | ||
message: 'When "enableServerManagement: false" is specified in buildConfig.js,\n"defaultTeams" must have one team at least.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we need the UI dialog now that we automatically message the admin? Or does it still build the app files in which case there's a chance the app will be distributed to others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely we added the automatic checker to the build script. However by reading the contents of package.json
, admin can distribute the app with wrong buildConfig. I think there is no such admin, though.
So I'm okay even if the UI dialog is removed. I could not determine whether the dialog is still needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if npm run package:*
fail if the admin is distributing the app with an incorrect buildConfig? Thoughts? (Not sure if that's even feasible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. When using wrong buildConfig, npm run package:*
fails.
Actually, npm run package:*
consists from three steps.
- Check buildConfig. (this PR)
- Compile JavaScript with webpack.
- Create distributable packages with electron-builder.
The step 3 is written at package.json
, so the admin can create packages without error by manually executing only step 3. However it's intentional. So I think it's okay even if we ignore such case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great. If people hit issues, we can always add the dialog later, but sounds like this should be okay for the majority of the admins.
We can remove the dialog 👍
scripts/check_build_config.js
Outdated
if (config.enableServerManagement === false && config.defaultTeams && config.defaultTeams.length === 0) { | ||
return { | ||
result: false, | ||
message: `When "enableServerManagement: false" is specified in buildConfig.js, "defaultTeams" must have one team at least.\n${JSON.stringify(config, null, 2)}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propose
Specify at least one server for "defaultTeams" in buildConfig.js when "enableServerManagement is set to false.\n${JSON.stringify(config, null, 2)}
Would you have an example of what ${JSON.stringify(config, null, 2)}
will output in the console?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a formatted text of buildConfig:
{
defaultTeams: [],
helpLink: 'https://docs.mattermost.com/help/apps/desktop-guide.html',
enableServerManagement: false
}
@jasonblais Updated. https://circleci.com/gh/yuya-oc/desktop/492 should not have any artifacts because |
Great, thanks @yuya-oc! Looks good to me, should be good to merge 👍
Oh right, that makes sense.. :) |
Thanks @jasonblais and @dmeza for many feedback! |
Before submitting, please confirm you've
npm run lint:js
for proper code formattingPlease provide the following information:
Summary
Simplify and split config.json into defaultPreferences and buildConfig
buildConfig is never overrode by user preferences. And this PR proposes several things.
It allows to write comments.
override.json
Admins need to know its format without any comments. In this PR, what they need to do is just editing existing config files.
They are listed on the tab bar prior to user-defined servers. And they are not listed on the settings page.
Side effect: Cache purging would not work by merging this. It would be fixed after merging
AppStateManager
of #582Issue link
#618
Test Cases
Additional Notes
https://circleci.com/gh/yuya-oc/desktop/441#artifacts