Skip to content

Commit

Permalink
Limit take param to reduce load
Browse files Browse the repository at this point in the history
  • Loading branch information
TigranVardanyan committed Jul 1, 2024
1 parent 1d17fef commit 6762d89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/datasources/asset/AssetDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export class AssetDataSource extends DataSourceBase<AssetQuery> {
const minionIds = replaceVariables(query.minionIds, this.templateSrv);
let workspaceId = this.templateSrv.replace(query.workspace);
const conditions = [];
if (workspaceId) {
conditions.push(`workspace = "${workspaceId}"`);
}
if (minionIds.length) {
const systemsCondition = minionIds.map(id => `${AssetFilterProperties.LocationMinionId} = "${id}"`)
conditions.push(`(${systemsCondition.join(' or ')})`);
}
if (workspaceId) {
conditions.push(`workspace = "${workspaceId}"`);
}
const assetFilter = conditions.join(' and ');
const assets: AssetModel[] = await this.queryAssets(assetFilter);
const assets: AssetModel[] = await this.queryAssets(assetFilter, 1000);
const workspaces = await this.getWorkspaces();
result.fields = [
{ name: 'id', values: assets.map(a => a.id) },
Expand Down
1 change: 1 addition & 0 deletions src/datasources/asset/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface AssetModel {

export interface AssetPresenceWithSystemConnectionModel {
assetPresence: "INITIALIZING" | "UNKNOWN" | "NOT_PRESENT" | "PRESENT" | string,
// to be compatible with both SLS and SLE
systemConnection?: "APPROVED" | "DISCONNECTED" | "CONNECTED_UPDATE_PENDING" | "CONNECTED_UPDATE_SUCCESSFUL" | "CONNECTED_UPDATE_FAILED" | "UNSUPPORTED" | "ACTIVATED" | "CONNECTED" | string
}

Expand Down

0 comments on commit 6762d89

Please sign in to comment.