/**
* GPII Process Reporter
*
* Copyright 2015-2017 OCAD University
*
* Licensed under the New BSD license. You may not use this file except in
* compliance with this License.
*
* You may obtain a copy of the License at
* https://github.com/GPII/universal/blob/master/LICENSE.txt
*/
"use strict";
var fluid = fluid || require("infusion"),
gpii = fluid.registerNamespace("gpii");
fluid.defaults("gpii.processReporter", {
gradeNames: ["fluid.component"],
components: {
nameResolver: {
type: "gpii.processReporter.nameResolver"
}
},
invokers: {
handleIsRunning: {
funcName: "gpii.processReporter.handleIsRunning",
args: ["{arguments}.0"]
// entry
}
}
});
fluid.defaults("gpii.processReporter.nameResolver", {
gradeNames: ["fluid.component"],
invokers: {
resolveName: {
funcName: "fluid.identity"
}
}
});
/* Marker function for use in isRunning sections of a launch handler
* to identify in a meaningful way that the solutions start block should always
* be run.
*/
fluid.defaults("gpii.processReporter.neverRunning", {
gradeNames: "fluid.function",
argumentMap: {}
});
gpii.processReporter.neverRunning = function () {
return false;
};
/**
* Runs the 'isRunning' entries of the 'entry' argument. If no 'isRunning' block is not present
* undefined is returned
*/
gpii.processReporter.handleIsRunning = function (entry) {
var running = undefined;
if (!!entry.isRunning) {
running = true;
fluid.each (fluid.makeArray(entry.isRunning), function (aMember) {
var partial = fluid.invokeGradedFunction(aMember.type, aMember);
running = running && partial;
});
}
return running;
};
|