Beispiel #1
0
def settings():
    form = SettingsForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        settings_services.update_profile(form.project_directory.data, form.extensions.data, form.ignore_dir.data)

    settings = settings_services.get_settings()
    extensions = settings.get('extensions', None)
    project_dir = settings.get('project_dir', None)
    ignore_dir = settings.get('ignore_dir', None)

    if project_dir is not None:
        if isinstance(project_dir, list):
            pdv = ','.join(project_dir)
        else:
            pdv = project_dir
    else:
        pdv = ''

    if extensions is not None:
        if isinstance(project_dir, list):
            ext = ','.join(extensions)
        else:
            ext = extensions
    else:
        ext = ''

    if ignore_dir is not None:
        if isinstance(project_dir, list):
            ign = ','.join(ignore_dir)
        else:
            ign = ignore_dir
    else:
        ign = ''

    return render_wrapper('public/settings.html', form=form, project_directory_values=pdv, ignore_dir_values=ign, extensions_values=ext)
Beispiel #2
0
def profile():
    select_form = ProfileForm(request.form)
    create_form = CreateProfileForm(request.form)

    select_form.profile.choices = settings_services.get_profiles()

    if select_form.validate_on_submit():
        settings_services.change_profile(select_form.profile.data)
        return redirect(url_for('admin.settings'))
    elif create_form.validate_on_submit():
        settings_services.create_profile(create_form.name.data)
        settings_services.change_profile(create_form.name.data)
        return redirect(url_for('admin.settings'))

    select_form.profile.choices = settings_services.get_profiles()
    select_form.profile.default = settings_services.get_settings()['profile_name']
    select_form.process()

    return render_wrapper('public/profile.html', create_form=create_form, select_form=select_form)
Beispiel #3
0
def risk():
    return render_wrapper('public/filechangerates.html')
Beispiel #4
0
def repo_details(repo_name):
    file_details = get_repo_details(repo_name)
    return render_wrapper('public/repo_detail.html', repo_name=repo_name, file_details=file_details)
Beispiel #5
0
def metrics():
    leaderboard = week_leader_board(n=5)
    repo_names = get_repo_names()
    return render_wrapper('public/metrics.html', leaderboard=leaderboard, repo_names=repo_names)
Beispiel #6
0
def blame():
    return render_wrapper('public/blame.html')
Beispiel #7
0
def repo_details(repo_name):
    file_details = get_repo_details(repo_name)
    return render_wrapper('public/repo_detail.html',
                          repo_name=repo_name,
                          file_details=file_details)
Beispiel #8
0
def metrics():
    leaderboard = week_leader_board(n=5)
    repo_names = get_repo_names()
    return render_wrapper('public/metrics.html',
                          leaderboard=leaderboard,
                          repo_names=repo_names)