Skip to content

Commit

Permalink
test item-value in CombBox
Browse files Browse the repository at this point in the history
Not functional
  • Loading branch information
12rambau committed Dec 23, 2020
1 parent 8034a29 commit a7a1a96
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sepal_ui/sepalwidgets/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,20 +339,23 @@ class AssetSelect(v.Combobox, SepalWidget):
def __init__(self, label = 'Select an asset', folder = None):

# if folder is not set use the root one
if not folder:
folder = ee.data.getAssetRoots()[0]['id'] + '/'
self.folder = folder if folder else ee.data.getAssetRoots()[0]['id'] + '/'

# get the list of user asset
assets = ee.data.listAssets({'parent': folder})['assets']
assets = ee.data.listAssets({'parent': self.folder})['assets']

# would be interesting when it will work
#items = [{'text': asset['name'].replace(self.folder, ''), 'value': asset['name']} for asset in assets]
items = [asset['name'] for asset in assets]

super().__init__(
clearable = True,
class_ = 'mb-5',
label = label,
placeholder = 'projects/earthengine-legacy/assets/users/someCustomUser/customAsset',
placeholder = 'users/someCustomUser/customAsset',
hint = "select an asset in the list or write a custom asset name. Be careful that you need to have access to this asset to use it",
persistent_hint = True,
items = [asset['name'] for asset in assets],
items = items,
v_model = None
)

1 comment on commit a7a1a96

@12rambau
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#93

Please sign in to comment.