Exemplo n.º 1
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDomTree.__init__(
            self,
            dom_father=dom_father,
            dom_storage=dom_storage,
        )

        IDynamicComponentProvider.__init__(self, )

        @with_cloudmap_resolver(self)
        def create_all_cp_envs_viewer(*args, **kwargs):
            d_all_cp_envs = {}
            for env in self.env_resolver.all_envs:
                d_all_cp_envs[env] = component.Component(
                    EnvViewer(
                        appcode=lambda: self.appcode,
                        aera=lambda: self.aera,
                        env=env,
                        resolvers=self,
                        dom_storage=self,
                        dom_father=self,
                    ))
            return d_all_cp_envs

        self.create_dynamic_component('all_cp_envs_viewer',
                                      create_all_cp_envs_viewer)
Exemplo n.º 2
0
    def __init__(self, dom_storage=None, dom_father=None, *args, **kwargs):

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )
Exemplo n.º 3
0
   def __init__( 
          self, 
          resolvers 		= None, 
          dom_storage 		= None,
          dom_father 		= None,
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      IDomTree.__init__(
         self,
         dom_storage 	= dom_storage,
         dom_father 	= dom_father,
      )

      IDynamicComponentProvider.__init__(
         self
      )

      self.__servername 	= '%s-%s-%s' % ( 
                                     self.appcomp, 
                                     self.num_component, 
                                     self.aera 
                                  )
Exemplo n.º 4
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        IDynamicComponentProvider.__init__(self, )

        @with_cloudmap_resolver(self)
        def create_cp_envs_viewer(*args, **kwargs):
            return component.Component(
                EnvsViewer(
                    appcode=lambda: self.appcode,
                    aera=lambda: self.aera,
                    resolvers=self,
                    dom_storage=self,
                    dom_father=self,
                ))

        self.create_dynamic_component('cp_envs_viewer', create_cp_envs_viewer)
Exemplo n.º 5
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDomTree.__init__(self, dom_storage=dom_storage, dom_father=dom_father)

        IDynamicComponentProvider.__init__(self)

        @with_cloudmap_resolver(self)
        def create_cp_servers_control(*args, **kwargs):
            return component.Component(
                ServersControl(
                    appcode=lambda: self.appcode,
                    aera=lambda: self.aera,
                    env=lambda: self.env,
                    appcomp=lambda: self.appcomp,
                    resolvers=self,
                    dom_storage=self,
                    dom_father=self,
                ))

        self.create_dynamic_component('cp_servers_control',
                                      create_cp_servers_control)
Exemplo n.º 6
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDynamicComponentProvider.__init__(self, )

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        # Définition des composants dynamiques
        # Menu de controle
        @with_cloudmap_resolver(self)
        def create_all_cp_aeras_viewer(*args, **kwargs):
            d_all_cp_aeras_viewer = {}
            for aera in self.aera_resolver.all_aeras:
                d_all_cp_aeras_viewer[aera] = component.Component(
                    AeraViewer(
                        aera=aera,
                        appcode=lambda: self.appcode,
                        resolvers=self,
                        dom_storage=self,
                        dom_father=self,
                    ))
            return d_all_cp_aeras_viewer

        self.create_dynamic_component('all_cp_aeras_viewer',
                                      create_all_cp_aeras_viewer)
Exemplo n.º 7
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None,
          dom_father 	= None,
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__(
         self, 
         resolvers 
      )

      ICloudMgrComet.__init__( 
                        self 
                     )

      IDomTree.__init__(
                  self,
                  dom_storage = dom_storage,
                  dom_father = dom_father,
               )

      IDynamicComponentProvider.__init__(
                                   self
                                )
   def __init__( 
          self, 
          dom_storage, 
          dom_father 
       ):

      IDomTree.__init__( 
                  self, 
                  dom_storage = dom_storage, 
                  dom_father = dom_father 
               )
Exemplo n.º 9
0
  def __init__( 
         self,
         dom_storage 	= None,
         dom_father 	= None,
         *args, 
         **kwargs
      ):

     IDomTree.__init__(
        self,
        dom_storage 	= dom_storage,
        dom_father 	= dom_father,
     )
Exemplo n.º 10
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None, 
          dom_father 	= None, 
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
                            self, 
                            resolvers 
                         )

      IDomTree.__init__(
         self,
         dom_storage = dom_storage,
         dom_father = dom_father
      )

      IDynamicComponentProvider.__init__(
                                   self
                                )


      @with_cloudmap_resolver( self )
      def create_all_cp_servers_viewer(
             *args,
             **kwargs
          ):

         d_all_cp_servers_viewer = {}
         try:
            for num_component, d_component_status in kwargs[ 'with_cloudmap_resolver' ].cloudmap[ self.aera ][ self.appcode ][ self.env ][ self.appcomp ].items():
               d_all_cp_servers_viewer[ num_component ] = component.Component( 
                                                             ServerViewer( 
                                                                appcode 		= lambda: self.appcode, 
                                                                aera 			= lambda: self.aera, 
                                                                env 			= lambda: self.env, 
                                                                appcomp 		= lambda: self.appcomp, 
                                                                num_component 		= num_component, 
                                                                d_component_status 	= d_component_status, 
                                                                resolvers 		= self, 
                                                                dom_storage 		= self,
                                                                dom_father 		= self,
                                                             ) 
                                                          ) 
         except Exception, e:
            pass

         return d_all_cp_servers_viewer
Exemplo n.º 11
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None,
          dom_father 	= None,
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
                            self, 
                            resolvers 
                         )


      IDomTree.__init__(
                  self,
                  dom_storage = dom_storage,
                  dom_father = dom_father,
               )

      IDynamicComponentProvider.__init__(
                                   self
                                )


      @with_cloudmap_resolver( self )
      def create_all_cp_appcomps_viewer(
             *args,
             **kwargs
          ):
         d_all_cp_appcomps = {}
         for appcomp in self.appcomp_resolver.get_all_appcomps_for_aera( self.aera ):
            d_all_cp_appcomps[ appcomp ] = component.Component( 
                                              AppCompViewer( 
                                                 appcode 	= lambda: self.appcode, 
                                                 aera 		= lambda: self.aera, 
                                                 env 		= lambda: self.env, 
                                                 appcomp 	= appcomp, 
                                                 resolvers 	= self, 
                                                 dom_storage 	= self,
                                                 dom_father 	= self,
                                              ) 
                                           )
         return d_all_cp_appcomps

      self.create_dynamic_component(
         'all_cp_appcomps_viewer',
         create_all_cp_appcomps_viewer
      )
Exemplo n.º 12
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None, 
          dom_father 	= None, 
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      IDynamicComponentProvider.__init__(
         self,
      )

      IDomTree.__init__(
         self,
         dom_storage 	= dom_storage,
         dom_father 	= dom_father,
      )


      # Définition des composants dynamiques
      # Menu de controle
      @with_cloudmap_resolver( self )
      def create_all_cp_aeras_viewer(
             *args,
             **kwargs
          ):
         d_all_cp_aeras_viewer = {}
         for aera in self.aera_resolver.all_aeras:
            d_all_cp_aeras_viewer[ aera ] = component.Component( 
                                               AeraViewer( 
                                                  aera 		= aera, 
                                                  appcode	= lambda: self.appcode, 
                                                  resolvers 	= self, 
                                                  dom_storage 	= self,
                                                  dom_father 	= self,
                                               ) 
                                            )
         return d_all_cp_aeras_viewer

      self.create_dynamic_component(
         'all_cp_aeras_viewer',
         create_all_cp_aeras_viewer
      )
Exemplo n.º 13
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDynamicComponentProvider.__init__(self)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        # Définition des composants dynamiques
        @with_cloudmap_resolver(self)
        def create_cp_counter_by_appcode_by_env(*args, **kwargs):
            return component.Component(
                CounterServers(
                    appcode=lambda: self.appcode,
                    env=lambda: self.env,
                    aera='*',
                    appcomp='*',
                    resolvers=self,
                    dom_storage=self,
                    dom_father=self,
                ))

        self.create_dynamic_component('cp_counter_by_appcode_by_env',
                                      create_cp_counter_by_appcode_by_env)

        @with_cloudmap_resolver(self)
        def create_cp_counter_by_env(*args, **kwargs):
            return component.Component(
                CounterServers(
                    appcode='*',
                    env=lambda: self.env,
                    aera='*',
                    appcomp='*',
                    resolvers=self,
                    dom_storage=self,
                    dom_father=self,
                ))

        self.create_dynamic_component('cp_counter_by_env',
                                      create_cp_counter_by_env)
Exemplo n.º 14
0
    def __init__(
        self,
        dom_storage=None,
        dom_father=None,
        cloudmgrweb=None,
    ):

        ICloudMgrComet.__init__(self)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        self._cloudmgrweb = cloudmgrweb
Exemplo n.º 15
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None,
          dom_father 	= None,
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      IDomTree.__init__(
         self,
         dom_father = dom_father,
         dom_storage = dom_storage,
      )

      IDynamicComponentProvider.__init__(
         self,
      )

      @with_cloudmap_resolver( self )
      def create_all_cp_envs_viewer(
             *args,
             **kwargs
         ):
         d_all_cp_envs = {}
         for env in self.env_resolver.all_envs:
            d_all_cp_envs[ env ] = component.Component( 
                                      EnvViewer( 
                                         appcode 	= lambda: self.appcode, 
                                         aera 		= lambda: self.aera, 
                                         env 		= env, 
                                         resolvers 	= self, 
                                         dom_storage 	= self,
                                         dom_father 	= self,
                                      ) 
                                   )
         return d_all_cp_envs

      self.create_dynamic_component(
         'all_cp_envs_viewer',
         create_all_cp_envs_viewer
      )
Exemplo n.º 16
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None,
          dom_father 	= None,
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      IDomTree.__init__(
         self,
         dom_storage = dom_storage,
         dom_father = dom_father
      )

      IDynamicComponentProvider.__init__(
         self
      )

      @with_cloudmap_resolver( self )
      def create_cp_servers_control(
             *args,
             **kwargs
          ):
         return component.Component( 
                             ServersControl( 
                                appcode 	= lambda: self.appcode, 
                                aera 		= lambda: self.aera, 
                                env 		= lambda: self.env, 
                                appcomp 	= lambda: self.appcomp, 
                                resolvers 	= self, 
                                dom_storage 	= self,
                                dom_father 	= self, 
                             ) 
                          )

      self.create_dynamic_component(
         'cp_servers_control',
         create_cp_servers_control
      )
Exemplo n.º 17
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        ICloudMgrComet.__init__(self)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        IDynamicComponentProvider.__init__(self)
Exemplo n.º 18
0
   def __init__( 
           self, 
           resolvers 	= None, 
           dom_storage 	= None,
           dom_father 	= None,
           *args,
           **kwargs
       ):

      ICloudMgrResolvers.__init__( 
                            self, 
                            resolvers 
                         )

      IDomTree.__init__(
                  self,
                  dom_storage = dom_storage,
                  dom_father = dom_father,
               )

      IDynamicComponentProvider.__init__(
                                   self,
                                )

      @with_cloudmap_resolver( self )
      def create_cp_envs_viewer(
             *args,
             **kwargs
          ):
         return component.Component( 
                   EnvsViewer( 
                      appcode 		= lambda: self.appcode, 
                      aera 		= lambda: self.aera, 
                      resolvers 	= self, 
                      dom_storage 	= self,
                      dom_father 	= self,
                   ) 
                )


      self.create_dynamic_component(
         'cp_envs_viewer',
         create_cp_envs_viewer
      )
Exemplo n.º 19
0
   def __init__(
          self,
          dom_storage      = None,
          dom_father       = None,
          cloudmgrweb      = None,
       ):

      ICloudMgrComet.__init__(
                        self
      )
 

      IDomTree.__init__(
                  self,
                  dom_storage    = dom_storage,
                  dom_father     = dom_father,
      )

      self._cloudmgrweb = cloudmgrweb
Exemplo n.º 20
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        IDynamicComponentProvider.__init__(self)

        self.__servername = '%s-%s-%s' % (self.appcomp, self.num_component,
                                          self.aera)
Exemplo n.º 21
0
    def __init__(self, resolvers=None, dom_storage=None, dom_father=None, *args, **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDomTree.__init__(self, dom_storage=dom_storage, dom_father=dom_father)

        IDynamicComponentProvider.__init__(self)

        @with_cloudmap_resolver(self)
        def create_cp_create_server_task(*args, **kwargs):
            return component.Component(
                CreateServerTask(
                    appcode=lambda: self.appcode,
                    aera=lambda: self.aera,
                    env=lambda: self.env,
                    appcomp=lambda: self.appcomp,
                    resolvers=self,
                    dom_storage=self,
                    dom_father=self,
                )
            )

        self.create_dynamic_component("cp_create_server_task", create_cp_create_server_task)

        @with_cloudmap_resolver(self)
        def create_cp_servers_viewer(*args, **kwargs):

            return component.Component(
                ServersViewer(
                    appcode=lambda: self.appcode,
                    aera=lambda: self.aera,
                    env=lambda: self.env,
                    appcomp=lambda: self.appcomp,
                    resolvers=self,
                    dom_storage=self,
                    dom_father=self,
                )
            )

        self.create_dynamic_component("cp_servers_viewer", create_cp_servers_viewer)
Exemplo n.º 22
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        IDynamicComponentProvider.__init__(self)

        @with_cloudmap_resolver(self)
        def create_all_cp_appcomps_viewer(*args, **kwargs):
            d_all_cp_appcomps = {}
            for appcomp in self.appcomp_resolver.get_all_appcomps_for_aera(
                    self.aera):
                d_all_cp_appcomps[appcomp] = component.Component(
                    AppCompViewer(
                        appcode=lambda: self.appcode,
                        aera=lambda: self.aera,
                        env=lambda: self.env,
                        appcomp=appcomp,
                        resolvers=self,
                        dom_storage=self,
                        dom_father=self,
                    ))
            return d_all_cp_appcomps

        self.create_dynamic_component('all_cp_appcomps_viewer',
                                      create_all_cp_appcomps_viewer)
Exemplo n.º 23
0
   def __init__( 
          self, 
          resolvers 	= None, 
          dom_storage 	= None,
          dom_father 	= None, 
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      IDynamicComponentProvider.__init__(
         self
      )

      IDomTree.__init__(
         self,
         dom_storage 	= dom_storage,
         dom_father 	= dom_father, 
      )

      # Définition des composants dynamiques
      @with_cloudmap_resolver( self )
      def create_cp_counter_by_appcode_by_env( *args, **kwargs ):
         return component.Component(
                   CounterServers( 
                      appcode 		= lambda: self.appcode, 
                      env 		= lambda: self.env, 
                      aera		= '*',
                      appcomp		= '*',
                      resolvers 	= self, 
                      dom_storage 	= self,
                      dom_father 	= self, 
                   ) 
                )

      self.create_dynamic_component(
         'cp_counter_by_appcode_by_env',
         create_cp_counter_by_appcode_by_env
      )


      @with_cloudmap_resolver( self )
      def create_cp_counter_by_env( *args, **kwargs ):
         return component.Component( 
                   CounterServers( 
                      appcode		= '*',
                      env 		= lambda: self.env, 
                      aera		= '*',
                      appcomp		= '*',
                      resolvers 	= self, 
                      dom_storage 	= self,
                      dom_father 	= self, 
                   ) 
                )
 
      self.create_dynamic_component(
         'cp_counter_by_env',
         create_cp_counter_by_env
      )
Exemplo n.º 24
0
    def __init__(self, dom_storage, dom_father):

        IDomTree.__init__(self, dom_storage=dom_storage, dom_father=dom_father)
Exemplo n.º 25
0
   def __init__(
          self, 
          resolvers 	= None, 
          dom_storage 	= None,
          dom_father 	= None, 
          *args,
          **kwargs
      ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      # Interaction comet
      ICloudMgrComet.__init__( 
         self 
      )

      IDynamicComponentProvider.__init__(
         self
      )

      IDomTree.__init__(
         self,
         dom_storage 	= dom_storage,
         dom_father 	= dom_father,
      )


      @with_cloudmap_resolver( self )
      def get_cloudmap_in_a_list( 
             *args,
             **kwargs 
          ):
         result = kwargs[ 'with_cloudmap_resolver' ].cloudmap.copy()
         return [ result ]

      def get_list_from_attribute( 
             l, 
             attribute = None 
          ):

         l_result = []
         for e in l:
            result = []

            if getattr( self, attribute ) and getattr( self, attribute ) <> '*':
            	result = e.get( 
                            getattr( 
                               self, 
                               attribute 
                            ), 
                            [] 
                         )
            else:
               result = e.values()

            if type( result ) == dict:
               result = [ result ]

            l_result.extend( result )
         return l_result 

      def print_struct( x ):
         pprint( x )
         print
         return x

      def sum_element_on_list( l ):
         result = 0
         for e in l:
            result = result + len( e )
         return result

      SequentialOps.__init__( 
         self, 
         self.cloudmap_resolver, 
         [ 
            get_cloudmap_in_a_list, 
            lambda l, attribute = 'aera': get_list_from_attribute( 
                                             l, 
                                             attribute 
                                          ),
            lambda l, attribute = 'appcode': get_list_from_attribute( 
                                                l, 
                                                attribute 
                                          ),
            lambda l, attribute = 'env': get_list_from_attribute( 
                                            l, 
                                            attribute 
                                         ),
            lambda l, attribute = 'appcomp': get_list_from_attribute( 
                                                l, 
                                                attribute 
                                             ),
            sum_element_on_list,
         ] 
      )
Exemplo n.º 26
0
   def __init__( 
          self, 
          dom_storage 	= None, 
          dom_father 	= None, 
          *args,
          **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self 
      )

      # Création de l'interface
      # permettant la génération
      # des composants de manière
      # dynamique et avec 
      # alimentation de l'objet en proprerties
      IDynamicComponentProvider.__init__( 
         self 
      )

      IDomTree.__init__( 
         self, 
         dom_storage 	= dom_storage, 
         dom_father 	= dom_father 
      )

      # Définition des composants dynamiques
      # Menu de controle
      @with_cloudmap_resolver( self )
      def create_cp_appcode_selector(
             *args,
             **kwargs
          ):
         return component.Component(
            AppcodeSelector(
               dom_storage 	= self,
               dom_father 	= self,
               appcode		= self.appcode,
            )
         )

      self.create_dynamic_component(
         'cp_appcode_selector',
         create_cp_appcode_selector,
      )

      @with_cloudmap_resolver( self )
      def create_cp_menu_control_envs(
             *args,
             **kwargs
          ):
         return component.Component(
                   MenuControlEnvs(
                      appcode 	= self.appcode,
                      resolvers 	= self,
                      dom_storage 	= self,
                      dom_father 	= self,
                   )
                )

      self.create_dynamic_component(
         'cp_menu_control_envs',
         create_cp_menu_control_envs,
      ) 
Exemplo n.º 27
0
   def __init__(
          self,
      ):

      default_appcode = ''


      ICloudMgrResolvers.__init__( 
         self 
      )

      # Interaction comet
      ICloudMgrComet.__init__(
         self
      )

      # Création de l'interface
      # permettant la génération
      # des composants de manière
      # dynamique et avec 
      # alimentation de l'objet en proprerties
      IDynamicComponentProvider.__init__( 
         self
      )

      IDomTree.__init__( 
         self, 
         dom_storage 	= None, 
         dom_father 	= None 
      )

      # Définition des composants dynamiques
      # Menu de controle
      def create_cp_menu_control():
         with self.cloudmap_resolver:
            return component.Component(
               MenuControl(
                  appcode 	= default_appcode,
                  dom_storage 	= self,
                  dom_father 	= self,
               )
            )

      self.create_dynamic_component( 
         'cp_menu_control', 
         create_cp_menu_control
      )

      # affichage des zones
      def create_cp_aeras_viewer():
         with self.cloudmap_resolver:
            return component.Component( 
                      AerasViewer(
                         appcode 	= default_appcode,
                         resolvers 	= self,
                         dom_storage 	= self,
                         dom_father 	= self,
                      )
                   )

      self.create_dynamic_component(
         'cp_aeras_viewer',
         create_cp_aeras_viewer
      ) 

      # Formulaire pour les rechargements
      # suite à un message comet
      def create_cp_form_refresh_on_comet():
         return component.Component(
                   FormRefreshOnComet(
                      dom_storage 	= self,
                      dom_father 	= self,
                   )
                )

      self.create_dynamic_component(
         'cp_form_refresh_on_comet',
         create_cp_form_refresh_on_comet
      ) 


      def create_cp_debug():
         return component.Component(
                   CloudmgrwebDebug(
                      dom_storage       = self,
                      dom_father        = self,
                      cloudmgrweb	= self,
                   )
                )

      self.create_dynamic_component(
         'cp_debug',
         create_cp_debug,
      )
Exemplo n.º 28
0
    def __init__(self,
                 resolvers=None,
                 dom_storage=None,
                 dom_father=None,
                 *args,
                 **kwargs):

        ICloudMgrResolvers.__init__(self, resolvers)

        # Interaction comet
        ICloudMgrComet.__init__(self)

        IDynamicComponentProvider.__init__(self)

        IDomTree.__init__(
            self,
            dom_storage=dom_storage,
            dom_father=dom_father,
        )

        @with_cloudmap_resolver(self)
        def get_cloudmap_in_a_list(*args, **kwargs):
            result = kwargs['with_cloudmap_resolver'].cloudmap.copy()
            return [result]

        def get_list_from_attribute(l, attribute=None):

            l_result = []
            for e in l:
                result = []

                if getattr(self,
                           attribute) and getattr(self, attribute) <> '*':
                    result = e.get(getattr(self, attribute), [])
                else:
                    result = e.values()

                if type(result) == dict:
                    result = [result]

                l_result.extend(result)
            return l_result

        def print_struct(x):
            pprint(x)
            print
            return x

        def sum_element_on_list(l):
            result = 0
            for e in l:
                result = result + len(e)
            return result

        SequentialOps.__init__(self, self.cloudmap_resolver, [
            get_cloudmap_in_a_list,
            lambda l, attribute='aera': get_list_from_attribute(l, attribute),
            lambda l, attribute='appcode': get_list_from_attribute(
                l, attribute),
            lambda l, attribute='env': get_list_from_attribute(l, attribute),
            lambda l, attribute='appcomp': get_list_from_attribute(
                l, attribute),
            sum_element_on_list,
        ])
Exemplo n.º 29
0
   def __init__( 
         self, 
         resolvers 	= None, 
         dom_storage 	= None, 
         dom_father 	= None, 
         *args,
         **kwargs
       ):

      ICloudMgrResolvers.__init__( 
         self, 
         resolvers 
      )

      IDynamicComponentProvider.__init__( 
         self 
      )

      IDomTree.__init__( 
         self, 
         dom_storage = dom_storage, 
         dom_father = dom_father 
      )

      # Définition des composants dynamiques
      # Filtre uniquement sur le code application
      @with_cloudmap_resolver( self )
      def create_cp_menu_all_envs(
             *args,
             **kwargs
          ):
         return component.Component(
                   MenuControlEnv( 
                      env 		= '*', 
                      appcode 		= lambda: self.appcode, 
                      resolvers 	= self, 
                      dom_storage 	= self,
                      dom_father 	= self, 
                   ),
                   model = '*' 
                ) 

      self.create_dynamic_component(
         'cp_menu_all_envs',
         create_cp_menu_all_envs
      )

      # filtre environnement par environnnement
      @with_cloudmap_resolver( self )
      def create_d_cp_menu_by_envs(
             *args,
             **kwargs
         ):
         d_cp_menu_by_envs = {}
         for env in self.env_resolver.all_envs:
            d_cp_menu_by_envs[ env ] = component.Component( 
                                          MenuControlEnv( 
                                             env 		= env, 
                                             appcode 		= lambda: self.appcode, 
                                             resolvers 		= self, 
                                             dom_storage 	= self,
                                             dom_father 	= self, 
                                          ) 
                                       ) 
         return d_cp_menu_by_envs

      self.create_dynamic_component(
         'd_cp_menu_by_envs',
         create_d_cp_menu_by_envs
      )