diff --git a/dao_analyzer/apps/aragon/business/app_service.py b/dao_analyzer/apps/aragon/business/app_service.py index c9d08eb0..7101a209 100644 --- a/dao_analyzer/apps/aragon/business/app_service.py +++ b/dao_analyzer/apps/aragon/business/app_service.py @@ -93,11 +93,13 @@ def get_layout(self, **kwargs) -> html.Div: """ if not self.__already_bound: self.bind_callbacks() + + org_list = self.organization_list() return view.generate_layout( - organization_list=self.organization_list(), + organization_list=org_list, + platform_info=self.platform(org_list), sections=self.__get_sections(), - ecosystem='aragon', update=self.__orgsDAO.get_last_update_str(), platform_id=TEXT['css_id_organization'], datapoints=self.__get_datapoints(), diff --git a/dao_analyzer/apps/common/business/transfers/organization/platform.py b/dao_analyzer/apps/common/business/transfers/organization/platform.py index 50486fc4..c19f335d 100644 --- a/dao_analyzer/apps/common/business/transfers/organization/platform.py +++ b/dao_analyzer/apps/common/business/transfers/organization/platform.py @@ -29,6 +29,10 @@ def __init__(self, def name(self) -> str: return self._name + @property + def id(self) -> str: + return self._name.lower() + @property def networks(self) -> List[str]: return self._networks diff --git a/dao_analyzer/apps/common/presentation/dashboard_view/dashboard_view.py b/dao_analyzer/apps/common/presentation/dashboard_view/dashboard_view.py index 7e163094..09a30894 100644 --- a/dao_analyzer/apps/common/presentation/dashboard_view/dashboard_view.py +++ b/dao_analyzer/apps/common/presentation/dashboard_view/dashboard_view.py @@ -28,9 +28,9 @@ def generate_layout( organization_list: OrganizationList, + platform_info: Platform, sections: Dict, datapoints, - ecosystem: str, update: str, platform_id: str, org_value: str, @@ -48,9 +48,11 @@ def generate_layout( if not org_value: org_value = organization_list.ALL_ORGS_ID + assert isinstance(platform_info, Platform) + return html.Div([ dbc.Container( - __generate_header(organization_list, ecosystem, update, org_value, network_value, filter_values), + __generate_header(organization_list, platform_info, update, org_value, network_value, filter_values), className='top body mb-3 py-4'), dbc.Container([ __generate_subheader(platform_id, datapoints), @@ -68,15 +70,15 @@ def __gen_ecosystem(id: str, selected: str) -> html.Div: def __generate_header( organization_list: OrganizationList, - ecosystem: str, + platform_info: Platform, update: str, org_value: str, network_value: str, filter_values: List[str], ) -> dbc.Row: selected: List[str] = __ECOSYSTEM_SELECTED['default'] - if ecosystem in __ECOSYSTEM_SELECTED.keys(): - selected = __ECOSYSTEM_SELECTED[ecosystem] + if platform_info.id in __ECOSYSTEM_SELECTED.keys(): + selected = __ECOSYSTEM_SELECTED[platform_info.id] ecosystems: List[html.Div] = [ __gen_ecosystem(eid, selected[i]) for i,eid in enumerate(['daohaus', 'aragon', 'daostack']) ] @@ -141,7 +143,7 @@ def __generate_header( # The following dcc is changed in callbacks that modify the dao-info-container dcc.Store( id='platform-info-store', - data=None, # Initially there is no data + data=platform_info, storage_type='memory', ), # This dcc is read-only an used to generate the dropdown diff --git a/dao_analyzer/apps/common/presentation/main_view/main_view_controller.py b/dao_analyzer/apps/common/presentation/main_view/main_view_controller.py index d661f5e5..40847113 100644 --- a/dao_analyzer/apps/common/presentation/main_view/main_view_controller.py +++ b/dao_analyzer/apps/common/presentation/main_view/main_view_controller.py @@ -159,9 +159,8 @@ def load_ecosystem(bt_daostack: int, bt_daohaus: int, bt_aragon: int, dropdown_v State('org-dropdown', 'value'), State('organization-list-store', 'data'), State('page-content', 'data-subpage'), - State('platform-info-store', 'data'), ) - def org_filters(filter_values: List[str], network_value: str, org_value: str, org_list: list, platform_name: str, prev_platform: str): + def org_filters(filter_values: List[str], network_value: str, org_value: str, org_list: list, platform_name: str): filtered = OrganizationList.from_json(org_list) # First we initialize all values @@ -184,8 +183,8 @@ def org_filters(filter_values: List[str], network_value: str, org_value: str, or else: value = organizations.get_all_orgs_dict()['value'] - # Change only if is all orgs, or its not stablished yet - if value == organizations.ALL_ORGS_ID or not prev_platform: + # Change only if is all orgs + if value == organizations.ALL_ORGS_ID: platform = services[platform_name].platform(organizations) return options, value, org_number, platform, _params_string(params) diff --git a/dao_analyzer/apps/daohaus/business/app_service.py b/dao_analyzer/apps/daohaus/business/app_service.py index 5565a02d..e668d603 100644 --- a/dao_analyzer/apps/daohaus/business/app_service.py +++ b/dao_analyzer/apps/daohaus/business/app_service.py @@ -90,10 +90,12 @@ def get_layout(self, **kwargs) -> html.Div: if not self.__already_bound: self.bind_callbacks() + org_list = self.organization_list() + return view.generate_layout( - organization_list=self.organization_list(), + organization_list=org_list, + platform_info=self.platform(org_list), sections=self.__get_sections(), - ecosystem='daohaus', update=self.__orgsDAO.get_last_update_str(), platform_id=TEXT['css_id_organization'], datapoints=self.__get_datapoints(), diff --git a/dao_analyzer/apps/daostack/business/app_service.py b/dao_analyzer/apps/daostack/business/app_service.py index 807ec926..62f331eb 100644 --- a/dao_analyzer/apps/daostack/business/app_service.py +++ b/dao_analyzer/apps/daostack/business/app_service.py @@ -101,10 +101,12 @@ def get_layout(self, **kwargs) -> html.Div: if not self.__already_bound: self.bind_callbacks() + org_list = self.organization_list() + return view.generate_layout( - organization_list=self.organization_list(), + organization_list=org_list, + platform_info=self.platform(org_list), sections=self.__get_sections(), - ecosystem='daostack', update=self.__orgsDAO.get_last_update_str(), platform_id=TEXT['css_id_organization'], datapoints=self.__get_datapoints(),