Example #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})
Example #2
0
def layer_detail(request, catalog_slug, layer_uuid=None, layer_id=None):
    if layer_uuid is not None:
        layer = get_object_or_404(Layer, uuid=layer_uuid)
    else:
        layer = get_object_or_404(Layer, pk=layer_id)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_layer(layer.id)
            else:
                check_layer.delay(layer.id)
        if 'remove' in request.POST:
            layer.check_set.all().delete()
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_layer(layer.id)
            else:
                index_layer.delay(layer.id)

    return render(
        request, 'aggregator/layer_detail.html', {
            'layer': layer,
            'SEARCH_TYPE': SEARCH_TYPE,
            'SEARCH_URL': SEARCH_URL.rstrip('/'),
            'catalog_slug': catalog_slug
        })
Example #3
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
        })
Example #4
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
        })
Example #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})
Example #6
0
def layer_detail(request, catalog_slug, layer_id):
    layer = get_object_or_404(Layer,
                              pk=layer_id,
                              catalog__slug=catalog_slug)

    if request.method == 'POST':
        if 'check' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                check_layer(layer)
            else:
                check_layer.delay(layer)
        if 'remove' in request.POST:
            layer.check_set.all().delete()
        if 'index' in request.POST:
            if settings.REGISTRY_SKIP_CELERY:
                index_layer(layer)
            else:
                index_layer.delay(layer)

    return render(request, 'aggregator/layer_detail.html', {'layer': layer,
                                                            'SEARCH_TYPE': SEARCH_TYPE,
                                                            'SEARCH_URL': SEARCH_URL.rstrip('/'),
                                                            'catalog_slug': catalog_slug})