public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pradip Parkale <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM7255]:Update select control UI
Date: Fri, 8 Apr 2022 12:21:54 +0530
Message-ID: <CAJ9T6StpmU+rZ5AzsY4k_=m_S2ie=X4gXPb957XajtT+4guyiw@mail.gmail.com> (raw)

Hi Hackers,

Please find the attached for #7255. I have removed the dropdown list icon
for the empty select list.


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM7255.patch (2.6K, 3-RM7255.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js
index 5b02716d3..fbc40d0a2 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.ui.js
@@ -198,7 +198,7 @@ export default class DatabaseSchema extends BaseUISchema {
         helpMessage: gettext('Note: Changes to the schema restriction will require the Schemas node in the browser to be refreshed before they will be shown.'),
         helpMessageMode: ['edit', 'create'],
         controlProps: {
-          multiple: true, allowClear: false, creatable: true,
+          multiple: true, allowClear: false, creatable: true, noDropdown: true
         }, depChange: (state)=>{
           if(!_.isUndefined(state.oid)) {
             obj.informText = undefined;
diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx
index cec2ae439..39ba9c7da 100644
--- a/web/pgadmin/static/js/components/FormComponents.jsx
+++ b/web/pgadmin/static/js/components/FormComponents.jsx
@@ -774,6 +774,18 @@ CustomSelectSingleValue.propTypes = {
   data: PropTypes.object,
 };
 
+const CustomDropDownIndicator = (props) => {
+  if (props.selectProps.isDropDown)
+    return (
+      <RSComponents.DropdownIndicator {...props} />
+    );
+  return null;
+};
+
+CustomDropDownIndicator.propTypes = {
+  selectProps: PropTypes.object,
+};
+
 export function flattenSelectOptions(options) {
   return _.flatMap(options, (option) => {
     if (option.options) {
@@ -895,6 +907,7 @@ export const InputSelect = forwardRef(({
     components: {
       Option: CustomSelectOption,
       SingleValue: CustomSelectSingleValue,
+      DropdownIndicator: CustomDropDownIndicator
     },
     isMulti: Boolean(controlProps.multiple),
     openMenuOnClick: !readonly,
@@ -906,6 +919,7 @@ export const InputSelect = forwardRef(({
     styles: styles,
     inputId: cid,
     placeholder: (readonly || disabled) ? '' : controlProps.placeholder || gettext('Select an item...'),
+    isDropDown: !controlProps.noDropdown,
     ...otherProps,
     ...props,
   };
@@ -915,7 +929,13 @@ export const InputSelect = forwardRef(({
     );
   } else {
     return (
-      <CreatableSelect ref={ref} {...commonProps} />
+      <CreatableSelect
+        ref={ref}
+        {...commonProps}
+        noOptionsMessage={() =>
+          !controlProps.noDropdown ? 'No options' : null
+        }
+      />
     );
   }
 });


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM7255]:Update select control UI
  In-Reply-To: <CAJ9T6StpmU+rZ5AzsY4k_=m_S2ie=X4gXPb957XajtT+4guyiw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox