def monitor_buttons(context, request): """ Build the action buttons for the monitor view based on the current state and the permissions of the user. :result: List of ActionButtons. :rtype: list """ buttons = list() # if request.has_permission('admin'): # buttons.append(ActionButton('delete_all_jobs', title=u'Delete all', # css_class=u'btn btn-danger')) buttons.append( ActionButton('delete_jobs', title='Delete', css_class='btn btn-danger', disabled=not request.has_permission('edit'))) buttons.append( ActionButton('make_public', title='Make Public', css_class='btn btn-warning', disabled=not request.has_permission('edit'))) buttons.append( ActionButton('make_private', title='Make Private', css_class='btn btn-warning', disabled=not request.has_permission('edit'))) return buttons
def buttongroup_td(self, col_num, i, item): from phoenix.utils import ActionButton buttons = list() buttons.append(ActionButton('results', title=u'Details', css_class=u'btn btn-default', href=self.request.route_path('job_details', tab='log', job_id=item.get('identifier')))) buttons.append(ActionButton('restart_job', title=u'Restart', css_class=u'btn btn-default', href="/restart_job/%s" % item.get('identifier'), disabled=item['status'] != 'ProcessSucceeded')) return self.render_buttongroup_td(buttons=buttons)
def buttongroup_td(self, col_num, i, item): from phoenix.utils import ActionButton buttons = list() buttons.append( ActionButton('edit', title="Edit", css_class="btn btn-default", href=self.request.route_path( 'profile', userid=item.get('identifier'), tab='account'))) buttons.append( ActionButton('delete', title='Delete', css_class="btn btn-danger", href=self.request.route_path( 'delete_user', userid=item.get('identifier')))) return self.render_buttongroup_td(buttons=buttons)
def generate_buttons(self): btns = [] if self.tab == 'twitcher': btn = ActionButton( name='generate_twitcher_token', title='Generate Token', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('generate_twitcher_token')) btns.append(btn) return btns
def buttongroup_td(self, col_num, i, item): from phoenix.utils import ActionButton buttons = [] if item.get('state') == 20: buttons.append(ActionButton( 'restart', css_class="btn btn-success", icon="fa fa-refresh", href=self.request.route_path('supervisor_process', action='restart', name=item.get('name')))) buttons.append(ActionButton( 'stop', css_class="btn btn-danger", icon="fa fa-stop", href=self.request.route_path('supervisor_process', action='stop', name=item.get('name')))) else: buttons.append(ActionButton( 'start', icon="fa fa-play", href=self.request.route_path('supervisor_process', action='start', name=item.get('name')))) # TODO: enable clear button again buttons.append(ActionButton( 'tail', icon="fa fa-align-left", href=self.request.route_path('supervisor_log', name=item.get('name'), offset=0))) return self.render_buttongroup_td(buttons=buttons)
def generate_buttons(self): btns = [] if self.tab == 'twitcher': btn = ActionButton( name='generate_twitcher_token', title='Generate Token', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('generate_twitcher_token')) btns.append(btn) elif self.tab == 'esgf_slcs': btn = ActionButton( name='generate_esgf_slcs_token', title='Generate Token', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('generate_esgf_slcs_token')) btns.append(btn) btn = ActionButton( name='forget_esgf_slcs_token', title='Forget Token', css_class="btn btn-danger btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('forget_esgf_slcs_token')) btns.append(btn) elif self.tab == 'esgf_certs': btn = ActionButton( name='update_esgf_certs', title='Update Credentials', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('edit'), href=self.request.route_path('update_esgf_certs')) btns.append(btn) btn = ActionButton( name='forget_esgf_certs', title='Forget Credentials', css_class="btn btn-danger btn-xs", disabled=not self.request.has_permission('edit'), href=self.request.route_path('forget_esgf_certs')) btns.append(btn) return btns
def generate_buttons(self): btns = [] if self.tab == 'twitcher': btn = ActionButton( name='generate_twitcher_token', title='Generate Token', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('generate_twitcher_token')) btns.append(btn) elif self.tab == 'c4i': btn = ActionButton( name='generate_c4i_token', title='Generate Token', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href= "https://dev.climate4impact.eu/impactportal/account/tokenapi.jsp" ) btns.append(btn) elif self.tab == 'esgf_slcs': btn = ActionButton( name='generate_esgf_slcs_token', title='Generate Token', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('generate_esgf_slcs_token')) btns.append(btn) btn = ActionButton( name='forget_esgf_slcs_token', title='Forget Token', css_class="btn btn-danger btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('forget_esgf_slcs_token')) btns.append(btn) elif self.tab == 'esgf_certs': btn = ActionButton( name='update_esgf_certs', title='Update Credentials', css_class="btn btn-success btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('update_esgf_certs')) btns.append(btn) btn = ActionButton( name='forget_esgf_certs', title='Forget Credentials', css_class="btn btn-danger btn-xs", disabled=not self.request.has_permission('submit'), href=self.request.route_path('forget_esgf_certs')) btns.append(btn) return btns