def _source(integration_name, name, job_number=None): # Get source source = (database['session'].query(Source).filter( Source.integration_name == integration_name).filter( Source.name == name).first()) if not source: abort(404) # Check access if not _check_source_access(source): abort(401, 'You are not authorized to access this source') # Get selected job if job_number: job = (database['session'].query(Job).filter( Job.source == source).filter(Job.number == job_number).first()) if not job: abort(404) # Get default job else: job = source.last_job return render_component('Source', props={ 'source': source.to_api(with_job_history=True), 'job': job.to_api() if job else None, })
def job(job_id): job = models.job.get(job_id) if not job: abort(404) return render_component('Job', props={ 'job': job, })
def try_goodtables(): return render_component('DemoForm', props={ 'apiUrl': settings.DEMO_API_URL, 'apiToken': settings.DEMO_API_TOKEN, 'apiSourceId': settings.DEMO_API_SOURCE_ID, })
def home(): return render_component('User', props={ 'userName': getattr(current_user, 'display_name', None), 'userEmail': getattr(current_user, 'email', None), })
def dashboard(): user_id = session.get('user_id') if not user_id: return redirect(url_for('site.home')) # TODO: Get most recent job per source github_jobs = models.job.get_by_integration('github', limit=5) s3_jobs = models.job.get_by_integration('s3', limit=5) return render_component('Dashboard', props={ 'githubJobs': github_jobs, 's3Jobs': s3_jobs, })
def dashboard(): if not current_user.is_authenticated: return redirect(url_for('site.home')) # Get user sources sources = (database['session'].query(Source).join( Job, isouter=True).filter(Source.users.any(id=current_user.id)).filter( Source.active == true()).order_by(Job.created.desc().nullslast(), Source.name).all()) if sources: sources = [source.to_api(with_last_job=True) for source in sources] return render_component('Dashboard', props={ 'sources': sources, })
def jobs(): jobs = models.job.find() return render_component('Jobs', props={ 'jobs': jobs, })
def home(): if session.get('user_id'): return redirect(url_for('site.dashboard')) return render_component('Home')
def s3_settings(): return render_component('S3Settings')
def index(): jobs = models.job.get_by_integration('s3') return render_component('S3Home', props={ 'jobs': jobs, })
def _error_response(code, err): if request.path.startswith('/api/'): return jsonify({'status': code, 'message': err.description}), code else: return (render_component('Error{}'.format(code), props={'message': err.description}), code)
def settings_page(): if not current_user.is_authenticated: return redirect(url_for('site.home')) return render_component('Settings')
def about(): return render_component('About')
def home(): if current_user.is_authenticated: return redirect(url_for('site.dashboard')) return render_component('Landing')
def server_error(err): return (render_component('Error500'), 500)
def not_found_error(err): return (render_component('Error404'), 404)