コード例 #1
0
ファイル: roles.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        self.modal = None

        frame = Frame(
            self, title='Role').title_style(Color.SUCCESS()).weight(3, 2)
        Label(frame, content='Name:').grid(0, 0)
        self.name = Entry(frame, content=self.role['name']).style(
            border=[0]).grid(0, 1).weight(col=2)
        Label(frame, content='Description:').grid(1, 0)
        self.description = Entry(
            frame, content=self.role['description']).style(
            border=[0]).grid(1, 1).weight(col=2)
        Label(frame, content='ID:').grid(2, 0)
        Label(frame, content=f'{self.role["id"]}').grid(2, 1)

        menu = Frame(self, title='Menu').grid(col=1)
        Button(menu, content='Policies',
               command=self.on_policies).style(border=[0])
        Button(menu, content='Users',
               command=self.on_users).grid(1).style(
                   Color.SUCCESS(), border=[0])

        actions = Frame(
            self, title='Actions').title_style(
                Color.WARNING()).grid(1).span(col=2)
        Button(actions, content='Delete', command=self.on_delete
               ).style(Color.DANGER()).grid(0, 1)
        Spacer(actions).grid(0, 2).weight(col=2)
        Button(actions, content='Save', command=self.on_save
               ).style(Color.SUCCESS()).grid(0, 3)
        Button(actions, content='Cancel', command=self.on_cancel
               ).style(Color.WARNING()).grid(0, 4)
コード例 #2
0
    def build(self) -> None:
        self.left = Frame(self, title='Left').grid(0, 1)
        Button(self.left, content='Content UP',
               command=self.on_click).style(Color.INFO(),
                                            Color.DANGER.reverse(),
                                            border=[0],
                                            align='C').grid(0)
        Button(self.left, content='MIDDLE UP BUTTON',
               command=self.on_click).style(Color.WARNING(),
                                            border=[0],
                                            align='C').grid(1)
        Button(self.left, content='MIDDLE DOWN BUTTON',
               command=self.on_click).style(Color.DANGER(),
                                            border=[0],
                                            align='C').grid(2)

        Entry(
            self.left,
            content=
            ('Nulla mollis mollis ornare. Cras tempor, metus semper pulvinar '
             '\nmattis, metus urna hendrerit orci, eget gravida tellus '
             '\nipsum a ex. Donec hendrerit metus vitae hendrerit dictum. '
             '\nSed varius venenatis ligula in scelerisque. Donec luctus sem '
             '\nnon lorem venenatis, eget lobortis tortor tincidunt. Nunc '
             '\nquis venenatis diam. Ut ac aliquam mi, a tempus nunc. Nunc '
             '\nluctus vulputate dui malesuada cursus.')).style(
                 Color.LIGHT(), border=[0]).grid(3)

        self.right = Frame(self, title='Right').grid(0, 2)

        data = [{'name': 'first'}, {'name': 'second'}, {'name': 'third'}] * 3
        Listbox(self.right,
                data=data,
                limit=4,
                item_style=Style(border=[], align='C'))
コード例 #3
0
ファイル: policies.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        self.modal = None

        frame = Frame(self,
                      title='Policy').title_style(Color.SUCCESS()).weight(
                          4, 2)
        Label(frame, content='Resource:').grid(0, 0)
        self.resource = Entry(frame, content=self.policy['resource']).style(
            border=[0]).grid(0, 1).weight(col=2)
        Label(frame, content='Privilege:').grid(1, 0)
        self.privilege = Entry(frame, content=self.policy['privilege']).style(
            border=[0]).grid(1, 1).weight(col=2)
        Label(frame, content='Active:').grid(2, 0)
        self.active = Entry(frame, content=str(
            self.policy['active'])).style(border=[0]).grid(2, 1).weight(col=2)
        Label(frame, content='ID:').grid(3, 0)
        Label(frame, content=f'{self.policy["id"]}').grid(3, 1)

        menu = Frame(self, title='Menu').grid(col=1)
        Button(menu, content='Restrictions',
               command=self.on_restrictions).style(border=[0])
        Spacer(menu).grid(1)

        actions = Frame(self, title='Actions').title_style(
            Color.WARNING()).grid(1).span(col=2)
        Button(actions, content='Delete',
               command=self.on_delete).style(Color.DANGER()).grid(0, 1)
        Spacer(actions).grid(0, 2).weight(col=2)
        Button(actions, content='Save',
               command=self.on_save).style(Color.SUCCESS()).grid(0, 3)
        Button(actions, content='Cancel',
               command=self.on_cancel).style(Color.WARNING()).grid(0, 4)
コード例 #4
0
    def build(self) -> None:
        self.title = 'Status'
        self.title_style(Color.WARNING()).style(border=[0])
        self.modal = None

        self.provision = Button(self,
                                content='Provision',
                                command=self.on_provision).style(
                                    Color.LIGHT()).grid(0, 0)
        self.switch = Button(self, content='Switch',
                             command=self.on_switch).style(
                                 Color.SUCCESS()).grid(0, 1)
        self.tenant_name = Label(self).grid(0, 2).weight(col=2)
        self.tenant_slug = Label(self).grid(0, 3).weight(col=2)
コード例 #5
0
    def build(self) -> None:
        super().build()
        self.modal = None
        frame = Frame(
            self, title=f'Restrictions for resource: {self.policy["resource"]}'
        ).title_style(Color.WARNING()).weight(4, 2)

        Button(frame, content='\U00002795 Create',
               command=self.on_create).grid(0, 0)
        Button(frame, content='\U00002716 Cancel',
               command=self.on_cancel).style(Color.WARNING()).grid(0, 1)

        Listbox(frame, data=['Sequence', 'Name', 'Target', 'Domain'],
                orientation='horizontal').grid(1).span(col=3)
        self.body = Listbox(frame, command=self.on_body
                            ).grid(3).span(col=3).weight(9)
コード例 #6
0
    def build(self) -> None:
        self.modal = None
        self.style(border=['*'] * 8)

        master = Frame(self, title='Master').grid(0).style(
            background_color=Color.LIGHT.reverse(),
            border_color=Color.PRIMARY.reverse())

        Label(master, content='Label:').grid(0,
                                             0).style(Color.DANGER.reverse(),
                                                      Color.DANGER.reverse())

        Button(master, content='Create',
               command=self.launch_modal).grid(0, 1).style(
                   Color.SUCCESS.reverse(), Color.SUCCESS.reverse())

        Frame(master, title='Details').title_style(Color.DANGER()).grid(
            1, 0).span(col=3).weight(3).style(
                background_color=Color.LIGHT.reverse())

        world = Frame(self, title='World').title_style(Color.WARNING()).grid(1)
        Entry(world)

        Content(self, title='Content').grid(0, 1).span(3).weight(col=3)

        self.listen('click', self.on_backdrop_click, True)
コード例 #7
0
ファイル: roles.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        self.modal = None
        self.title = 'Roles'

        Button(self, content='\U00002795 Create',
               command=self.on_create).grid(0, 0)
        Button(self, content='Dominion',
               command=self.on_dominion).style(Color.SUCCESS()).grid(0, 1)
        self.dominion_label = Label(
            self, content=f'{self.dominion.get("name")}').grid(0, 2)
        Listbox(self, data=['Name', 'Description'],
                orientation='horizontal').grid(1).span(col=3)

        self.body = Listbox(
            self, command=self.on_body).grid(2).span(col=3).weight(9)
コード例 #8
0
ファイル: policies.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        self.modal = None
        frame = Frame(
            self, title=f'Policies for role: {self.role["name"]}').title_style(
                Color.DANGER()).weight(4, 2)

        Button(frame, content='\U00002795 Create',
               command=self.on_create).grid(0, 0)
        Button(frame, content='\U00002716 Cancel',
               command=self.on_cancel).style(Color.WARNING()).grid(0, 1)
        Listbox(frame,
                data=['Resource', 'Privilege', 'Active'],
                orientation='horizontal').grid(1).span(col=3)

        self.body = Listbox(frame,
                            command=self.on_body).grid(3).span(col=3).weight(9)
コード例 #9
0
    def build(self) -> None:
        super().build()
        frame = Frame(self,
                      title='Tenant').weight(6).title_style(Color.LIGHT())
        Label(frame, content='ID:').grid(0, 0)
        self.id = Entry(frame,
                        content=' ').style(border=[0]).grid(0, 1).weight(col=2)
        Label(frame, content='Name:').grid(1, 0)
        self.name = Entry(frame,
                          content=' ').style(border=[0]).grid(1,
                                                              1).weight(col=2)

        actions = Frame(self, title='Actions').grid(1).title_style(
            Color.WARNING()).weight(3)
        Spacer(actions).grid(0, 2).weight(col=2)
        Button(actions, content='Save',
               command=self.on_save).style(Color.SUCCESS()).grid(0, 3)
        Button(actions, content='Cancel',
               command=self.on_cancel).style(Color.WARNING()).grid(0, 4)
コード例 #10
0
    def build(self) -> None:
        super().build()
        self.modal = None

        frame = Frame(self,
                      title='Dominion').title_style(Color.SUCCESS()).weight(
                          4, 2)
        Label(frame, content='Name:').grid(0, 0)
        self.name = Entry(frame, content=self.dominion['name']).style(
            border=[0]).grid(0, 1).weight(col=2)
        Spacer(frame).grid(2).span(col=2)

        actions = Frame(self, title='Actions').title_style(
            Color.WARNING()).grid(1).span(col=2)
        Button(actions, content='Delete',
               command=self.on_delete).style(Color.DANGER()).grid(0, 1)
        Spacer(actions).grid(0, 2).weight(col=2)
        Button(actions, content='Save',
               command=self.on_save).style(Color.SUCCESS()).grid(0, 3)
        Button(actions, content='Cancel',
               command=self.on_cancel).style(Color.WARNING()).grid(0, 4)
コード例 #11
0
ファイル: users.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        frame = Frame(
            self, title='User').title_style(Color.SUCCESS()).weight(6, 3)
        Label(frame, content='Name:').grid(0, 0)
        self.name = Entry(frame, content=self.user['name']).style(
            border=[0]).grid(0, 1).weight(col=2)
        Label(frame, content='Username:'******'username']).style(
            border=[0]).grid(1, 1).weight(col=2)
        Label(frame, content='Email:').grid(2, 0)
        self.email = Entry(frame, content=self.user['email']).style(
            border=[0]).grid(2, 1).weight(col=2)
        Label(frame, content='Password:'******'Attributes:').grid(4, 0)

        self.attributes = Entry(
            frame, content=json.dumps(
                self.user['attributes'], indent=4)).style(
            border=[0]).grid(4, 1).weight(4, 2)

        menu = Frame(self, title='Menu').grid(col=1)
        Button(menu, content='Roles', command=self.on_roles).style(border=[0])
        Button(menu, content='Credentials',
               command=self.on_credentials).style(border=[0]).grid(1)
        Spacer(menu).grid(2).weight(2)

        actions = Frame(self, title='Actions').title_style(
            Color.WARNING()).grid(1).span(col=2)
        Button(actions, content='Delete', command=self.on_delete
               ).style(Color.DANGER()).grid(0, 1)
        Spacer(actions).grid(0, 2).weight(col=2)
        Button(actions, content='Save', command=self.on_save
               ).style(Color.SUCCESS()).grid(0, 3)
        Button(actions, content='Cancel', command=self.on_cancel
               ).style(Color.WARNING()).grid(0, 4)
コード例 #12
0
ファイル: rankings.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        self.modal = None
        frame = Frame(self, title='Rankings').title_style(
            Color.WARNING()).weight(4, 2)
        Button(frame, content='\U00002795 Assign',
               command=self.on_assign).grid(0, 0)
        Label(frame, content='"Middle click" to Delete').grid(0, 1)
        self.header = Listbox(
            frame, data=['ID', 'Role', 'Dominion'],
            orientation='horizontal').grid(1).span(col=3)

        self.body = Listbox(frame, command=self.on_body).grid(
            3).span(col=3).weight(9)
コード例 #13
0
    def build(self) -> None:
        super().build()
        self.modal = None

        frame = Frame(
            self, title='Restriction').title_style(
                Color.SUCCESS()).weight(4, 2)

        Label(frame, content='Sequence:').grid(0, 0)
        self.sequence = Entry(
            frame, content=str(self.restriction['sequence'])).style(
            border=[0]).grid(0, 1).weight(col=2)
        Label(frame, content='Name:').grid(1, 0)
        self.name = Entry(frame, content=self.restriction['name']).style(
            border=[0]).grid(1, 1).weight(col=2)
        Label(frame, content='Target:').grid(2, 0)
        self.target = Entry(
            frame, content=str(self.restriction['target'])).style(
            border=[0]).grid(2, 1).weight(col=2)
        Label(frame, content='Domain:').grid(3, 0)
        self.domain = Entry(
            frame, content=str(self.restriction['domain'])).style(
            border=[0]).grid(3, 1).weight(2, 2)
        Label(frame, content='ID:').grid(4, 0)
        Label(frame, content=f'{self.restriction["id"]}').grid(4, 1)

        actions = Frame(
            self, title='Actions').title_style(
                Color.WARNING()).grid(1).span(col=2)
        Button(actions, content='Delete', command=self.on_delete
               ).style(Color.DANGER()).grid(0, 1)
        Spacer(actions).grid(0, 2).weight(col=2)
        Button(actions, content='Save', command=self.on_save
               ).style(Color.SUCCESS()).grid(0, 3)
        Button(actions, content='Cancel', command=self.on_cancel
               ).style(Color.WARNING()).grid(0, 4)
コード例 #14
0
    def build(self) -> None:
        self.modal = None
        self.title = 'Dominions'
        self.style(Color.SUCCESS())
        Button(self, content='\U00002795 Create',
               command=self.on_create).grid(0, 0)
        Spacer(self).grid(0, 1).weight(col=2)
        self.header = Listbox(self,
                              data=['ID', 'Name'],
                              orientation='horizontal').grid(1).span(col=3)

        self.body = Listbox(
            self,
            command=self.on_body,
        ).grid(3).span(col=3).weight(9)
コード例 #15
0
ファイル: users.py プロジェクト: knowark/authark
 def build(self) -> None:
     self.modal = None
     self.title = 'Users'
     self.style(Color.SUCCESS())
     Button(self, content='\U00002795 Create',
            command=self.on_create).grid(0, 0)
     Label(self, content='\U0001F50D Search:').grid(0, 1)
     self.search = Entry(self).grid(0, 2).style(
         border=[0]).weight(col=3)
     self.header = Listbox(
         self, data=['ID', 'Name', 'Email'],
         orientation='horizontal').grid(1).span(col=3)
     self.body = Listbox(
         self, command=self.on_body).grid(3).span(col=3).weight(9)
     self.search.listen('keydown', self.on_search, True)
コード例 #16
0
ファイル: roles.py プロジェクト: knowark/authark
    def build(self) -> None:
        super().build()
        self.modal = None

        available_frame = Frame(self, title='Available').weight(
            5, 4).grid(0, 0)
        self.available_search = Entry(
            available_frame, command=self.on_available_search).listen(
                'keydown', self.on_available_search, True).weight(
                    col=2).grid(0, 0)
        self.available_total = Label(
            available_frame, content='Total: 0').grid(0, 1)
        self.available = Listbox(
            available_frame, command=self.on_select).weight(
                9).span(col=2).grid(1)

        switchers = Frame(self).title_style(
            Color.SUCCESS()).style(border=[]).weight(5).grid(0, 1)

        Button(switchers, content='\U000025B6', command=self.on_choose).style(
            Color.SUCCESS(), border=[], template='{}').grid(0)
        Button(switchers, content='\U000025C0', command=self.on_clear).style(
            Color.SUCCESS(), border=[], template='{}').grid(1)
        Button(switchers, content='\U000023E9',
               command=self.on_choose_all).style(
            Color.SUCCESS(), border=[], template='{}').grid(2)
        Button(switchers, content='\U000023EA',
               command=self.on_clear_all).style(
            Color.SUCCESS(), border=[], template='{}').grid(3)

        chosen_frame = Frame(self, title='Chosen').weight(
            5, 4).grid(0, 2)
        self.chosen_search = Entry(chosen_frame).listen(
            'keydown', self.on_chosen_search, True).weight(col=2).grid(0, 0)
        self.chosen_total = Label(
            chosen_frame, content='Total: 0').grid(0, 1)
        self.chosen = Listbox(
            chosen_frame, command=self.on_select).weight(
                9).span(col=2).grid(1)

        actions = Frame(
            self, title='Actions').title_style(
                Color.WARNING()).grid(1).span(col=3)
        Label(actions, content=f'Role: {self.role["name"]}').grid(0, 2)
        Spacer(actions).grid(0, 3).weight(col=1)
        Button(actions, content='Save', command=self.on_save
               ).style(Color.SUCCESS()).grid(0, 4)
        Button(actions, content='Cancel', command=self.on_cancel
               ).style(Color.WARNING()).grid(0, 5)