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

Custom Editor #1924

Merged
merged 1 commit into from
Nov 6, 2019
Merged

Custom Editor #1924

merged 1 commit into from
Nov 6, 2019

Conversation

zlavergne
Copy link

Note: This PR requires a migration

With this PR, a PM with expert mode enabled can add a custom editor to a project.

Demos

Project edit

custom-editor_edit

Mapping

custom-editor_mapping

Note: This will currently only work with iD-ish urls or JOSM urls that don't require parameters.

cc @xamanu @russdeffner

closes #1916

@zlavergne zlavergne changed the base branch from develop to master October 18, 2019 01:31
@zlavergne zlavergne force-pushed the hotfix/custom-editor-field branch 2 times, most recently from f12e88a to 2426a61 Compare October 18, 2019 01:58
@pantierra pantierra self-assigned this Oct 21, 2019
Copy link
Contributor

@pantierra pantierra left a comment

Choose a reason for hiding this comment

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

Checked and reviewed. Works fine and source code it good.

@pantierra pantierra assigned fitoria and unassigned pantierra Oct 22, 2019
@pantierra pantierra added this to the 3.4.5 Release milestone Oct 22, 2019
Copy link
Contributor

@fitoria fitoria left a comment

Choose a reason for hiding this comment

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

I got this error, doing the following steps.

  • Add a custom editor
  • Enabled it
  • Remove custom editor
  • Add custom editor again.
CRITICAL in project_admin_api: Project GET - unhandled error: (psycopg2.IntegrityError) null value in column "enabled" violates not-null constraint
DETAIL:  Failing row contains (4, test, test desc, http://testeditor.com, null).

[SQL: UPDATE project_custom_editors SET name=%(name)s, description=%(description)s, url=%(url)s, enabled=%(enabled)s WHERE project_custom_editors.project_id = %(project_custom_editors_project_id)s]
[parameters: {'name': 'test', 'description': 'test desc', 'url': 'http://testeditor.com', 'enabled': None, 'project_custom_editors_project_id': 4}]
(Background on this error at: http://sqlalche.me/e/gkpj)

image

The field seems to not being sent

@zlavergne
Copy link
Author

zlavergne commented Oct 24, 2019

@fitoria figured it out. Long story short, since I was using an uninitialized ng-model (projectCtrl.customEditor) when rendering, the checkbox was set to null. When the rest of the data was input but the checkbox wasn't toggled, nothing triggered projectCtrl.customEditor.enabled to ever be initialized.

I decided to fix this on the backend by:

  1. changing the default for the column in the model to False
  2. adding the same default to the DTO object

@pantierra pantierra force-pushed the hotfix/custom-editor-field branch 4 times, most recently from 6f48187 to 364bc2f Compare November 6, 2019 10:56
@pantierra
Copy link
Contributor

Rerolled after a conflict with newest master after PR #1918 and catched up to newest migration. Tested it again and it is good to go.

@pantierra pantierra merged commit f9a17a7 into master Nov 6, 2019
@pantierra pantierra deleted the hotfix/custom-editor-field branch November 6, 2019 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants