Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
attachWorkunit() {
const hash = hashSum({
baseUrl: this.baseUrl(),
wuid: this.wuid()
});
if (this._prevHash !== hash) {
this._prevHash = hash;
this._wu = Workunit.attach({ baseUrl: this.baseUrl() }, this.wuid());
if (this._wuHandle) {
this._wuHandle.release();
}
this._wuHandle = this._wu.watch(changes => {
this.lazyRender();
});
}
}
hash(): string {
return hashSum({
Sort: this.column().map(sb => sb.hash())
});
}
fetchScopeGraph(wuid: string, graphID: string, subgraphID: string = "", refresh: boolean = false): Promise {
this.graphStatus.innerText = this.i18n.FetchingData;
const hash = hashSum({
wuid,
graphID,
subgraphID
});
if (!this._prevScopeGraph || refresh || this._prevHashSum !== hash) {
this._prevHashSum = hash;
this._gc.clear();
const wu = Workunit.attach({ baseUrl: "" }, wuid);
this._prevScopeGraph = wu.fetchGraphs().then(graphs => {
for (const graph of graphs) {
if (graph.Name === graphID) {
return graph.fetchScopeGraph(subgraphID).then(scopedGraph => {
this.graphStatus.innerText = this.i18n.Loading;
return new Promise((resolve, reject) => {
setTimeout(() => {
this._gc.set(scopedGraph);
hash(): string {
return hashSum(this.label());
}
fetchScopes() {
const hash = hashSum({
baseUrl: this.baseUrl(),
wuid: this.wuid(),
request: this.request()
});
if (this._prevHashSum !== hash) {
this._prevHashSum = hash;
const wu = Workunit.attach({ baseUrl: this.baseUrl() }, this.wuid());
wu.fetchDetails(this.request()).then(scopes => {
return scopes.filter(scope => scope.Id && scope.attr("WhenStarted").RawValue).map((scope: Scope) => {
const whenStarted = +scope.attr("WhenStarted").RawValue / 1000;
const timeElapsed = +scope.attr("TimeElapsed").RawValue / 1000000;
return [
scope.Id,
new Date(whenStarted).toISOString(),
timeElapsed ? new Date(whenStarted + timeElapsed).toISOString() : undefined,
null,
fetchScopeGraph(wuid: string, graphID: string, refresh: boolean = false): Promise {
this.graphStatus.innerText = this.i18n.FetchingData;
const hash = hashSum({
wuid,
graphID
});
if (!this._prevScopeGraph || refresh || this._prevHashSum !== hash) {
this._prevHashSum = hash;
this._gc.clear();
const wu = Workunit.attach({ baseUrl: "" }, wuid);
this._prevScopeGraph = wu.fetchScopeGraphs(graphID ? [graphID] : []).then(scopedGraph => {
this.graphStatus.innerText = this.i18n.Loading;
return new Promise((resolve, reject) => {
setTimeout(() => {
this._gc.set(scopedGraph);
resolve(scopedGraph);
}, 0);
});
});
hash(): string {
return hashSum({
computedFields: this.computedFields().map(cf => cf.hash()),
});
}
hash(): string {
return hashSum({
limit: this.rows()
});
}