def plugin_data(self, request: Request): del request # unused menu_data = PluginUtils.get_plugins_menus(self.config_type) plugin_names = [] plugin_states = {} plugin_components = {} plugins = PluginUtils.get_plugins(self.config_type) for plugin_name in plugins: plugin_names.append(plugin_name) plugin = plugins[plugin_name] if self.config_type in plugin.states: states_data, found = plugin.states[ self.config_type].get_javascript() if found: plugin_states[plugin_name] = states_data if self.config_type in plugin.components: components = plugin.components[self.config_type] plugin_components[plugin_name] = {} for component_name in components: component_data, found = components[ component_name].get_javascript() if found: plugin_components[plugin_name][ component_name] = component_data return Response( data={ 'menu_data': menu_data, 'plugin_names': plugin_names, 'plugin_states': plugin_states, 'plugin_components': plugin_components, })
def plugins_menu(self, request): del request # unused if has_license: return Response(data=PluginUtils.get_plugins_menus(PluginConfigTypes.staff)) else: return Response( data={ 'menus': [], 'menu_items': [], } )