~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/datasource-function/datasource-function.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('datasource-function', function(Y) {
8
 
 
9
 
/**
10
 
 * Provides a DataSource implementation which can be used to retrieve data from a custom function.
11
 
 *
12
 
 * @module datasource
13
 
 * @submodule datasource-function
14
 
 */
15
 
 
16
 
/**
17
 
 * Function subclass for the DataSource Utility.
18
 
 * @class DataSource.Function
19
 
 * @extends DataSource.Local
20
 
 * @constructor
21
 
 */    
22
 
var LANG = Y.Lang,
23
 
 
24
 
    DSFn = function() {
25
 
        DSFn.superclass.constructor.apply(this, arguments);
26
 
    };
27
 
    
28
 
 
29
 
    /////////////////////////////////////////////////////////////////////////////
30
 
    //
31
 
    // DataSource.Function static properties
32
 
    //
33
 
    /////////////////////////////////////////////////////////////////////////////
34
 
Y.mix(DSFn, {
35
 
    /**
36
 
     * Class name.
37
 
     *
38
 
     * @property NAME
39
 
     * @type String
40
 
     * @static     
41
 
     * @final
42
 
     * @value "dataSourceFunction"
43
 
     */
44
 
    NAME: "dataSourceFunction",
45
 
 
46
 
 
47
 
    /////////////////////////////////////////////////////////////////////////////
48
 
    //
49
 
    // DataSource.Function Attributes
50
 
    //
51
 
    /////////////////////////////////////////////////////////////////////////////
52
 
 
53
 
    ATTRS: {
54
 
        /**
55
 
        * @attribute source
56
 
        * @description Pointer to live data.
57
 
        * @type MIXED
58
 
        * @default null
59
 
        */
60
 
        source: {
61
 
            validator: LANG.isFunction
62
 
        }
63
 
    }
64
 
});
65
 
    
66
 
Y.extend(DSFn, Y.DataSource.Local, {
67
 
    /**
68
 
     * Passes query string to IO. Fires <code>response</code> event when
69
 
     * response is received asynchronously.
70
 
     *
71
 
     * @method _defRequestFn
72
 
     * @param e {Event.Facade} Event Facade with the following properties:
73
 
     * <dl>
74
 
     * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd>
75
 
     * <dt>request (Object)</dt> <dd>The request.</dd>
76
 
     * <dt>callback (Object)</dt> <dd>The callback object with the following properties:
77
 
     *     <dl>
78
 
     *         <dt>success (Function)</dt> <dd>Success handler.</dd>
79
 
     *         <dt>failure (Function)</dt> <dd>Failure handler.</dd>
80
 
     *     </dl>
81
 
     * </dd>
82
 
     * <dt>cfg (Object)</dt> <dd>Configuration object.</dd>
83
 
     * </dl>
84
 
     * @protected
85
 
     */
86
 
    _defRequestFn: function(e) {
87
 
        var fn = this.get("source"),
88
 
            payload = e.details[0];
89
 
            
90
 
        if (fn) {
91
 
            try {
92
 
                payload.data = fn(e.request, this, e);
93
 
            } catch (ex) {
94
 
                payload.error = ex;
95
 
            }
96
 
        } else {
97
 
            payload.error = new Error("Function data failure");
98
 
        }
99
 
 
100
 
        this.fire("data", payload);
101
 
            
102
 
        return e.tId;
103
 
    }
104
 
});
105
 
  
106
 
Y.DataSource.Function = DSFn;
107
 
 
108
 
 
109
 
}, '3.4.1' ,{requires:['datasource-local']});