ui(admin): add role select for user management
This commit is contained in:
parent
58f0bbbb9b
commit
25feeaa9f5
16 changed files with 202 additions and 52 deletions
|
@ -12,10 +12,12 @@ export default ({ selected }: { selected: Database | null }) => {
|
|||
|
||||
const onSearch = (query: string): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
searchDatabases({ name: query }).then((databases) => {
|
||||
setDatabases(databases);
|
||||
return resolve();
|
||||
}).catch(reject);
|
||||
searchDatabases({ name: query })
|
||||
.then(databases => {
|
||||
setDatabases(databases);
|
||||
return resolve();
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -24,14 +26,16 @@ export default ({ selected }: { selected: Database | null }) => {
|
|||
context.setFieldValue('databaseHostId', database?.id || null);
|
||||
};
|
||||
|
||||
const getSelectedText = (database: Database | null): string => {
|
||||
return database?.name || '';
|
||||
const getSelectedText = (database: Database | null): string | undefined => {
|
||||
return database?.name;
|
||||
};
|
||||
|
||||
return (
|
||||
<SearchableSelect
|
||||
id="database"
|
||||
name="Database"
|
||||
id={'databaseId'}
|
||||
name={'databaseId'}
|
||||
label={'Database'}
|
||||
placeholder={'Select a database...'}
|
||||
items={databases}
|
||||
selected={database}
|
||||
setSelected={setDatabase}
|
||||
|
@ -42,7 +46,7 @@ export default ({ selected }: { selected: Database | null }) => {
|
|||
nullable
|
||||
>
|
||||
{databases?.map(d => (
|
||||
<Option key={d.id} selectId="database" id={d.id} item={d} active={d.id === database?.id}>
|
||||
<Option key={d.id} selectId={'databaseId'} id={d.id} item={d} active={d.id === database?.id}>
|
||||
{d.name}
|
||||
</Option>
|
||||
))}
|
||||
|
|
|
@ -12,10 +12,12 @@ export default ({ selected }: { selected: Location | null }) => {
|
|||
|
||||
const onSearch = (query: string): Promise<void> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
searchLocations({ short: query }).then((locations) => {
|
||||
setLocations(locations);
|
||||
return resolve();
|
||||
}).catch(reject);
|
||||
searchLocations({ short: query })
|
||||
.then(locations => {
|
||||
setLocations(locations);
|
||||
return resolve();
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -24,14 +26,16 @@ export default ({ selected }: { selected: Location | null }) => {
|
|||
context.setFieldValue('locationId', location?.id || null);
|
||||
};
|
||||
|
||||
const getSelectedText = (location: Location | null): string => {
|
||||
return location?.short || '';
|
||||
const getSelectedText = (location: Location | null): string | undefined => {
|
||||
return location?.short;
|
||||
};
|
||||
|
||||
return (
|
||||
<SearchableSelect
|
||||
id="location"
|
||||
name="Location"
|
||||
id={'locationId'}
|
||||
name={'locationId'}
|
||||
label={'Location'}
|
||||
placeholder={'Select a location...'}
|
||||
items={locations}
|
||||
selected={location}
|
||||
setSelected={setLocation}
|
||||
|
@ -42,7 +46,7 @@ export default ({ selected }: { selected: Location | null }) => {
|
|||
nullable
|
||||
>
|
||||
{locations?.map(d => (
|
||||
<Option key={d.id} selectId="location" id={d.id} item={d} active={d.id === location?.id}>
|
||||
<Option key={d.id} selectId={'locationId'} id={d.id} item={d} active={d.id === location?.id}>
|
||||
{d.short}
|
||||
</Option>
|
||||
))}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue