-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33938 from dimagi/riese/dynamic_map_pop_up
Dynamically load case details when clicking markers
- Loading branch information
Showing
15 changed files
with
268 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
corehq/apps/app_manager/management/commands/migrate_address_popup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from corehq.apps.app_manager.management.commands.helpers import AppMigrationCommandBase | ||
from corehq.toggles import CASE_LIST_MAP | ||
|
||
|
||
class Command(AppMigrationCommandBase): | ||
help = """Migrate case list address popup fields to case detail""" | ||
|
||
include_builds = True | ||
include_linked_apps = True | ||
DOMAIN_LIST_FILENAME = 'migrate_address_popup_domain.txt' | ||
DOMAIN_PROGRESS_NUMBER_FILENAME = 'migrate_address_popup_progress.txt' | ||
chunk_size = 1 | ||
|
||
def add_arguments(self, parser): | ||
super(Command, self).add_arguments(parser) | ||
|
||
parser.add_argument( | ||
'--reverse', | ||
action='store_true', | ||
default=False, | ||
help="Perform the migration in reverse", | ||
) | ||
|
||
def get_domains(self): | ||
return CASE_LIST_MAP.get_enabled_domains() | ||
|
||
@staticmethod | ||
def migrate_app_impl(app, reverse): | ||
app_was_changed = False | ||
|
||
for module in app['modules']: | ||
detail_pair = module.get('case_details') | ||
if detail_pair: | ||
if reverse: | ||
detail_from, detail_to = detail_pair['long'], detail_pair['short'] | ||
else: | ||
detail_from, detail_to = detail_pair['short'], detail_pair['long'] | ||
|
||
address_popup_columns = \ | ||
[c for c in detail_from.get('columns') if c.get('format') == 'address-popup'] | ||
if len(address_popup_columns) > 0: | ||
app_was_changed = app_was_changed or True | ||
other_columns = [c for c in detail_from.get('columns') if c.get('format') != 'address-popup'] | ||
|
||
detail_from['columns'] = other_columns | ||
detail_to_columns = detail_to.get('columns', []) | ||
detail_to_columns.extend(address_popup_columns) | ||
detail_to['columns'] = detail_to_columns | ||
|
||
if app_was_changed: | ||
return app | ||
|
||
def migrate_app(self, app): | ||
reverse = self.options['reverse'] | ||
return Command.migrate_app_impl(app, reverse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.