Skip to content
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

Fleet UI: Calendar settings iterations #17779

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const API_KEY_JSON_PLACEHOLDER = `{
"type": "service_account",
"project_id": "fleet-in-your-calendar",
"private_key_id": "<private key id>",
"private_key": "-----BEGIN PRIVATE KEY-----\n<private key>\n-----END PRIVATE KEY-----\n",
"private_key": "-----BEGIN PRIVATE KEY----\\n<private key>\\n-----END PRIVATE KEY-----\\n",
"client_email": "fleet-calendar-events@fleet-in-your-calendar.iam.gserviceaccount.com",
"client_id": "<client id>",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
Expand Down Expand Up @@ -103,7 +103,14 @@ const Calendars = (): JSX.Element => {
errors.apiKeyJson = "API key JSON must be present";
}
if (!curFormData.domain && !!curFormData.apiKeyJson) {
errors.apiKeyJson = "Domain must be present";
errors.domain = "Domain must be present";
}
if (curFormData.apiKeyJson) {
try {
JSON.parse(curFormData.apiKeyJson);
} catch (e) {
errors.apiKeyJson = e.message.toString();
}
}
return errors;
};
Expand Down Expand Up @@ -277,6 +284,7 @@ const Calendars = (): JSX.Element => {
placeholder={API_KEY_JSON_PLACEHOLDER}
ignore1password
inputClassName={`${baseClass}__api-key-json`}
error={formErrors.apiKeyJson}
/>
<InputField
label="Primary domain"
Expand All @@ -301,12 +309,13 @@ const Calendars = (): JSX.Element => {
/>
</>
}
error={formErrors.domain}
/>
<Button
type="submit"
variant="brand"
disabled={Object.keys(formErrors).length > 0}
className="save-loading button-wrap"
className="save-loading"
isLoading={isUpdatingSettings}
>
Save
Expand Down Expand Up @@ -378,6 +387,10 @@ const Calendars = (): JSX.Element => {
</li>
</ul>
</p>
<p>
You&apos;re ready to automatically schedule calendar events for end
users.
</p>
</div>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
color: $core-fleet-black;
}

p {
margin: $pad-large 0;
}

ui {
margin-block-start: $pad-small;
}
Expand All @@ -30,6 +34,7 @@

#oauth-scopes {
font-family: "SourceCodePro", $monospace;
color: $core-fleet-black;
min-height: 80px;
padding: $pad-medium;
padding-right: $pad-xxlarge;
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"jsx": "react",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"lib": ["ES2021.String"]
"lib": ["ES2021.String"],
"useUnknownInCatchVariables": false
},
"include": ["./frontend/**/*"],
"exclude": ["node_modules"],
Expand Down
Loading