def get_stat_flex(self, execution: dict) -> Flex: stat_flex = Flex() stat_flex.add( f"Status: {execution['status']}", style=self.status_styles.get(execution['status'], {}), ) stat_flex.add(f"Step: {execution['step']}") stat_flex.add(f"Commit: {execution['commit']['identifier']}") stat_flex.add(f'{self.n_events} events', align='right') return stat_flex
def get_stat_flex(self, execution): events = execution.get('events', ()) stat_flex = Flex() stat_flex.add( 'Status: {status}'.format(status=execution['status']), style=self.status_styles.get(execution['status'], {}), ) stat_flex.add('Step: {step}'.format(step=execution['step'])) stat_flex.add('Commit: {commit}'.format(commit=execution['commit']['identifier'])) stat_flex.add('{n} events'.format(n=len(events)), align='right') return stat_flex
def get_header_flex(self, execution): header_flex = Flex(style={'bg': 'blue', 'fg': 'white'}) header_flex.add( content='({project}) #{counter}'.format( project=execution['project']['name'], counter=execution['counter'], ), style={'bold': True}, ) header_flex.add( content=datetime.datetime.now().isoformat(), align='right', ) return header_flex
def draw(self) -> None: execution = self.log_manager.execution events = self.events l = Layout() l.add(self.get_header_flex(execution)) l.add(self.get_stat_flex(execution)) l.add(Divider('=')) available_height = l.height - len(l.rows) - 2 if available_height > 0: for event in events[-available_height:]: l.add( Flex(style=stream_styles.get(event['stream'])).add( event['time'].split('T')[1][:-4] + ' ', flex=0).add(clean_log_line(event['message']), flex=4)) click.clear() l.draw()
def draw(self): execution = self.data events = execution.get('events', ()) l = Layout() l.add(self.get_header_flex(execution)) l.add(self.get_stat_flex(execution)) l.add(Divider('=')) available_height = l.height - len(l.rows) - 2 if available_height > 0: for event in events[-available_height:]: l.add( Flex(style=stream_styles.get(event['stream'])) .add(event['time'].split('T')[1][:-4] + ' ', flex=0) .add(event['message'], flex=4) ) click.clear() l.draw()
def get_header_flex(self, execution: dict) -> Flex: header_flex = Flex(style={'bg': 'blue', 'fg': 'white'}) header_flex.add( content=f"({execution['project']['name']}) #{execution['counter']}", style={'bold': True}, ) if self.status_text: header_flex.add( align='center', style={ 'fg': 'black', 'bg': 'yellow' }, ) header_flex.add( content=datetime.datetime.now().isoformat(), align='right', ) return header_flex