Exemple #1
0
def service_detail(request, catalog_slug, service_id):
    service = get_object_or_404(Service,
                                pk=service_id,
                                catalog__slug=catalog_slug)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_service(service)
            else:
                check_service.delay(service)
        if 'remove' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                remove_service_checks(service)
            else:
                remove_service_checks.delay(service)
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_service(service)
            else:
                index_service.delay(service)

    return render(
        request, 'aggregator/service_detail.html', {
            'service': service,
            'SEARCH_TYPE': SEARCH_TYPE,
            'SEARCH_URL': SEARCH_URL.rstrip('/'),
            'catalog_slug': catalog_slug
        })
Exemple #2
0
def service_detail(request, catalog_slug, service_id):
    service = get_object_or_404(Service,
                                pk=service_id,
                                catalog__slug=catalog_slug)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_service(service)
            else:
                check_service.delay(service)
        if 'remove' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                remove_service_checks(service)
            else:
                remove_service_checks.delay(service)
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_service(service)
            else:
                index_service.delay(service)

    return render(request, 'aggregator/service_detail.html', {'service': service,
                                                              'SEARCH_TYPE': SEARCH_TYPE,
                                                              'SEARCH_URL': SEARCH_URL.rstrip('/'),
                                                              'catalog_slug': catalog_slug})
Exemple #3
0
def service_post_save(instance, *args, **kwargs):
    """
    Used to do a service full check when saving it.
    """
    # check service
    if not settings.SKIP_CELERY_TASK:
        check_service.delay(instance)
    else:
        check_service(instance)
Exemple #4
0
def service_post_save(instance, *args, **kwargs):
    """
    Used to do a service full check when saving it.
    """
    # check service
    if not settings.SKIP_CELERY_TASK:
        check_service.delay(instance)
    else:
        check_service(instance)
Exemple #5
0
def service_detail(request, catalog_slug, service_uuid=None, service_id=None):

    if service_uuid is not None:
        service = get_object_or_404(Service, uuid=service_uuid)
    else:
        service = get_object_or_404(Service, pk=service_id)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_service(service.id)
            else:
                check_service.delay(service.id)
        if 'remove' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                remove_service_checks(service.id)
            else:
                remove_service_checks.delay(service.id)
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_service(service.id)
            else:
                index_service.delay(service.id)

    page = request.GET.get('page', 1)
    layers = service.layer_set.select_related('catalog').prefetch_related(
        'check_set').all()
    paginator = BootstrapPaginator(layers,
                                   settings.PAGINATION_DEFAULT_PAGINATION)

    try:
        layers = paginator.page(page)
    except PageNotAnInteger:
        layers = paginator.page(1)
    except EmptyPage:
        layers = paginator.page(paginator.num_pages)

    return render(
        request, 'aggregator/service_detail.html', {
            'service': service,
            'layers': layers,
            'SEARCH_TYPE': SEARCH_TYPE,
            'SEARCH_URL': SEARCH_URL.rstrip('/'),
            'catalog_slug': catalog_slug
        })
Exemple #6
0
def service_detail(request, service_id):
    service = get_object_or_404(Service, pk=service_id)

    if request.method == 'POST':
        if 'check' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                check_service.delay(service)
            else:
                check_service(service)
        if 'remove' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                remove_service_checks.delay(service)
            else:
                remove_service_checks(service)
        if 'index' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                index_service.delay(service)
            else:
                index_service(service)

    return render(request, 'aggregator/service_detail.html', {'service': service})
Exemple #7
0
def service_detail(request, catalog_slug, service_uuid=None, service_id=None):

    if service_uuid is not None:
        service = get_object_or_404(Service, uuid=service_uuid)
    else:
        service = get_object_or_404(Service, pk=service_id)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_service(service.id)
            else:
                check_service.delay(service.id)
        if 'remove' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                remove_service_checks(service.id)
            else:
                remove_service_checks.delay(service.id)
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_service(service.id)
            else:
                index_service.delay(service.id)

    page = request.GET.get('page', 1)
    layers = service.layer_set.select_related('catalog').prefetch_related('check_set').all()
    paginator = BootstrapPaginator(layers, settings.PAGINATION_DEFAULT_PAGINATION)

    try:
        layers = paginator.page(page)
    except PageNotAnInteger:
        layers = paginator.page(1)
    except EmptyPage:
        layers = paginator.page(paginator.num_pages)

    return render(request, 'aggregator/service_detail.html', {'service': service,
                                                              'layers': layers,
                                                              'SEARCH_TYPE': SEARCH_TYPE,
                                                              'SEARCH_URL': SEARCH_URL.rstrip('/'),
                                                              'catalog_slug': catalog_slug})
Exemple #8
0
def service_detail(request, service_id):
    service = get_object_or_404(Service, pk=service_id)

    if request.method == 'POST':
        if 'check' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                check_service.delay(service)
            else:
                check_service(service)
        if 'remove' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                remove_service_checks.delay(service)
            else:
                remove_service_checks(service)
        if 'index' in request.POST:
            if not settings.SKIP_CELERY_TASK:
                index_service.delay(service)
            else:
                index_service(service)

    return render(request, 'aggregator/service_detail.html',
                  {'service': service})