Browse Source

HPCC-9210 Create generic ESPRequest.Store

Simplify dojo Store creation from ESP responses.

Fixes HPCC-9210

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 12 years ago
parent
commit
6c5d5680e7

+ 40 - 85
esp/files/scripts/ESPDFUWorkunit.js

@@ -24,99 +24,54 @@ define([
 
     "hpcc/FileSpray",
     "hpcc/ESPUtil",
+    "hpcc/ESPRequest",
     "hpcc/ESPResult"
 ], function (declare, arrayUtil, lang, Deferred, ObjectStore, QueryResults, Observable,
-    FileSpray, ESPUtil, ESPResult) {
+    FileSpray, ESPUtil, ESPRequest, ESPResult) {
 
-    var _workunits = {};
+    var Store = declare([ESPRequest.Store], {
+        service: "FileSpray",
+        action: "GetDFUWorkunits",
+        responseQualifier: "results.DFUWorkunit",
+        responseTotalQualifier: "NumWUs",
+        idProperty: "ID",
+        startProperty: "PageStartFrom",
+        countProperty: "PageSize",
 
-    var Store = declare(null, {
-        idProperty: "Wuid",
-
-        _watched: {},
-
-        constructor: function (options) {
-            declare.safeMixin(this, options);
-        },
-
-        getIdentity: function (object) {
-            return object[this.idProperty];
-        },
-
-        get: function (id) {
-            if (!_workunits[id]) {
-                _workunits[id] = new Workunit({
-                    Wuid: id
-                });
+        _watched: [],
+        preRequest: function (request) {
+            switch (request.Sortby) {
+                case "ClusterName":
+                    request.Sortby = "Cluster";
+                    break;
+                case "JobName":
+                    request.Sortby = "Jobname";
+                    break;
+                case "Command":
+                    request.Sortby = "Type";
+                    break;
+                case "StateMessage":
+                    request.Sortby = "State";
+                    break;
             }
-            return _workunits[id];
         },
-
-        remove: function (item) {
-            if (_workunits[this.getIdentity(item)]) {
-                _workunits[this.getIdentity(item)].stopMonitor();
-                delete _workunits[this.getIdentity(item)];
-            }
+        create: function (id) {
+            return new Workunit({
+                ID: id,
+                Wuid: id
+            });
         },
-
-        query: function (query, options) {
-            var request = query;
-            lang.mixin(request, options.query);
-            if (options.start !== undefined)
-                request['PageStartFrom'] = options.start;
-            if (options.count !== undefined)
-                request['PageSize'] = options.count;
-            if (options.sort !== undefined) {
-                switch (options.sort[0].attribute) {
-                    case "ClusterName":
-                        request['Sortby'] = "Cluster";
-                        break;
-                    case "Command":
-                        request['Sortby'] = "Type";
-                        break;
-                    case "StateMessage":
-                        request['Sortby'] = "State";
-                        break;
-                    default:
-                        request['Sortby'] = options.sort[0].attribute;
-                }
-                request['Descending'] = options.sort[0].descending;
+        update: function (id, item) {
+            var storeItem = this.get(id);
+            storeItem.updateData(item);
+            if (!this._watched[id]) {
+                var context = this;
+                this._watched[id] = storeItem.watch("changedCount", function (name, oldValue, newValue) {
+                    if (oldValue !== newValue) {
+                        context.notify(storeItem, id);
+                    }
+                });
             }
-
-            var results = FileSpray.GetDFUWorkunits({
-                request: request
-            });
-
-            var deferredResults = new Deferred();
-            deferredResults.total = results.then(function (response) {
-                if (lang.exists("GetDFUWorkunitsResponse.NumWUs", response)) {
-                    return response.GetDFUWorkunitsResponse.NumWUs;
-                }
-                return 0;
-            });
-            var context = this;
-            Deferred.when(results, function (response) {
-                var workunits = [];
-                for (key in context._watched) {
-                    context._watched[key].unwatch();
-                }
-                this._watched = {};
-                if (lang.exists("GetDFUWorkunitsResponse.results.DFUWorkunit", response)) {
-                    arrayUtil.forEach(response.GetDFUWorkunitsResponse.results.DFUWorkunit, function (item, index) {
-                        var wu = context.get(item.ID);
-                        wu.updateData(item);
-                        workunits.push(wu);
-                        context._watched[wu.Wuid] = wu.watch("changedCount", function (name, oldValue, newValue) {
-                            if (oldValue !== newValue) {
-                                context.notify(wu, context.getIdentity(wu));
-                            }
-                        });
-                    });
-                }
-                deferredResults.resolve(workunits);
-            });
-
-            return QueryResults(deferredResults);
         }
     });
 

+ 23 - 71
esp/files/scripts/ESPLogicalFile.js

@@ -25,88 +25,40 @@ define([
 
     "hpcc/WsDfu",
     "hpcc/FileSpray",
+    "hpcc/ESPRequest",
     "hpcc/ESPUtil",
     "hpcc/ESPResult"
 ], function (declare, arrayUtil, lang, Deferred, ObjectStore, QueryResults, Observable, Stateful,
-        WsDfu, FileSpray, ESPUtil, ESPResult) {
+        WsDfu, FileSpray, ESPRequest, ESPUtil, ESPResult) {
 
     var _logicalFiles = {};
 
-    var Store = declare(null, {
+    var Store = declare([ESPRequest.Store], {
+        service: "WsDfu",
+        action: "DFUQuery",
+        responseQualifier: "DFULogicalFiles.DFULogicalFile",
+        responseTotalQualifier: "NumFiles",
         idProperty: "Name",
+        startProperty: "PageStartFrom",
+        countProperty: "Count",
 
-        _watched: {},
-
-        constructor: function (options) {
-            declare.safeMixin(this, options);
-        },
-
-        getIdentity: function (object) {
-            return object[this.idProperty];
+        _watched: [],
+        create: function (id) {
+            return new LogicalFile({
+                Name: id
+            });
         },
-
-        get: function (name) {
-            if (!_logicalFiles[name]) {
-                _logicalFiles[name] = new LogicalFile({
-                    Name: name
+        update: function (id, item) {
+            var storeItem = this.get(id);
+            storeItem.updateData(item);
+            if (!this._watched[id]) {
+                var context = this;
+                this._watched[id] = storeItem.watch("changedCount", function (name, oldValue, newValue) {
+                    if (oldValue !== newValue) {
+                        context.notify(storeItem, id);
+                    }
                 });
             }
-            return _logicalFiles[name];
-        },
-
-        remove: function (item) {
-            if (_logicalFiles[this.getIdentity(item)]) {
-                _logicalFiles[this.getIdentity(item)].stopMonitor();
-                delete _logicalFiles[this.getIdentity(item)];
-            }
-        },
-
-        query: function (query, options) {
-            var request = query;
-            lang.mixin(request, options.query);
-            if (options.start !== undefined)
-                request['PageStartFrom'] = options.start;
-            if (options.count !== undefined)
-                request['Count'] = options.count;
-            if (options.sort !== undefined) {
-                request['Sortby'] = options.sort[0].attribute;
-                request['Descending'] = options.sort[0].descending;
-            }
-
-            var results = WsDfu.DFUQuery({
-                request: request
-            });
-
-            var deferredResults = new Deferred();
-            deferredResults.total = results.then(function (response) {
-                if (lang.exists("DFUQueryResponse.NumFiles", response)) {
-                    return response.DFUQueryResponse.NumFiles;
-                }
-                return 0;
-            });
-            var context = this;
-            Deferred.when(results, function (response) {
-                var logicalFiles = [];
-                for (key in context._watched) {
-                    context._watched[key].unwatch();
-                }
-                this._watched = {};
-                if (lang.exists("DFUQueryResponse.DFULogicalFiles.DFULogicalFile", response)) {
-                    arrayUtil.forEach(response.DFUQueryResponse.DFULogicalFiles.DFULogicalFile, function (item, index) {
-                        var logicalFile = context.get(item.Name);
-                        logicalFile.updateData(item);
-                        logicalFiles.push(logicalFile);
-                        context._watched[logicalFile.Name] = logicalFile.watch("changedCount", function (name, oldValue, newValue) {
-                            if (oldValue !== newValue) {
-                                context.notify(logicalFile, logicalFile.Name);
-                            }
-                        });
-                    });
-                }
-                deferredResults.resolve(logicalFiles);
-            });
-
-            return QueryResults(deferredResults);
         }
     });
 

+ 121 - 3
esp/files/scripts/ESPRequest.js

@@ -15,11 +15,16 @@
 ############################################################################## */
 define([
     "dojo/_base/declare",
+    "dojo/_base/array",
     "dojo/_base/lang",
     "dojo/_base/config",
+    "dojo/_base/Deferred",
     "dojo/request",
-    "dojo/request/script"
-], function (declare, lang, config, request, script) {
+    "dojo/request/script",
+    "dojo/store/util/QueryResults",
+    "dojo/store/Observable"
+
+], function (declare, arrayUtil, lang, config, Deferred, request, script, QueryResults, Observable) {
     var RequestHelper = declare(null, {
 
         serverIP: null,
@@ -196,6 +201,7 @@ define([
         }
     });
 
+    _StoreSingletons = [];
     return {
         flattenArray: function (target, arrayName, arrayID) {
             if (lang.exists(arrayName + ".length", target)) {
@@ -234,6 +240,118 @@ define([
         send: function (service, action, params) {
             var helper = new RequestHelper();
             return helper.send(service, action, params);
-        }
+        },
+
+        Store: declare(null, {
+            constructor: function (options) {
+                if (!this.service) {
+                    throw new Error("service:  Undefined - Missing service name (eg 'WsWorkunts').");
+                }
+                if (!this.action) {
+                    throw new Error("action:  Undefined - Missing action name (eg 'WUQuery').");
+                }
+                if (!this.responseQualifier) {
+                    throw new Error("responseQualifier:  Undefined - Missing action name (eg 'Workunits.ECLWorkunit').");
+                }
+                if (!this.idProperty) {
+                    throw new Error("idProperty:  Undefined - Missing ID field (eg 'Wuid').");
+                }
+                declare.safeMixin(this, options);
+            },
+
+            getIdentity: function (item) {
+                return item[this.idProperty];
+            },
+
+            exists: function (id) {
+                return lang.exists(this.service + "." + this.action + "." + id, _StoreSingletons);
+            },
+
+            get: function (id) {
+                if (!this.exists(id)) {
+                    var retVal = lang.getObject(this.service + "." + this.action + "." + id, true, _StoreSingletons);
+                    lang.mixin(retVal, this.create(id))
+                    return retVal;
+                }
+                return lang.getObject(this.service + "." + this.action + "." + id, false, _StoreSingletons);
+            },
+
+            create: function (id) {
+                var retVal = {
+                };
+                retVal[this.idProperty] = id;
+                return retVal;
+            },
+
+            update: function (id, item) {
+                lang.mixin(this.get(id), item);
+            },
+
+            _hasResponseContent: function(response) {
+                return lang.exists(this.action + "Response." + this.responseQualifier, response);
+            },
+
+            _getResponseContent: function(response) {
+                return lang.getObject(this.action + "Response." + this.responseQualifier, false, response);
+            },
+
+            query: function (query, options) {
+                var request = query;
+                if (options !== undefined && options.start !== undefined && options.count !== undefined) {
+                    if (this.startProperty) {
+                        request[this.startProperty] = options.start;
+                    }
+                    if (this.countProperty) {
+                        request[this.countProperty] = options.count;
+                    }
+                }
+                if (options.sort !== undefined && options.sort[0].attribute !== undefined) {
+                    request['Sortby'] = options.sort[0].attribute;
+                    if (options.sort[0].descending) {
+                        request['Descending'] = options.sort[0].descending;
+                    }
+                }
+                if (this.preRequest) {
+                    this.preRequest(request);
+                }
+                var helper = new RequestHelper();
+                var results = helper.send(this.service, this.action, {
+                    request: request
+                });
+
+                var deferredResults = new Deferred();
+                var context = this;
+                deferredResults.total = results.then(function (response) {
+                    if (context.responseTotalQualifier) {
+                        return lang.getObject(context.action + "Response." + context.responseTotalQualifier, false, response);
+                    } else if (context._hasResponseContent(response)) {
+                        return context._getResponseContent(response).length;
+                    }
+                    return 0;
+                });
+                Deferred.when(results, function (response) {
+                    var items = [];
+                    if (context._hasResponseContent(response)) {
+                        if (context.preProcessResponse) {
+                            context.preProcessResponse(lang.getObject(context.action + "Response", false, response), request);
+                        }
+                        arrayUtil.forEach(context._getResponseContent(response), function (item, index) {
+                            if (context.preProcessRow) {
+                                context.preProcessRow(item);
+                            }
+                            var storeItem = context.get(context.getIdentity(item));
+                            context.update(context.getIdentity(item), item);
+                            items.push(storeItem);
+                        });
+                    }
+                    if (context.postProcessResults) {
+                        context.postProcessResults(items);
+                    }
+                    deferredResults.resolve(items);
+                });
+
+                return QueryResults(deferredResults);
+            }
+        })
     };
 });

+ 32 - 63
esp/files/scripts/ESPResult.js

@@ -15,6 +15,7 @@
 ############################################################################## */
 define([
     "dojo/_base/declare",
+    "dojo/_base/array",
     "dojo/_base/Deferred",
     "dojo/_base/lang",
     "dojo/data/ObjectStore",
@@ -27,70 +28,36 @@ define([
     "dojox/html/entities",
 
     "hpcc/ESPBase",
+    "hpcc/ESPRequest",
     "hpcc/WsWorkunits"
-], function (declare, Deferred, lang, ObjectStore, QueryResults, Observable, domConstruct,
+], function (declare, arrayUtil, Deferred, lang, ObjectStore, QueryResults, Observable, domConstruct,
             parser, DomParser, entities,
-            ESPBase, WsWorkunits) {
-    var Store = declare(ESPBase, {
-        idProperty: "myInjectedRowNum",
-        wuid: "",
-        sequence: 0,
-        isComplete: false,
-
-        constructor: function (args) {
-            declare.safeMixin(this, args);
-        },
-
-        getIdentity: function (object) {
-            return object[this.idProperty];
-        },
-
-        queryWhenComplete: function (query, options, deferredResults) {
-            var context = this;
-            if (this.isComplete === true) {
-                var request = {};
-                if (this.name) {
-                    request['LogicalName'] = this.name;
-                } else {
-                    request['Wuid'] = this.wuid;
-                    request['Sequence'] = this.sequence;
-                }
-                request['Start'] = options.start;
-                request['Count'] = options.count;
-
-                var results = WsWorkunits.WUResult({
-                    request: request
-                });
-
-                Deferred.when(results, function (response) {
-                    if (lang.exists("WUResultResponse.Total", response)) {
-                        deferredResults.total.resolve(response.WUResultResponse.Total);
-                    } else {
-                        deferredResults.total.resolve(0);
-                    }
-
-                    var rows = [];
-                    if (lang.exists("WUResultResponse.Result", response)) {
-                        var xml = "<Result>" + response.WUResultResponse.Result + "</Result>";
-                        var domXml = parser.parse(xml);
-                        rows = context.getValues(domXml, "Row");
-                        for (var i = 0; i < rows.length; ++i) {
-                            rows[i].myInjectedRowNum = options.start + i + 1;
-                        }
-                    }
-                    deferredResults.resolve(rows);
-                });
+            ESPBase, ESPRequest, WsWorkunits) {
+
+    var Store = declare([ESPRequest.Store, ESPBase], {
+        service: "WsWorkunits",
+        action: "WUResult",
+        responseQualifier: "Result",
+        responseTotalQualifier: "Total",
+        idProperty: "rowNum",
+        startProperty: "Start",
+        countProperty: "Count",
+        preRequest: function (request) {
+            if (this.name) {
+                request['LogicalName'] = this.name;
             } else {
-                setTimeout(function () {
-                    context.queryWhenComplete(query, options, deferredResults);
-                }, 100);
+                request['Wuid'] = this.wuid;
+                request['Sequence'] = this.sequence;
             }
         },
-        query: function (query, options) {
-            var deferredResults = new Deferred();
-            deferredResults.total = new Deferred();
-            this.queryWhenComplete(query, options, deferredResults);
-            return QueryResults(deferredResults);
+        preProcessResponse: function (response, request) {
+            var xml = "<Result>" + response.Result + "</Result>";
+            var domXml = parser.parse(xml);
+            rows = this.getValues(domXml, "Row");
+            arrayUtil.forEach(rows, function (item, index) {
+                item.rowNum = request.Start + index + 1;
+            });
+            response.Result = rows;
         }
     });
 
@@ -213,7 +180,8 @@ define([
                             label: name,
                             field: name,
                             width: this.extractWidth(type, name) * 9,
-                            classes: "resultGridCell"
+                            className: "resultGridCell",
+                            sortable: false
                         });
                     }
                     if (node.hasChildNodes()) {
@@ -227,7 +195,8 @@ define([
                                 return div.innerHTML;
                             },
                             width: this.getRowWidth(node) * 9,
-                            classes: "resultGridCell"
+                            className: "resultGridCell",
+                            sortable: false
                         });
                     }
                 }
@@ -252,7 +221,7 @@ define([
                             return cell;
                         },
                         width: context.extractWidth("string12", key) * 9,
-                        classes: "resultGridCell"
+                        className: "resultGridCell"
                     });
                 }
             }
@@ -265,7 +234,7 @@ define([
                     cells: [
                         [
                             {
-                                label: "##", field: this.store.idProperty, width: 54, classes: "resultGridCell"
+                                label: "##", field: this.store.idProperty, width: 54, className: "resultGridCell", sortable: false
                             }
                         ]
                     ]

+ 23 - 71
esp/files/scripts/ESPWorkunit.js

@@ -24,87 +24,39 @@ define([
 
     "hpcc/WsWorkunits",
     "hpcc/ESPUtil",
+    "hpcc/ESPRequest",
     "hpcc/ESPResult"
 ], function (declare, arrayUtil, lang, Deferred, ObjectStore, QueryResults, Observable,
-    WsWorkunits, ESPUtil, ESPResult) {
+    WsWorkunits, ESPUtil, ESPRequest, ESPResult) {
 
     var _workunits = {};
 
-    var Store = declare(null, {
+    var Store = declare([ESPRequest.Store], {
+        service: "WsWorkunits",
+        action: "WUQuery",
+        responseQualifier: "Workunits.ECLWorkunit",
+        responseTotalQualifier: "NumWUs",
         idProperty: "Wuid",
+        startProperty: "PageStartFrom",
+        countProperty: "Count",
 
-        _watched: {},
-
-        constructor: function (options) {
-            declare.safeMixin(this, options);
-        },
-
-        getIdentity: function (object) {
-            return object[this.idProperty];
+        _watched: [],
+        create: function (id) {
+            return new Workunit({
+                Wuid: id
+            });
         },
-
-        get: function (id) {
-            if (!_workunits[id]) {
-                _workunits[id] = new Workunit({
-                    Wuid: id
+        update: function (id, item) {
+            var storeItem = this.get(id);
+            storeItem.updateData(item);
+            if (!this._watched[id]) {
+                var context = this;
+                this._watched[id] = storeItem.watch("changedCount", function (name, oldValue, newValue) {
+                    if (oldValue !== newValue) {
+                        context.notify(storeItem, id);
+                    }
                 });
             }
-            return _workunits[id];
-        },
-
-        remove: function (item) {
-            if (_workunits[this.getIdentity(item)]) {
-                _workunits[this.getIdentity(item)].stopMonitor();
-                delete _workunits[this.getIdentity(item)];
-            }
-        },
-
-        query: function (query, options) {
-            var request = query;
-            lang.mixin(request, options.query);
-            if (options.start !== undefined)
-                request["PageStartFrom"] = options.start;
-            if (options.count !== undefined)
-                request["Count"] = options.count;
-            if (options.sort !== undefined) {
-                request["Sortby"] = options.sort[0].attribute;
-                request["Descending"] = options.sort[0].descending;
-            }
-
-            var results = WsWorkunits.WUQuery({
-                request: request
-            });
-
-            var deferredResults = new Deferred();
-            deferredResults.total = results.then(function (response) {
-                if (lang.exists("WUQueryResponse.NumWUs", response)) {
-                    return response.WUQueryResponse.NumWUs;
-                }
-                return 0;
-            });
-            var context = this;
-            Deferred.when(results, function (response) {
-                var workunits = [];
-                for (key in context._watched) {
-                    context._watched[key].unwatch();
-                }
-                this._watched = {};
-                if (lang.exists("WUQueryResponse.Workunits.ECLWorkunit", response)) {
-                    arrayUtil.forEach(response.WUQueryResponse.Workunits.ECLWorkunit, function (item, index) {
-                        var wu = context.get(item.Wuid);
-                        wu.updateData(item);
-                        workunits.push(wu);
-                        context._watched[wu.Wuid] = wu.watch("changedCount", function (name, oldValue, newValue) {
-                            if (oldValue !== newValue) {
-                                context.notify(wu, wu.Wuid);
-                            }
-                        });
-                    });
-                }
-                deferredResults.resolve(workunits);
-            });
-
-            return QueryResults(deferredResults);
         }
     });
 

+ 93 - 13
esp/files/scripts/FileSpray.js

@@ -19,18 +19,86 @@ define([
     "dojo/_base/array",
     "dojo/_base/Deferred",
     "dojo/store/util/QueryResults",
-    "dojo/store/JsonRest", 
-    "dojo/store/Memory", 
-    "dojo/store/Cache", 
+    "dojo/store/JsonRest",
+    "dojo/store/Memory",
+    "dojo/store/Cache",
     "dojo/store/Observable",
-    
-    "dojox/xml/parser",    
+
+    "dojox/xml/parser",
 
     "hpcc/ESPBase",
     "hpcc/ESPRequest"
 ], function (declare, lang, arrayUtil, Deferred, QueryResults, JsonRest, Memory, Cache, Observable,
     parser,
     ESPBase, ESPRequest) {
+    var FileListStore = declare([ESPRequest.Store], {
+        service: "FileSpray",
+        action: "FileList",
+        responseQualifier: "files.PhysicalFileStruct",
+        idProperty: "calculatedID",
+        preProcessRow: function (row) {
+            lang.mixin(row, {
+                calculatedID: this.parent.calculatedID + "/" + row.name,
+                Subfolder: this.parent.Subfolder + row.name + "/",
+                DropZone: this.parent.DropZone,
+                displayName: row.name,
+                type: row.isDir ? "folder" : "file"
+            });
+        },
+        postProcessResults: function (items) {
+            items.sort(function (l, r) {
+                if (l.isDir === r.isDir) {
+                    if (l.displayName === r.displayName)
+                        return 0;
+                    else if (l.displayName < r.displayName)
+                        return -1;
+                    return 1;
+                } else if (l.isDir) {
+                    return -1;
+                }
+                return 1;
+            });
+        }
+    });
+
+    var LandingZonesStore = declare([ESPRequest.Store], {
+        service: "FileSpray",
+        action: "DropZoneFiles",
+        responseQualifier: "DropZones.DropZone",
+        idProperty: "calculatedID",
+        constructor: function (options) {
+            declare.safeMixin(this, options);
+        },
+        preProcessRow: function (row) {
+            lang.mixin(row, {
+                calculatedID: row.NetAddress,
+                displayName: row.Name,
+                type: "dropzone",
+                Subfolder: "/",
+                DropZone: row
+            });
+        },
+        mayHaveChildren: function (item) {
+            switch (item.type) {
+                case "dropzone":
+                case "folder":
+                    return true;
+            }
+            return false;
+        },
+        getChildren: function (parent, options) {
+            var store = Observable(new FileListStore({
+                parent: parent
+            }));
+            return store.query({
+                Netaddr: parent.DropZone.NetAddress,
+                Path: parent.DropZone.Path + (parent.Subfolder ? "/" + parent.Subfolder : ""),
+                Mask: "",
+                OS: parent.DropZone.Linux === "true" ? 1 : 0
+            });
+        }
+    });
+
     return {
         States: {
             0: "unknown",
@@ -44,6 +112,16 @@ define([
             8: "aborting"
         },
 
+        isComplete: function (state) {
+            switch (state) {
+                case 4:
+                case 5:
+                case 6:
+                    return true;
+            }
+            return false;
+        },
+
         CommandMessages: {
             1: "Copy",
             2: "Remove",
@@ -79,6 +157,11 @@ define([
             13: "variablebigendian"
         },
 
+        CreateLandingZonesStore: function (options) {
+            var store = new LandingZonesStore(options);
+            return Observable(store);
+        },
+
         GetDFUWorkunits: function (params) {
             return ESPRequest.send("FileSpray", "GetDFUWorkunits", params);
         },
@@ -146,14 +229,11 @@ define([
             });
             return ESPRequest.send("FileSpray", "DFUWUFile", params);
         },
-        isComplete: function (state) {
-            switch (state) {
-                case 4:	
-                case 5:	
-                case 6:	
-                    return true;
-            }
-            return false;
+        FileList: function (params) {
+            return ESPRequest.send("FileSpray", "FileList", params);
+        },
+        DropZoneFiles: function (params) {
+            return ESPRequest.send("FileSpray", "DropZoneFiles", params);
         }
     };
 });

+ 0 - 43
esp/files/scripts/WsTopology.js

@@ -25,50 +25,7 @@ define([
     "hpcc/ESPRequest"
 ], function (declare, lang, xhr, Deferred, QueryResults,
     ESPBase, ESPRequest) {
-    var TpServiceQuery =  declare(ESPBase, {
-        idProperty: "Wuid",
-
-        constructor: function (options) {
-            declare.safeMixin(this, options);
-        },
-
-        getIdentity: function (object) {
-            return object[this.idProperty];
-        },
-
-        query: function (query, options) {
-            var request = {
-                    Type: "ALLSERVICES"
-            };
-            lang.mixin(request, options.query);
-            request['rawxml_'] = "1";
-
-            var results = xhr.get({
-                url: this.getBaseURL("WsTopology") + "/TpServiceQuery",
-                handleAs: "xml",
-                content: request
-            });
-
-            var context = this;
-            var parsedResults = results.then(function (domXml) {
-                var data = context.getValues(domXml, "TpDropZone", ["TpMachine"]);
-                return data;
-            });
-
-            lang.mixin(parsedResults, {
-                total: Deferred.when(parsedResults, function (data) {
-                    return data.length;
-                })
-            });
-
-            return QueryResults(parsedResults);
-        }
-    });
-
-
     return {
-        TpServiceQuery: TpServiceQuery,
-
         TpServiceQuery: function (params) {
             lang.mixin(params.request, {
                 Type: "ALLSERVICES"