Example #1
0
from nautobot.core.apps import HomePageItem, HomePagePanel
from nautobot.tenancy.models import Tenant

layout = (HomePagePanel(
    name="Organization",
    weight=100,
    items=(HomePageItem(
        name="Tenants",
        link="tenancy:tenant_list",
        model=Tenant,
        description="Customers or departments",
        permissions=["tenancy.view_tenant"],
        weight=200,
    ), ),
), )
Example #2
0
layout = (HomePagePanel(
    name="IPAM",
    weight=400,
    items=(
        HomePageItem(
            name="VRFs",
            link="ipam:vrf_list",
            model=VRF,
            description="Virtual routing and forwarding tables",
            permissions=["circuits.view_vrf"],
            weight=100,
        ),
        HomePageItem(
            name="Aggregates",
            link="ipam:aggregate_list",
            model=Aggregate,
            description="Top-level IP allocations",
            permissions=["ipam.view_aggregate"],
            weight=200,
        ),
        HomePageItem(
            name="Prefixes",
            link="ipam:prefix_list",
            model=Prefix,
            description="IPv4 and IPv6 network assignments",
            permissions=["ipam.view_prefix"],
            weight=300,
        ),
        HomePageItem(
            name="IP Addresses",
            link="ipam:ipaddress_list",
            model=IPAddress,
            description="IPv4 and IPv6 network assignments",
            permissions=["ipam.view_ipaddress"],
            weight=400,
        ),
        HomePageItem(
            name="VLAN",
            link="ipam:vlan_list",
            model=VLAN,
            description="Layer two domains, identified by VLAN ID",
            permissions=["ipam.view_vlan"],
            weight=500,
        ),
    ),
), )
Example #3
0
from nautobot.core.apps import HomePageItem, HomePagePanel
from nautobot.virtualization.models import Cluster, VirtualMachine

layout = (HomePagePanel(
    name="Virtualization",
    weight=600,
    items=(
        HomePageItem(
            name="Clusters",
            link="virtualization:cluster_list",
            model=Cluster,
            description="Clusters of physical hosts in which VMs reside",
            permissions=["virtualization.view_cluster"],
            weight=100,
        ),
        HomePageItem(
            name="Virtual Machines",
            link="virtualization:virtualmachine_list",
            model=VirtualMachine,
            description="Virtual compute instances running inside clusters",
            permissions=["virtualization.view_virtualmachine"],
            weight=200,
        ),
    ),
), )
Example #4
0
def get_changelog(request):
    """Callback function to collect changelog for panel."""
    return ObjectChange.objects.restrict(request.user,
                                         "view").prefetch_related(
                                             "user",
                                             "changed_object_type")[:15]


layout = (
    HomePagePanel(
        name="Data Sources",
        weight=700,
        items=(HomePageItem(
            name="Git Repositories",
            link="extras:gitrepository_list",
            model=GitRepository,
            description="Collections of data and/or job files",
            permissions=["extras.view_gitrepository"],
            weight=100,
        ), ),
    ),
    HomePagePanel(
        name="Job History",
        permissions=["extras.view_jobresult"],
        weight=800,
        custom_data={"job_results": get_job_results},
        custom_template="panel_jobhistory.html",
    ),
    HomePagePanel(
        name="Change Log",
        permissions=["extras.view_objectchange"],
Example #5
0
from nautobot.circuits.models import Circuit, Provider
from nautobot.core.apps import HomePageItem, HomePagePanel

layout = (HomePagePanel(
    name="Circuits",
    weight=500,
    items=(
        HomePageItem(
            name="Providers",
            link="circuits:provider_list",
            model=Provider,
            description="Organizations which provide circuit connectivity",
            permissions=["circuits.view_provider"],
            weight=100,
        ),
        HomePageItem(
            name="Circuits",
            link="circuits:circuit_list",
            model=Circuit,
            description=
            "Communication links for Internet transit, peering, and other services",
            permissions=["circuits.view_circuit"],
            weight=200,
        ),
    ),
), )
Example #6
0
    if not examples:
        examples = (
            DummyModel.objects.create(name="Example 1", number=100),
            DummyModel.objects.create(name="Example 2", number=200),
            DummyModel.objects.create(name="Example 3", number=300),
        )
    return examples


layout = (
    HomePagePanel(
        name="Organization",
        items=(HomePageItem(
            name="Dummy Models",
            model=DummyModel,
            weight=150,
            link="plugins:dummy_plugin:dummymodel_list",
            description="List dummy plugin models.",
            permissions=["dummy_plugin.view_dummymodel"],
        ), ),
    ),
    HomePagePanel(
        name="Dummy Plugin",
        weight=250,
        items=(HomePageItem(
            name="Custom Dummy Plugin",
            custom_template="item_dummy_example.html",
            custom_data={"dummy_data": get_dummy_data},
            permissions=["dummy_plugin.view_dummymodel"],
            weight=100,
        ), ),
Example #7
0
from nautobot.core.apps import HomePageGroup, HomePageItem, HomePagePanel
from nautobot.dcim import models


layout = (
    HomePagePanel(
        name="Organization",
        weight=100,
        items=(
            HomePageItem(
                name="Sites",
                link="dcim:site_list",
                model=models.Site,
                description="Geographic location",
                permissions=["dcim.view_site"],
                weight=100,
            ),
        ),
    ),
    HomePagePanel(
        name="DCIM",
        weight=200,
        items=(
            HomePageItem(
                name="Racks",
                link="dcim:rack_list",
                model=models.Rack,
                description="Equipment racks, optionally organized by group",
                permissions=["dcim.view_rack"],
                weight=100,
            ),
Example #8
0
    if not examples:
        examples = (
            ExampleModel.objects.create(name="Example 1", number=100),
            ExampleModel.objects.create(name="Example 2", number=200),
            ExampleModel.objects.create(name="Example 3", number=300),
        )
    return examples


layout = (
    HomePagePanel(
        name="Organization",
        items=(HomePageItem(
            name="Example Models",
            model=ExampleModel,
            weight=150,
            link="plugins:example_plugin:examplemodel_list",
            description="List example plugin models.",
            permissions=["example_plugin.view_examplemodel"],
        ), ),
    ),
    HomePagePanel(
        name="Example Plugin",
        weight=250,
        items=(HomePageItem(
            name="Custom Example Plugin",
            custom_template="item_example.html",
            custom_data={"example_data": get_example_data},
            permissions=["example_plugin.view_examplemodel"],
            weight=100,
        ), ),