本文整理汇总了TypeScript中lodash.findWhere函数的典型用法代码示例。如果您正苦于以下问题:TypeScript findWhere函数的具体用法?TypeScript findWhere怎么用?TypeScript findWhere使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findWhere函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
return this.backendSrv.get(`/api/plugins/${this.pluginId}/settings`).then(result => {
this.model = result;
this.pluginIcon = this.getPluginIcon(this.model.type);
this.model.dependencies.plugins.forEach(plug => {
plug.icon = this.getPluginIcon(plug.type);
});
this.includes = _.map(result.includes, plug => {
plug.icon = this.getPluginIcon(plug.type);
return plug;
});
if (this.model.type === 'app') {
this.tabIndex = 1;
this.tabs.push('Config');
this.hasDashboards = _.findWhere(result.includes, {type: 'dashboard'});
if (this.hasDashboards) {
this.tabs.push('Dashboards');
}
}
return this.initReadme();
});
示例2: it
it('should add datasource to required', function() {
var require = _.findWhere(exported.__requires, {name: 'TestDB'});
expect(require.name).to.be("TestDB");
expect(require.id).to.be("testdb");
expect(require.type).to.be("datasource");
expect(require.version).to.be("1.2.1");
});
示例3: repeatRow
// returns a new row clone or reuses a clone from previous iteration
repeatRow(row, rowIndex) {
var variables = this.dashboard.templating.list;
var variable = _.findWhere(variables, {name: row.repeat});
if (!variable) {
return;
}
var selected, copy, i, panel;
if (variable.current.text === 'All') {
selected = variable.options.slice(1, variable.options.length);
} else {
selected = _.filter(variable.options, {selected: true});
}
_.each(selected, (option, index) => {
copy = this.getRowClone(row, index, rowIndex);
copy.scopedVars = {};
copy.scopedVars[variable.name] = option;
for (i = 0; i < copy.panels.length; i++) {
panel = copy.panels[i];
panel.scopedVars = {};
panel.scopedVars[variable.name] = option;
panel.repeatIteration = this.iteration;
}
});
}
示例4: datasourceChanged
datasourceChanged() {
var ds = _.findWhere(this.datasources, {name: this.dsSegment.value});
if (ds) {
this.current = ds;
this.panelCtrl.setDatasource(ds);
}
}
示例5:
return this.panelCtrl.getDashboardOptions().then(options => {
if (!this.target) { return; }
var option = _.findWhere(options, {value: this.target.dashboard});
if (!option) { return; }
this.targetName = option.name;
});
示例6:
this.backendSrv.get(`/api/org/plugins/${this.pluginId}/settings`).then(app => {
this.appModel = app;
this.page = _.findWhere(app.pages, {slug: this.$routeParams.slug});
if (!this.page) {
$rootScope.appEvent('alert-error', ['App Page Not Found', '']);
}
});
示例7: function
.add<UpdateToolSlotPayl>("UPDATE_SLOT", function (s, a) {
let { slot_id, property, value } = a.payload;
let slot = _.findWhere(s.tool_slots, { id: parseInt(slot_id) });
/** ??? TODO: Tried changing interfaces but can't seem to please TS */
(slot as any)[property] = parseInt(value);
return s;
})
示例8: function
$scope.koulutusalaMuuttui = function() {
$scope.hakuparametrit.opintoala = "";
if ($scope.hakuparametrit.koulutusala !== "") {
$scope.opintoalat = (_.findWhere($scope.koulutusalat, {
koodi: $scope.hakuparametrit.koulutusala
}) as any).opintoalat;
} else {
$scope.opintoalat = [];
}
$scope.hakuMuuttui();
};