-
Notifications
You must be signed in to change notification settings - Fork 871
Fleet UI: Clean up empty enroll secret bugs #43233
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
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 |
|---|---|---|
|
|
@@ -52,12 +52,54 @@ const EnrollSecretModal = ({ | |
| title="Manage enroll secrets" | ||
| className={baseClass} | ||
| > | ||
| <div className={`${baseClass} form`}> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just moved the |
||
| {teamInfo?.secrets?.length ? ( | ||
| <> | ||
| <div className={`${baseClass}__header`}> | ||
| <div className={`${baseClass}__description`}> | ||
| Use these secret(s) to enroll hosts | ||
| {teamInfo?.secrets?.length ? ( | ||
| <div className={`${baseClass} form`}> | ||
| <div className={`${baseClass}__header`}> | ||
| <div className={`${baseClass}__description`}> | ||
| Use these secret(s) to enroll hosts | ||
| {primoMode || teamInfo?.name === "Unassigned" ? ( | ||
| "" | ||
| ) : ( | ||
| <> | ||
| {" "} | ||
| to <b>{teamInfo?.name}</b> | ||
| </> | ||
| )} | ||
| . | ||
| </div> | ||
| <div className={`${baseClass}__add-secret`}> | ||
| <GitOpsModeTooltipWrapper | ||
| entityType="secrets" | ||
| position="right" | ||
| tipOffset={8} | ||
| renderChildren={(disableChildren) => ( | ||
| <Button | ||
| disabled={disableChildren} | ||
| onClick={addNewSecretClick} | ||
| className={`${baseClass}__add-secret-btn`} | ||
| variant="brand-inverse-icon" | ||
| iconStroke | ||
| > | ||
| Add secret <Icon name="plus" color="core-fleet-green" /> | ||
| </Button> | ||
| )} | ||
| /> | ||
| </div> | ||
| </div> | ||
| <EnrollSecretTable | ||
| secrets={teamInfo?.secrets} | ||
| toggleSecretEditorModal={toggleSecretEditorModal} | ||
| toggleDeleteSecretModal={toggleDeleteSecretModal} | ||
| setSelectedSecret={setSelectedSecret} | ||
| /> | ||
| </div> | ||
| ) : ( | ||
| <Card color="grey" paddingSize="small"> | ||
| <EmptyTable | ||
| header="You have no enroll secrets." | ||
| info={ | ||
| <> | ||
| Add secret(s) to enroll hosts | ||
| {primoMode || teamInfo?.name === "Unassigned" ? ( | ||
| "" | ||
| ) : ( | ||
|
|
@@ -67,75 +109,31 @@ const EnrollSecretModal = ({ | |
| </> | ||
| )} | ||
| . | ||
| </div> | ||
| <div className={`${baseClass}__add-secret`}> | ||
| <GitOpsModeTooltipWrapper | ||
| entityType="secrets" | ||
| position="right" | ||
| tipOffset={8} | ||
| renderChildren={(disableChildren) => ( | ||
| <Button | ||
| disabled={disableChildren} | ||
| onClick={addNewSecretClick} | ||
| className={`${baseClass}__add-secret-btn`} | ||
| variant="brand-inverse-icon" | ||
| iconStroke | ||
| > | ||
| Add secret <Icon name="plus" color="core-fleet-green" /> | ||
| </Button> | ||
| )} | ||
| /> | ||
| </div> | ||
| </div> | ||
| <EnrollSecretTable | ||
| secrets={teamInfo?.secrets} | ||
| toggleSecretEditorModal={toggleSecretEditorModal} | ||
| toggleDeleteSecretModal={toggleDeleteSecretModal} | ||
| setSelectedSecret={setSelectedSecret} | ||
| /> | ||
| </> | ||
| ) : ( | ||
| <Card color="grey" paddingSize="small"> | ||
| <EmptyTable | ||
| header="You have no enroll secrets." | ||
| info={ | ||
| <> | ||
| Add secret(s) to enroll hosts | ||
| {primoMode || teamInfo?.name === "Unassigned" ? ( | ||
| "" | ||
| ) : ( | ||
| <> | ||
| {" "} | ||
| to <b>{teamInfo?.name}</b> | ||
| </> | ||
| )} | ||
| . | ||
| </> | ||
| } | ||
| primaryButton={ | ||
| <GitOpsModeTooltipWrapper | ||
| entityType="secrets" | ||
| position="right" | ||
| tipOffset={8} | ||
| renderChildren={(disableChildren) => ( | ||
| <Button | ||
| disabled={disableChildren} | ||
| onClick={addNewSecretClick} | ||
| className={`${baseClass}__add-secret-btn`} | ||
| variant="brand-inverse-icon" | ||
| iconStroke | ||
| > | ||
| Add secret <Icon name="plus" color="core-fleet-green" /> | ||
| </Button> | ||
| )} | ||
| /> | ||
| } | ||
| /> | ||
| </Card> | ||
| )} | ||
| <div className="modal-cta-wrap"> | ||
| <Button onClick={onReturnToApp}>Close</Button> | ||
| </div> | ||
| </> | ||
| } | ||
| primaryButton={ | ||
| <GitOpsModeTooltipWrapper | ||
| entityType="secrets" | ||
| position="right" | ||
| tipOffset={8} | ||
| renderChildren={(disableChildren) => ( | ||
| <Button | ||
| disabled={disableChildren} | ||
| onClick={addNewSecretClick} | ||
| className={`${baseClass}__add-secret-btn`} | ||
| variant="brand-inverse-icon" | ||
| iconStroke | ||
| > | ||
| Add secret <Icon name="plus" color="core-fleet-green" /> | ||
| </Button> | ||
| )} | ||
| /> | ||
| } | ||
| /> | ||
| </Card> | ||
| )} | ||
| <div className="modal-cta-wrap"> | ||
| <Button onClick={onReturnToApp}>Close</Button> | ||
| </div> | ||
| </Modal> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,16 +4,6 @@ | |
| text-decoration: none; | ||
| } | ||
|
|
||
| pre, | ||
| code { | ||
| background-color: $ui-off-white; | ||
| color: $core-fleet-blue; | ||
| border: 1px solid $ui-fleet-black-10; | ||
| border-radius: $border-radius; | ||
| padding: 7px $pad-medium; | ||
| margin: $pad-large 0 0 44px; | ||
| } | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused code |
||
| &__error { | ||
| color: $ui-error; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,16 +9,6 @@ | |
| margin: $pad-medium 0 0 0; | ||
| } | ||
|
|
||
| pre, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused |
||
| code { | ||
| background-color: $ui-off-white; | ||
| color: $core-fleet-blue; | ||
| border: 1px solid $ui-fleet-black-10; | ||
| border-radius: $border-radius; | ||
| padding: 7px $pad-medium; | ||
| margin: $pad-large 0 0 44px; | ||
| } | ||
|
|
||
| &__error { | ||
| color: $ui-error; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -85,6 +85,7 @@ import { strToBool } from "utilities/strings/stringUtils"; | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| import Button from "components/buttons/Button"; | ||||||||||||||||||||||||||||||||||||||||||
| import Icon from "components/Icon/Icon"; | ||||||||||||||||||||||||||||||||||||||||||
| import CustomLink from "components/CustomLink"; | ||||||||||||||||||||||||||||||||||||||||||
| import { SingleValue } from "react-select-5"; | ||||||||||||||||||||||||||||||||||||||||||
| import DropdownWrapper from "components/forms/fields/DropdownWrapper"; | ||||||||||||||||||||||||||||||||||||||||||
| import { CustomOptionType } from "components/forms/fields/DropdownWrapper/DropdownWrapper"; | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1934,8 +1935,13 @@ const ManageHostsPage = ({ | |||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||||||||||
| <span> | ||||||||||||||||||||||||||||||||||||||||||
| You have no enroll secrets. Manage enroll secrets to enroll hosts | ||||||||||||||||||||||||||||||||||||||||||
| to <b>{isAnyTeamSelected ? currentTeamName : "Fleet"}</b>. | ||||||||||||||||||||||||||||||||||||||||||
| You have no enroll secrets.{" "} | ||||||||||||||||||||||||||||||||||||||||||
| <CustomLink | ||||||||||||||||||||||||||||||||||||||||||
| customClickHandler={() => setShowEnrollSecretModal(true)} | ||||||||||||||||||||||||||||||||||||||||||
| text="Manage enroll secrets" | ||||||||||||||||||||||||||||||||||||||||||
| />{" "} | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1939
to
+1942
|
||||||||||||||||||||||||||||||||||||||||||
| <CustomLink | |
| customClickHandler={() => setShowEnrollSecretModal(true)} | |
| text="Manage enroll secrets" | |
| />{" "} | |
| <button | |
| type="button" | |
| onClick={() => setShowEnrollSecretModal(true)} | |
| style={{ | |
| background: "none", | |
| border: 0, | |
| padding: 0, | |
| margin: 0, | |
| color: "inherit", | |
| textDecoration: "underline", | |
| cursor: "pointer", | |
| font: "inherit", | |
| }} | |
| > | |
| Manage enroll secrets | |
| </button>{" "} |
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.
CustomLink with no href is the only way we currently can get that underline like a link styling with a custom onclick. Maybe we can revisit with agentic programming to get a button to do the underline transition on hover in a future iteration.
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.
CustomLinkrenders an<a href={url}>, but this usage doesn’t pass aurl. Anchors withouthrefare usually not treated as links by assistive tech, even if they’re clickable. Consider passing a realurl(or adjusting the component/usage to render a semantic button when it’s an in-app action that opens a modal).