mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 03:27:15 +00:00
improvement: add scope handling to service token search
This commit is contained in:
+11
-3
@@ -94,11 +94,19 @@ export const ServiceTokenTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
() =>
|
() =>
|
||||||
data
|
data
|
||||||
?.filter((token) => {
|
?.filter((token) => {
|
||||||
const { name } = token;
|
const { name, scopes } = token;
|
||||||
|
|
||||||
const searchValue = search.trim().toLowerCase();
|
const searchValue = search.trim().toLowerCase();
|
||||||
|
|
||||||
return name.toLowerCase().includes(searchValue);
|
if (name.toLowerCase().includes(searchValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return scopes.some(
|
||||||
|
({ environment, secretPath }) =>
|
||||||
|
environment.toLowerCase().includes(searchValue) ||
|
||||||
|
secretPath.toLowerCase().includes(searchValue)
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
const [tokenOne, tokenTwo] = orderDirection === OrderByDirection.ASC ? [a, b] : [b, a];
|
const [tokenOne, tokenTwo] = orderDirection === OrderByDirection.ASC ? [a, b] : [b, a];
|
||||||
@@ -148,7 +156,7 @@ export const ServiceTokenTable = ({ handlePopUpOpen }: Props) => {
|
|||||||
value={search}
|
value={search}
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
|
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
|
||||||
placeholder="Search service tokens..."
|
placeholder="Search service tokens by name, environment or secret path..."
|
||||||
className="flex-1"
|
className="flex-1"
|
||||||
containerClassName="mb-4 mt-2"
|
containerClassName="mb-4 mt-2"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user