Exemplo n.º 1
0
class PatchPortTable(BootstrapTable):
    class Meta:
        table_args = {
            'data-sort-name': 'name',
        }

    name = Column('Name',
                  width=2,
                  col_args={'data-sorter': 'table.sortPatchPort'})
    room = LinkColumn('→ Raum', width=5)
    switch_port = LinkColumn('→ Switch-Port',
                             width=3,
                             col_args={'data-sorter': 'table.sortPort'})
    edit_link = BtnColumn('Editieren', hide_if=no_inf_change)
    delete_link = BtnColumn('Löschen', hide_if=no_inf_change)

    def __init__(self, *a, room_id=None, **kw):
        super().__init__(*a, **kw)

        self.room_id = room_id

    @property
    def toolbar(self):
        if no_inf_change():
            return
        href = url_for(".patch_port_create", switch_room_id=self.room_id)
        return button_toolbar("Patch-Port", href)
Exemplo n.º 2
0
class UsersDueTable(BootstrapTable):
    """A table for displaying the users that """
    user_id = Column("Nutzer-ID")
    user = LinkColumn("Name")
    valid_on = Column("Gültig am")
    description = Column("Beschreibung")
    fee_account_id = LinkColumn("Beitragskonto")
    amount = Column("Betrag", formatter="table.coloredFormatter")
Exemplo n.º 3
0
class UnconfirmedTransactionsTable(BootstrapTable):
    """A table for displaying unconfirmed transactions """
    description = LinkColumn("Beschreibung")
    user = LinkColumn("Nutzer")
    room = Column("Wohnort")
    date = DateColumn("Datum")
    amount = Column("Wert")
    author = LinkColumn("Ersteller")
    actions = MultiBtnColumn("Aktionen")
Exemplo n.º 4
0
class PortTable(BootstrapTable):
    class Meta:
        table_args = {
            'data-sort-name': 'switchport_name',
        }

    def __init__(self, *a, switch_id=None, **kw):
        super().__init__(*a, **kw)
        self.switch_id = switch_id

    switchport_name = Column("Name",
                             width=2,
                             col_args={'data-sorter': 'table.sortPort'})
    patchport_name = Column("→ Patchport",
                            width=2,
                            col_args={'data-sorter': 'table.sortPatchPort'})
    room = LinkColumn("→ Raum", width=10)
    edit_link = BtnColumn('Editieren', hide_if=no_inf_change)
    delete_link = BtnColumn('Löschen', hide_if=no_inf_change)

    @property
    def toolbar(self):
        if no_inf_change():
            return
        href = url_for(".switch_port_create", switch_id=self.switch_id)
        return button_toolbar("Switch-Port", href)
Exemplo n.º 5
0
class TransactionTable(BootstrapTable):
    """A table for displaying bank account activities """
    account = LinkColumn("Konto")
    amount = Column("Wert")

    class Meta:
        table_args = {
            'data-row-style': 'table.financeRowFormatter',
        }
Exemplo n.º 6
0
class ArchivableMembersTable(RefreshableTableMixin, BootstrapTable):
    class Meta:
        table_args = {'data-escape': 'false', 'data-sort-stable': True}

    id = Column("#")
    user = LinkColumn("Mitglied")
    room_shortname = LinkColumn("<i class=\"fas fa-home\"></i>")
    num_hosts = Column("<i class=\"fas fa-laptop\"></i>")
    current_properties = Column("Props", formatter="table.propertiesFormatter")
    end_of_membership = DateColumn("EOM")

    if typing.TYPE_CHECKING:

        @classmethod
        def row(cls, id: int, user: dict, room_shortname: dict,
                current_properties: str, num_hosts: int,
                end_of_membership: dict) -> dict:
            ...
Exemplo n.º 7
0
class SwitchTable(BootstrapTable):
    id = Column("#")
    name = LinkColumn("Name")
    ip = Column("Management IP")
    edit_link = BtnColumn('Editieren', width=1, hide_if=no_inf_change)
    delete_link = BtnColumn('Löschen', width=1, hide_if=no_inf_change)

    @property
    def toolbar(self):
        if not current_user.has_property('infrastructure_change'):
            return

        return button_toolbar("Switch", url_for(".switch_create"))
Exemplo n.º 8
0
class BuildingLevelRoomTable(BootstrapTable):
    class Meta:
        table_args = {
            'data-sort-name': 'room',
            'data-query-params': 'perhaps_all_users_query_params',
        }

    room = LinkColumn("Raum")
    inhabitants = MultiBtnColumn('Bewohner')

    @property
    def toolbar(self):
        return toggle_button_toolbar("Display all users",
                                     id="rooms-toggle-all-users",
                                     icon="fa-user")
Exemplo n.º 9
0
class SiteTable(BootstrapTable):
    site = LinkColumn("Site")
    buildings = MultiBtnColumn("Buildings")
Exemplo n.º 10
0
class RoomOvercrowdedTable(BootstrapTable):
    room = LinkColumn("Raum")
    inhabitants = MultiBtnColumn("Bewohner")

    class Meta:
        table_args = {'data-sort-name': 'room'}
Exemplo n.º 11
0
class RoomLogTable(BootstrapTable):
    created_at = DateColumn("Erstellt um")
    user = LinkColumn("Nutzer")
    message = Column("Nachricht")
Exemplo n.º 12
0
class FinanceTable(BootstrapTable):
    class Meta:
        table_args = {
            'data-side-pagination': 'server',
            # 'data-search': 'true',
            'data-sort-order': 'desc',
            # 'data-sort-name': 'valid_on',
            'data-page-list': '[5, 10, 25, 50, 100]'
        }

    def __init__(self, *a, saldo=None, user_id=None, inverted=False, **kw):
        """Init

        :param int user_id: An optional user_id.  If set, this causes
            a “details” button to be rendered in the toolbar
            referencing the user.
        :param bool inverted: An optional switch adding
            `style=inverted` to the given `data_url`
        """

        self.saldo = saldo

        if inverted:
            self._enforced_url_params = frozenset({
                ('style', 'inverted')
            }.union(self._enforced_url_params))
            self.saldo = -saldo

        super().__init__(*a, **kw)

        self.user_id = user_id
        self.table_footer_offset = 3

    posted_at = Column("Erstellt um")
    valid_on = Column("Gültig am")
    description = LinkColumn("Beschreibung")
    amount = ColoredColumn("Wert", cell_style='table.tdRelativeCellStyle')

    @property
    def toolbar(self):
        """Generate a toolbar with a details button

        If a user_id was passed in the constructor, this renders a
        “details” button reaching the finance overview of the user's account.
        """
        if self.user_id is None:
            return
        href = url_for("user.user_account", user_id=self.user_id)
        return button_toolbar("Details", href, icon="fa-chart-area")

    @property
    @lazy_join
    def table_footer(self):
        yield "<tfoot>"
        yield "<tr>"

        yield f"<td colspan=\"{self.table_footer_offset}\" class=\"text-right\">"
        yield "<strong>Saldo:</strong>"
        yield "</td>"

        yield "<td>"
        yield "{}".format(
            money_filter(self.saldo) if self.saldo is not None else "-")
        yield "</td>"

        yield "</tr>"
        yield "</tfoot>"
Exemplo n.º 13
0
class TenancyTable(BootstrapTable):
    room = LinkColumn("Zimmer")
    begins_at = DateColumn("Von")
    ends_at = DateColumn("Bis")
    status = Column("Status")
Exemplo n.º 14
0
class RoomHistoryTable(BootstrapTable):
    room = LinkColumn("Wohnort")
    begins_at = DateColumn("Von")
    ends_at = DateColumn("Bis")
Exemplo n.º 15
0
class TrafficTopTable(BootstrapTable):
    """A table for displaying the users with the highest traffic usage"""
    url = LinkColumn("Name")
    traffic_for_days = Column("Traffic", formatter='table.byteFormatterBinary')
Exemplo n.º 16
0
class SearchTable(BootstrapTable):
    """A table for displaying search results"""
    id = Column("ID")
    url = LinkColumn("Name")
    login = Column("Login")