def post(self): dashboard_properties = request.get_json(force=True) dashboard = models.Dashboard(name=dashboard_properties['name'], user=self.current_user, layout='[]') dashboard.save() return dashboard.to_dict()
def post(self): """ Creates a new dashboard. :<json string name: Dashboard name Responds with a :ref:`dashboard <dashboard-response-label>`. """ dashboard_properties = request.get_json(force=True) LOG.info('** receive dashboard create param: %s' % dashboard_properties) dash_name = dashboard_properties.get('dashName') dash_group = dashboard_properties.get('dashGroup') group_ref = models.Group.query\ .filter(models.Group.name == dash_group)\ .first() dashboard = models.Dashboard( name=dash_name, group_id=group_ref.id, org=self.current_org, user=self.current_user, is_draft=True, layout="[]", ) models.db.session.add(dashboard) models.db.session.commit() return serialize_dashboard(dashboard)
def post(self): dashboard_properties = request.get_json(force=True) dashboard = models.Dashboard(name=dashboard_properties['name'], org=self.current_org, user=self.current_user, is_draft=True, layout='[]') models.db.session.add(dashboard) models.db.session.commit() return dashboard.to_dict()
def post(self): """ Creates a new dashboard. :<json string name: Dashboard name Responds with a :ref:`dashboard <dashboard-response-label>`. """ dashboard_properties = request.get_json(force=True) dashboard = models.Dashboard(name=dashboard_properties['name'], org=self.current_org, user=self.current_user, is_draft=True, layout='[]') models.db.session.add(dashboard) models.db.session.commit() return serialize_dashboard(dashboard)