-
Notifications
You must be signed in to change notification settings - Fork 61
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 an HFOSS filter to the UI #13
Comments
@alexdor Hello Alex, we are trying to add an HFOSS BooleanInput to the admin console, and then, if it is selected, we'd like to have a method execute that will add 'HFOSS' to the tags of the project. Can you help us with the syntax for executing a method if the BooleanInput is set to true? |
Hello @katiehrenchir in order to implement this functionality 2 tasks need to be completed. For the backend, the project model needs to be updated to include a boolean field that indicates whether this project is 'HFOSS' or not (with the default value set to false). In order to achieve that a new column needs to be created at the database and the project model needs to be updated with the new field. Once the model is updated the backend will automatically include the new field on every Get, Post and Put request. Please let me know if you would like more info about any specific part : ) |
Ok! We have added the BooleanInput component to the create and edit sections of src/routes/Admin/components/Projects.tsx and then we also just added this to the backend's Projects.go file |
Now we would like to have some code that adds 'HFOSS' to the tags of the Project based upon the value of the HFOSS boolean field |
you also need to add a new database migration. You need to create a migration similar to this one migrations/20180830162007_AddTagsToRepos.up.fizz but with the column that you want. You can generate a migration file by running this command |
We don't want to create a new column for HFOSS in the database, we just want to add or remove the HFOSS tag from the existing Tags based on the BooleanInput value... can this be accomplished with an "action" instead of a database change? |
Unfortunately, this can't be done by a simple action. The reason is that tags are parsed automatically by GitHub, if you add a tag (with the current setup) it will be overwritten when the project is fetched from GitHub. |
How often is the project "fetched"? Is it every time the page is loaded, or only when the project object is created/edited? |
Each project is “fetched” approximately once every 30’ from the worker
…On Thu, 27 Sep 2018 at 21.01, Katie Hrenchir ***@***.***> wrote:
How often is the project "fetched"? Is it every time the page is loaded,
or only when the project object is created/edited?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AICth6sOewP9snxqdIwIX6xWVIdp4JYZks5ufSBpgaJpZM4W7iWB>
.
|
Alex, this is our migration and we added this line to the admin Projects file Christos said that the environment should automatically do the migration for us? However, the admin console's projects list now says "No results found" so something about this is wrong, I suspect the migration. I think this added HFOSS to the Projects table, right? |
I would suggest to change the migration to
add_column("projects", "HFOSS", "boolean", {"default": false})
In order to run the migration, stop and start the running docket instance
…On Thu, 27 Sep 2018 at 21.10, Katie Hrenchir ***@***.***> wrote:
Alex, this is our migration
add_column("projects", "HFOSS", "boolean", {"null": true})
and we added this line to the admin Projects file
<BooleanField source="HFOSS" label="HFOSS?" />
Christos said that the environment should automatically do the migration
for us? However, the admin console's projects list now says "No results
found" so something about this is wrong, I suspect the migration. I think
this added HFOSS to the Projects table, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AICth_44u-UeEI6FZ2dOObSBXGhrs5Kmks5ufSK1gaJpZM4W7iWB>
.
|
Alex, here is the output: https://pastebin.com/1eXwtCyK |
@katiehrenchir could you upload the source code somewhere as well so I can try to see why is the migration not running? (You could push it to your fork of the repo) |
Alex, I have pushed the changes to my fork of the backend. |
I've left a comment with a possible issue, when you have a look and let me know if it worked : ) |
@alexdor is this being worked on now? |
@siddhant1 no I've left my comments here katiehrenchir/fixme_backend@4fa6636 |
Add an HFOSS filter on the UI/filters list
The text was updated successfully, but these errors were encountered: