-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Add new admin toggle for turning Enterprise on and off #1095
Conversation
Deployed commit |
2afddcd
to
7542c93
Compare
Deployed commit |
7542c93
to
3c3abfa
Compare
Deployed commit |
3c3abfa
to
3139328
Compare
Deployed commit |
3139328
to
4476820
Compare
Docker doesn't like mixed case in keywords.
4476820
to
8febbaf
Compare
Deployed commit |
Deployed commit |
8febbaf
to
529e160
Compare
Deployed commit |
Small cosmetic change, POSIX requires final newlines in text files. https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline
…s truthy This will ensure that the grist-ee image will have a consistent config setting when created from the default value.
This adds PATCH and GET endpoints to handle `config.json`.
Patterned after TelemetryModel.ts
529e160
to
5770c43
Compare
Deployed commit |
2793b24
to
08f87f8
Compare
I believe I've addressed most of Jarek's concerns, save for some module separations I'm stubbornly keeping. Current round of commit messages:
|
Deployed commit |
175eb9c
to
eede7d5
Compare
Deployed commit |
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.
This looks pretty good. Testing locally, with the supervisor I can see restarts. But in enterprise mode, and with a reloaded page, I don't see signs of enterprise activity, e.g. an Activation page in menu, or a banner. What could I be doing wrong? I have included an ext
directory from grist-ee and it is built I believe.
Some content notes:
|
In case Grist isn't running with the supervisor (e.g. it's running under nodemon instead via `yarn start`), surface the problem to the frontend.
This new API is somewhat patterned after the InstallAPI, but simpler whenever possible.
Deployed commit |
Since we've started using Markdown, why not a simple utility function to start using it?
Strongly patterned after SupportGristPage. In fact, it has almost the same structure. Perhaps one day it would be possible to synchronise the logic between the two toggles even further, but I couldn't see a simple way to do so now. For now, some code structure duplication seemed easiest in lieau of more abstractions.
fd866e6
to
2e8f812
Compare
Deployed commit |
Thanks for the review, @nbush
Done.
Made those changes.
This one is tricky. There are two separate actions: you use the toggle to turn on enterprise, with a 30 day trial that will expire. You use the activation key to keep enterprise on after your trial period is over. I figured the first action was called "enabling" and the second action was called "activation". Are you telling me to just replace all instances of "enable" to "activate"?
Done.
Done.
I wrote some verbiage to explain this, but I put it in our README. Should it also or instead live in our docs website? It might correspond nicely with the docs that Spoffy is writing. |
4e93041
to
cc1ebb4
Compare
Deployed commit |
Deployed commit |
Thanks @jordigh !
Ah, I understand. That is a bit confusing, but I get why it's the case. How is the user notified that the trial has lapsed? I would assume two things: the "trial" banner would change somehow, and the toggle would be auto-disabled. But then I get a bit lost – since the activation key is a file/env var, does Grist check it's been properly detected and enable Enterprise automatically? Can Enterprise still be enabled/disabled with a detected activation key? If the states are independent I'd leave the text as-is. If Grist doesn't auto-enable Enterprise if the activation key is set up correctly, we should mention how to enable it in the docs. Additionally (and this is outside the scope of this review) it might be nice if this section mentioned if an activation key was properly set up, like: "Grist Enterprise has been activated with a key and is now enabled." In this case, we could also hide the explanatory text around activation and signing up for Enterprise. Always nice to confirm things we know.
Your explanation is clear, but will be a bit disorienting to link to from here. Spoffy's section is helpful too but with no easy permalink. On second thought, linking "Grist Core" to here is probably the best option for now, but there are already too many links in this part that are more important, so I wouldn't worry about it. |
@jordigh the check for running over supervisor looks good, but the error message doesn't propagate to the user if this happens in admin panel. They just get this: |
Very strange. If I hit the toggle too quickly in succession, I get a NetworkError. |
Final ingredient. This surfaces the work in creating the backend config API, the frontend model, the grainjs observable, and the grainjs DOM and CSS components.
cc1ebb4
to
ee716ae
Compare
I've made some changes to make the error messages clearer. How's that? |
Deployed commit |
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.
Thanks @jordigh, let's go for it.
Suggested TODOs to file for a follow-on:
- Tests.
- Count time of enterprise time from when it is first activated, rather than when Grist is first installed.
- Clean up retry (common code maybe? cancellation on retoggle?)
import { BindableValue, DomElementMethod, subscribeElem } from 'grainjs'; | ||
import { marked } from 'marked'; | ||
|
||
export function markdown(markdownObs: BindableValue<string>): DomElementMethod { |
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.
Some comments around purpose would be useful for these two methods.
|
||
// Copied from DocPageModel.ts | ||
const reconnectIntervals = [1000, 1000, 2000, 5000, 10000]; | ||
async function retryOnNetworkError<R>(func: () => Promise<R>): Promise<R> { |
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.
Not great to have copies of retry code that get independent fixes, but also ok given schedule.
Hmm might be a bit weird if multiple requests overlap, there's no cancellation.
It is acceptable, given what it is.
Original commit messages:
9c3f9de Dockerfile: silence a warning
Docker doesn't like mixed case in keywords.
8a1d124 config: end the file with a newline
Small cosmetic change, POSIX requires final newlines in text files.
https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline
2060416 configCore: default to enterprise edition if TEST_ENABLE_ACTIVATION is truthy
This will ensure that the grist-ee image will have a consistent config
setting when created from the default value.
cbf15af config: new API endpoint
This adds PATCH and GET endpoints to handle
config.json
.531f6d1 FlexServer: remove restart endpoint
The restart logic is now handled by the config endpoint, which is
where it's needed.
314962a supervisor: remove config stub
The configuration is now handled by the config API, so we no longer
need the stub function here.
733677b ConfigAPI: new class to handle frontend requests to config backend
This new API is somewhat patterned after the InstallAPI, but simpler
whenever possible.
262838f ToggleEnterpriseModel: new GrainJS model to handle changes to config API
Patterned after TelemetryModel.ts
9c5e669 AdminToggleCss: factor out CSS from SupportGristPage
We will create a new enterprise toggle, so we will need to share the same CSS.
8559b99 ToggleEnterpriseWidget: new frontend toggle for the admin
Strongly patterned after SupportGristPage. In fact, it has almost the
same structure.
Perhaps one day it would be possible to synchronise the logic between
the two toggles even further, but I couldn't see a simple way to do so
now. For now, some code structure duplication seemed easiest in lieau
of more abstractions.
466211e AdminPanel: add the toggle for enterprise
Final ingredient. This surfaces the work in creating the backend
config API, the frontend model, the grainjs observable, and the
grainjs DOM and CSS components.