mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
add org support url input to org info form (#12591)
relates to #12568 adds the missing org support URL input on the settings page org info form.  - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality
This commit is contained in:
parent
eae417bc2a
commit
0ce66b952d
3 changed files with 28 additions and 2 deletions
1
changes/issue-12568-add-org-support-url-input
Normal file
1
changes/issue-12568-add-org-support-url-input
Normal file
|
|
@ -0,0 +1 @@
|
|||
- add Organization support URL input on the setting page Organization info form.
|
||||
|
|
@ -13,6 +13,12 @@ import {
|
|||
IAppConfigFormErrors,
|
||||
} from "../constants";
|
||||
|
||||
interface IOrgInfoFormData {
|
||||
orgName: string;
|
||||
orgLogoURL: string;
|
||||
orgSupportURL: string;
|
||||
}
|
||||
|
||||
const baseClass = "app-config-form";
|
||||
|
||||
const Info = ({
|
||||
|
|
@ -20,12 +26,14 @@ const Info = ({
|
|||
handleSubmit,
|
||||
isUpdatingSettings,
|
||||
}: IAppConfigFormProps): JSX.Element => {
|
||||
const [formData, setFormData] = useState<any>({
|
||||
const [formData, setFormData] = useState<IOrgInfoFormData>({
|
||||
orgName: appConfig.org_info.org_name || "",
|
||||
orgLogoURL: appConfig.org_info.org_logo_url || "",
|
||||
orgSupportURL:
|
||||
appConfig.org_info.contact_url || "https://fleetdm.com/company/contact",
|
||||
});
|
||||
|
||||
const { orgName, orgLogoURL } = formData;
|
||||
const { orgName, orgLogoURL, orgSupportURL } = formData;
|
||||
|
||||
const [formErrors, setFormErrors] = useState<IAppConfigFormErrors>({});
|
||||
|
||||
|
|
@ -45,6 +53,12 @@ const Info = ({
|
|||
errors.org_logo_url = `${orgLogoURL} is not a valid URL`;
|
||||
}
|
||||
|
||||
if (!orgSupportURL) {
|
||||
errors.org_support_url = `Organization support URL must be present`;
|
||||
} else if (!validUrl({ url: orgSupportURL, protocol: "http" })) {
|
||||
errors.org_support_url = `${orgSupportURL} is not a valid URL`;
|
||||
}
|
||||
|
||||
setFormErrors(errors);
|
||||
};
|
||||
|
||||
|
|
@ -56,6 +70,7 @@ const Info = ({
|
|||
org_info: {
|
||||
org_logo_url: orgLogoURL,
|
||||
org_name: orgName,
|
||||
contact_url: orgSupportURL,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -85,6 +100,15 @@ const Info = ({
|
|||
onBlur={validateForm}
|
||||
error={formErrors.org_logo_url}
|
||||
/>
|
||||
<InputField
|
||||
label="Organization support URL"
|
||||
onChange={handleInputChange}
|
||||
name="orgSupportURL"
|
||||
value={orgSupportURL}
|
||||
parseTarget
|
||||
onBlur={validateForm}
|
||||
error={formErrors.org_support_url}
|
||||
/>
|
||||
</div>
|
||||
<div className={`${baseClass}__details ${baseClass}__avatar-preview`}>
|
||||
<OrgLogoIcon src={orgLogoURL} />
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export interface IAppConfigFormErrors {
|
|||
server_url?: string | null;
|
||||
org_name?: string | null;
|
||||
org_logo_url?: string | null;
|
||||
org_support_url?: string | null;
|
||||
idp_image_url?: string | null;
|
||||
sender_address?: string | null;
|
||||
server?: string | null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue