mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Use 'brief=true' query parameter on API calls from API-backed select elements
This commit is contained in:
parent
7eef726ee1
commit
dd58ef1de5
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
4
netbox/project-static/src/global.d.ts
vendored
4
netbox/project-static/src/global.d.ts
vendored
@ -30,8 +30,8 @@ type APIError = {
|
||||
|
||||
type APIObjectBase = {
|
||||
id: number;
|
||||
display?: string;
|
||||
name: string;
|
||||
display: string;
|
||||
name?: Nullable<string>;
|
||||
url: string;
|
||||
[k: string]: JSONAble;
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
|
||||
import type { Option } from 'slim-select/dist/data';
|
||||
|
||||
type QueryFilter = Map<string, string | number>;
|
||||
type QueryFilter = Map<string, string | number | boolean>;
|
||||
|
||||
// Various one-off patterns to replace in query param keys.
|
||||
const REPLACE_PATTERNS = [
|
||||
@ -161,6 +161,7 @@ class APISelect {
|
||||
this.updatePathValues(filter);
|
||||
}
|
||||
|
||||
this.queryParams.set('brief', true);
|
||||
this.queryParams.set('limit', 0);
|
||||
this.updateQueryUrl();
|
||||
|
||||
@ -414,7 +415,7 @@ class APISelect {
|
||||
private updateQueryUrl(): void {
|
||||
// Create new URL query parameters based on the current state of `queryParams` and create an
|
||||
// updated API query URL.
|
||||
const query = {} as Record<string, string | number>;
|
||||
const query = {} as Dict<string | number | boolean>;
|
||||
for (const [key, value] of this.queryParams.entries()) {
|
||||
query[key] = value;
|
||||
}
|
||||
@ -529,7 +530,7 @@ class APISelect {
|
||||
displayName = result[legacyDisplayProperty] as string;
|
||||
}
|
||||
|
||||
if (!displayName) {
|
||||
if (!displayName && typeof result.name === 'string') {
|
||||
displayName = result.name;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user