@hpcc-js/eclwatch 3.2.10 → 3.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -40
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +11 -11
- package/src/WUResult.ts +6 -1
- package/src/WUResultStore.ts +7 -2
- package/types/WUResultStore.d.ts +2 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".eclwatch_WUGraphLegend .graph_Vertex{cursor:auto}.eclwatch_WUGraphLegend .graph_Vertex .common_Icon{cursor:pointer}.eclwatch_WUGraph .graph_Vertex{cursor:auto}.eclwatch_WUGraph .marker{fill:#656565;stroke:none;stroke-width:1px}.eclwatch_WUGraph .zoom{fill:none;pointer-events:all}.eclwatch_WUGraph .selectionBrush{fill:none;stroke:#a9a9a9}.d3-tip .eclwatch_WUGraph_Tooltip h3,.d3-tip .eclwatch_WUGraph_Tooltip h4{margin:0}.d3-tip .eclwatch_WUGraph_Tooltip table{border-collapse:separate;border-spacing:5px}.d3-tip .eclwatch_WUGraph_Tooltip table .key{font-weight:700}.d3-tip .eclwatch_WUGraph_Tooltip table .value{font-weight:400}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
1
|
(function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@hpcc-js/codemirror"),require("@hpcc-js/comms"),require("@hpcc-js/phosphor"),require("@hpcc-js/tree"),require("@hpcc-js/util"),require("@hpcc-js/common"),require("@hpcc-js/dgrid"),require("@hpcc-js/graph"),require("@hpcc-js/layout"),require("@hpcc-js/timeline")):typeof define=="function"&&define.amd?define(["exports","@hpcc-js/codemirror","@hpcc-js/comms","@hpcc-js/phosphor","@hpcc-js/tree","@hpcc-js/util","@hpcc-js/common","@hpcc-js/dgrid","@hpcc-js/graph","@hpcc-js/layout","@hpcc-js/timeline"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global["@hpcc-js/eclwatch"]={},global["@hpcc-js/codemirror"],global["@hpcc-js/comms"],global["@hpcc-js/phosphor"],global["@hpcc-js/tree"],global["@hpcc-js/util"],global["@hpcc-js/common"],global["@hpcc-js/dgrid"],global["@hpcc-js/graph"],global["@hpcc-js/layout"],global["@hpcc-js/timeline"]))})(this,function(exports2,codemirror,comms,phosphor,tree,util,common,dgrid,graph,layout,timeline){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);const PKG_NAME="@hpcc-js/eclwatch",PKG_VERSION="3.1.1",BUILD_VERSION="3.2.1";class ECLArchiveViewer extends phosphor.SplitPanel{constructor(){super("horizontal");__publicField(this,"_prevHash");__publicField(this,"_contentStr");__publicField(this,"_directoryPane",new tree.DirectoryTree);__publicField(this,"_fileEditorPane",new codemirror.Editor().text(""));this._directoryPane.rowClick=text=>{this._fileEditorPane.text(text).render()}}transformArchiveTreeData(json){const ret={label:json.name,children:json._children.map(transformNode).filter(n=>n)};if(ret.children&&ret.children[0]&&ret.children[0].label==="html")return{label:"root",children:[{label:"error",content:JSON.stringify(ret,null,4)}]};return ret;function transformNode(node){const _node={};if(_node.label=node.name+(node.$&&node.$.key?` (${node.$.key})`:""),node._children&&node._children.length>0)_node.children=node._children.map(_node2=>transformNode(_node2)).filter(n=>n);else if(typeof node.content=="string"&&node.content.trim())_node.content=node.content;else return!1;return _node}}updateDirectoryPane(contentStr){let json;if(contentStr)try{json=JSON.parse(contentStr)}catch{json=util.xml2json(contentStr)}if(json){const _data=this.transformArchiveTreeData(json);this._directoryPane.data(_data).render()}}enter(domNode,element){super.enter(domNode,element),this.addWidget(this._directoryPane).addWidget(this._fileEditorPane)}update(domNode,element){super.update(domNode,element);const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==hash||typeof this._contentStr>"u"?comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchArchive().then(resp=>{this._contentStr=resp,this.updateDirectoryPane(this._contentStr),this._prevHash=hash}):this.updateDirectoryPane(this._contentStr),this.relativeSizes([this.directoryWidthRatio(),1-this.directoryWidthRatio()])}}ECLArchiveViewer.prototype._class+=" eclwatch_ECLArchiveViewer",ECLArchiveViewer.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),ECLArchiveViewer.prototype.publish("wuid","","string","Workunit ID"),ECLArchiveViewer.prototype.publish("directoryWidthRatio",.38,"number","Default directory panel width ratio relative to the full width"),ECLArchiveViewer.prototype.publish("contentString",null,"string","XML/JSON archive content string"),ECLArchiveViewer.prototype.publishProxy("directoryPaneColor","_directoryPane","backgroundColor"),ECLArchiveViewer.prototype.publishProxy("directoryPaneHoverColor","_directoryPane","hoverBackgroundColor"),ECLArchiveViewer.prototype.publishProxy("iconSize","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("fontColor","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("fontFamily","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("fontSize","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("folderIconOpen","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("folderIconClosed","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("textFileIcon","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("codeFileIcon","_directoryPane"),ECLArchiveViewer.prototype.publishProxy("verticalScroll","_directoryPane");class LegendVertex extends graph.Vertex{constructor(){super()}enter(domNode,element){super.enter(domNode,element),this._icon.on("click",()=>{this.click(this.data())})}click(kind){}}class WUGraphLegend extends layout.Legend{constructor(){super(...arguments);__publicField(this,"icon",common.local());__publicField(this,"_disabled2",{})}disabled(_){if(!arguments.length){const retVal=[];for(const key in this._disabled2)this._disabled2[key]&&retVal.push(key);return retVal}return this._disabled2={},_.forEach(kind=>this._disabled2[kind]=!0),this}toggle(kind){this._disabled2[kind]=!this._disabled2[kind]}update(domNode,element){super.update(domNode,element);const context=this,items=this._g.selectAll(".legendItem").data(this.data(),d=>d.kind);items.enter().append("g").attr("class","legendItem").each(function(d){context.icon.set(this,new LegendVertex().target(this).data(d.kind).textbox_shape_colorStroke("none").textbox_shape_colorFill("none").iconAnchor("left").faChar(d.faChar).text(`${d.label} (${d.count})`).tooltip(`${d.kind} - ${d.label}`).on("click",kind=>{context.toggle(kind),context.render(),context.click(kind)}).on("mouseover",kind=>{context.mouseover(kind)}).on("mouseout",kind=>{context.mouseout(kind)}))}).merge(items).each(function(d,i){const bbox2=context.icon.get(this).icon_shape_colorFill(context._disabled2[d.kind]?"gray":null).render().getBBox();common.select(this).attr("transform",`translate(${+bbox2.width/2}, ${i*30})`)}),items.exit().each(function(d){context.icon.get(this).target(null).render()}).remove();const bbox=this.getBBox(!0,!0);this._g.attr("transform",`translate(16, ${this.height()/2-bbox.height/2})`)}click(kind){}mouseover(kind){}mouseout(kind){}}WUGraphLegend.prototype._class+=" eclwatch_WUGraphLegend";function faCharFactory(kind){switch(kind){case"2":return"";case"3":return"";case"5":return"";case"6":return"";case"12":return"";case"15":return"";case"17":return"";case"22":return"";case"23":return"";case"25":return"";case"26":return"";case"29":return"";case"36":return"";case"44":return"";case"47":return"";case"54":return"";case"56":return"";case"59":return"";case"61":return"";case"82":return"";case"88":return"";case"92":return"";case"93":return"";case"99":return"";case"105":return"";case"7":return"";case"9":return"";case"16":return"";case"19":return"";case"21":return"";case"35":return"";case"37":return"";case"71":return"";case"133":return"";case"148":return"";case"168":return""}return""}class WUScopeController{constructor(){__publicField(this,"graphDB");__publicField(this,"subgraphsMap",{});__publicField(this,"rSubgraphsMap",{});__publicField(this,"verticesMap",{});__publicField(this,"rVerticesMap",{});__publicField(this,"edgesMap",{});__publicField(this,"rEdgesMap",{});__publicField(this,"kindMap",{});__publicField(this,"_disabled",{})}clear(){this.subgraphsMap={},this.rSubgraphsMap={},this.verticesMap={},this.rVerticesMap={},this.edgesMap={},this.rEdgesMap={}}set(masterGraph){this.graphDB=masterGraph,this.graphGui(this.graphDB),this.kindMap={},this.graphDB.walk(item=>{if(!(item instanceof util.Subgraph)){if(item instanceof util.Vertex){const kind=item._.attr("Kind").RawValue;this.kindMap[kind]||(this.kindMap[kind]=[]),this.kindMap[kind].push(item)}}})}disabled(_){if(!arguments.length){const retVal=[];for(const key in this._disabled)this._disabled[key]&&retVal.push(key);return retVal}return this._disabled={},_.forEach(kind=>this._disabled[kind]=!0),this}graphGui(graphDB){const graphGui={subgraphs:[],vertices:[],edges:[],hierarchy:[]};return graphDB.walk(item=>{if(item instanceof util.Subgraph){const subgraph=this.appendSubgraph(item,graphGui.hierarchy,graphGui.subgraphs);subgraph.showMinMax(item.vertices.length>3||subgraph.minState()!=="normal")}else item instanceof util.Vertex?this.appendVertex(item,graphGui.hierarchy,graphGui.vertices):item instanceof util.Edge&&this.appendEdge(item,graphGui.edges)}),graphGui}format(labelTpl,obj){let retVal="",lpos=labelTpl.indexOf("%"),rpos=-1;for(;lpos>=0;){if(retVal+=labelTpl.substring(rpos+1,lpos),rpos=labelTpl.indexOf("%",lpos+1),rpos<0){console.warn("Invalid Label Template");break}const key=labelTpl.substring(lpos+1,rpos);retVal+=key?obj[labelTpl.substring(lpos+1,rpos)]||"":"%",lpos=labelTpl.indexOf("%",rpos+1)}return retVal+=labelTpl.substring(rpos+1,labelTpl.length),retVal.split("\\n").join(`
|
|
3
2
|
`)}createSubgraph(subgraph){let sg=this.subgraphsMap[subgraph._.Id];return sg||(sg=new graph.Subgraph().title(subgraph._.Id).on("minClick",()=>{this.minClick(sg)}),this.subgraphsMap[subgraph._.Id]=sg,this.rSubgraphsMap[sg.id()]=subgraph),sg}createVertex(vertex){let v=this.verticesMap[vertex._.Id];if(!v){const attrs=vertex._.rawAttrs();if(vertex._.ScopeType==="dummy"){const parent=this.subgraphsMap[vertex.parent._.Id];v=new common.Icon().shape_colorFill("darkred").shape_colorStroke("darkred").image_colorFill("white").faChar("").on("click",()=>{parent.minState("normal"),this.minClick(parent)})}else{v=new graph.Vertex().icon_shape_colorFill("#1f77b4").icon_image_colorFill("white").faChar(faCharFactory(attrs.Kind)).text(attrs.Label);const annotations=[];vertex._.hasAttr("Definition")&&annotations.push({faChar:"",tooltip:"Definition",shape_colorFill:"lightgray",shape_colorStroke:"lightgray",image_colorFill:"black"}),vertex._.hasAttr("IsInternal")&&annotations.push({faChar:"",tooltip:"IsInternal",shape_colorFill:"red",shape_colorStroke:"red",image_colorFill:"white"}),v.annotationIcons(annotations)}this.verticesMap[vertex._.Id]=v,this.rVerticesMap[v.id()]=vertex}return v}isSpill(edge){const sourceKind=edge.source._.attr("Kind").RawValue,targetKind=edge.target._.attr("Kind").RawValue;return sourceKind==="2"||targetKind==="71"}spansSubgraph(edge){return edge.source.parent._.Id!==edge.target.parent._.Id}createEdge(edge){let e=this.edgesMap[edge._.Id];if(!e){const attrs=edge._.rawAttrs(),sourceV=this.verticesMap[edge.source._.Id],targetV=this.verticesMap[edge.target._.Id];if(sourceV&&targetV){const isSpill=this.isSpill(edge),spansSubgraph=this.spansSubgraph(edge),label=this.format(`%Label%
|
|
4
3
|
%NumRowsProcessed%`,attrs);let strokeDasharray=null,weight=100;attrs.IsDependency?(weight=10,strokeDasharray="1,5"):attrs._childGraph?strokeDasharray="5,5":isSpill?(weight=25,strokeDasharray="5,5,10,5"):spansSubgraph&&(weight=5,strokeDasharray="5,5"),e=new graph.Edge().sourceVertex(sourceV).targetVertex(targetV).sourceMarker("circle").targetMarker("arrow").weight(weight).strokeDasharray(strokeDasharray).text(label),this.edgesMap[edge._.Id]=e,this.rEdgesMap[e.id()]=edge}}return e}appendSubgraph(subgraph,hierarchy,subgraphs){const sg=this.createSubgraph(subgraph);subgraphs.push(sg);const parent=this.subgraphsMap[subgraph.parent._.Id];return parent&&hierarchy.push({parent,child:sg}),sg}appendVertex(vertex,hierarchy,vertices){const v=this.createVertex(vertex);vertices.push(v);const parent=this.subgraphsMap[vertex.parent._.Id];return parent&&hierarchy.push({parent,child:v}),v}appendEdge(edge,edges){const e=this.createEdge(edge);return e&&edges.push(e),e}filterLegend(graphDB){for(let i=graphDB.vertices.length-1;i>=0;--i){const vertex=graphDB.vertices[i],kind=vertex._.attr("Kind").RawValue;this._disabled[kind]&&vertex.remove(!1,(source,target)=>new comms.BaseScope({ScopeName:vertex._.ScopeName+":in",Id:source.Id+"->"+target.Id,ScopeType:"dummy-edge",Properties:{Property:[vertex._.attr("Label")]},Notes:{Note:[]},SinkActivity:""}))}}filterPartial(graphDB){for(const subgraph of graphDB.subgraphs)switch(this.subgraphsMap[subgraph._.Id].minState()){case"partial":const childVertices=subgraph.vertices,vShow=[],vHide=[];for(const vertex of childVertices)vertex.inEdges.length===0||vertex.inEdges.some(edge=>edge.source.parent!==edge.target.parent)||vertex.outEdges.length===0||vertex.outEdges.some(edge=>edge.source.parent!==edge.target.parent)?vShow.push(vertex):vHide.push(vertex);if(vHide.length>1){const dummyDetails={ScopeName:subgraph._.ScopeName,Id:subgraph._.Id+":dummy",ScopeType:"dummy",Properties:{Property:[{Name:"Activities",RawValue:""+vHide.length,Formatted:""+vHide.length,Measure:"count",Creator:"",CreatorType:""}]},Notes:{Note:[]},SinkActivity:""},dummyScope=new comms.BaseScope(dummyDetails),dummyVertex=subgraph.createVertex(dummyScope);for(const vertex of vHide){for(const edge of vertex.inEdges)if(vShow.indexOf(edge.source)>=0){const dummyEdgeScope=new comms.BaseScope({ScopeName:edge.source._.ScopeName,Id:edge.source._.Id+"->"+dummyVertex._.Id,ScopeType:"dummy-in",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});subgraph.createEdge(edge.source,dummyVertex,dummyEdgeScope)}for(const edge of vertex.outEdges)if(vShow.indexOf(edge.target)>=0){const dummyEdgeScope=new comms.BaseScope({ScopeName:edge.target._.ScopeName,Id:dummyVertex._.Id+"->"+edge.target._.Id,ScopeType:"dummy-out",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});subgraph.createEdge(dummyVertex,edge.target,dummyEdgeScope)}}vHide.forEach(vertex=>vertex.remove(!0))}break}}filterEmptySubgraphs(graphDB){for(;;){const emptySubgraphs=graphDB.subgraphs.filter(subgraph=>subgraph.subgraphs.length===0&&subgraph.vertices.length===0);if(emptySubgraphs.length===0)break;emptySubgraphs.forEach(subgraph=>subgraph.remove(!0))}}removeObsoleteSubgraphs(graphDB){for(const subgraph of[...graphDB.subgraphs])subgraph.vertices.length===0&&subgraph.remove(!1)}graphData(){const graphDB=this.graphDB.clone();return this.filterLegend(graphDB),this.filterPartial(graphDB),this.filterEmptySubgraphs(graphDB),this.removeObsoleteSubgraphs(graphDB),this.graphGui(graphDB)}calcLegend(){const retVal=[];for(const kind in this.kindMap)retVal.push({kind:parseInt(kind),faChar:faCharFactory(kind),label:this.kindMap[kind][0]._.attr("Label").RawValue.split(`
|
|
5
|
-
`)[0],count:this.kindMap[kind].length});return retVal}vertices(kind){const retVal=[];for(const v of this.kindMap[kind])retVal.push(this.verticesMap[v._.Id]);return retVal}formatRow(item,columns2,row){const attrs=item._.formattedAttrs();for(const key in attrs){const idx=columns2.indexOf(key);idx===-1?(columns2.push(key),row.push(attrs[key])):row[idx]=attrs[key]}for(let i=0;i<100;++i)row[i]===void 0&&(row[i]="");return row}activityData(){const columns2=["Id","Kind","Label"],data=this.graphDB.vertices.map(v=>{const row=[parseInt(v._.Id.split("a")[1])];return this.formatRow(v,columns2,row)});return{columns:columns2,data}}edgeData(){const columns2=["Id","Label"],data=this.graphDB.edges.map(e=>{const row=[e._.Id];return this.formatRow(e,columns2,row)});return{columns:columns2,data}}subgraphData(){const columns2=["Id","Label"],data=this.graphDB.subgraphs.map(sg=>{const row=[sg._.Id];return this.formatRow(sg,columns2,row)});return{columns:columns2,data}}calcGraphTooltip(item){let scope,parentScope;if(item instanceof graph.Subgraph){const subgraph=this.rSubgraphsMap[item.id()];scope=subgraph._,parentScope=subgraph.parent._}else if(item instanceof graph.Vertex||item instanceof common.Icon){const vertex=this.rVerticesMap[item.id()];scope=vertex._,parentScope=vertex.parent._}else if(item instanceof graph.Edge){const edge=this.rEdgesMap[item.id()];scope=edge._,parentScope=edge.parent._}return scope?scope.calcTooltip(parentScope):""}subgraph(id){return this.subgraphsMap[id]}vertex(id){return this.verticesMap[id]}edge(id){return this.edgesMap[id]}minClick(sg){}}class WUGraph extends layout.ChartPanel{constructor(){super();__publicField(this,"_partialAll",new common.Button().faChar("fa-window-restore").tooltip("Partial All").on("click",()=>{this.stateClick(this._partialAll)}));__publicField(this,"_maxAll",new common.Button().faChar("fa-window-maximize").tooltip("Max All").on("click",()=>{this.stateClick(this._maxAll)}));__publicField(this,"_toggleGraph",new common.ToggleButton().faChar("fa-chain").tooltip("Graph").selected(!0).on("click",()=>{this.viewClick(this._toggleGraph)}));__publicField(this,"_toggleActivities",new common.ToggleButton().faChar("fa-table").tooltip("Activitiies").selected(!1).on("click",()=>{this.viewClick(this._toggleActivities)}));__publicField(this,"_toggleEdges",new common.ToggleButton().faChar("fa-table").tooltip("Edges").selected(!1).on("click",()=>{this.viewClick(this._toggleEdges)}));__publicField(this,"_toggleSubgraphs",new common.ToggleButton().faChar("fa-table").tooltip("Subgraphs").selected(!1).on("click",()=>{this.viewClick(this._toggleSubgraphs)}));__publicField(this,"_graph",new graph.Graph().layout("Hierarchy").applyScaleOnLayout(!0).showToolbar(!1).allowDragging(!1));__publicField(this,"_activities",new dgrid.Table().pagination(!1));__publicField(this,"_edges",new dgrid.Table().pagination(!1));__publicField(this,"_subgraphs",new dgrid.Table().pagination(!1));__publicField(this,"_legend",new WUGraphLegend(this).on("click",kind=>{this.render()}).on("mouseover",kind=>{const verticesMap={};for(const vertex of this._gc.vertices(kind))verticesMap[vertex.id()]=!0;this._graph.highlightVerticies(verticesMap)}).on("mouseout",kind=>{this._graph.highlightVerticies()}));__publicField(this,"_view",new layout.Carousel().widgets([this._graph,this._activities,this._edges,this._subgraphs]));__publicField(this,"_gc",new WUScopeController);__publicField(this,"_prevHashSum");__publicField(this,"_prevScopeGraph");this.topOverlay(!1),this.widget(this._view);const buttons=[this._toggleGraph,this._toggleActivities,this._toggleEdges,this._toggleSubgraphs,new common.Spacer,this._partialAll,this._maxAll,new common.Spacer,...this._graph.iconBarButtons(),new common.Spacer];this.buttons(buttons.concat(this.buttons())),this._gc.minClick=sg=>{this.loadGraph(),this._graph.render(w=>{this._graph.selection([sg]).centerOnItem(sg)})},this._graph.tooltipHTML(v=>this._gc.calcGraphTooltip(v))}stateClick(sourceB){switch(sourceB){case this._partialAll:this._graph.data().subgraphs.forEach(sg=>{sg.minState("partial")});break;case this._maxAll:this._graph.data().subgraphs.forEach(sg=>{sg.minState("normal")});break}this.render()}viewClick(sourceTB){switch(this._toggleGraph.selected(sourceTB===this._toggleGraph),this._toggleActivities.selected(sourceTB===this._toggleActivities),this._toggleEdges.selected(sourceTB===this._toggleEdges),this._toggleSubgraphs.selected(sourceTB===this._toggleSubgraphs),sourceTB){case this._toggleGraph:this._view.active(0);break;case this._toggleActivities:this._view.active(1);break;case this._toggleEdges:this._view.active(2);break;case this._toggleSubgraphs:this._view.active(3);break}this.render(w=>{})}fetchScopeGraph(){const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),graphID:this.graphID(),subgraphID:this.subgraphID()});return!this._prevScopeGraph||this._prevHashSum!==hash?(this.startProgress(),this._prevHashSum=hash,this._gc.clear(),comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchGraphs().then(graphs=>{for(const graph2 of graphs)if(graph2.Name===this.graphID())return this.finishProgress(),graph2.fetchScopeGraph(this.subgraphID())}).then(scopeGraph=>(this._prevScopeGraph=scopeGraph,this._prevScopeGraph))):Promise.resolve(this._prevScopeGraph)}enter(domNode,_element){super.enter(domNode,_element)}update(domNode,element){super.update(domNode,element)}exit(domNode,element){super.exit(domNode,element)}loadGraph(){this._gc.disabled(this._legend.disabled()),this._graph.data(this._gc.graphData(),!0);{const{columns:columns2,data}=this._gc.activityData();this._activities.columns(columns2).data(data)}{const{columns:columns2,data}=this._gc.edgeData();this._edges.columns(columns2).data(data)}{const{columns:columns2,data}=this._gc.subgraphData();this._subgraphs.columns(columns2).data(data)}}render(callback){return this.wuid()&&this.graphID()?this.fetchScopeGraph().then(scopedGraph=>{this._gc.set(scopedGraph),this._legend.data(this._gc.calcLegend()),this.loadGraph(),super.render(callback)}):super.render(callback),this}selection(_){if(!arguments.length)return this._graph.selection();const item=this._gc.vertex(_)||this._gc.edge(_)||this._gc.subgraph(_);return item&&this._graph.selection([item]),this}}WUGraph.prototype._class+=" eclwatch_WUGraph",WUGraph.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),WUGraph.prototype.publish("wuid","","string","Workunit ID"),WUGraph.prototype.publish("graphID","","string","Graph ID"),WUGraph.prototype.publish("subgraphID","","string","Subgraph ID");function entitiesEncode(str){return String(str).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function safeEncode(item){switch(Object.prototype.toString.call(item)){case"[object Undefined]":case"[object Boolean]":case"[object Number]":return item;case"[object String]":return entitiesEncode(item);default:console.warn("Unknown cell type: "+Object.prototype.toString.call(item))}return item}class Store{constructor(wuResult,schema,renderHtml,filter={}){__publicField(this,"wuResult");__publicField(this,"schema");__publicField(this,"_columns");__publicField(this,"_cache",{});__publicField(this,"rowFormatter");__publicField(this,"_filter",{});this.wuResult=wuResult,this.schema=schema,this._columns=this.schema2Columns(this.schema.root),this.rowFormatter=new dgrid.RowFormatter(this._columns,renderHtml),this._filter=filter}columns(){return this._columns}schema2Columns(parentNode,prefix=""){return parentNode?parentNode.children().filter(node=>node.name.indexOf("__hidden",node.name.length-8)===-1).map((node,idx)=>{const label=node.name,keyed=node.attrs["hpcc:keyed"],column={field:prefix+label,leafID:label,idx,label:label+(keyed?" (i)":""),className:"resultGridCell",sortable:!1,width:keyed?16:0,isSet:node.isSet},children=this.schema2Columns(node,prefix+label+"_");return children.length?(column.width+=10+children.reduce((prev,childNode)=>prev+childNode.width,0),column.children=children):(column.width+=node.charWidth()*9,column.formatter=(cell,row)=>{switch(typeof cell){case"string":return{html:cell.replace(/\t/g," ").trim()};case"undefined":return""}return cell}),column}):[]}isChildDataset(cell){if(Object.prototype.toString.call(cell)!=="[object Object]")return!1;let propCount=0,firstPropType=null;for(const key in cell)firstPropType||(firstPropType=Object.prototype.toString.call(cell[key])),propCount++;return propCount===1&&firstPropType==="[object Array]"}rowToTable(cell,__row,node){if(this.isChildDataset(cell)){for(const key in cell)this.rowToTable(cell[key],__row,node);return}const table=dgrid.domConstruct.create("table",{border:1,cellspacing:0,width:"100%"},node);switch(Object.prototype.toString.call(cell)){case"[object Object]":let tr=dgrid.domConstruct.create("tr",null,table);for(const key in cell)dgrid.domConstruct.create("th",{innerHTML:safeEncode(key)},tr);tr=dgrid.domConstruct.create("tr",null,table);for(const key in cell)switch(Object.prototype.toString.call(cell[key])){case"[object Object]":case"[object Array]":this.rowToTable(cell[key],__row,node);break;default:dgrid.domConstruct.create("td",{innerHTML:safeEncode(cell[key])},tr);break}break;case"[object Array]":for(let i=0;i<cell.length;++i)switch(Object.prototype.toString.call(cell[i])){case"[object Boolean]":case"[object Number]":case"[object String]":const tr1=dgrid.domConstruct.create("tr",null,table);dgrid.domConstruct.create("td",{innerHTML:safeEncode(cell[i])},tr1);break;default:if(i===0){const tr2=dgrid.domConstruct.create("tr",null,table);for(const key in cell[i])dgrid.domConstruct.create("th",{innerHTML:safeEncode(key)},tr2)}dgrid.domConstruct.create("tr",null,table);for(const key in cell[i])if(cell[i][key])if(Object.prototype.toString.call(cell[i][key])==="[object Object]"||Object.prototype.toString.call(cell[i][key])==="[object Array]"){const td=dgrid.domConstruct.create("td",null,tr1);this.rowToTable(cell[i][key],cell[i],td)}else if(key.indexOf("__html",key.length-6)!==-1)dgrid.domConstruct.create("td",{innerHTML:cell[i][key]},tr1);else if(key.indexOf("__javascript",key.length-12)!==-1)dgrid.domConstruct.create("td",null,tr1);else{const val=cell[i][key];dgrid.domConstruct.create("td",{innerHTML:safeEncode(val)},tr1)}else dgrid.domConstruct.create("td",{innerHTML:""},tr1)}break}}getIdentity(row){return row.__hpcc_id}_request(start,end){if(!this.wuResult)return Promise.resolve({totalLength:0,data:[]});const cacheKey=`${start}->${end}`;if(this._cache[cacheKey])return this._cache[cacheKey];const retVal=this.wuResult.fetchRows(start,end-start,!1,this._filter).then(rows=>({totalLength:this.wuResult.Total,data:rows.map((row,idx)=>{const formattedRow=this.rowFormatter.format(row);return formattedRow.__hpcc_id=start+idx,formattedRow.__hpcc_orig=row,formattedRow})}));return this._cache[cacheKey]=retVal,retVal}fetchRange(options){const retVal=new dgrid.Deferred;return this._request(options.start,options.end).then(response=>retVal.resolve(response)),new dgrid.QueryResults(retVal.then(response=>response.data),{totalLength:retVal.then(response=>response.totalLength)})}}class WUResult extends dgrid.Common{constructor(){super();__publicField(this,"_result");__publicField(this,"_localStore");__publicField(this,"_prevResultHash");__publicField(this,"_prevStoreHash");__publicField(this,"_prevQueryHash");this.renderHtml(!1)}hashSum(opts={}){return util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),resultName:this.resultName(),sequence:this.sequence(),nodeGroup:this.nodeGroup(),logicalFile:this.logicalFile(),userID:this.user(),password:this.password(),...opts})}calcResult(){const resultHash=this.hashSum();if(this._prevResultHash!==resultHash){this._prevResultHash=resultHash;const opts={baseUrl:this.baseUrl(),userID:this.user(),password:this.password()};this.wuid()&&this.resultName()?this._result=comms.Result.attach(opts,this.wuid(),this.resultName()):this.wuid()&&this.sequence()!==void 0?this._result=comms.Result.attach(opts,this.wuid(),this.sequence()):this.logicalFile()&&this.nodeGroup()?this._result=comms.Result.attachLogicalFile(opts,this.nodeGroup(),this.logicalFile()):this.logicalFile()&&(this._result=comms.Result.attachLogicalFile(opts,"",this.logicalFile()))}return this._result}fetch(row,count,abortController=new AbortController){const result=this.calcResult();return result?result.fetchRows(row,count,!1,{},abortController.signal):Promise.resolve([])}update(domNode,element){super.update(domNode,element);const storeHash=this.hashSum({renderHtml:this.renderHtml(),filter:this.filter()});if(this._prevStoreHash!==storeHash){this._prevStoreHash=storeHash;const result=this.calcResult();result&&result.fetchXMLSchema().then(schema=>{var _a,_b;this._localStore=new Store(result,schema,this.renderHtml(),this.filter()),(_a=this._dgrid)==null||_a.set("columns",this._localStore.columns()),(_b=this._dgrid)==null||_b.set("collection",this._localStore)})}}click(row,col,sel){}}WUResult.prototype._class+=" eclwatch_WUResult",WUResult.prototype.publish("baseUrl","","string","URL to WsWorkunits"),WUResult.prototype.publish("user","","string","User ID"),WUResult.prototype.publish("password","","string","Password"),WUResult.prototype.publish("wuid","","string","Workunit ID"),WUResult.prototype.publish("resultName","","string","Result Name"),WUResult.prototype.publish("sequence",void 0,"number","Sequence Number"),WUResult.prototype.publish("nodeGroup","","string","NodeGroup"),WUResult.prototype.publish("logicalFile","","string","Logical File Name"),WUResult.prototype.publish("filter",{},"object","Filter");var STATUS=(STATUS2=>(STATUS2.CREATE="Created",STATUS2.COMPILE="Compiled",STATUS2.EXECUTE="Executed",STATUS2.COMPLETE="Completed",STATUS2))(STATUS||{}),STATUS_ACTIVE=(STATUS_ACTIVE2=>(STATUS_ACTIVE2.CREATE="Creating",STATUS_ACTIVE2.COMPILE="Compiling",STATUS_ACTIVE2.EXECUTE="Executing",STATUS_ACTIVE2.COMPLETE="Completed",STATUS_ACTIVE2))(STATUS_ACTIVE||{});class WUStatus extends graph.Graph{constructor(){super();__publicField(this,"_wu");__publicField(this,"_wuHandle");__publicField(this,"_create");__publicField(this,"_compile");__publicField(this,"_execute");__publicField(this,"_complete");__publicField(this,"_prevHash");this.zoomable(!1).zoomToFitLimit(1).layout("Hierarchy").hierarchyRankDirection("LR").showToolbar(!1).allowDragging(!1)}attachWorkunit(){const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==hash&&(this._prevHash=hash,this._wu=comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()),this._wuHandle&&this._wuHandle.release(),this._wuHandle=this._wu.watch(changes=>{this.lazyRender()}))}createVertex(faChar){return new graph.Vertex().icon_diameter(32).icon_shape_colorFill("none").icon_shape_colorStroke("none").icon_image_colorFill("darkgray").iconAnchor("middle").textbox_shape_colorFill("none").textbox_shape_colorStroke("none").textbox_text_colorFill("darkgray").faChar(faChar)}updateVertex(vertex,color){vertex.icon_image_colorFill(color).textbox_text_colorFill(color)}updateVertexStatus(level,active=!1){const completeColor=this._wu.isFailed()?"darkred":"darkgreen";switch(this._create.text("Created"),this._compile.text("Compiled"),this._execute.text("Executed"),this._complete.text("Completed"),level){case 0:this.updateVertex(this._create,"darkgray"),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 1:this._create.text("Creating"),this.updateVertex(this._create,active?"orange":completeColor),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 2:this._compile.text("Compiling"),this.updateVertex(this._create,completeColor),this.updateVertex(this._compile,active?"orange":completeColor),this.updateVertex(this._execute,completeColor),this.updateVertex(this._complete,"darkgray");break;case 3:this._execute.text("Executing"),this.updateVertex(this._create,completeColor),this.updateVertex(this._compile,completeColor),this.updateVertex(this._execute,active?"orange":completeColor),this.updateVertex(this._complete,"darkgray");break;case 4:this.updateVertex(this._create,completeColor),this.updateVertex(this._compile,completeColor),this.updateVertex(this._execute,completeColor),this.updateVertex(this._complete,completeColor);break}}createEdge(source,target){return new graph.Edge().sourceVertex(source).targetVertex(target).strokeColor("black").showArc(!1)}enter(domNode,element){super.enter(domNode,element),this._create=this.createVertex(""),this._compile=this.createVertex(""),this._execute=this.createVertex(""),this._complete=this.createVertex("");const e1=this.createEdge(this._create,this._compile),e2=this.createEdge(this._compile,this._execute),e3=this.createEdge(this._execute,this._complete);this.data({vertices:[this._create,this._compile,this._execute,this._complete],edges:[e1,e2,e3]})}update(domNode,element){switch(this.attachWorkunit(),this._wu.StateID){case comms.WUStateID.Blocked:case comms.WUStateID.Wait:case comms.WUStateID.Scheduled:case comms.WUStateID.UploadingFiled:this.updateVertexStatus(1);break;case comms.WUStateID.Compiling:this.updateVertexStatus(2,!0);break;case comms.WUStateID.Submitted:this.updateVertexStatus(1,!0);break;case comms.WUStateID.Compiled:this.updateVertexStatus(2);break;case comms.WUStateID.Aborting:case comms.WUStateID.Running:this.updateVertexStatus(3,!0);break;case comms.WUStateID.Aborted:case comms.WUStateID.Archived:case comms.WUStateID.Completed:this.updateVertexStatus(4);break;case comms.WUStateID.Failed:this.updateVertexStatus(4,!1);break;case comms.WUStateID.DebugPaused:case comms.WUStateID.DebugRunning:case comms.WUStateID.Paused:case comms.WUStateID.Unknown:default:this.updateVertexStatus(0);break}super.update(domNode,element),this.zoomToFit()}exit(domNode,element){this._wuHandle&&this._wuHandle.release(),super.exit(domNode,element)}}WUStatus.prototype._class+=" eclwatch_WUStatus",WUStatus.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),WUStatus.prototype.publish("wuid","","string","Workunit ID");const columns=["label","start","end","icon","color","series"];class WUTimeline extends timeline.ReactTimelineSeries{constructor(){super();__publicField(this,"_palette",common.Palette.ordinal("default"));__publicField(this,"_prevHashSum");this.columns(columns).titleColumn("label").iconColumn("icon").colorColumn("color").seriesColumn("series").timePattern("%Y-%m-%dT%H:%M:%S.%LZ").tickFormat("%H:%M").tooltipTimeFormat("%H:%M:%S.%L").tooltipHTML(d=>d[columns.length].calcTooltip())}clear(){return delete this._prevHashSum,this}fetchScopes(){const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),request:this.request()});this._prevHashSum!==hash&&(this._prevHashSum=hash,comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchDetails(this.request()).then(scopes=>scopes.filter(scope=>scope.Id&&scope.attr("WhenStarted").RawValue).map(scope=>{const whenStarted=+scope.attr("WhenStarted").RawValue/1e3,timeElapsed=+scope.attr("TimeElapsed").RawValue/1e6;return[scope.Id,new Date(whenStarted).toISOString(),timeElapsed?new Date(whenStarted+timeElapsed).toISOString():void 0,null,this._palette(scope.ScopeType),scope.ScopeName.split("::").join(":").split(":").slice(0,1),scope]})).then(scopes=>{this.data(scopes).render()}))}enter(domNode,_element){super.enter(domNode,_element)}update(domNode,element){this.fetchScopes(),super.update(domNode,element)}exit(domNode,element){super.exit(domNode,element)}}WUTimeline.prototype._class+=" eclwatch_WUTimeline",WUTimeline.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),WUTimeline.prototype.publish("wuid","","string","Workunit ID"),WUTimeline.prototype.publish("request",{ScopeFilter:{MaxDepth:3,ScopeTypes:["graph","subgraph"]},NestedFilter:{Depth:0,ScopeTypes:[]},PropertiesToReturn:{AllProperties:!1,AllStatistics:!0,AllHints:!1,Properties:["WhenStarted","TimeElapsed"]},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},"object","WUDetails Request"),exports2.BUILD_VERSION=BUILD_VERSION,exports2.ECLArchiveViewer=ECLArchiveViewer,exports2.PKG_NAME=PKG_NAME,exports2.PKG_VERSION=PKG_VERSION,exports2.STATUS=STATUS,exports2.STATUS_ACTIVE=STATUS_ACTIVE,exports2.WUGraph=WUGraph,exports2.WUResult=WUResult,exports2.WUScopeController=WUScopeController,exports2.WUStatus=WUStatus,exports2.WUTimeline=WUTimeline,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
`)[0],count:this.kindMap[kind].length});return retVal}vertices(kind){const retVal=[];for(const v of this.kindMap[kind])retVal.push(this.verticesMap[v._.Id]);return retVal}formatRow(item,columns2,row){const attrs=item._.formattedAttrs();for(const key in attrs){const idx=columns2.indexOf(key);idx===-1?(columns2.push(key),row.push(attrs[key])):row[idx]=attrs[key]}for(let i=0;i<100;++i)row[i]===void 0&&(row[i]="");return row}activityData(){const columns2=["Id","Kind","Label"],data=this.graphDB.vertices.map(v=>{const row=[parseInt(v._.Id.split("a")[1])];return this.formatRow(v,columns2,row)});return{columns:columns2,data}}edgeData(){const columns2=["Id","Label"],data=this.graphDB.edges.map(e=>{const row=[e._.Id];return this.formatRow(e,columns2,row)});return{columns:columns2,data}}subgraphData(){const columns2=["Id","Label"],data=this.graphDB.subgraphs.map(sg=>{const row=[sg._.Id];return this.formatRow(sg,columns2,row)});return{columns:columns2,data}}calcGraphTooltip(item){let scope,parentScope;if(item instanceof graph.Subgraph){const subgraph=this.rSubgraphsMap[item.id()];scope=subgraph._,parentScope=subgraph.parent._}else if(item instanceof graph.Vertex||item instanceof common.Icon){const vertex=this.rVerticesMap[item.id()];scope=vertex._,parentScope=vertex.parent._}else if(item instanceof graph.Edge){const edge=this.rEdgesMap[item.id()];scope=edge._,parentScope=edge.parent._}return scope?scope.calcTooltip(parentScope):""}subgraph(id){return this.subgraphsMap[id]}vertex(id){return this.verticesMap[id]}edge(id){return this.edgesMap[id]}minClick(sg){}}class WUGraph extends layout.ChartPanel{constructor(){super();__publicField(this,"_partialAll",new common.Button().faChar("fa-window-restore").tooltip("Partial All").on("click",()=>{this.stateClick(this._partialAll)}));__publicField(this,"_maxAll",new common.Button().faChar("fa-window-maximize").tooltip("Max All").on("click",()=>{this.stateClick(this._maxAll)}));__publicField(this,"_toggleGraph",new common.ToggleButton().faChar("fa-chain").tooltip("Graph").selected(!0).on("click",()=>{this.viewClick(this._toggleGraph)}));__publicField(this,"_toggleActivities",new common.ToggleButton().faChar("fa-table").tooltip("Activitiies").selected(!1).on("click",()=>{this.viewClick(this._toggleActivities)}));__publicField(this,"_toggleEdges",new common.ToggleButton().faChar("fa-table").tooltip("Edges").selected(!1).on("click",()=>{this.viewClick(this._toggleEdges)}));__publicField(this,"_toggleSubgraphs",new common.ToggleButton().faChar("fa-table").tooltip("Subgraphs").selected(!1).on("click",()=>{this.viewClick(this._toggleSubgraphs)}));__publicField(this,"_graph",new graph.Graph().layout("Hierarchy").applyScaleOnLayout(!0).showToolbar(!1).allowDragging(!1));__publicField(this,"_activities",new dgrid.Table().pagination(!1));__publicField(this,"_edges",new dgrid.Table().pagination(!1));__publicField(this,"_subgraphs",new dgrid.Table().pagination(!1));__publicField(this,"_legend",new WUGraphLegend(this).on("click",kind=>{this.render()}).on("mouseover",kind=>{const verticesMap={};for(const vertex of this._gc.vertices(kind))verticesMap[vertex.id()]=!0;this._graph.highlightVerticies(verticesMap)}).on("mouseout",kind=>{this._graph.highlightVerticies()}));__publicField(this,"_view",new layout.Carousel().widgets([this._graph,this._activities,this._edges,this._subgraphs]));__publicField(this,"_gc",new WUScopeController);__publicField(this,"_prevHashSum");__publicField(this,"_prevScopeGraph");this.topOverlay(!1),this.widget(this._view);const buttons=[this._toggleGraph,this._toggleActivities,this._toggleEdges,this._toggleSubgraphs,new common.Spacer,this._partialAll,this._maxAll,new common.Spacer,...this._graph.iconBarButtons(),new common.Spacer];this.buttons(buttons.concat(this.buttons())),this._gc.minClick=sg=>{this.loadGraph(),this._graph.render(w=>{this._graph.selection([sg]).centerOnItem(sg)})},this._graph.tooltipHTML(v=>this._gc.calcGraphTooltip(v))}stateClick(sourceB){switch(sourceB){case this._partialAll:this._graph.data().subgraphs.forEach(sg=>{sg.minState("partial")});break;case this._maxAll:this._graph.data().subgraphs.forEach(sg=>{sg.minState("normal")});break}this.render()}viewClick(sourceTB){switch(this._toggleGraph.selected(sourceTB===this._toggleGraph),this._toggleActivities.selected(sourceTB===this._toggleActivities),this._toggleEdges.selected(sourceTB===this._toggleEdges),this._toggleSubgraphs.selected(sourceTB===this._toggleSubgraphs),sourceTB){case this._toggleGraph:this._view.active(0);break;case this._toggleActivities:this._view.active(1);break;case this._toggleEdges:this._view.active(2);break;case this._toggleSubgraphs:this._view.active(3);break}this.render(w=>{})}fetchScopeGraph(){const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),graphID:this.graphID(),subgraphID:this.subgraphID()});return!this._prevScopeGraph||this._prevHashSum!==hash?(this.startProgress(),this._prevHashSum=hash,this._gc.clear(),comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchGraphs().then(graphs=>{for(const graph2 of graphs)if(graph2.Name===this.graphID())return this.finishProgress(),graph2.fetchScopeGraph(this.subgraphID())}).then(scopeGraph=>(this._prevScopeGraph=scopeGraph,this._prevScopeGraph))):Promise.resolve(this._prevScopeGraph)}enter(domNode,_element){super.enter(domNode,_element)}update(domNode,element){super.update(domNode,element)}exit(domNode,element){super.exit(domNode,element)}loadGraph(){this._gc.disabled(this._legend.disabled()),this._graph.data(this._gc.graphData(),!0);{const{columns:columns2,data}=this._gc.activityData();this._activities.columns(columns2).data(data)}{const{columns:columns2,data}=this._gc.edgeData();this._edges.columns(columns2).data(data)}{const{columns:columns2,data}=this._gc.subgraphData();this._subgraphs.columns(columns2).data(data)}}render(callback){return this.wuid()&&this.graphID()?this.fetchScopeGraph().then(scopedGraph=>{this._gc.set(scopedGraph),this._legend.data(this._gc.calcLegend()),this.loadGraph(),super.render(callback)}):super.render(callback),this}selection(_){if(!arguments.length)return this._graph.selection();const item=this._gc.vertex(_)||this._gc.edge(_)||this._gc.subgraph(_);return item&&this._graph.selection([item]),this}}WUGraph.prototype._class+=" eclwatch_WUGraph",WUGraph.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),WUGraph.prototype.publish("wuid","","string","Workunit ID"),WUGraph.prototype.publish("graphID","","string","Graph ID"),WUGraph.prototype.publish("subgraphID","","string","Subgraph ID");function entitiesEncode(str){return String(str).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function safeEncode(item){switch(Object.prototype.toString.call(item)){case"[object Undefined]":case"[object Boolean]":case"[object Number]":return item;case"[object String]":return entitiesEncode(item);default:console.warn("Unknown cell type: "+Object.prototype.toString.call(item))}return item}class Store{constructor(wuResult,schema,renderHtml,filter={},onError){__publicField(this,"wuResult");__publicField(this,"schema");__publicField(this,"_columns");__publicField(this,"_cache",{});__publicField(this,"rowFormatter");__publicField(this,"_filter",{});__publicField(this,"onError");this.wuResult=wuResult,this.schema=schema,this._columns=this.schema2Columns(this.schema.root),this.rowFormatter=new dgrid.RowFormatter(this._columns,renderHtml),this._filter=filter,this.onError=onError}columns(){return this._columns}schema2Columns(parentNode,prefix=""){return parentNode?parentNode.children().filter(node=>node.name.indexOf("__hidden",node.name.length-8)===-1).map((node,idx)=>{const label=node.name,keyed=node.attrs["hpcc:keyed"],column={field:prefix+label,leafID:label,idx,label:label+(keyed?" (i)":""),className:"resultGridCell",sortable:!1,width:keyed?16:0,isSet:node.isSet},children=this.schema2Columns(node,prefix+label+"_");return children.length?(column.width+=10+children.reduce((prev,childNode)=>prev+childNode.width,0),column.children=children):(column.width+=node.charWidth()*9,column.formatter=(cell,row)=>{switch(typeof cell){case"string":return{html:cell.replace(/\t/g," ").trim()};case"undefined":return""}return cell}),column}):[]}isChildDataset(cell){if(Object.prototype.toString.call(cell)!=="[object Object]")return!1;let propCount=0,firstPropType=null;for(const key in cell)firstPropType||(firstPropType=Object.prototype.toString.call(cell[key])),propCount++;return propCount===1&&firstPropType==="[object Array]"}rowToTable(cell,__row,node){if(this.isChildDataset(cell)){for(const key in cell)this.rowToTable(cell[key],__row,node);return}const table=dgrid.domConstruct.create("table",{border:1,cellspacing:0,width:"100%"},node);switch(Object.prototype.toString.call(cell)){case"[object Object]":let tr=dgrid.domConstruct.create("tr",null,table);for(const key in cell)dgrid.domConstruct.create("th",{innerHTML:safeEncode(key)},tr);tr=dgrid.domConstruct.create("tr",null,table);for(const key in cell)switch(Object.prototype.toString.call(cell[key])){case"[object Object]":case"[object Array]":this.rowToTable(cell[key],__row,node);break;default:dgrid.domConstruct.create("td",{innerHTML:safeEncode(cell[key])},tr);break}break;case"[object Array]":for(let i=0;i<cell.length;++i)switch(Object.prototype.toString.call(cell[i])){case"[object Boolean]":case"[object Number]":case"[object String]":const tr1=dgrid.domConstruct.create("tr",null,table);dgrid.domConstruct.create("td",{innerHTML:safeEncode(cell[i])},tr1);break;default:if(i===0){const tr2=dgrid.domConstruct.create("tr",null,table);for(const key in cell[i])dgrid.domConstruct.create("th",{innerHTML:safeEncode(key)},tr2)}dgrid.domConstruct.create("tr",null,table);for(const key in cell[i])if(cell[i][key])if(Object.prototype.toString.call(cell[i][key])==="[object Object]"||Object.prototype.toString.call(cell[i][key])==="[object Array]"){const td=dgrid.domConstruct.create("td",null,tr1);this.rowToTable(cell[i][key],cell[i],td)}else if(key.indexOf("__html",key.length-6)!==-1)dgrid.domConstruct.create("td",{innerHTML:cell[i][key]},tr1);else if(key.indexOf("__javascript",key.length-12)!==-1)dgrid.domConstruct.create("td",null,tr1);else{const val=cell[i][key];dgrid.domConstruct.create("td",{innerHTML:safeEncode(val)},tr1)}else dgrid.domConstruct.create("td",{innerHTML:""},tr1)}break}}getIdentity(row){return row.__hpcc_id}_request(start,end){if(!this.wuResult)return Promise.resolve({totalLength:0,data:[]});const cacheKey=`${start}->${end}`;if(this._cache[cacheKey])return this._cache[cacheKey];const retVal=this.wuResult.fetchRows(start,end-start,!1,this._filter).then(rows=>({totalLength:this.wuResult.Total,data:rows.map((row,idx)=>{const formattedRow=this.rowFormatter.format(row);return formattedRow.__hpcc_id=start+idx,formattedRow.__hpcc_orig=row,formattedRow})})).catch(err=>(this.onError(err.Message||"An exception has occurred"),{totalLength:0,data:[]}));return this._cache[cacheKey]=retVal,retVal}fetchRange(options){const retVal=new dgrid.Deferred;return this._request(options.start,options.end).then(response=>retVal.resolve(response)),new dgrid.QueryResults(retVal.then(response=>response.data),{totalLength:retVal.then(response=>response.totalLength)})}}class WUResult extends dgrid.Common{constructor(){super();__publicField(this,"_result");__publicField(this,"_localStore");__publicField(this,"_prevResultHash");__publicField(this,"_prevStoreHash");__publicField(this,"_prevQueryHash");this.renderHtml(!1)}hashSum(opts={}){return util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),resultName:this.resultName(),sequence:this.sequence(),nodeGroup:this.nodeGroup(),logicalFile:this.logicalFile(),userID:this.user(),password:this.password(),...opts})}calcResult(){const resultHash=this.hashSum();if(this._prevResultHash!==resultHash){this._prevResultHash=resultHash;const opts={baseUrl:this.baseUrl(),userID:this.user(),password:this.password()};this.wuid()&&this.resultName()?this._result=comms.Result.attach(opts,this.wuid(),this.resultName()):this.wuid()&&this.sequence()!==void 0?this._result=comms.Result.attach(opts,this.wuid(),this.sequence()):this.logicalFile()&&this.nodeGroup()?this._result=comms.Result.attachLogicalFile(opts,this.nodeGroup(),this.logicalFile()):this.logicalFile()&&(this._result=comms.Result.attachLogicalFile(opts,"",this.logicalFile()))}return this._result}fetch(row,count,abortController=new AbortController){const result=this.calcResult();return result?result.fetchRows(row,count,!1,{},abortController.signal):Promise.resolve([])}update(domNode,element){super.update(domNode,element);const storeHash=this.hashSum({renderHtml:this.renderHtml(),filter:this.filter()});if(this._prevStoreHash!==storeHash){this._prevStoreHash=storeHash;const result=this.calcResult();result&&result.fetchXMLSchema().then(schema=>{var _a,_b;this._localStore=new Store(result,schema,this.renderHtml(),this.filter(),msg=>{this._dgrid&&(this._dgrid.noDataMessage=`<span class='dojoxGridNoData'>${msg}</span>`,this._dgrid.refresh())}),(_a=this._dgrid)==null||_a.set("columns",this._localStore.columns()),(_b=this._dgrid)==null||_b.set("collection",this._localStore)})}}click(row,col,sel){}}WUResult.prototype._class+=" eclwatch_WUResult",WUResult.prototype.publish("baseUrl","","string","URL to WsWorkunits"),WUResult.prototype.publish("user","","string","User ID"),WUResult.prototype.publish("password","","string","Password"),WUResult.prototype.publish("wuid","","string","Workunit ID"),WUResult.prototype.publish("resultName","","string","Result Name"),WUResult.prototype.publish("sequence",void 0,"number","Sequence Number"),WUResult.prototype.publish("nodeGroup","","string","NodeGroup"),WUResult.prototype.publish("logicalFile","","string","Logical File Name"),WUResult.prototype.publish("filter",{},"object","Filter");var STATUS=(STATUS2=>(STATUS2.CREATE="Created",STATUS2.COMPILE="Compiled",STATUS2.EXECUTE="Executed",STATUS2.COMPLETE="Completed",STATUS2))(STATUS||{}),STATUS_ACTIVE=(STATUS_ACTIVE2=>(STATUS_ACTIVE2.CREATE="Creating",STATUS_ACTIVE2.COMPILE="Compiling",STATUS_ACTIVE2.EXECUTE="Executing",STATUS_ACTIVE2.COMPLETE="Completed",STATUS_ACTIVE2))(STATUS_ACTIVE||{});class WUStatus extends graph.Graph{constructor(){super();__publicField(this,"_wu");__publicField(this,"_wuHandle");__publicField(this,"_create");__publicField(this,"_compile");__publicField(this,"_execute");__publicField(this,"_complete");__publicField(this,"_prevHash");this.zoomable(!1).zoomToFitLimit(1).layout("Hierarchy").hierarchyRankDirection("LR").showToolbar(!1).allowDragging(!1)}attachWorkunit(){const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==hash&&(this._prevHash=hash,this._wu=comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()),this._wuHandle&&this._wuHandle.release(),this._wuHandle=this._wu.watch(changes=>{this.lazyRender()}))}createVertex(faChar){return new graph.Vertex().icon_diameter(32).icon_shape_colorFill("none").icon_shape_colorStroke("none").icon_image_colorFill("darkgray").iconAnchor("middle").textbox_shape_colorFill("none").textbox_shape_colorStroke("none").textbox_text_colorFill("darkgray").faChar(faChar)}updateVertex(vertex,color){vertex.icon_image_colorFill(color).textbox_text_colorFill(color)}updateVertexStatus(level,active=!1){const completeColor=this._wu.isFailed()?"darkred":"darkgreen";switch(this._create.text("Created"),this._compile.text("Compiled"),this._execute.text("Executed"),this._complete.text("Completed"),level){case 0:this.updateVertex(this._create,"darkgray"),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 1:this._create.text("Creating"),this.updateVertex(this._create,active?"orange":completeColor),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 2:this._compile.text("Compiling"),this.updateVertex(this._create,completeColor),this.updateVertex(this._compile,active?"orange":completeColor),this.updateVertex(this._execute,completeColor),this.updateVertex(this._complete,"darkgray");break;case 3:this._execute.text("Executing"),this.updateVertex(this._create,completeColor),this.updateVertex(this._compile,completeColor),this.updateVertex(this._execute,active?"orange":completeColor),this.updateVertex(this._complete,"darkgray");break;case 4:this.updateVertex(this._create,completeColor),this.updateVertex(this._compile,completeColor),this.updateVertex(this._execute,completeColor),this.updateVertex(this._complete,completeColor);break}}createEdge(source,target){return new graph.Edge().sourceVertex(source).targetVertex(target).strokeColor("black").showArc(!1)}enter(domNode,element){super.enter(domNode,element),this._create=this.createVertex(""),this._compile=this.createVertex(""),this._execute=this.createVertex(""),this._complete=this.createVertex("");const e1=this.createEdge(this._create,this._compile),e2=this.createEdge(this._compile,this._execute),e3=this.createEdge(this._execute,this._complete);this.data({vertices:[this._create,this._compile,this._execute,this._complete],edges:[e1,e2,e3]})}update(domNode,element){switch(this.attachWorkunit(),this._wu.StateID){case comms.WUStateID.Blocked:case comms.WUStateID.Wait:case comms.WUStateID.Scheduled:case comms.WUStateID.UploadingFiled:this.updateVertexStatus(1);break;case comms.WUStateID.Compiling:this.updateVertexStatus(2,!0);break;case comms.WUStateID.Submitted:this.updateVertexStatus(1,!0);break;case comms.WUStateID.Compiled:this.updateVertexStatus(2);break;case comms.WUStateID.Aborting:case comms.WUStateID.Running:this.updateVertexStatus(3,!0);break;case comms.WUStateID.Aborted:case comms.WUStateID.Archived:case comms.WUStateID.Completed:this.updateVertexStatus(4);break;case comms.WUStateID.Failed:this.updateVertexStatus(4,!1);break;case comms.WUStateID.DebugPaused:case comms.WUStateID.DebugRunning:case comms.WUStateID.Paused:case comms.WUStateID.Unknown:default:this.updateVertexStatus(0);break}super.update(domNode,element),this.zoomToFit()}exit(domNode,element){this._wuHandle&&this._wuHandle.release(),super.exit(domNode,element)}}WUStatus.prototype._class+=" eclwatch_WUStatus",WUStatus.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),WUStatus.prototype.publish("wuid","","string","Workunit ID");const columns=["label","start","end","icon","color","series"];class WUTimeline extends timeline.ReactTimelineSeries{constructor(){super();__publicField(this,"_palette",common.Palette.ordinal("default"));__publicField(this,"_prevHashSum");this.columns(columns).titleColumn("label").iconColumn("icon").colorColumn("color").seriesColumn("series").timePattern("%Y-%m-%dT%H:%M:%S.%LZ").tickFormat("%H:%M").tooltipTimeFormat("%H:%M:%S.%L").tooltipHTML(d=>d[columns.length].calcTooltip())}clear(){return delete this._prevHashSum,this}fetchScopes(){const hash=util.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),request:this.request()});this._prevHashSum!==hash&&(this._prevHashSum=hash,comms.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchDetails(this.request()).then(scopes=>scopes.filter(scope=>scope.Id&&scope.attr("WhenStarted").RawValue).map(scope=>{const whenStarted=+scope.attr("WhenStarted").RawValue/1e3,timeElapsed=+scope.attr("TimeElapsed").RawValue/1e6;return[scope.Id,new Date(whenStarted).toISOString(),timeElapsed?new Date(whenStarted+timeElapsed).toISOString():void 0,null,this._palette(scope.ScopeType),scope.ScopeName.split("::").join(":").split(":").slice(0,1),scope]})).then(scopes=>{this.data(scopes).render()}))}enter(domNode,_element){super.enter(domNode,_element)}update(domNode,element){this.fetchScopes(),super.update(domNode,element)}exit(domNode,element){super.exit(domNode,element)}}WUTimeline.prototype._class+=" eclwatch_WUTimeline",WUTimeline.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),WUTimeline.prototype.publish("wuid","","string","Workunit ID"),WUTimeline.prototype.publish("request",{ScopeFilter:{MaxDepth:3,ScopeTypes:["graph","subgraph"]},NestedFilter:{Depth:0,ScopeTypes:[]},PropertiesToReturn:{AllProperties:!1,AllStatistics:!0,AllHints:!1,Properties:["WhenStarted","TimeElapsed"]},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},"object","WUDetails Request"),exports2.BUILD_VERSION=BUILD_VERSION,exports2.ECLArchiveViewer=ECLArchiveViewer,exports2.PKG_NAME=PKG_NAME,exports2.PKG_VERSION=PKG_VERSION,exports2.STATUS=STATUS,exports2.STATUS_ACTIVE=STATUS_ACTIVE,exports2.WUGraph=WUGraph,exports2.WUResult=WUResult,exports2.WUScopeController=WUScopeController,exports2.WUStatus=WUStatus,exports2.WUTimeline=WUTimeline,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
|
|
6
5
|
//# sourceMappingURL=index.umd.cjs.map
|
|
6
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".eclwatch_WUGraphLegend .graph_Vertex{cursor:auto}.eclwatch_WUGraphLegend .graph_Vertex .common_Icon{cursor:pointer}.eclwatch_WUGraph .graph_Vertex{cursor:auto}.eclwatch_WUGraph .marker{fill:#656565;stroke:none;stroke-width:1px}.eclwatch_WUGraph .zoom{fill:none;pointer-events:all}.eclwatch_WUGraph .selectionBrush{fill:none;stroke:#a9a9a9}.d3-tip .eclwatch_WUGraph_Tooltip h3,.d3-tip .eclwatch_WUGraph_Tooltip h4{margin:0}.d3-tip .eclwatch_WUGraph_Tooltip table{border-collapse:separate;border-spacing:5px}.d3-tip .eclwatch_WUGraph_Tooltip table .key{font-weight:700}.d3-tip .eclwatch_WUGraph_Tooltip table .value{font-weight:400}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|