repeatPanel(panel, row) { var variable = _.find(this.variables, {name: panel.repeat}); if (!variable) { return; } var selected; if (variable.current.text === 'All') { selected = variable.options.slice(1, variable.options.length); } else { selected = _.filter(variable.options, {selected: true}); } _.each(selected, (option, index) => { var copy = this.getPanelClone(panel, row, index); copy.span = Math.max(12 / selected.length, panel.minSpan || 4); copy.scopedVars = copy.scopedVars || {}; copy.scopedVars[variable.name] = option; }); }
private _populateFunctions(): void { const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function) as FunctionAbi[]; _.forEach(functionsAbi, (functionAbi: MethodAbi) => { if (functionAbi.constant) { const cbStyleCallFunction = this._contract[functionAbi.name].call; this[functionAbi.name] = promisify(cbStyleCallFunction, this._contract); this[functionAbi.name].call = promisify(cbStyleCallFunction, this._contract); } else { const cbStyleFunction = this._contract[functionAbi.name]; const cbStyleCallFunction = this._contract[functionAbi.name].call; const cbStyleEstimateGasFunction = this._contract[functionAbi.name].estimateGas; this[functionAbi.name] = this._promisifyWithDefaultParams(cbStyleFunction); this[functionAbi.name].estimateGasAsync = promisify(cbStyleEstimateGasFunction); this[functionAbi.name].sendTransactionAsync = this._promisifyWithDefaultParams(cbStyleFunction); this[functionAbi.name].call = promisify(cbStyleCallFunction, this._contract); } }); }
export function getCapAlignment(polyhedron: Polyhedron, cap: Cap) { const isRhombicosidodecahedron = cap.type === 'cupola'; const orthoCaps = isRhombicosidodecahedron ? _.filter( Cap.getAll(polyhedron), cap => getCupolaGyrate(polyhedron, cap) === 'ortho', ) : []; const otherNormal = orthoCaps.length > 0 ? getSingle(orthoCaps) .boundary() .normal() : polyhedron.largestFace().normal(); return isInverse(cap.normal(), otherNormal) ? 'para' : 'meta'; }
it('should be able to set all recipe ingredients', () => { let recipe = RecipeMock.entity(); let leftoverIngredient = MealLeftoverIngredient.convertToMealLeftoverIngredient(_.head(recipe._ingredients)); let meal = new Meal({ _recipes: [recipe], _leftoverIngredients: [leftoverIngredient] }); expect( _.filter(meal.__allRecipeIngredients, (recipeIngredient:ISelectedRecipeIngredient) => { return recipeIngredient.selected; }).length ).to.equal(1); });
export default function getOverlappingStudies(studies: CancerStudy[]):CancerStudy[][] { const groupedTCGAStudies = _.reduce(studies,(memo, study:CancerStudy)=>{ if (/_tcga/.test(study.studyId)) { // we need to find when root of study name is in duplicate, so strip out the modifiers (pub or pancan) const initial = study.studyId.replace(/(_\d\d\d\d|_pub|(_pub\d\d\d\d)|_pan_can_atlas_\d\d\d\d)$/g,''); if (initial) { if (initial in memo) { memo[initial].push(study); } else { memo[initial] = [study]; } } } return memo; }, {} as { [studyId:string]:CancerStudy[] }); return _.filter(groupedTCGAStudies, (grouping)=>grouping.length > 1); }
private populateFunctions(): void { const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === AbiType.Function); _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { if (functionAbi.constant) { const cbStyleCallFunction = this.contract[functionAbi.name].call; this[functionAbi.name] = { callAsync: promisify(cbStyleCallFunction, this.contract), }; } else { const cbStyleFunction = this.contract[functionAbi.name]; const cbStyleEstimateGasFunction = this.contract[functionAbi.name].estimateGas; this[functionAbi.name] = { estimateGasAsync: promisify(cbStyleEstimateGasFunction, this.contract), sendTransactionAsync: this.promisifyWithDefaultParams(cbStyleFunction), }; } }); }
function getExecutionDefinitionsAndColumns(mdObj: any, options: any, attributesMap: any) { const measures = getMeasures(mdObj); let attributes = getAttributes(mdObj); const metrics = flatten(map(measures, (measure, index) => getMetricFactory(measure, mdObj)(measure, mdObj, index, attributesMap)) ); if (options.removeDateItems) { attributes = filter(attributes, attribute => !isDateAttribute(attribute, attributesMap)); } attributes = map(attributes, partial(categoryToElement, attributesMap, mdObj)); const columns = compact(map([...attributes, ...metrics], 'element')); return { columns, definitions: sortDefinitions(compact(map(metrics, 'definition'))) }; }
]).spread((uiDescriptor) => { let vm = parentContext.object._vm; context.object = _.map(_.reject( _.filter(parentContext.object.devices, {type: this.vmRepository.DEVICE_TYPE.VOLUME}), {properties: {type: 'NFS'}} ), volume => _.assign(volume, { _objectType: objectType, _vm: vm, id: uuid.v4() }) ); context.object._vm = parentContext.object; context.object._objectType = objectType; context.userInterfaceDescriptor = uiDescriptor; return this.updateStackWithContext(this.stack, context); });
formatter: function () { //TODO: check this //let s = '<b>' + Highcharts.dateFormat('%A, %b %d, %H:%M', new Date(this.x)) + '</b>'; let dateFormat = newOptions.dateFormat || '%A, %b %d, %H:%M'; let s = '<b>' + Highcharts.dateFormat(dateFormat, this.x) + '</b>'; if (_.filter(this.points, (point: any) => { return point.y !== 0; }).length) { _.forEach(this.points, function (point) { if (point.y) { let name = ' ' + (point.series.options.labelPrefix ? point.series.options.labelPrefix + ' ' + point.series.name : point.series.name); s += '<br /><span style="color:' + point.color + '">\u25CF</span>' + name + ': <b>' + (point.series.options.decimalFormat?Highcharts.numberFormat(point.y, 2):point.y) + (point.series.options.labelSuffix?point.series.options.labelSuffix:'') + '</b>'; } }); } return s; },
// remove stuff that should not count in diff cleanDashboardFromIgnoredChanges(dashData) { // need to new up the domain model class to get access to expand / collapse row logic let model = new DashboardModel(dashData); // Expand all rows before making comparison. This is required because row expand / collapse // change order of panel array and panel positions. model.expandRows(); let dash = model.getSaveModelClone(); // ignore time and refresh dash.time = 0; dash.refresh = 0; dash.schemaVersion = 0; // ignore iteration property delete dash.iteration; dash.panels = _.filter(dash.panels, panel => { if (panel.repeatPanelId) { return false; } // remove scopedVars panel.scopedVars = null; // ignore panel legend sort if (panel.legend) { delete panel.legend.sort; delete panel.legend.sortDesc; } return true; }); // ignore template variable values _.each(dash.templating.list, function(value) { value.current = null; value.options = null; value.filters = null; }); return dash; }