Пример #1
0
def cards(cardname=None):
    prototypes = get_prototype_lib()
    if cardname is None:
        stage_cards = [
            v for k, v in viewitems(prototypes)
            if isinstance(v, CardPrototype)
        ]
        stage_cards.sort(key=lambda x: (x.status, x.ident))

        series = {}
        tstatuses = {str(x): 0 for x in status.get_known_statuses()}
        for card in stage_cards:
            if card.configs.snoseries not in series.keys():
                series[card.configs.snoseries] = 1
            else:
                series[card.configs.snoseries] += 1
            tstatuses[str(card.status)] += 1
        statuses = [(x, tstatuses[str(x)])
                    for x in status.get_known_statuses()]

        stage = {
            'statuses':
            statuses,
            'series':
            series,
            'cards':
            stage_cards,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Modules", path="modules/"),
                Crumb(name="Cards", path="cards/")
            ]
        }
        return render_template('entityhub_cards.html',
                               stage=stage,
                               pagetitle="Cards")
    else:
        prototype = prototypes[cardname]
        stage = {
            'prototype':
            prototype,
            'inclusion':
            ehproducts.get_module_inclusion(cardname),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Modules", path="modules/"),
                Crumb(name="Cards", path="cards/"),
                Crumb(name=cardname, path="cards/" + cardname)
            ]
        }
        return render_template('entityhub_card_detail.html',
                               stage=stage,
                               pagetitle=cardname + " Card Details")
Пример #2
0
def products(productname=None):
    if productname is None:
        stage_products = sorted(ehproducts.productlib,
                                key=lambda x: (x.info.status, x.name))
        lines = {}
        ptypes = {}
        tstatuses = {str(x): 0 for x in status.get_known_statuses()}
        for product in stage_products:
            if product.info.ptype not in ptypes.keys():
                ptypes[product.info.ptype] = 1
            else:
                ptypes[product.info.ptype] += 1
            if product.info.line not in lines.keys():
                lines[product.info.line] = 1
            else:
                lines[product.info.line] += 1
            tstatuses[str(product.status)] += 1
        statuses = [(x, tstatuses[str(x)])
                    for x in status.get_known_statuses()]
        stage = {
            'statuses':
            statuses,
            'lines':
            lines,
            'ptypes':
            ptypes,
            'products':
            stage_products,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Products", path="products/")
            ]
        }
        return render_template('entityhub_products.html',
                               stage=stage,
                               pagetitle="Products")
    else:
        stage = {
            'product':
            ehproducts.get_product_by_ident(productname),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Products", path="products/"),
                Crumb(name=productname, path="pcbs/" + productname)
            ],  # noqa
        }
        return render_template(
            'entityhub_product_detail.html',
            stage=stage,
            pagetitle="Product Detail {0}".format(productname))
Пример #3
0
def cards(cardname=None):
    prototypes = get_prototype_lib()
    if cardname is None:
        stage_cards = [v for k, v in viewitems(prototypes)
                       if isinstance(v, CardPrototype)]
        stage_cards.sort(key=lambda x: (x.status, x.ident))

        series = {}
        tstatuses = {str(x): 0 for x in status.get_known_statuses()}
        for card in stage_cards:
            if card.configs.snoseries not in series.keys():
                series[card.configs.snoseries] = 1
            else:
                series[card.configs.snoseries] += 1
            tstatuses[str(card.status)] += 1
        statuses = [(x, tstatuses[str(x)]) for x in status.get_known_statuses()]

        stage = {'statuses': statuses,
                 'series': series,
                 'cards': stage_cards,
                 'crumbroot': '/entityhub',
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Modules", path="modules/"),
                                 Crumb(name="Cards", path="cards/")]
                 }
        return render_template('entityhub_cards.html', stage=stage,
                               pagetitle="Cards")
    else:
        prototype = prototypes[cardname]
        stage = {'prototype': prototype,
                 'inclusion': ehproducts.get_module_inclusion(cardname),
                 'crumbroot': '/entityhub',
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Modules", path="modules/"),
                                 Crumb(name="Cards", path="cards/"),
                                 Crumb(name=cardname, path="cards/"+cardname)]
                 }
        return render_template('entityhub_card_detail.html', stage=stage,
                               pagetitle=cardname + " Card Details")
Пример #4
0
def products(productname=None):
    if productname is None:
        stage_products = sorted(ehproducts.productlib,
                                key=lambda x: (x.info.status, x.name))
        lines = {}
        ptypes = {}
        tstatuses = {str(x): 0 for x in status.get_known_statuses()}
        for product in stage_products:
            if product.info.ptype not in ptypes.keys():
                ptypes[product.info.ptype] = 1
            else:
                ptypes[product.info.ptype] += 1
            if product.info.line not in lines.keys():
                lines[product.info.line] = 1
            else:
                lines[product.info.line] += 1
            tstatuses[str(product.status)] += 1
        statuses = [(x, tstatuses[str(x)]) for x in status.get_known_statuses()]
        stage = {'statuses': statuses,
                 'lines': lines,
                 'ptypes': ptypes,
                 'products': stage_products,
                 'crumbroot': '/entityhub',
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Products", path="products/")]
                 }
        return render_template('entityhub_products.html', stage=stage,
                               pagetitle="Products")
    else:
        stage = {'product': ehproducts.get_product_by_ident(productname),
                 'crumbroot': '/entityhub',
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Products", path="products/"),
                                 Crumb(name=productname, path="pcbs/" + productname)],  # noqa
                 }
        return render_template('entityhub_product_detail.html', stage=stage,
                               pagetitle="Product Detail {0}".format(productname))