Teams dropdown bug (#11122)

## Addresses #10756
https://www.loom.com/share/b5ba605b892c4c789a73f05d160819cc
- Set the teams dropdown's max-height to be 66% of the viewport height
- Made a small script to automate creation of an arbitrary number of
teams
- [x] Changes file added for user-visible changes in `changes/` 
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling 2023-04-11 10:20:43 -07:00 committed by GitHub
parent 83bca0819e
commit 9ea390a7da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,2 @@
- Added a maximum height to the teams dropdown, allowng the user to scroll through a large number of
teams

View File

@ -22,7 +22,7 @@
.Select-menu {
padding-right: $pad-small; // moves scrollbar to edge of dropdown
max-height: none;
max-height: 66vh;
}
.Select-menu-outer {

View File

@ -0,0 +1,29 @@
#!/usr/bin/python3
'''
Create n new teams, each with a randomly generated 5-letter name, where n is the integer first
argument passed to the script. Assumes all relevant environment variables are set.
'''
import subprocess, os, sys, string, random
def main(n: int):
token, server_url = os.environ.get("TOKEN"), os.environ.get("SERVER_URL")
if not token or not server_url:
raise Exception("Make sure you have set TOKEN and SERVER_URL as environment variables.")
for i in range(n):
name = "Team " + ''.join(random.choices(string.ascii_lowercase, k=5)).capitalize()
data = f'{{"name": "{name}"}}'
print(data)
subprocess.run(
["curl", "-X", "POST", "-k", "-s", "-H", f"Authorization: Bearer {token}", f"{server_url}/api/latest/fleet/teams", "-d", f"{data}", "--insecure"]
)
if __name__ == "__main__":
try:
n = int(sys.argv[1])
except:
raise Exception("Enter the number of teams to create as a single integer argument to this script.")
main(n)