Просмотр исходного кода

Use display field for all API-backed select options

checktheroads 4 лет назад
Родитель
Сommit
5e1156abe2

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
netbox/project-static/dist/netbox.js.map


+ 1 - 24
netbox/project-static/src/select/api.ts

@@ -314,7 +314,7 @@ class APISelect {
     const options = [PLACEHOLDER] as Option[];
 
     for (const result of results) {
-      const text = this.getDisplayName(result);
+      const text = result.display;
       const data = {} as Record<string, string>;
       const value = result.id.toString();
       let style, selected, disabled;
@@ -514,29 +514,6 @@ class APISelect {
     return placeholder;
   }
 
-  /**
-   * Find this element's display name.
-   */
-  private getDisplayName(result: APIObjectBase): string {
-    let displayName = result.display;
-
-    const legacyDisplayProperty = this.base.getAttribute('display-field');
-
-    if (
-      typeof displayName === 'undefined' &&
-      legacyDisplayProperty !== null &&
-      legacyDisplayProperty in result
-    ) {
-      displayName = result[legacyDisplayProperty] as string;
-    }
-
-    if (!displayName && typeof result.name === 'string') {
-      displayName = result.name;
-    }
-
-    return displayName;
-  }
-
   /**
    * Get this element's disabled options by value. The `data-query-param-exclude` attribute will
    * contain a stringified JSON array of option values.

Некоторые файлы не были показаны из-за большого количества измененных файлов