-
Notifications
You must be signed in to change notification settings - Fork 0
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
Import config JSON or YAML #143
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
+ Coverage 93.83% 94.02% +0.18%
==========================================
Files 24 24
Lines 2221 2291 +70
Branches 120 128 +8
==========================================
+ Hits 2084 2154 +70
Misses 137 137 ☔ View full report in Codecov by Sentry. |
@@ -54,7 +54,7 @@ repos: | |||
- id: prettier-js-format | |||
name: prettier-js-format | |||
entry: yarn prettier | |||
files: "florist/app" | |||
files: "(florist/app|florist/tests/unit/app)" |
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.
Shoehorning this here so prettier can also format the unit test files as well.
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 generally LGTM. I'll have more questions and comments once I get more into the code and wipe some rust off of next.js and typescript "skills".
I'll get setup on the codebase by eow.
} else if (file.name.endsWith(".yaml") || file.name.endsWith(".yml")) { | ||
data = yaml.load(fileText); | ||
} else { | ||
console.error(`file extension not supported: ${file.name}`); |
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.
should we popup a modal to notify the user?
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.
I thought about that but I didn't want to come up with a whole modal or to pop up an alert. Maybe there is a way to limit to only .json
or .yaml
file types on the upload dialog?
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.
Ah okay, i think then this fine for now. In some past projects we used "ready-made" components that we can just use or at least adapt to make fit with our app style.
I think we could just chalk this up as part of something we look to do post milestone 1?
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.
I have added an attribute to the input file to only accept yaml and json files, now the error will only happen if the user goes out of their way to upload something that's not supported. I think that makes it better and prevents us from doing some extra work that doesn't add a lot to the app. Let me know what you think.
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.
@nerdai yes, we can also do this as part of the next milestone. About ready-made components, the CSS template I'm using has a modal component and that's what I used on #130 to display the logs modal, but JS part of it is not perfectly integrated with NextJS and it turned out to be a bit more work than I expected to make it work well. I think it will be easier to do once that PR is merged.
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.
Ah okay, thanks for the context!
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.
lgtm!
ref={buttonRef} | ||
id="job-server-config-uploader" | ||
onChange={handleFileUpload} | ||
accept=".json,.yaml,.yml,application/json,application/x-yaml,text/yaml" |
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.
noice!
PR Type
Feature
Short Description
Clickup Ticket(s): https://app.clickup.com/t/868b1x701
Adding a button on the edit page to import a JSON or YAML file to populate the server configuration.
Tests Added
Fully unit tested