当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript QueryResults.QueryResults函数代码示例

本文整理汇总了TypeScript中dojo/store/util/QueryResults.QueryResults函数的典型用法代码示例。如果您正苦于以下问题:TypeScript QueryResults函数的具体用法?TypeScript QueryResults怎么用?TypeScript QueryResults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了QueryResults函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

    query: function (query, options) {
        var results = all([
            this.refreshResources(query),
            this.refreshAccountPermissions(query)
        ]).then(lang.hitch(this, function (response) {
            var accountPermissions = {};
            arrayUtil.forEach(response[1], function (item, idx) {
                accountPermissions[item.PermissionName] = item;
            }, this);

            var data = [];
            arrayUtil.forEach(response[0], function (item, idx) {
                var accountPermission = accountPermissions[item.name];
                data.push(lang.mixin(item, {
                    __hpcc_type: "Resources",
                    __hpcc_id: this.parentRow.__hpcc_id + CONCAT_SYMBOL + item.name,
                    __hpcc_parent: this.parentRow,
                    DisplayName: item.description ? item.description : item.name,
                    AccountName: this.groupname,
                    allow_access: accountPermission ? accountPermission.allow_access : false,
                    allow_read: accountPermission ? accountPermission.allow_read : false,
                    allow_write: accountPermission ? accountPermission.allow_write : false,
                    allow_full: accountPermission ? accountPermission.allow_full : false,
                    deny_access: accountPermission ? accountPermission.deny_access : false,
                    deny_read: accountPermission ? accountPermission.deny_read : false,
                    deny_write: accountPermission ? accountPermission.deny_write : false,
                    deny_full: accountPermission ? accountPermission.deny_full : false
                }));
            }, this);
            options = options || {};
            this.setData(SimpleQueryEngine({}, { sort: options.sort })(data));
            return this.data;
        }));
        return QueryResults(results);
    },
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:35,代码来源:ws_access.ts

示例2: function

    query: function (query, options) {
        var deferredResults = new Deferred();
        deferredResults.total = new Deferred();

        function nextItem(itemParts) {
            var part = "";
            while (itemParts.length && part.trim() === "") {
                part = itemParts[0]; itemParts.shift();
            }
            return part;
        }

        if (!query.Name) {
            deferredResults.resolve([]);
            deferredResults.total.resolve(0);
        } else {
            TpLogFile({
                request: lang.mixin({}, query, {
                    PageNumber: options.start / options.count
                })
            }).then(lang.hitch(this, function (response) {
                var data = [];
                if (lang.exists("TpLogFileResponse.LogData", response)) {
                    this.lastPage = response.TpLogFileResponse.LogData;
                    this.emit("pageLoaded", this.lastPage);
                    arrayUtil.forEach(response.TpLogFileResponse.LogData.split("\n"), function (item, idx) {
                        if (options.start === 0 || idx > 0) {
                            //  Throw away first line as it will probably only be a partial line  ---
                            var itemParts = item.split(" ");
                            var lineNo, date, time, pid, tid, details;
                            if (itemParts.length) lineNo = nextItem(itemParts);
                            if (itemParts.length) date = nextItem(itemParts);
                            if (itemParts.length) time = nextItem(itemParts);
                            if (itemParts.length) pid = nextItem(itemParts);
                            if (itemParts.length) tid = nextItem(itemParts);
                            if (itemParts.length) details = itemParts.join(" ");
                            data.push({
                                __hpcc_id: response.TpLogFileResponse.PageNumber + "_" + idx,
                                lineNo: lineNo,
                                date: date,
                                time: time,
                                pid: pid,
                                tid: tid,
                                details: details
                            });
                        }
                    }, this);
                }
                this.setData(data);
                if (lang.exists("TpLogFileResponse.TotalPages", response)) {
                    deferredResults.total.resolve(response.TpLogFileResponse.TotalPages * options.count);
                } else {
                    deferredResults.total.resolve(data.length);
                }
                return deferredResults.resolve(this.data);
            }));
        }

        return QueryResults(deferredResults);
    }
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:60,代码来源:WsTopology.ts

示例3: function

 getChildren: function (parent, options) {
     var children = [];
     if (parent.TpMachines) {
         arrayUtil.forEach(parent.TpMachines.TpMachine, function (item, idx) {
             children.push({
                 calculatedID: item.Netaddress,
                 displayName: item.ConfigNetaddress !== item.Netaddress ? item.ConfigNetaddress + " [" + item.Netaddress + "]" : item.ConfigNetaddress,
                 NetAddress: item.Netaddress,
                 ConfigNetaddress: item.ConfigNetaddress,
                 type: "machine",
                 isMachine: true,
                 isDir: false,
                 OS: item.OS,
                 fullPath: parent.fullPath,
                 DropZone: parent.DropZone
             });
         });
         return QueryResults(children);
     } else if (parent.isMachine || parent.isDir) {
         var store = Observable(new FileListStore({
             parent: parent
         }));
         return store.query({
             Netaddr: parent.NetAddress,
             Path: parent.fullPath,
             Mask: "",
             OS: parent.OS
         });
     }
 }
开发者ID:richardkchapman,项目名称:HPCC-Platform,代码行数:30,代码来源:FileSpray.ts

示例4: function

 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 !== undefined && options.sort !== undefined && options.sort[0].attribute !== undefined) {
         request[this.SortbyProperty] = options.sort[0].attribute;
         request[this.DescendingProperty] = options.sort[0].descending ? true : false;
     }
     if (this.preRequest) {
         this.preRequest(request);
     }
     var deferredResults = new Deferred();
     deferredResults.total = new Deferred();
     var helper = new RequestHelper();
     var context = this;
     helper.send(this.service, this.action, {
         request: request
     }).then(function (response) {
         if (context.preProcessFullResponse) {
             context.preProcessFullResponse(response, request, query, options);
         }
         var items = [];
         if (context._hasResponseContent(response)) {
             if (context.preProcessResponse) {
                 var responseQualiferArray = context.responseQualifier.split(".");
                 context.preProcessResponse(lang.getObject(responseQualiferArray[0], false, response), request, query, options);
             }
             arrayUtil.forEach(context._getResponseContent(response), function (item, index) {
                 if (context.preProcessRow) {
                     context.preProcessRow(item, request, query, options);
                 }
                 var storeItem = context.get(context.getIdentity(item), item);
                 context.update(context.getIdentity(item), item);
                 items.push(storeItem);
             });
         }
         if (context.postProcessResults) {
             context.postProcessResults(items);
         }
         if (context.responseTotalQualifier) {
             deferredResults.total.resolve(lang.getObject(context.responseTotalQualifier, false, response));
         } else if (context._hasResponseContent(response)) {
             deferredResults.total.resolve(items.length);
         } else {
             deferredResults.total.resolve(0);
         }
         if (deferredResults.isResolved()) {
             debugger;
         }
         deferredResults.resolve(items);
         return response;
     });
     return QueryResults(deferredResults);
 }
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:60,代码来源:ESPRequest.ts

示例5: function

 query: function (query, options) {
     switch (query.CountBy) {
         case "Year":
         case "Quarter":
         case "Month":
         case "Day":
             query.Interval = query.CountBy;
             query.CountBy = "Date";
             break;
     }
     var deferredResults = new Deferred();
     deferredResults.total = new Deferred();
     DFUSpace({
         request: query
     }).then(lang.hitch(this, function (response) {
         var data = [];
         if (lang.exists("DFUSpaceResponse.DFUSpaceItems.DFUSpaceItem", response)) {
             arrayUtil.forEach(response.DFUSpaceResponse.DFUSpaceItems.DFUSpaceItem, function (item, idx) {
                 data.push(lang.mixin(item, {
                     __hpcc_id: item.Name
                 }));
             }, this);
         }
         if (options.sort && options.sort.length) {
             data.sort(function (_l, _r) {
                 var l = _l[options.sort[0].attribute];
                 var r = _r[options.sort[0].attribute];
                 if (l === r) {
                     return 0;
                 }
                 switch (options.sort[0].attribute) {
                     case "TotalSize":
                     case "LargestSize":
                     case "SmallestSize":
                     case "NumOfFiles":
                     case "NumOfFilesUnknown":
                         l = parseInt(l.split(",").join(""));
                         r = parseInt(r.split(",").join(""));
                 }
                 if (options.sort[0].descending) {
                     return r < l ? -1 : 1;
                 }
                 return l < r ? -1 : 1;
             })
         }
         this.setData(data);
         deferredResults.resolve(data);
         deferredResults.total.resolve(data.length);
     }));
     return QueryResults(deferredResults);
 }
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:51,代码来源:WsDfu.ts

示例6: function

 getChildren: function (treeNode, options) {
     var data = [];
     if (treeNode.__hpcc_children.length) {
         data = treeNode.__hpcc_children;
     } else {
         switch (this._viewMode) {
             case "Targets":
                 data = arrayUtil.map(treeNode.__hpcc_treeItem.__hpcc_children, function (item) {
                     return this.createTreeNode(treeNode, item);
                 }, this);
                 break;
             case "Services":
                 if (!treeNode.__hpcc_parentNode) {
                     arrayUtil.forEach(treeNode.__hpcc_treeItem.__hpcc_children, function (child) {
                         var serviceNode = this.createTreeNode(treeNode, child);
                         var machines = [];
                         var bindings = [];
                         arrayUtil.forEach(child.__hpcc_children, function (gchild) {
                             if (gchild instanceof TpMachine) {
                                 machines.push(gchild);
                             } else if (gchild instanceof TpBinding) {
                                 bindings.push(gchild);
                             }
                         }, this);
                         arrayUtil.forEach(bindings, function (binding) {
                             var bindingNode = this.createTreeNode(serviceNode, binding);
                             arrayUtil.forEach(machines, function (machine) {
                                 this.createTreeNode(bindingNode, machine);
                             }, this);
                         }, this);
                         arrayUtil.forEach(machines, function (machine) {
                             var machineNode = this.createTreeNode(serviceNode, machine);
                             arrayUtil.forEach(bindings, function (binding) {
                                 this.createTreeNode(machineNode, binding);
                             }, this);
                         }, this);
                         data.push(serviceNode);
                     }, this);
                 }
                 break;
             case "Debug":
                 data = arrayUtil.map(treeNode.__hpcc_treeItem.__hpcc_children, function (item) {
                     return this.createTreeNode(treeNode, item);
                 }, this);
                 break;
             default:
                 break;
         }
     }
     return QueryResults(this.queryEngine({}, {})(data));
 },
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:51,代码来源:ESPTopology.ts

示例7: function

    query: function (query, options) {
        var request = {};
        lang.mixin(request, options.query);
        if (options.query.Target)
            request['Target'] = options.query.Target;
        if (options.query.Process)
            request['Process'] = options.query.Process;
        if (options.query.ProcessFilter)
            request['ProcessFilter'] = options.query.ProcessFilter;

        var results = WsPackageMaps.PackageMapQuery({
            request: request
        });

        var deferredResults = new Deferred();
        deferredResults.total = results.then(function (response) {
            if (lang.exists("ListPackagesResponse.NumPackages", response)) {
                return response.ListPackagesResponse.NumPackages;
            }
            return 0;
        });
        var context = this;
        Deferred.when(results, function (response) {
            var packageMaps = [];
            for (var key in context._watched) {
                context._watched[key].unwatch();
            }
            this._watched = {};
            if (lang.exists("ListPackagesResponse.PackageMapList.PackageListMapData", response)) {
                arrayUtil.forEach(response.ListPackagesResponse.PackageMapList.PackageListMapData, function (item, index) {
                    var packageMap = context.get(item.Id);
                    packageMap.updateData(item);
                    packageMaps.push(packageMap);
                    context._watched[packageMap.Id] = packageMap.watch("__hpcc_changedCount", function (name, oldValue, newValue) {
                        if (oldValue !== newValue) {
                            context.notify(packageMap, packageMap.Id);
                        }
                    });
                });
                if (options.sort) {
                    packageMaps = context.sortPackageMaps(packageMaps, options.sort[0]);
                }
            }
            deferredResults.resolve(packageMaps);
        });

        return QueryResults(deferredResults);
    }
开发者ID:richardkchapman,项目名称:HPCC-Platform,代码行数:48,代码来源:ESPPackageProcess.ts

示例8: function

 getChildren: function (parent, options) {
     return QueryResults(this._fetchFiles(parent.__hpcc_childScope));
 },
开发者ID:richardkchapman,项目名称:HPCC-Platform,代码行数:3,代码来源:ESPLogicalFile.ts


注:本文中的dojo/store/util/QueryResults.QueryResults函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。