-
Notifications
You must be signed in to change notification settings - Fork 1
π¨ Palette: Add dashboard link to success message #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
18014bb
23cdca4
d904433
10b8da3
095c870
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -628,7 +628,7 @@ | |
|
|
||
|
|
||
| # --------------------------------------------------------------------------- # | ||
| # 2. Clients | ||
| # 2. Clients (configured with secure defaults) | ||
| # --------------------------------------------------------------------------- # | ||
| def _api_client() -> httpx.Client: | ||
| return httpx.Client( | ||
|
|
@@ -2396,6 +2396,29 @@ | |
| print(f"{line('β', 'β΄', 'β')}\n") | ||
|
|
||
|
|
||
| def print_success_message(profile_ids: List[str]) -> None: | ||
| """Prints a random success message and a link to the Control D dashboard.""" | ||
| if not USE_COLORS: | ||
| return | ||
|
|
||
| success_msgs = [ | ||
| "β¨ All synced!", | ||
| "π Ready for liftoff!", | ||
| "π¨ Beautifully done!", | ||
| "π Smooth operation!", | ||
| "π Perfect harmony!", | ||
| ] | ||
|
Comment on lines
+2399
to
+2410
|
||
| print(f"\n{Colors.GREEN}{random.choice(success_msgs)}{Colors.ENDC}") | ||
|
||
|
|
||
Check warningCode scanning / Prospector (reported by Codacy) multiple statements on one line (def) (E704) Warning
multiple statements on one line (def) (E704)
Check warningCode scanning / Prospector (reported by Codacy) ambiguous variable name 'l' (E741) Warning
ambiguous variable name 'l' (E741)
|
||
| # Construct dashboard URL | ||
| if profile_ids and len(profile_ids) == 1 and profile_ids[0] != "dry-run-placeholder": | ||
| dashboard_url = f"https://controld.com/dashboard/profiles/{profile_ids[0]}/filters" | ||
| print(f"{Colors.CYAN}π View your changes: {Colors.UNDERLINE}{dashboard_url}{Colors.ENDC}") | ||
| elif len(profile_ids) > 1: | ||
| dashboard_url = "https://controld.com/dashboard/profiles" | ||
Check warningCode scanning / Prospector (reported by Codacy) line too long (245 > 159 characters) (E501) Warning
line too long (245 > 159 characters) (E501)
|
||
| print(f"{Colors.CYAN}π View your changes: {Colors.UNDERLINE}{dashboard_url}{Colors.ENDC}") | ||
abhimehro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def parse_args() -> argparse.Namespace: | ||
| """ | ||
| Parses command-line arguments for the Control D sync tool. | ||
|
|
@@ -2721,15 +2744,8 @@ | |
| print(make_col_separator(Box.BL, Box.B, Box.BR, Box.H)) | ||
|
|
||
| # Success Delight | ||
| if all_success and USE_COLORS and not args.dry_run: | ||
| success_msgs = [ | ||
| "β¨ All synced!", | ||
| "π Ready for liftoff!", | ||
| "π¨ Beautifully done!", | ||
| "π Smooth operation!", | ||
| "π Perfect harmony!", | ||
| ] | ||
| print(f"\n{Colors.GREEN}{random.choice(success_msgs)}{Colors.ENDC}") | ||
| if all_success and not args.dry_run: | ||
| print_success_message(profile_ids) | ||
|
|
||
| # Dry Run Next Steps | ||
| if args.dry_run: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
success_msgslist is defined inside theprint_success_messagefunction. This means it's recreated every time the function is called. For better performance and to follow the convention of defining constants at the module level, consider moving this list outside the function, for example, as a module-level constant like_SUCCESS_MESSAGES.