@hpcc-js/comms
Version:
hpcc-js - Communications
172 lines • 6.52 kB
JavaScript
import { __assign, __awaiter, __extends, __generator } from "tslib";
import { debounce, StateObject } from "@hpcc-js/util";
import { SMCService } from "../services/wsSMC";
import { Workunit } from "./workunit";
var _activity;
var Activity = /** @class */ (function (_super) {
__extends(Activity, _super);
function Activity(optsConnection) {
var _this = _super.call(this) || this;
_this.lazyRefresh = debounce(function () { return __awaiter(_this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.connection.Activity({})];
case 1:
response = _a.sent();
this.set(response);
return [2 /*return*/, this];
}
});
}); });
if (optsConnection instanceof SMCService) {
_this.connection = optsConnection;
}
else {
_this.connection = new SMCService(optsConnection);
}
_this.clear({});
return _this;
}
Object.defineProperty(Activity.prototype, "properties", {
get: function () { return this.get(); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "Exceptions", {
get: function () { return this.get("Exceptions"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "Build", {
get: function () { return this.get("Build"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "ThorClusterList", {
get: function () { return this.get("ThorClusterList"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "RoxieClusterList", {
get: function () { return this.get("RoxieClusterList"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "HThorClusterList", {
get: function () { return this.get("HThorClusterList"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "DFUJobs", {
get: function () { return this.get("DFUJobs"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "Running", {
get: function () { return this.get("Running", { ActiveWorkunit: [] }); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "BannerContent", {
get: function () { return this.get("BannerContent"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "BannerColor", {
get: function () { return this.get("BannerColor"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "BannerSize", {
get: function () { return this.get("BannerSize"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "BannerScroll", {
get: function () { return this.get("BannerScroll"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "ChatURL", {
get: function () { return this.get("ChatURL"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "ShowBanner", {
get: function () { return this.get("ShowBanner"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "ShowChatURL", {
get: function () { return this.get("ShowChatURL"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "SortBy", {
get: function () { return this.get("SortBy"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "Descending", {
get: function () { return this.get("Descending"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "SuperUser", {
get: function () { return this.get("SuperUser"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "AccessRight", {
get: function () { return this.get("AccessRight"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "ServerJobQueues", {
get: function () { return this.get("ServerJobQueues"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "ActivityTime", {
get: function () { return this.get("ActivityTime"); },
enumerable: false,
configurable: true
});
Object.defineProperty(Activity.prototype, "DaliDetached", {
get: function () { return this.get("DaliDetached"); },
enumerable: false,
configurable: true
});
Activity.attach = function (optsConnection, state) {
if (!_activity) {
_activity = new Activity(optsConnection);
}
if (state) {
_activity.set(state);
}
return _activity;
};
Activity.prototype.runningWorkunits = function (clusterName) {
var _this = this;
if (clusterName === void 0) { clusterName = ""; }
return this.Running.ActiveWorkunit.filter(function (awu) { return clusterName === "" || awu.ClusterName === clusterName; }).map(function (awu) { return Workunit.attach(_this.connection.connectionOptions(), awu.Wuid, awu); });
};
Activity.prototype.setBanner = function (request) {
var _this = this;
return this.connection.SetBanner(__assign({}, request)).then(function (response) {
_this.set(response);
return _this;
});
};
Activity.prototype.refresh = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.lazyRefresh()];
});
});
};
return Activity;
}(StateObject));
export { Activity };
//# sourceMappingURL=activity.js.map