<s> from django . utils . translation import ugettext as _ <EOL> from freenasUI . api . resources import ( <EOL> GlobalConfigurationResourceMixin , <EOL> InterfacesResourceMixin , LAGGInterfaceResourceMixin , <EOL> LAGGInterfaceMembersResourceMixin <EOL> ) <EOL> from freenasUI . common . system import get_sw_name <EOL> from freenasUI . freeadmin . options import BaseFreeAdmin <EOL> from freenasUI . freeadmin . site import site <EOL> from freenasUI . middleware . notifier import notifier <EOL> from freenasUI . network import models <EOL> SW_NAME = get_sw_name ( ) <EOL> class GlobalConfigurationFAdmin ( BaseFreeAdmin ) : <EOL> deletable = False <EOL> resource_mixin = GlobalConfigurationResourceMixin <EOL> class InterfacesFAdmin ( BaseFreeAdmin ) : <EOL> create_modelform = "<STR_LIT>" <EOL> delete_form = "<STR_LIT>" <EOL> edit_modelform = "<STR_LIT>" <EOL> icon_object = u"<STR_LIT>" <EOL> icon_model = u"<STR_LIT>" <EOL> icon_add = u"<STR_LIT>" <EOL> icon_view = u"<STR_LIT>" <EOL> inlines = [ <EOL> { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } , <EOL> ] <EOL> resource_mixin = InterfacesResourceMixin <EOL> exclude_fields = ( <EOL> '<STR_LIT:id>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def get_datagrid_columns ( self ) : <EOL> columns = super ( InterfacesFAdmin , self ) . get_datagrid_columns ( ) <EOL> columns . insert ( <NUM_LIT:3> , { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:label>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> } ) <EOL> columns . insert ( <NUM_LIT:4> , { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:label>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> } ) <EOL> columns . insert ( <NUM_LIT:5> , { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:label>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> } ) <EOL> return columns <EOL> def get_confirm_message ( self , action , ** kwargs ) : <EOL> if ( <EOL> hasattr ( notifier , '<STR_LIT>' ) and <EOL> notifier ( ) . failover_status ( ) == '<STR_LIT>' <EOL> ) : <EOL> from freenasUI . failover . models import Failover <EOL> if Failover . objects . all ( ) [ <NUM_LIT:0> ] . disabled is False : <EOL> return _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> return _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> class LAGGInterfaceFAdmin ( BaseFreeAdmin ) : <EOL> icon_object = u"<STR_LIT>" <EOL> icon_model = u"<STR_LIT>" <EOL> icon_add = u"<STR_LIT>" <EOL> icon_view = u"<STR_LIT>" <EOL> create_modelform = "<STR_LIT>" <EOL> resource_mixin = LAGGInterfaceResourceMixin <EOL> def get_actions ( self ) : <EOL> actions = super ( LAGGInterfaceFAdmin , self ) . get_actions ( ) <EOL> actions [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : """<STR_LIT>""" % { <EOL> '<STR_LIT>' : _ ( '<STR_LIT>' ) , <EOL> } } <EOL> return actions <EOL> def get_confirm_message ( self , action , ** kwargs ) : <EOL> if ( <EOL> hasattr ( notifier , '<STR_LIT>' ) and <EOL> notifier ( ) . failover_status ( ) == '<STR_LIT>' <EOL> ) : <EOL> return _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> else : <EOL> return _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> class LAGGInterfaceMembersFAdmin ( BaseFreeAdmin ) : <EOL> icon_object = u"<STR_LIT>" <EOL> icon_model = u"<STR_LIT>" <EOL> resource_mixin = LAGGInterfaceMembersResourceMixin <EOL> def get_datagrid_filters ( self , request ) : <EOL> return { <EOL> "<STR_LIT>" : request . GET . get ( "<STR_LIT:id>" ) , <EOL> } <EOL> class VLANFAdmin ( BaseFreeAdmin ) : <EOL> icon_object = u"<STR_LIT>" <EOL> icon_model = u"<STR_LIT>" <EOL> icon_add = u"<STR_LIT>" <EOL> icon_view = u"<STR_LIT>" <EOL> def get_confirm_message ( self , action , ** kwargs ) : <EOL> if ( <EOL> hasattr ( notifier , '<STR_LIT>' ) and <EOL> notifier ( ) . failover_status ( ) == '<STR_LIT>' <EOL> ) : <EOL> return _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> else : <EOL> return _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> site . register ( models . GlobalConfiguration , GlobalConfigurationFAdmin ) <EOL> site . register ( models . Interfaces , InterfacesFAdmin ) <EOL> site . register ( models . VLAN , VLANFAdmin ) <EOL> site . register ( models . LAGGInterface , LAGGInterfaceFAdmin ) <EOL> site . register ( models . LAGGInterfaceMembers , LAGGInterfaceMembersFAdmin ) </s>
