@hpcc-js/eclwatch 3.3.4 → 3.3.6
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 +1196 -1411
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -3
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +4 -4
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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")):"function"==typeof define&&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"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@hpcc-js/eclwatch"]={},e["@hpcc-js/codemirror"],e["@hpcc-js/comms"],e["@hpcc-js/phosphor"],e["@hpcc-js/tree"],e["@hpcc-js/util"],e["@hpcc-js/common"],e["@hpcc-js/dgrid"],e["@hpcc-js/graph"],e["@hpcc-js/layout"],e["@hpcc-js/timeline"])}(this,function(e,t,r,s,i,a,o,c,h,n,l){"use strict";var p=Object.defineProperty,u=(e,t)=>p(e,"name",{value:t,configurable:!0});const d=class _ECLArchiveViewer extends s.SplitPanel{_prevHash;_contentStr;_directoryPane=new i.DirectoryTree;_fileEditorPane=(new t.Editor).text("");constructor(){super("horizontal"),this._directoryPane.rowClick=e=>{this._fileEditorPane.text(e).render()}}transformArchiveTreeData(e){const t={label:e.name,children:e._children.map(r).filter(e=>e)};return t.children&&t.children[0]&&"html"===t.children[0].label?{label:"root",children:[{label:"error",content:JSON.stringify(t,null,4)}]}:t;function r(e){const t={};if(t.label=e.name+(e.$&&e.$.key?` (${e.$.key})`:""),e._children&&e._children.length>0)t.children=e._children.map(e=>r(e)).filter(e=>e);else{if("string"!=typeof e.content||!e.content.trim())return!1;t.content=e.content}return t}}updateDirectoryPane(e){let t;if(e)try{t=JSON.parse(e)}catch(r){t=a.xml2json(e)}if(t){const e=this.transformArchiveTreeData(t);this._directoryPane.data(e).render()}}enter(e,t){super.enter(e,t),this.addWidget(this._directoryPane).addWidget(this._fileEditorPane)}update(e,t){super.update(e,t);const s=a.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==s||void 0===this._contentStr?r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchArchive().then(e=>{this._contentStr=e,this.updateDirectoryPane(this._contentStr),this._prevHash=s}):this.updateDirectoryPane(this._contentStr),this.relativeSizes([this.directoryWidthRatio(),1-this.directoryWidthRatio()])}};u(d,"ECLArchiveViewer");let g=d;g.prototype._class+=" eclwatch_ECLArchiveViewer",g.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),g.prototype.publish("wuid","","string","Workunit ID"),g.prototype.publish("directoryWidthRatio",.38,"number","Default directory panel width ratio relative to the full width"),g.prototype.publish("contentString",null,"string","XML/JSON archive content string"),g.prototype.publishProxy("directoryPaneColor","_directoryPane","backgroundColor"),g.prototype.publishProxy("directoryPaneHoverColor","_directoryPane","hoverBackgroundColor"),g.prototype.publishProxy("iconSize","_directoryPane"),g.prototype.publishProxy("fontColor","_directoryPane"),g.prototype.publishProxy("fontFamily","_directoryPane"),g.prototype.publishProxy("fontSize","_directoryPane"),g.prototype.publishProxy("folderIconOpen","_directoryPane"),g.prototype.publishProxy("folderIconClosed","_directoryPane"),g.prototype.publishProxy("textFileIcon","_directoryPane"),g.prototype.publishProxy("codeFileIcon","_directoryPane"),g.prototype.publishProxy("verticalScroll","_directoryPane");const _=class _LegendVertex extends h.Vertex{constructor(){super()}enter(e,t){super.enter(e,t),this._icon.on("click",()=>{this.click(this.data())})}click(e){}};u(_,"LegendVertex");let m=_;const b=class _WUGraphLegend extends n.Legend{icon=o.local();_disabled2={};disabled(e){if(!arguments.length){const e=[];for(const t in this._disabled2)this._disabled2[t]&&e.push(t);return e}return this._disabled2={},e.forEach(e=>this._disabled2[e]=!0),this}toggle(e){this._disabled2[e]=!this._disabled2[e]}update(e,t){super.update(e,t);const r=this,s=this._g.selectAll(".legendItem").data(this.data(),e=>e.kind);s.enter().append("g").attr("class","legendItem").each(function(e){r.icon.set(this,(new m).target(this).data(e.kind).textbox_shape_colorStroke("none").textbox_shape_colorFill("none").iconAnchor("left").faChar(e.faChar).text(`${e.label} (${e.count})`).tooltip(`${e.kind} - ${e.label}`).on("click",e=>{r.toggle(e),r.render(),r.click(e)}).on("mouseover",e=>{r.mouseover(e)}).on("mouseout",e=>{r.mouseout(e)}))}).merge(s).each(function(e,t){const s=r.icon.get(this).icon_shape_colorFill(r._disabled2[e.kind]?"gray":null).render().getBBox();o.select(this).attr("transform",`translate(${+s.width/2}, ${30*t})`)}),s.exit().each(function(e){r.icon.get(this).target(null).render()}).remove();const i=this.getBBox(!0,!0);this._g.attr("transform",`translate(16, ${this.height()/2-i.height/2})`)}click(e){}mouseover(e){}mouseout(e){}};u(b,"WUGraphLegend");let f=b;function S(e){switch(e){case"2":case"44":case"47":case"56":case"61":case"35":case"37":return"";case"3":return"";case"5":return"";case"6":return"";case"12":return"";case"15":case"17":case"59":return"";case"22":return"";case"23":return"";case"25":case"133":case"148":return"";case"26":case"19":return"";case"29":case"16":return"";case"36":return"";case"54":return"";case"82":case"88":case"99":case"105":case"71":return"";case"92":case"93":return"";case"7":return"";case"9":return"";case"21":case"168":return""}return""}f.prototype._class+=" eclwatch_WUGraphLegend",u(S,"faCharFactory");const y=class _WUScopeController{graphDB;subgraphsMap={};rSubgraphsMap={};verticesMap={};rVerticesMap={};edgesMap={};rEdgesMap={};kindMap={};_disabled={};constructor(){}clear(){this.subgraphsMap={},this.rSubgraphsMap={},this.verticesMap={},this.rVerticesMap={},this.edgesMap={},this.rEdgesMap={}}set(e){this.graphDB=e,this.graphGui(this.graphDB),this.kindMap={},this.graphDB.walk(e=>{if(e instanceof a.Subgraph);else if(e instanceof a.Vertex){const t=e._.attr("Kind").RawValue;this.kindMap[t]||(this.kindMap[t]=[]),this.kindMap[t].push(e)}})}disabled(e){if(!arguments.length){const e=[];for(const t in this._disabled)this._disabled[t]&&e.push(t);return e}return this._disabled={},e.forEach(e=>this._disabled[e]=!0),this}graphGui(e){const t={subgraphs:[],vertices:[],edges:[],hierarchy:[]};return e.walk(e=>{if(e instanceof a.Subgraph){const r=this.appendSubgraph(e,t.hierarchy,t.subgraphs);r.showMinMax(e.vertices.length>3||"normal"!==r.minState())}else e instanceof a.Vertex?this.appendVertex(e,t.hierarchy,t.vertices):e instanceof a.Edge&&this.appendEdge(e,t.edges)}),t}format(e,t){let r="",s=e.indexOf("%"),i=-1;for(;s>=0;){if(r+=e.substring(i+1,s),i=e.indexOf("%",s+1),i<0){console.warn("Invalid Label Template");break}r+=e.substring(s+1,i)?t[e.substring(s+1,i)]||"":"%",s=e.indexOf("%",i+1)}return r+=e.substring(i+1,e.length),r.split("\\n").join("\n")}createSubgraph(e){let t=this.subgraphsMap[e._.Id];return t||(t=(new h.Subgraph).title(e._.Id).on("minClick",()=>{this.minClick(t)}),this.subgraphsMap[e._.Id]=t,this.rSubgraphsMap[t.id()]=e),t}createVertex(e){let t=this.verticesMap[e._.Id];if(!t){const r=e._.rawAttrs();if("dummy"===e._.ScopeType){const r=this.subgraphsMap[e.parent._.Id];t=(new o.Icon).shape_colorFill("darkred").shape_colorStroke("darkred").image_colorFill("white").faChar("").on("click",()=>{r.minState("normal"),this.minClick(r)})}else{t=(new h.Vertex).icon_shape_colorFill("#1f77b4").icon_image_colorFill("white").faChar(S(r.Kind)).text(r.Label);const s=[];e._.hasAttr("Definition")&&s.push({faChar:"",tooltip:"Definition",shape_colorFill:"lightgray",shape_colorStroke:"lightgray",image_colorFill:"black"}),e._.hasAttr("IsInternal")&&s.push({faChar:"",tooltip:"IsInternal",shape_colorFill:"red",shape_colorStroke:"red",image_colorFill:"white"}),t.annotationIcons(s)}this.verticesMap[e._.Id]=t,this.rVerticesMap[t.id()]=e}return t}isSpill(e){const t=e.source._.attr("Kind").RawValue,r=e.target._.attr("Kind").RawValue;return"2"===t||"71"===r}spansSubgraph(e){return e.source.parent._.Id!==e.target.parent._.Id}createEdge(e){let t=this.edgesMap[e._.Id];if(!t){const r=e._.rawAttrs(),s=this.verticesMap[e.source._.Id],i=this.verticesMap[e.target._.Id];if(s&&i){const a=this.isSpill(e),o=this.spansSubgraph(e),c=this.format("%Label%\n%NumRowsProcessed%",r);let n=null,l=100;r.IsDependency?(l=10,n="1,5"):r._childGraph?n="5,5":a?(l=25,n="5,5,10,5"):o&&(l=5,n="5,5"),t=(new h.Edge).sourceVertex(s).targetVertex(i).sourceMarker("circle").targetMarker("arrow").weight(l).strokeDasharray(n).text(c),this.edgesMap[e._.Id]=t,this.rEdgesMap[t.id()]=e}}return t}appendSubgraph(e,t,r){const s=this.createSubgraph(e);r.push(s);const i=this.subgraphsMap[e.parent._.Id];return i&&t.push({parent:i,child:s}),s}appendVertex(e,t,r){const s=this.createVertex(e);r.push(s);const i=this.subgraphsMap[e.parent._.Id];return i&&t.push({parent:i,child:s}),s}appendEdge(e,t){const r=this.createEdge(e);return r&&t.push(r),r}filterLegend(e){for(let t=e.vertices.length-1;t>=0;--t){const s=e.vertices[t],i=s._.attr("Kind").RawValue;this._disabled[i]&&s.remove(!1,(e,t)=>new r.BaseScope({ScopeName:s._.ScopeName+":in",Id:e.Id+"->"+t.Id,ScopeType:"dummy-edge",Properties:{Property:[s._.attr("Label")]},Notes:{Note:[]},SinkActivity:""}))}}filterPartial(e){for(const t of e.subgraphs){if("partial"===this.subgraphsMap[t._.Id].minState()){const e=t.vertices,s=[],i=[];for(const t of e)0===t.inEdges.length||t.inEdges.some(e=>e.source.parent!==e.target.parent)||0===t.outEdges.length||t.outEdges.some(e=>e.source.parent!==e.target.parent)?s.push(t):i.push(t);if(i.length>1){const e={ScopeName:t._.ScopeName,Id:t._.Id+":dummy",ScopeType:"dummy",Properties:{Property:[{Name:"Activities",RawValue:""+i.length,Formatted:""+i.length,Measure:"count",Creator:"",CreatorType:""}]},Notes:{Note:[]},SinkActivity:""},a=new r.BaseScope(e),o=t.createVertex(a);for(const c of i){for(const e of c.inEdges)if(s.indexOf(e.source)>=0){const s=new r.BaseScope({ScopeName:e.source._.ScopeName,Id:e.source._.Id+"->"+o._.Id,ScopeType:"dummy-in",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});t.createEdge(e.source,o,s)}for(const e of c.outEdges)if(s.indexOf(e.target)>=0){const s=new r.BaseScope({ScopeName:e.target._.ScopeName,Id:o._.Id+"->"+e.target._.Id,ScopeType:"dummy-out",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});t.createEdge(o,e.target,s)}}i.forEach(e=>e.remove(!0))}}}}filterEmptySubgraphs(e){for(;;){const t=e.subgraphs.filter(e=>0===e.subgraphs.length&&0===e.vertices.length);if(0===t.length)break;t.forEach(e=>e.remove(!0))}}removeObsoleteSubgraphs(e){for(const t of[...e.subgraphs])0===t.vertices.length&&t.remove(!1)}graphData(){const e=this.graphDB.clone();return this.filterLegend(e),this.filterPartial(e),this.filterEmptySubgraphs(e),this.removeObsoleteSubgraphs(e),this.graphGui(e)}calcLegend(){const e=[];for(const t in this.kindMap)e.push({kind:parseInt(t),faChar:S(t),label:this.kindMap[t][0]._.attr("Label").RawValue.split("\n")[0],count:this.kindMap[t].length});return e}vertices(e){const t=[];for(const r of this.kindMap[e])t.push(this.verticesMap[r._.Id]);return t}formatRow(e,t,r){const s=e._.formattedAttrs();for(const i in s){const e=t.indexOf(i);-1===e?(t.push(i),r.push(s[i])):r[e]=s[i]}for(let i=0;i<100;++i)void 0===r[i]&&(r[i]="");return r}activityData(){const e=["Id","Kind","Label"],t=this.graphDB.vertices.map(t=>{const r=[parseInt(t._.Id.split("a")[1])];return this.formatRow(t,e,r)});return{columns:e,data:t}}edgeData(){const e=["Id","Label"],t=this.graphDB.edges.map(t=>{const r=[t._.Id];return this.formatRow(t,e,r)});return{columns:e,data:t}}subgraphData(){const e=["Id","Label"],t=this.graphDB.subgraphs.map(t=>{const r=[t._.Id];return this.formatRow(t,e,r)});return{columns:e,data:t}}calcGraphTooltip(e){let t,r;if(e instanceof h.Subgraph){const s=this.rSubgraphsMap[e.id()];t=s._,r=s.parent._}else if(e instanceof h.Vertex||e instanceof o.Icon){const s=this.rVerticesMap[e.id()];t=s._,r=s.parent._}else if(e instanceof h.Edge){const s=this.rEdgesMap[e.id()];t=s._,r=s.parent._}return t?t.calcTooltip(r):""}subgraph(e){return this.subgraphsMap[e]}vertex(e){return this.verticesMap[e]}edge(e){return this.edgesMap[e]}minClick(e){}};u(y,"WUScopeController");let w=y;const x=class _WUGraph extends n.ChartPanel{_partialAll=(new o.Button).faChar("fa-window-restore").tooltip("Partial All").on("click",()=>{this.stateClick(this._partialAll)});_maxAll=(new o.Button).faChar("fa-window-maximize").tooltip("Max All").on("click",()=>{this.stateClick(this._maxAll)});_toggleGraph=(new o.ToggleButton).faChar("fa-chain").tooltip("Graph").selected(!0).on("click",()=>{this.viewClick(this._toggleGraph)});_toggleActivities=(new o.ToggleButton).faChar("fa-table").tooltip("Activitiies").selected(!1).on("click",()=>{this.viewClick(this._toggleActivities)});_toggleEdges=(new o.ToggleButton).faChar("fa-table").tooltip("Edges").selected(!1).on("click",()=>{this.viewClick(this._toggleEdges)});_toggleSubgraphs=(new o.ToggleButton).faChar("fa-table").tooltip("Subgraphs").selected(!1).on("click",()=>{this.viewClick(this._toggleSubgraphs)});_graph=(new h.Graph).layout("Hierarchy").applyScaleOnLayout(!0).showToolbar(!1).allowDragging(!1);_activities=(new c.Table).pagination(!1);_edges=(new c.Table).pagination(!1);_subgraphs=(new c.Table).pagination(!1);_legend=new f(this).on("click",e=>{this.render()}).on("mouseover",e=>{const t={};for(const r of this._gc.vertices(e))t[r.id()]=!0;this._graph.highlightVerticies(t)}).on("mouseout",e=>{this._graph.highlightVerticies()});_view=(new n.Carousel).widgets([this._graph,this._activities,this._edges,this._subgraphs]);_gc=new w;constructor(){super(),this.topOverlay(!1),this.widget(this._view);const e=[this._toggleGraph,this._toggleActivities,this._toggleEdges,this._toggleSubgraphs,new o.Spacer,this._partialAll,this._maxAll,new o.Spacer,...this._graph.iconBarButtons(),new o.Spacer];this.buttons(e.concat(this.buttons())),this._gc.minClick=e=>{this.loadGraph(),this._graph.render(t=>{this._graph.selection([e]).centerOnItem(e)})},this._graph.tooltipHTML(e=>this._gc.calcGraphTooltip(e))}stateClick(e){switch(e){case this._partialAll:this._graph.data().subgraphs.forEach(e=>{e.minState("partial")});break;case this._maxAll:this._graph.data().subgraphs.forEach(e=>{e.minState("normal")})}this.render()}viewClick(e){switch(this._toggleGraph.selected(e===this._toggleGraph),this._toggleActivities.selected(e===this._toggleActivities),this._toggleEdges.selected(e===this._toggleEdges),this._toggleSubgraphs.selected(e===this._toggleSubgraphs),e){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)}this.render(e=>{})}_prevHashSum;_prevScopeGraph;fetchScopeGraph(){const e=a.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),graphID:this.graphID(),subgraphID:this.subgraphID()});if(!this._prevScopeGraph||this._prevHashSum!==e){this.startProgress(),this._prevHashSum=e,this._gc.clear();return r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchGraphs().then(e=>{for(const t of e)if(t.Name===this.graphID())return this.finishProgress(),t.fetchScopeGraph(this.subgraphID())}).then(e=>(this._prevScopeGraph=e,this._prevScopeGraph))}return Promise.resolve(this._prevScopeGraph)}enter(e,t){super.enter(e,t)}update(e,t){super.update(e,t)}exit(e,t){super.exit(e,t)}loadGraph(){this._gc.disabled(this._legend.disabled()),this._graph.data(this._gc.graphData(),!0);{const{columns:e,data:t}=this._gc.activityData();this._activities.columns(e).data(t)}{const{columns:e,data:t}=this._gc.edgeData();this._edges.columns(e).data(t)}{const{columns:e,data:t}=this._gc.subgraphData();this._subgraphs.columns(e).data(t)}}render(e){return this.wuid()&&this.graphID()?this.fetchScopeGraph().then(t=>{this._gc.set(t),this._legend.data(this._gc.calcLegend()),this.loadGraph(),super.render(e)}):super.render(e),this}selection(e){if(!arguments.length)return this._graph.selection();const t=this._gc.vertex(e)||this._gc.edge(e)||this._gc.subgraph(e);return t&&this._graph.selection([t]),this}};u(x,"WUGraph");let v=x;function k(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function C(e){switch(Object.prototype.toString.call(e)){case"[object Undefined]":case"[object Boolean]":case"[object Number]":return e;case"[object String]":return k(e);default:console.warn("Unknown cell type: "+Object.prototype.toString.call(e))}return e}v.prototype._class+=" eclwatch_WUGraph",v.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),v.prototype.publish("wuid","","string","Workunit ID"),v.prototype.publish("graphID","","string","Graph ID"),v.prototype.publish("subgraphID","","string","Subgraph ID"),u(k,"entitiesEncode"),u(C,"safeEncode");const I=class _Store{wuResult;schema;_columns;_cache={};rowFormatter;_filter={};onError;constructor(e,t,r,s={},i){this.wuResult=e,this.schema=t,this._columns=this.schema2Columns(this.schema.root),this.rowFormatter=new c.RowFormatter(this._columns,r),this._filter=s,this.onError=i}columns(){return this._columns}schema2Columns(e,t=""){return e?e.children().filter(e=>-1===e.name.indexOf("__hidden",e.name.length-8)).map((e,r)=>{const s=e.name,i=e.attrs["hpcc:keyed"],a={field:t+s,leafID:s,idx:r,label:s+(i?" (i)":""),className:"resultGridCell",sortable:!1,width:i?16:0,isSet:e.isSet},o=this.schema2Columns(e,t+s+"_");return o.length?(a.width+=10+o.reduce((e,t)=>e+t.width,0),a.children=o):(a.width+=9*e.charWidth(),a.formatter=(e,t)=>{switch(typeof e){case"string":return{html:e.replace(/\t/g," ").trim()};case"undefined":return""}return e}),a}):[]}isChildDataset(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=0,r=null;for(const s in e)r||(r=Object.prototype.toString.call(e[s])),t++;return 1===t&&"[object Array]"===r}rowToTable(e,t,r){if(this.isChildDataset(e)){for(const s in e)this.rowToTable(e[s],t,r);return}const s=c.domConstruct.create("table",{border:1,cellspacing:0,width:"100%"},r);switch(Object.prototype.toString.call(e)){case"[object Object]":let i=c.domConstruct.create("tr",null,s);for(const t in e)c.domConstruct.create("th",{innerHTML:C(t)},i);i=c.domConstruct.create("tr",null,s);for(const s in e)switch(Object.prototype.toString.call(e[s])){case"[object Object]":case"[object Array]":this.rowToTable(e[s],t,r);break;default:c.domConstruct.create("td",{innerHTML:C(e[s])},i)}break;case"[object Array]":for(let t=0;t<e.length;++t)switch(Object.prototype.toString.call(e[t])){case"[object Boolean]":case"[object Number]":case"[object String]":const r=c.domConstruct.create("tr",null,s);c.domConstruct.create("td",{innerHTML:C(e[t])},r);break;default:if(0===t){const r=c.domConstruct.create("tr",null,s);for(const s in e[t])c.domConstruct.create("th",{innerHTML:C(s)},r)}c.domConstruct.create("tr",null,s);for(const s in e[t])if(e[t][s])if("[object Object]"===Object.prototype.toString.call(e[t][s])||"[object Array]"===Object.prototype.toString.call(e[t][s])){const i=c.domConstruct.create("td",null,r);this.rowToTable(e[t][s],e[t],i)}else if(-1!==s.indexOf("__html",s.length-6))c.domConstruct.create("td",{innerHTML:e[t][s]},r);else if(-1!==s.indexOf("__javascript",s.length-12))c.domConstruct.create("td",null,r);else{const i=e[t][s];c.domConstruct.create("td",{innerHTML:C(i)},r)}else c.domConstruct.create("td",{innerHTML:""},r)}}}getIdentity(e){return e.__hpcc_id}_request(e,t){if(!this.wuResult)return Promise.resolve({totalLength:0,data:[]});const r=`${e}->${t}`;if(this._cache[r])return this._cache[r];const s=this.wuResult.fetchRows(e,t-e,!1,this._filter).then(t=>({totalLength:this.wuResult.Total,data:t.map((t,r)=>{const s=this.rowFormatter.format(t);return s.__hpcc_id=e+r,s.__hpcc_orig=t,s})})).catch(e=>(this.onError(e.Message||"An exception has occurred"),{totalLength:0,data:[]}));return this._cache[r]=s,s}fetchRange(e){const t=new c.Deferred;return this._request(e.start,e.end).then(e=>t.resolve(e)),new c.QueryResults(t.then(e=>e.data),{totalLength:t.then(e=>e.totalLength)})}};u(I,"Store");let D=I;const U=class _WUResult extends c.Common{_result;_localStore;constructor(){super(),this.renderHtml(!1)}hashSum(e={}){return a.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(),bypassCache:this.bypassCache(),...e})}_prevResultHash;calcResult(){const e=this.hashSum();if(this._prevResultHash!==e){this._prevResultHash=e;const t={baseUrl:this.baseUrl(),userID:this.user(),password:this.password()};this.wuid()&&this.resultName()?this._result=r.Result.attach(t,this.wuid(),this.resultName()):this.wuid()&&void 0!==this.sequence()?this._result=r.Result.attach(t,this.wuid(),this.sequence()):this.logicalFile()&&this.nodeGroup()?this._result=r.Result.attachLogicalFile(t,this.nodeGroup(),this.logicalFile()):this.logicalFile()&&(this._result=r.Result.attachLogicalFile(t,"",this.logicalFile())),this._result&&this.bypassCache()&&this._result.bypassCache(this.bypassCache())}return this._result}fetch(e,t,r=new AbortController){const s=this.calcResult();return s?s.fetchRows(e,t,!1,{},r.signal):Promise.resolve([])}_prevStoreHash;_prevQueryHash;update(e,t){super.update(e,t);const r=this.hashSum({renderHtml:this.renderHtml(),filter:this.filter()});if(this._prevStoreHash!==r){this._prevStoreHash=r;const e=this.calcResult();e&&e.fetchXMLSchema().then(t=>{this._localStore=new D(e,t,this.renderHtml(),this.filter(),e=>{this._dgrid&&(this._dgrid.noDataMessage=`<span class='dojoxGridNoData'>${e}</span>`,this._dgrid.refresh())}),this._dgrid?.set("columns",this._localStore.columns()),this._dgrid?.set("collection",this._localStore)})}}click(e,t,r){}};u(U,"WUResult");let E=U;E.prototype._class+=" eclwatch_WUResult",E.prototype.publish("baseUrl","","string","URL to WsWorkunits"),E.prototype.publish("user","","string","User ID"),E.prototype.publish("password","","string","Password"),E.prototype.publish("wuid","","string","Workunit ID"),E.prototype.publish("resultName","","string","Result Name"),E.prototype.publish("sequence",void 0,"number","Sequence Number"),E.prototype.publish("nodeGroup","","string","NodeGroup"),E.prototype.publish("logicalFile","","string","Logical File Name"),E.prototype.publish("filter",{},"object","Filter"),E.prototype.publish("bypassCache",!1,"boolean","Bypass cached results");var P=(e=>(e.CREATE="Created",e.COMPILE="Compiled",e.EXECUTE="Executed",e.COMPLETE="Completed",e))(P||{}),V=(e=>(e.CREATE="Creating",e.COMPILE="Compiling",e.EXECUTE="Executing",e.COMPLETE="Completed",e))(V||{});const M=class _WUStatus extends h.Graph{_wu;_wuHandle;_create;_compile;_execute;_complete;constructor(){super(),this.zoomable(!1).zoomToFitLimit(1).layout("Hierarchy").hierarchyRankDirection("LR").showToolbar(!1).allowDragging(!1)}_prevHash;attachWorkunit(){const e=a.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==e&&(this._prevHash=e,this._wu=r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()),this._wuHandle&&this._wuHandle.release(),this._wuHandle=this._wu.watch(e=>{this.lazyRender()}))}createVertex(e){return(new h.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(e)}updateVertex(e,t){e.icon_image_colorFill(t).textbox_text_colorFill(t)}updateVertexStatus(e,t=!1){const r=this._wu.isFailed()?"darkred":"darkgreen";switch(this._create.text("Created"),this._compile.text("Compiled"),this._execute.text("Executed"),this._complete.text("Completed"),e){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,t?"orange":r),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,r),this.updateVertex(this._compile,t?"orange":r),this.updateVertex(this._execute,r),this.updateVertex(this._complete,"darkgray");break;case 3:this._execute.text("Executing"),this.updateVertex(this._create,r),this.updateVertex(this._compile,r),this.updateVertex(this._execute,t?"orange":r),this.updateVertex(this._complete,"darkgray");break;case 4:this.updateVertex(this._create,r),this.updateVertex(this._compile,r),this.updateVertex(this._execute,r),this.updateVertex(this._complete,r)}}createEdge(e,t){return(new h.Edge).sourceVertex(e).targetVertex(t).strokeColor("black").showArc(!1)}enter(e,t){super.enter(e,t),this._create=this.createVertex(""),this._compile=this.createVertex(""),this._execute=this.createVertex(""),this._complete=this.createVertex("");const r=this.createEdge(this._create,this._compile),s=this.createEdge(this._compile,this._execute),i=this.createEdge(this._execute,this._complete);this.data({vertices:[this._create,this._compile,this._execute,this._complete],edges:[r,s,i]})}update(e,t){switch(this.attachWorkunit(),this._wu.StateID){case r.WUStateID.Blocked:case r.WUStateID.Wait:case r.WUStateID.Scheduled:case r.WUStateID.UploadingFiled:this.updateVertexStatus(1);break;case r.WUStateID.Compiling:this.updateVertexStatus(2,!0);break;case r.WUStateID.Submitted:this.updateVertexStatus(1,!0);break;case r.WUStateID.Compiled:this.updateVertexStatus(2);break;case r.WUStateID.Aborting:case r.WUStateID.Running:this.updateVertexStatus(3,!0);break;case r.WUStateID.Aborted:case r.WUStateID.Archived:case r.WUStateID.Completed:this.updateVertexStatus(4);break;case r.WUStateID.Failed:this.updateVertexStatus(4,!1);break;case r.WUStateID.DebugPaused:case r.WUStateID.DebugRunning:case r.WUStateID.Paused:case r.WUStateID.Unknown:default:this.updateVertexStatus(0)}super.update(e,t),this.zoomToFit()}exit(e,t){this._wuHandle&&this._wuHandle.release(),super.exit(e,t)}};u(M,"WUStatus");let T=M;T.prototype._class+=" eclwatch_WUStatus",T.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),T.prototype.publish("wuid","","string","Workunit ID");const j=["label","start","end","icon","color","series"],W=class _WUTimeline extends l.ReactTimelineSeries{_palette=o.Palette.ordinal("default");constructor(){super(),this.columns(j).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(e=>e[j.length].calcTooltip())}_prevHashSum;clear(){return delete this._prevHashSum,this}fetchScopes(){const e=a.hashSum({baseUrl:this.baseUrl(),wuid:this.wuid(),request:this.request()});if(this._prevHashSum!==e){this._prevHashSum=e;r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchDetails(this.request()).then(e=>e.filter(e=>e.Id&&e.attr("WhenStarted").RawValue).map(e=>{const t=+e.attr("WhenStarted").RawValue/1e3,r=+e.attr("TimeElapsed").RawValue/1e6;return[e.Id,new Date(t).toISOString(),r?new Date(t+r).toISOString():void 0,null,this._palette(e.ScopeType),e.ScopeName.split("::").join(":").split(":").slice(0,1),e]})).then(e=>{this.data(e).render()})}}enter(e,t){super.enter(e,t)}update(e,t){this.fetchScopes(),super.update(e,t)}exit(e,t){super.exit(e,t)}};u(W,"WUTimeline");let R=W;R.prototype._class+=" eclwatch_WUTimeline",R.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),R.prototype.publish("wuid","","string","Workunit ID"),R.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"),e.BUILD_VERSION="3.2.1",e.ECLArchiveViewer=g,e.PKG_NAME="@hpcc-js/eclwatch",e.PKG_VERSION="3.1.1",e.STATUS=P,e.STATUS_ACTIVE=V,e.WUGraph=v,e.WUResult=E,e.WUScopeController=w,e.WUStatus=T,e.WUTimeline=R,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
-
//# sourceMappingURL=index.umd.cjs.map
|
|
3
|
-
!function(){"use strict";try{if("undefined"!=typeof document){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)}}();
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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")):"function"==typeof define&&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"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@hpcc-js/eclwatch"]={},e["@hpcc-js/codemirror"],e["@hpcc-js/comms"],e["@hpcc-js/phosphor"],e["@hpcc-js/tree"],e["@hpcc-js/util"],e["@hpcc-js/common"],e["@hpcc-js/dgrid"],e["@hpcc-js/graph"],e["@hpcc-js/layout"],e["@hpcc-js/timeline"])}(this,function(e,t,r,s,i,a,o,c,h,n,l){var p=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,m=(e,t,r)=>(r=null!=e?p(_(e)):{},((e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var i,a=g(t),o=0,c=a.length;o<c;o++)i=a[o],b.call(e,i)||i===r||u(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(s=d(t,i))||s.enumerable});return e})(!t&&e&&e.__esModule?r:u(r,"default",{value:e,enumerable:!0}),e));t=m(t),r=m(r),s=m(s),i=m(i),a=m(a),o=m(o),c=m(c),h=m(h),n=m(n),l=m(l);var f=class extends s.SplitPanel{_prevHash;_contentStr;_directoryPane=new i.DirectoryTree;_fileEditorPane=(new t.Editor).text("");constructor(){super("horizontal"),this._directoryPane.rowClick=e=>{this._fileEditorPane.text(e).render()}}transformArchiveTreeData(e){const t={label:e.name,children:e._children.map(function e(t){const r={};if(r.label=t.name+(t.$&&t.$.key?` (${t.$.key})`:""),t._children&&t._children.length>0)r.children=t._children.map(t=>e(t)).filter(e=>e);else{if("string"!=typeof t.content||!t.content.trim())return!1;r.content=t.content}return r}).filter(e=>e)};return t.children&&t.children[0]&&"html"===t.children[0].label?{label:"root",children:[{label:"error",content:JSON.stringify(t,null,4)}]}:t}updateDirectoryPane(e){let t;if(e)try{t=JSON.parse(e)}catch(r){t=(0,a.xml2json)(e)}if(t){const e=this.transformArchiveTreeData(t);this._directoryPane.data(e).render()}}enter(e,t){super.enter(e,t),this.addWidget(this._directoryPane).addWidget(this._fileEditorPane)}update(e,t){super.update(e,t);const s=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==s||void 0===this._contentStr?r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchArchive().then(e=>{this._contentStr=e,this.updateDirectoryPane(this._contentStr),this._prevHash=s}):this.updateDirectoryPane(this._contentStr),this.relativeSizes([this.directoryWidthRatio(),1-this.directoryWidthRatio()])}};f.prototype._class+=" eclwatch_ECLArchiveViewer",f.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),f.prototype.publish("wuid","","string","Workunit ID"),f.prototype.publish("directoryWidthRatio",.38,"number","Default directory panel width ratio relative to the full width"),f.prototype.publish("contentString",null,"string","XML/JSON archive content string"),f.prototype.publishProxy("directoryPaneColor","_directoryPane","backgroundColor"),f.prototype.publishProxy("directoryPaneHoverColor","_directoryPane","hoverBackgroundColor"),f.prototype.publishProxy("iconSize","_directoryPane"),f.prototype.publishProxy("fontColor","_directoryPane"),f.prototype.publishProxy("fontFamily","_directoryPane"),f.prototype.publishProxy("fontSize","_directoryPane"),f.prototype.publishProxy("folderIconOpen","_directoryPane"),f.prototype.publishProxy("folderIconClosed","_directoryPane"),f.prototype.publishProxy("textFileIcon","_directoryPane"),f.prototype.publishProxy("codeFileIcon","_directoryPane"),f.prototype.publishProxy("verticalScroll","_directoryPane");var S=class extends h.Vertex{constructor(){super()}enter(e,t){super.enter(e,t),this._icon.on("click",()=>{this.click(this.data())})}click(e){}},y=class extends n.Legend{icon=(0,o.local)();_disabled2={};disabled(e){if(!arguments.length){const e=[];for(const t in this._disabled2)this._disabled2[t]&&e.push(t);return e}return this._disabled2={},e.forEach(e=>this._disabled2[e]=!0),this}toggle(e){this._disabled2[e]=!this._disabled2[e]}update(e,t){super.update(e,t);const r=this,s=this._g.selectAll(".legendItem").data(this.data(),e=>e.kind);s.enter().append("g").attr("class","legendItem").each(function(e){r.icon.set(this,(new S).target(this).data(e.kind).textbox_shape_colorStroke("none").textbox_shape_colorFill("none").iconAnchor("left").faChar(e.faChar).text(`${e.label} (${e.count})`).tooltip(`${e.kind} - ${e.label}`).on("click",e=>{r.toggle(e),r.render(),r.click(e)}).on("mouseover",e=>{r.mouseover(e)}).on("mouseout",e=>{r.mouseout(e)}))}).merge(s).each(function(e,t){const s=r.icon.get(this).icon_shape_colorFill(r._disabled2[e.kind]?"gray":null).render().getBBox();(0,o.select)(this).attr("transform",`translate(${+s.width/2}, ${30*t})`)}),s.exit().each(function(e){r.icon.get(this).target(null).render()}).remove();const i=this.getBBox(!0,!0);this._g.attr("transform",`translate(16, ${this.height()/2-i.height/2})`)}click(e){}mouseover(e){}mouseout(e){}};function w(e){switch(e){case"2":case"44":case"47":case"56":case"61":case"35":case"37":return"";case"3":return"";case"5":return"";case"6":return"";case"12":return"";case"15":case"17":case"59":return"";case"22":return"";case"23":return"";case"25":case"133":case"148":return"";case"26":case"19":return"";case"29":case"16":return"";case"36":return"";case"54":return"";case"82":case"88":case"99":case"105":case"71":return"";case"92":case"93":return"";case"7":return"";case"9":return"";case"21":case"168":return""}return""}y.prototype._class+=" eclwatch_WUGraphLegend";var x=class{graphDB;subgraphsMap={};rSubgraphsMap={};verticesMap={};rVerticesMap={};edgesMap={};rEdgesMap={};kindMap={};_disabled={};constructor(){}clear(){this.subgraphsMap={},this.rSubgraphsMap={},this.verticesMap={},this.rVerticesMap={},this.edgesMap={},this.rEdgesMap={}}set(e){this.graphDB=e,this.graphGui(this.graphDB),this.kindMap={},this.graphDB.walk(e=>{if(e instanceof a.Subgraph);else if(e instanceof a.Vertex){const t=e._.attr("Kind").RawValue;this.kindMap[t]||(this.kindMap[t]=[]),this.kindMap[t].push(e)}else a.Edge})}disabled(e){if(!arguments.length){const e=[];for(const t in this._disabled)this._disabled[t]&&e.push(t);return e}return this._disabled={},e.forEach(e=>this._disabled[e]=!0),this}graphGui(e){const t={subgraphs:[],vertices:[],edges:[],hierarchy:[]};return e.walk(e=>{if(e instanceof a.Subgraph){const r=this.appendSubgraph(e,t.hierarchy,t.subgraphs);r.showMinMax(e.vertices.length>3||"normal"!==r.minState())}else e instanceof a.Vertex?this.appendVertex(e,t.hierarchy,t.vertices):e instanceof a.Edge&&this.appendEdge(e,t.edges)}),t}format(e,t){let r="",s=e.indexOf("%"),i=-1;for(;s>=0;){if(r+=e.substring(i+1,s),i=e.indexOf("%",s+1),i<0){console.warn("Invalid Label Template");break}r+=e.substring(s+1,i)?t[e.substring(s+1,i)]||"":"%",s=e.indexOf("%",i+1)}return r+=e.substring(i+1,e.length),r.split("\\n").join("\n")}createSubgraph(e){let t=this.subgraphsMap[e._.Id];return t||(t=(new h.Subgraph).title(e._.Id).on("minClick",()=>{this.minClick(t)}),this.subgraphsMap[e._.Id]=t,this.rSubgraphsMap[t.id()]=e),t}createVertex(e){let t=this.verticesMap[e._.Id];if(!t){const r=e._.rawAttrs();if("dummy"===e._.ScopeType){const r=this.subgraphsMap[e.parent._.Id];t=(new o.Icon).shape_colorFill("darkred").shape_colorStroke("darkred").image_colorFill("white").faChar("").on("click",()=>{r.minState("normal"),this.minClick(r)})}else{t=(new h.Vertex).icon_shape_colorFill("#1f77b4").icon_image_colorFill("white").faChar(w(r.Kind)).text(r.Label);const s=[];e._.hasAttr("Definition")&&s.push({faChar:"",tooltip:"Definition",shape_colorFill:"lightgray",shape_colorStroke:"lightgray",image_colorFill:"black"}),e._.hasAttr("IsInternal")&&s.push({faChar:"",tooltip:"IsInternal",shape_colorFill:"red",shape_colorStroke:"red",image_colorFill:"white"}),t.annotationIcons(s)}this.verticesMap[e._.Id]=t,this.rVerticesMap[t.id()]=e}return t}isSpill(e){const t=e.source._.attr("Kind").RawValue,r=e.target._.attr("Kind").RawValue;return"2"===t||"71"===r}spansSubgraph(e){return e.source.parent._.Id!==e.target.parent._.Id}createEdge(e){let t=this.edgesMap[e._.Id];if(!t){const r=e._.rawAttrs(),s=this.verticesMap[e.source._.Id],i=this.verticesMap[e.target._.Id];if(s&&i){const a=this.isSpill(e),o=this.spansSubgraph(e),c=this.format("%Label%\n%NumRowsProcessed%",r);let n=null,l=100;r.IsDependency?(l=10,n="1,5"):r._childGraph?n="5,5":a?(l=25,n="5,5,10,5"):o&&(l=5,n="5,5"),t=(new h.Edge).sourceVertex(s).targetVertex(i).sourceMarker("circle").targetMarker("arrow").weight(l).strokeDasharray(n).text(c),this.edgesMap[e._.Id]=t,this.rEdgesMap[t.id()]=e}}return t}appendSubgraph(e,t,r){const s=this.createSubgraph(e);r.push(s);const i=this.subgraphsMap[e.parent._.Id];return i&&t.push({parent:i,child:s}),s}appendVertex(e,t,r){const s=this.createVertex(e);r.push(s);const i=this.subgraphsMap[e.parent._.Id];return i&&t.push({parent:i,child:s}),s}appendEdge(e,t){const r=this.createEdge(e);return r&&t.push(r),r}filterLegend(e){for(let t=e.vertices.length-1;t>=0;--t){const s=e.vertices[t],i=s._.attr("Kind").RawValue;this._disabled[i]&&s.remove(!1,(e,t)=>new r.BaseScope({ScopeName:s._.ScopeName+":in",Id:e.Id+"->"+t.Id,ScopeType:"dummy-edge",Properties:{Property:[s._.attr("Label")]},Notes:{Note:[]},SinkActivity:""}))}}filterPartial(e){for(const t of e.subgraphs)if("partial"===this.subgraphsMap[t._.Id].minState()){const e=t.vertices,s=[],i=[];for(const t of e)0===t.inEdges.length||t.inEdges.some(e=>e.source.parent!==e.target.parent)||0===t.outEdges.length||t.outEdges.some(e=>e.source.parent!==e.target.parent)?s.push(t):i.push(t);if(i.length>1){const e=new r.BaseScope({ScopeName:t._.ScopeName,Id:t._.Id+":dummy",ScopeType:"dummy",Properties:{Property:[{Name:"Activities",RawValue:""+i.length,Formatted:""+i.length,Measure:"count",Creator:"",CreatorType:""}]},Notes:{Note:[]},SinkActivity:""}),a=t.createVertex(e);for(const o of i){for(const e of o.inEdges)if(s.indexOf(e.source)>=0){const s=new r.BaseScope({ScopeName:e.source._.ScopeName,Id:e.source._.Id+"->"+a._.Id,ScopeType:"dummy-in",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});t.createEdge(e.source,a,s)}for(const e of o.outEdges)if(s.indexOf(e.target)>=0){const s=new r.BaseScope({ScopeName:e.target._.ScopeName,Id:a._.Id+"->"+e.target._.Id,ScopeType:"dummy-out",Properties:{Property:[]},Notes:{Note:[]},SinkActivity:""});t.createEdge(a,e.target,s)}}i.forEach(e=>e.remove(!0))}}}filterEmptySubgraphs(e){for(;;){const t=e.subgraphs.filter(e=>0===e.subgraphs.length&&0===e.vertices.length);if(0===t.length)break;t.forEach(e=>e.remove(!0))}}removeObsoleteSubgraphs(e){for(const t of[...e.subgraphs])0===t.vertices.length&&t.remove(!1)}graphData(){const e=this.graphDB.clone();return this.filterLegend(e),this.filterPartial(e),this.filterEmptySubgraphs(e),this.removeObsoleteSubgraphs(e),this.graphGui(e)}calcLegend(){const e=[];for(const t in this.kindMap)e.push({kind:parseInt(t),faChar:w(t),label:this.kindMap[t][0]._.attr("Label").RawValue.split("\n")[0],count:this.kindMap[t].length});return e}vertices(e){const t=[];for(const r of this.kindMap[e])t.push(this.verticesMap[r._.Id]);return t}formatRow(e,t,r){const s=e._.formattedAttrs();for(const i in s){const e=t.indexOf(i);-1===e?(t.push(i),r.push(s[i])):r[e]=s[i]}for(let i=0;i<100;++i)void 0===r[i]&&(r[i]="");return r}activityData(){const e=["Id","Kind","Label"];return{columns:e,data:this.graphDB.vertices.map(t=>{const r=[parseInt(t._.Id.split("a")[1])];return this.formatRow(t,e,r)})}}edgeData(){const e=["Id","Label"];return{columns:e,data:this.graphDB.edges.map(t=>{const r=[t._.Id];return this.formatRow(t,e,r)})}}subgraphData(){const e=["Id","Label"];return{columns:e,data:this.graphDB.subgraphs.map(t=>{const r=[t._.Id];return this.formatRow(t,e,r)})}}calcGraphTooltip(e){let t,r;if(e instanceof h.Subgraph){const s=this.rSubgraphsMap[e.id()];t=s._,r=s.parent._}else if(e instanceof h.Vertex||e instanceof o.Icon){const s=this.rVerticesMap[e.id()];t=s._,r=s.parent._}else if(e instanceof h.Edge){const s=this.rEdgesMap[e.id()];t=s._,r=s.parent._}return t?t.calcTooltip(r):""}subgraph(e){return this.subgraphsMap[e]}vertex(e){return this.verticesMap[e]}edge(e){return this.edgesMap[e]}minClick(e){}},v=class extends n.ChartPanel{_partialAll=(new o.Button).faChar("fa-window-restore").tooltip("Partial All").on("click",()=>{this.stateClick(this._partialAll)});_maxAll=(new o.Button).faChar("fa-window-maximize").tooltip("Max All").on("click",()=>{this.stateClick(this._maxAll)});_toggleGraph=(new o.ToggleButton).faChar("fa-chain").tooltip("Graph").selected(!0).on("click",()=>{this.viewClick(this._toggleGraph)});_toggleActivities=(new o.ToggleButton).faChar("fa-table").tooltip("Activitiies").selected(!1).on("click",()=>{this.viewClick(this._toggleActivities)});_toggleEdges=(new o.ToggleButton).faChar("fa-table").tooltip("Edges").selected(!1).on("click",()=>{this.viewClick(this._toggleEdges)});_toggleSubgraphs=(new o.ToggleButton).faChar("fa-table").tooltip("Subgraphs").selected(!1).on("click",()=>{this.viewClick(this._toggleSubgraphs)});_graph=(new h.Graph).layout("Hierarchy").applyScaleOnLayout(!0).showToolbar(!1).allowDragging(!1);_activities=(new c.Table).pagination(!1);_edges=(new c.Table).pagination(!1);_subgraphs=(new c.Table).pagination(!1);_legend=new y(this).on("click",e=>{this.render()}).on("mouseover",e=>{const t={};for(const r of this._gc.vertices(e))t[r.id()]=!0;this._graph.highlightVerticies(t)}).on("mouseout",e=>{this._graph.highlightVerticies()});_view=(new n.Carousel).widgets([this._graph,this._activities,this._edges,this._subgraphs]);_gc=new x;constructor(){super(),this.topOverlay(!1),this.widget(this._view);const e=[this._toggleGraph,this._toggleActivities,this._toggleEdges,this._toggleSubgraphs,new o.Spacer,this._partialAll,this._maxAll,new o.Spacer,...this._graph.iconBarButtons(),new o.Spacer];this.buttons(e.concat(this.buttons())),this._gc.minClick=e=>{this.loadGraph(),this._graph.render(t=>{this._graph.selection([e]).centerOnItem(e)})},this._graph.tooltipHTML(e=>this._gc.calcGraphTooltip(e))}stateClick(e){switch(e){case this._partialAll:this._graph.data().subgraphs.forEach(e=>{e.minState("partial")});break;case this._maxAll:this._graph.data().subgraphs.forEach(e=>{e.minState("normal")})}this.render()}viewClick(e){switch(this._toggleGraph.selected(e===this._toggleGraph),this._toggleActivities.selected(e===this._toggleActivities),this._toggleEdges.selected(e===this._toggleEdges),this._toggleSubgraphs.selected(e===this._toggleSubgraphs),e){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)}this.render(e=>{})}_prevHashSum;_prevScopeGraph;fetchScopeGraph(){const e=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid(),graphID:this.graphID(),subgraphID:this.subgraphID()});return this._prevScopeGraph&&this._prevHashSum===e?Promise.resolve(this._prevScopeGraph):(this.startProgress(),this._prevHashSum=e,this._gc.clear(),r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchGraphs().then(e=>{for(const t of e)if(t.Name===this.graphID())return this.finishProgress(),t.fetchScopeGraph(this.subgraphID())}).then(e=>(this._prevScopeGraph=e,this._prevScopeGraph)))}enter(e,t){super.enter(e,t)}update(e,t){super.update(e,t)}exit(e,t){super.exit(e,t)}loadGraph(){this._gc.disabled(this._legend.disabled()),this._graph.data(this._gc.graphData(),!0);{const{columns:e,data:t}=this._gc.activityData();this._activities.columns(e).data(t)}{const{columns:e,data:t}=this._gc.edgeData();this._edges.columns(e).data(t)}{const{columns:e,data:t}=this._gc.subgraphData();this._subgraphs.columns(e).data(t)}}render(e){return this.wuid()&&this.graphID()?this.fetchScopeGraph().then(t=>{this._gc.set(t),this._legend.data(this._gc.calcLegend()),this.loadGraph(),super.render(e)}):super.render(e),this}selection(e){if(!arguments.length)return this._graph.selection();const t=this._gc.vertex(e)||this._gc.edge(e)||this._gc.subgraph(e);return t&&this._graph.selection([t]),this}};function k(e){switch(Object.prototype.toString.call(e)){case"[object Undefined]":case"[object Boolean]":case"[object Number]":return e;case"[object String]":return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");default:console.warn("Unknown cell type: "+Object.prototype.toString.call(e))}return e}v.prototype._class+=" eclwatch_WUGraph",v.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),v.prototype.publish("wuid","","string","Workunit ID"),v.prototype.publish("graphID","","string","Graph ID"),v.prototype.publish("subgraphID","","string","Subgraph ID");var I=class{wuResult;schema;_columns;_cache={};rowFormatter;_filter={};onError;constructor(e,t,r,s={},i){this.wuResult=e,this.schema=t,this._columns=this.schema2Columns(this.schema.root),this.rowFormatter=new c.RowFormatter(this._columns,r),this._filter=s,this.onError=i}columns(){return this._columns}schema2Columns(e,t=""){return e?e.children().filter(e=>-1===e.name.indexOf("__hidden",e.name.length-8)).map((e,r)=>{const s=e.name,i=e.attrs["hpcc:keyed"],a={field:t+s,leafID:s,idx:r,label:s+(i?" (i)":""),className:"resultGridCell",sortable:!1,width:i?16:0,isSet:e.isSet},o=this.schema2Columns(e,t+s+"_");return o.length?(a.width+=10+o.reduce((e,t)=>e+t.width,0),a.children=o):(a.width+=9*e.charWidth(),a.formatter=(e,t)=>{switch(typeof e){case"string":return{html:e.replace(/\t/g," ").trim()};case"undefined":return""}return e}),a}):[]}isChildDataset(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=0,r=null;for(const s in e)r||(r=Object.prototype.toString.call(e[s])),t++;return 1===t&&"[object Array]"===r}rowToTable(e,t,r){if(this.isChildDataset(e)){for(const s in e)this.rowToTable(e[s],t,r);return}const s=c.domConstruct.create("table",{border:1,cellspacing:0,width:"100%"},r);switch(Object.prototype.toString.call(e)){case"[object Object]":let i=c.domConstruct.create("tr",null,s);for(const t in e)c.domConstruct.create("th",{innerHTML:k(t)},i);i=c.domConstruct.create("tr",null,s);for(const s in e)switch(Object.prototype.toString.call(e[s])){case"[object Object]":case"[object Array]":this.rowToTable(e[s],t,r);break;default:c.domConstruct.create("td",{innerHTML:k(e[s])},i)}break;case"[object Array]":for(let t=0;t<e.length;++t)switch(Object.prototype.toString.call(e[t])){case"[object Boolean]":case"[object Number]":case"[object String]":const r=c.domConstruct.create("tr",null,s);c.domConstruct.create("td",{innerHTML:k(e[t])},r);break;default:if(0===t){const r=c.domConstruct.create("tr",null,s);for(const s in e[t])c.domConstruct.create("th",{innerHTML:k(s)},r)}c.domConstruct.create("tr",null,s);for(const s in e[t])if(e[t][s])if("[object Object]"===Object.prototype.toString.call(e[t][s])||"[object Array]"===Object.prototype.toString.call(e[t][s])){const i=c.domConstruct.create("td",null,r);this.rowToTable(e[t][s],e[t],i)}else if(-1!==s.indexOf("__html",s.length-6))c.domConstruct.create("td",{innerHTML:e[t][s]},r);else if(-1!==s.indexOf("__javascript",s.length-12))c.domConstruct.create("td",null,r);else{const i=e[t][s];c.domConstruct.create("td",{innerHTML:k(i)},r)}else c.domConstruct.create("td",{innerHTML:""},r)}}}getIdentity(e){return e.__hpcc_id}_request(e,t){if(!this.wuResult)return Promise.resolve({totalLength:0,data:[]});const r=`${e}->${t}`;if(this._cache[r])return this._cache[r];const s=this.wuResult.fetchRows(e,t-e,!1,this._filter).then(t=>({totalLength:this.wuResult.Total,data:t.map((t,r)=>{const s=this.rowFormatter.format(t);return s.__hpcc_id=e+r,s.__hpcc_orig=t,s})})).catch(e=>(this.onError(e.Message||"An exception has occurred"),{totalLength:0,data:[]}));return this._cache[r]=s,s}fetchRange(e){const t=new c.Deferred;return this._request(e.start,e.end).then(e=>t.resolve(e)),new c.QueryResults(t.then(e=>e.data),{totalLength:t.then(e=>e.totalLength)})}},C=class extends c.Common{_result;_localStore;constructor(){super(),this.renderHtml(!1)}hashSum(e={}){return(0,a.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(),bypassCache:this.bypassCache(),...e})}_prevResultHash;calcResult(){const e=this.hashSum();if(this._prevResultHash!==e){this._prevResultHash=e;const t={baseUrl:this.baseUrl(),userID:this.user(),password:this.password()};this.wuid()&&this.resultName()?this._result=r.Result.attach(t,this.wuid(),this.resultName()):this.wuid()&&void 0!==this.sequence()?this._result=r.Result.attach(t,this.wuid(),this.sequence()):this.logicalFile()&&this.nodeGroup()?this._result=r.Result.attachLogicalFile(t,this.nodeGroup(),this.logicalFile()):this.logicalFile()&&(this._result=r.Result.attachLogicalFile(t,"",this.logicalFile())),this._result&&this.bypassCache()&&this._result.bypassCache(this.bypassCache())}return this._result}fetch(e,t,r=new AbortController){const s=this.calcResult();return s?s.fetchRows(e,t,!1,{},r.signal):Promise.resolve([])}_prevStoreHash;_prevQueryHash;update(e,t){super.update(e,t);const r=this.hashSum({renderHtml:this.renderHtml(),filter:this.filter()});if(this._prevStoreHash!==r){this._prevStoreHash=r;const e=this.calcResult();e&&e.fetchXMLSchema().then(t=>{this._localStore=new I(e,t,this.renderHtml(),this.filter(),e=>{this._dgrid&&(this._dgrid.noDataMessage=`<span class='dojoxGridNoData'>${e}</span>`,this._dgrid.refresh())}),this._dgrid?.set("columns",this._localStore.columns()),this._dgrid?.set("collection",this._localStore)})}}click(e,t,r){}};C.prototype._class+=" eclwatch_WUResult",C.prototype.publish("baseUrl","","string","URL to WsWorkunits"),C.prototype.publish("user","","string","User ID"),C.prototype.publish("password","","string","Password"),C.prototype.publish("wuid","","string","Workunit ID"),C.prototype.publish("resultName","","string","Result Name"),C.prototype.publish("sequence",void 0,"number","Sequence Number"),C.prototype.publish("nodeGroup","","string","NodeGroup"),C.prototype.publish("logicalFile","","string","Logical File Name"),C.prototype.publish("filter",{},"object","Filter"),C.prototype.publish("bypassCache",!1,"boolean","Bypass cached results");let E=function(e){return e.CREATE="Created",e.COMPILE="Compiled",e.EXECUTE="Executed",e.COMPLETE="Completed",e}({}),P=function(e){return e.CREATE="Creating",e.COMPILE="Compiling",e.EXECUTE="Executing",e.COMPLETE="Completed",e}({});var D=class extends h.Graph{_wu;_wuHandle;_create;_compile;_execute;_complete;constructor(){super(),this.zoomable(!1).zoomToFitLimit(1).layout("Hierarchy").hierarchyRankDirection("LR").showToolbar(!1).allowDragging(!1)}_prevHash;attachWorkunit(){const e=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid()});this._prevHash!==e&&(this._prevHash=e,this._wu=r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()),this._wuHandle&&this._wuHandle.release(),this._wuHandle=this._wu.watch(e=>{this.lazyRender()}))}createVertex(e){return(new h.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(e)}updateVertex(e,t){e.icon_image_colorFill(t).textbox_text_colorFill(t)}updateVertexStatus(e,t=!1){const r=this._wu.isFailed()?"darkred":"darkgreen";switch(this._create.text(E.CREATE),this._compile.text(E.COMPILE),this._execute.text(E.EXECUTE),this._complete.text(E.COMPLETE),e){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(P.CREATE),this.updateVertex(this._create,t?"orange":r),this.updateVertex(this._compile,"darkgray"),this.updateVertex(this._execute,"darkgray"),this.updateVertex(this._complete,"darkgray");break;case 2:this._compile.text(P.COMPILE),this.updateVertex(this._create,r),this.updateVertex(this._compile,t?"orange":r),this.updateVertex(this._execute,r),this.updateVertex(this._complete,"darkgray");break;case 3:this._execute.text(P.EXECUTE),this.updateVertex(this._create,r),this.updateVertex(this._compile,r),this.updateVertex(this._execute,t?"orange":r),this.updateVertex(this._complete,"darkgray");break;case 4:this.updateVertex(this._create,r),this.updateVertex(this._compile,r),this.updateVertex(this._execute,r),this.updateVertex(this._complete,r)}}createEdge(e,t){return(new h.Edge).sourceVertex(e).targetVertex(t).strokeColor("black").showArc(!1)}enter(e,t){super.enter(e,t),this._create=this.createVertex(""),this._compile=this.createVertex(""),this._execute=this.createVertex(""),this._complete=this.createVertex("");const r=this.createEdge(this._create,this._compile),s=this.createEdge(this._compile,this._execute),i=this.createEdge(this._execute,this._complete);this.data({vertices:[this._create,this._compile,this._execute,this._complete],edges:[r,s,i]})}update(e,t){switch(this.attachWorkunit(),this._wu.StateID){case r.WUStateID.Blocked:case r.WUStateID.Wait:case r.WUStateID.Scheduled:case r.WUStateID.UploadingFiled:this.updateVertexStatus(1);break;case r.WUStateID.Compiling:this.updateVertexStatus(2,!0);break;case r.WUStateID.Submitted:this.updateVertexStatus(1,!0);break;case r.WUStateID.Compiled:this.updateVertexStatus(2);break;case r.WUStateID.Aborting:case r.WUStateID.Running:this.updateVertexStatus(3,!0);break;case r.WUStateID.Aborted:case r.WUStateID.Archived:case r.WUStateID.Completed:this.updateVertexStatus(4);break;case r.WUStateID.Failed:this.updateVertexStatus(4,!1);break;case r.WUStateID.DebugPaused:case r.WUStateID.DebugRunning:case r.WUStateID.Paused:case r.WUStateID.Unknown:default:this.updateVertexStatus(0)}super.update(e,t),this.zoomToFit()}exit(e,t){this._wuHandle&&this._wuHandle.release(),super.exit(e,t)}};D.prototype._class+=" eclwatch_WUStatus",D.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),D.prototype.publish("wuid","","string","Workunit ID");var M=["label","start","end","icon","color","series"],j=class extends l.ReactTimelineSeries{_palette=o.Palette.ordinal("default");constructor(){super(),this.columns(M).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(e=>e[M.length].calcTooltip())}_prevHashSum;clear(){return delete this._prevHashSum,this}fetchScopes(){const e=(0,a.hashSum)({baseUrl:this.baseUrl(),wuid:this.wuid(),request:this.request()});this._prevHashSum!==e&&(this._prevHashSum=e,r.Workunit.attach({baseUrl:this.baseUrl()},this.wuid()).fetchDetails(this.request()).then(e=>e.filter(e=>e.Id&&e.attr("WhenStarted").RawValue).map(e=>{const t=+e.attr("WhenStarted").RawValue/1e3,r=+e.attr("TimeElapsed").RawValue/1e6;return[e.Id,new Date(t).toISOString(),r?new Date(t+r).toISOString():void 0,null,this._palette(e.ScopeType),e.ScopeName.split("::").join(":").split(":").slice(0,1),e]})).then(e=>{this.data(e).render()}))}enter(e,t){super.enter(e,t)}update(e,t){this.fetchScopes(),super.update(e,t)}exit(e,t){super.exit(e,t)}};j.prototype._class+=" eclwatch_WUTimeline",j.prototype.publish("baseUrl","","string","HPCC Platform Base URL"),j.prototype.publish("wuid","","string","Workunit ID"),j.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"),e.BUILD_VERSION="3.2.1",e.ECLArchiveViewer=f,e.PKG_NAME="@hpcc-js/eclwatch",e.PKG_VERSION="3.1.1",e.STATUS=E,e.STATUS_ACTIVE=P,e.WUGraph=v,e.WUResult=C,e.WUScopeController=x,e.WUStatus=D,e.WUTimeline=j});
|
|
2
|
+
//# sourceMappingURL=index.umd.cjs.map!function(){try{if("undefined"!=typeof document){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}\n/*$vite$:1*/")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|