Exemple #1
0
 def _getPasswordFields(self, obj):
     """
     Return fields for obj if it has xtype and it is password.
     """
     fields = IFormBuilder(IInfo(obj)).fields()
     return [
         field for field in fields if fields[field].get('xtype', None)
         and fields[field].get('xtype') == 'password'
     ]
Exemple #2
0
    def getInfo(self, uid):
        """
        Get the properties of an object.

        @type  uid: string
        @param uid: Unique identifier of an object
        @rtype:   DirectResponse
        @return:  B{Properties}
            - data: (dictionary) Object properties
            - form: (dictionary) Object representing an ExtJS form for the object
        """
        facade = self._getFacade()
        info = facade.getInfo(uid)
        form = IFormBuilder(info).render(fieldsets=False)
        return DirectResponse(success=True, data=Zuul.marshal(info), form=form)
Exemple #3
0
    def getForm(self, uid):
        """
        Given an object identifier, this returns all of the editable fields
        on that object as well as their ExtJs xtype that one would
        use on a client side form.

        @type  uid: string
        @param uid: Unique identifier of an object
        @rtype:   DirectResponse
        @return:  B{Properties}
           - form: (dictionary) form fields for the object
        """
        app = self._getFacade().get(uid)
        form = IFormBuilder(IInfo(app)).render(fieldsets=False)
        form = Zuul.marshal(form)
        return DirectResponse(form=form)
Exemple #4
0
    def getDataPointDetails(self, uid):
        """
        Get a data point's details.

        @type  uid: string
        @param uid: Unique ID of a data point
        @rtype:   dictionary
        @return:  B{Properties}:
             - record: (dictionary) Object representing the data point
             - form: (dictionary) Object representing an ExtJS form for the data
             point
        """
        facade = self._getFacade()
        details = facade.getDataPointDetails(uid)
        form = IFormBuilder(details).render(fieldsets=False)
        data = Zuul.marshal(dict(record=details, form=form))
        return data
Exemple #5
0
    def getThresholdDetails(self, uid):
        """
        Get a threshold's details.

        @type  uid: string
        @param uid: Unique ID of a threshold
        @rtype:   dictionary
        @return:  B{Properties}:
             - record: (dictionary) Object representing the threshold
             - form: (dictionary) Object representing an ExtJS form for the threshold
        """
        facade = self._getFacade()
        thresholdDetails = facade.getThresholdDetails(uid)
        form = IFormBuilder(thresholdDetails).render(fieldsets=False)
        # turn the threshold into a dictionary
        data = Zuul.marshal(dict(record=thresholdDetails, form=form))
        return data
Exemple #6
0
    def getInfo(self, uid, useFieldSets=True):
        """
        Get the properties of a MIB

        @type  uid: string
        @param uid: Unique identifier of a MIB
        @type  useFieldSets: boolean
        @param useFieldSets: True to return a fieldset version of the info form
                             (default: True)
        @rtype:   DirectResponse
        @return:  B{Properties}
            - data: (dictionary) Object representing a MIB's properties
            - form: (dictionary) Object representing an edit form for a MIB's
                    properties
        """
        info = self.api.getInfo(uid)
        form = IFormBuilder(info).render(fieldsets=useFieldSets)
        return DirectResponse.succeed(data=Zuul.marshal(info), form=form)
Exemple #7
0
 def generateJavascriptContent(self, notification):
     content = self.getInfo(notification)
     return IFormBuilder(content).render(fieldsets=False)