Beispiel #1
0
    def get(self, scope, hashkey, plugin_hashkey):
        from core.plugins.loader import plugins
        context, mod = get_context_for_scope(scope, hashkey)
        views = plugins[plugin_hashkey].views

        context.plugin = plugins[plugin_hashkey]
        manager = ViewManager(context)
        user_views = []
        for v in views:
            data = manager.get_meta(v.hashkey)
            data['url'] = self.get_url(scope, hashkey, plugin_hashkey, v.hashkey)
            user_views.append(data)
        return user_views
Beispiel #2
0
 def get_view_data(self):
     list = ScopeViewsList()
     data = list.get("user", self.manager.user.hashkey)
     views = []
     for view in data:
         if 'daily-count-timeseries' in view['tags']:
             views.append(view)
     view_data = []
     for v in views:
         context = ExecutionContext(user=self.manager.user, plugin=PluginProxy(hashkey=v['plugin'], name=""))
         manager = ViewManager(context, manager=self.manager)
         view_d = manager.handle_route(v['hashkey'], "get", {}, v['hashkey'])
         view_data.append(json.loads(view_d.data))
     return view_data
Beispiel #3
0
def load_plugins():
    plugins = {}
    from flask import current_app
    context = ExecutionContext()
    manager = DatabaseManager(context, session=db.session)
    view_manager = ViewManager(context, manager=manager)
    for plugin in PluginLoader(current_app.config['PLUGIN_PATH']):
        # Store plugins in a dictionary for later access.
        plugins[plugin.hashkey] = plugin
        # Register all plugins and create a DB entry as needed.
        manager.register_plugin(plugin)
        view_manager.register_views(plugin)
    db.session.commit()
    return plugins
Beispiel #4
0
def load_plugins():
    plugins = {}
    from flask import current_app
    context = ExecutionContext()
    manager = DatabaseManager(context, session=db.session)
    view_manager = ViewManager(context, manager=manager)
    for plugin in PluginLoader(current_app.config['PLUGIN_PATH']):
        # Store plugins in a dictionary for later access.
        plugins[plugin.hashkey] = plugin
        # Register all plugins and create a DB entry as needed.
        manager.register_plugin(plugin)
        view_manager.register_views(plugin)
    db.session.commit()
    return plugins
Beispiel #5
0
    def get(self, scope, hashkey):
        from core.plugins.loader import plugins
        context, mod = get_context_for_scope(scope, hashkey)
        user_views = []
        scope_installed = [p.hashkey for p in mod.plugins]
        for key in plugins:
            p = plugins[key]
            views = p.views
            for v in views:
                context.plugin = p
                manager = ViewManager(context)
                data = manager.get_meta(v.hashkey)
                data['url'] = self.get_url(scope, hashkey, p.hashkey, v.hashkey)
                data['installed'] = False
                data['plugin'] = p.hashkey
                if p.hashkey in scope_installed:
                    data['installed'] = True
                user_views.append(data)

        return user_views
Beispiel #6
0
 def call_view_handler(self, view_hashkey, method, data, resource_hashkey):
     view_manager = ViewManager(self.context)
     return view_manager.handle_route(view_hashkey, method, data, resource_hashkey)
Beispiel #7
0
 def call_view_handler(self, view_hashkey, method, data, resource_hashkey):
     view_manager = ViewManager(self.context)
     return view_manager.handle_route(view_hashkey, method, data,
                                      resource_hashkey)