本文整理匯總了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();
};