Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into DEVPROD-3362
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 committed Mar 4, 2024
2 parents 685c1c3 + c783b5a commit 92b3f7b
Show file tree
Hide file tree
Showing 42 changed files with 742 additions and 441 deletions.
8 changes: 7 additions & 1 deletion .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ functions:
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
cd -
nvm install --no-progress --default ${node_version}
# Retry the download for Node in case it flakes.
for i in {1..5}; do
nvm install --no-progress --default ${node_version}
[[ $? -eq 0 ]] && break
echo "Attempt $i of 5 to install Node failed"
sleep 10
done
npm install -g yarn
run-make-background:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ describe("Project Settings when not defaulting to repo", () => {
cy.dataCy("var-name-input").should("not.exist");
// Verify persistence
cy.reload();
saveButtonEnabled(false);
cy.dataCy("var-name-input").should("not.exist");
});
});
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spruce",
"version": "3.0.212",
"version": "3.0.216",
"private": true,
"scripts": {
"bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh",
Expand Down Expand Up @@ -86,7 +86,7 @@
"@leafygreen-ui/radio-box-group": "12.0.16",
"@leafygreen-ui/radio-group": "10.2.4",
"@leafygreen-ui/search-input": "2.0.8",
"@leafygreen-ui/segmented-control": "8.2.6",
"@leafygreen-ui/segmented-control": "8.2.8",
"@leafygreen-ui/select": "11.1.1",
"@leafygreen-ui/side-nav": "14.1.0",
"@leafygreen-ui/skeleton-loader": "1.1.0",
Expand Down Expand Up @@ -150,7 +150,7 @@
"@testing-library/jest-dom": "6.1.3",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.5.1",
"@types/jest": "29.4.0",
"@types/jest": "29.5.12",
"@types/jest-specific-snapshot": "0.5.9",
"@types/js-cookie": "^3.0.4",
"@types/lodash.debounce": "4.0.7",
Expand Down Expand Up @@ -189,7 +189,7 @@
"http-proxy": "^1.18.1",
"husky": "8.0.1",
"identity-obj-proxy": "3.0.0",
"jest": "29.5.0",
"jest": "29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "29.7.0",
"jest-junit": "15.0.0",
Expand Down
14 changes: 9 additions & 5 deletions scripts/deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/sh
#!/bin/bash

# This script runs the aws cli command to deploy the app to s3
# This script runs the AWS CLI command to deploy the app to S3.

# Try this step and throw an error if it fails
echo "Deploying to S3"
aws s3 sync build/ s3://"${BUCKET}"/ --acl public-read --follow-symlinks --delete --exclude .env-cmdrc.json
echo "Deployed to S3"

if ! aws s3 sync build/ s3://"${BUCKET}"/ --acl public-read --follow-symlinks --delete --exclude .env-cmdrc.json; then
echo "Deployment to S3 failed"
exit 1
else
echo "Successfully deployed to S3"
fi
4 changes: 2 additions & 2 deletions src/analytics/task/useTaskAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "gql/generated/types";
import { TASK } from "gql/queries";
import { useQueryParam } from "hooks/useQueryParam";
import { CommitType } from "pages/task/actionButtons/previousCommits/types";
import { CommitType } from "pages/task/actionButtons/RelevantCommits/types";
import { RequiredQueryParams, LogTypes } from "types/task";

type LogViewer = "raw" | "html" | "parsley";
Expand Down Expand Up @@ -70,7 +70,7 @@ type Action =
| { name: "Click Last Failing Stepback Task Link" }
| { name: "Click Previous Stepback Task Link" }
| { name: "Click Next Stepback Task Link" }
| { name: "Submit Previous Commit Selector"; type: CommitType };
| { name: "Submit Relevant Commit Selector"; type: CommitType };

export const useTaskAnalytics = () => {
const { id } = useParams<{ id: string }>();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/UserDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const UserDropdown = () => {
},
];
if (permissions?.canEditAdminSettings) {
menuItems.splice(1, 0, {
menuItems.splice(2, 0, {
"data-cy": "admin-link",
text: "Admin",
href: adminSettingsURL,
Expand Down
17 changes: 12 additions & 5 deletions src/components/SpruceForm/Widgets/LeafyGreenWidgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export const LeafyGreenSelect: React.FC<

export const LeafyGreenRadio: React.FC<EnumSpruceWidgetProps> = ({
disabled,
id,
label,
onChange,
options,
Expand All @@ -224,11 +225,17 @@ export const LeafyGreenRadio: React.FC<EnumSpruceWidgetProps> = ({
} = options;
return (
<ElementWrapper css={elementWrapperCSS}>
{label && (
<LabelContainer>
<Label htmlFor={id}>{label}</Label>
</LabelContainer>
)}
<RadioGroup
data-cy={dataCy}
id={id}
name={label}
value={value}
onChange={(e) => onChange(e.target.value)}
data-cy={dataCy}
value={value}
>
{enumOptions.map((o) => {
const optionDisabled = enumDisabled?.includes(o.value) ?? false;
Expand Down Expand Up @@ -275,12 +282,12 @@ export const LeafyGreenRadioBox: React.FC<
return (
<ElementWrapper css={elementWrapperCSS}>
{showLabel !== false && (
<RadioBoxLabelContainer>
<LabelContainer>
<Label htmlFor={id} disabled={disabled}>
{label}
</Label>
{description && <Description>{description}</Description>}
</RadioBoxLabelContainer>
</LabelContainer>
)}
{!!errors && (
<StyledBanner variant="danger" data-cy="error-banner">
Expand Down Expand Up @@ -320,7 +327,7 @@ const StyledBanner = styled(Banner)`
margin-bottom: ${size.s};
`;

const RadioBoxLabelContainer = styled.div`
const LabelContainer = styled.div`
margin-bottom: ${size.xs};
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ exports[`Snapshot Tests SpruceForm.stories Example2 1`] = `
<div
aria-label="radio-group-"
class="leafygreen-ui-14o8ny9"
id="root_reprovisionMethod"
role="group"
>
<div
Expand Down
2 changes: 2 additions & 0 deletions src/components/SpruceForm/customFormats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
validateJira,
validateJiraURL,
validateNoSpecialCharacters,
validateNoStartingOrTrailingWhitespace,
validatePercentage,
validateRegexp,
validateSlack,
Expand All @@ -17,6 +18,7 @@ export const customFormats = (jiraHost: string) => ({
noSpecialCharacters: validateNoSpecialCharacters,
// Permit empty string but disallow whitespace
noSpaces: /^$|^\S+$/,
noStartingOrTrailingWhitespace: validateNoStartingOrTrailingWhitespace,
validDuration: validateDuration,
validEmail: validateEmail,
validJiraTicket: validateJira,
Expand Down
5 changes: 5 additions & 0 deletions src/components/SpruceForm/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export const transformErrors = (errors: AjvError[]) =>
...error,
message: "Value should not contain spaces.",
};
case "noStartingOrTrailingWhitespace":
return {
...error,
message: "Value should not start or end with whitespace.",
};
case "validDuration":
return {
...error,
Expand Down
2 changes: 2 additions & 0 deletions src/constants/externalResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const ignoredFilesDocumentationUrl = `${wikiBaseUrl}/Project-Configuratio

export const cliDocumentationUrl = `${wikiBaseUrl}/CLI`;

export const containersOnboardingDocumentationUrl = `${wikiBaseUrl}/Containers/Container-Tasks`;

export const windowsPasswordRulesURL =
"https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc786468(v=ws.10)?redirectedfrom=MSDN";

Expand Down
15 changes: 5 additions & 10 deletions src/constants/fieldMaps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { getDateCopy } from "utils/string";

export const timeZones = [
{
str: "Coordinated Universal Time",
Expand Down Expand Up @@ -167,7 +165,7 @@ export const timeZones = [
},
];

const listOfDateFormatStrings = [
export const listOfDateFormatStrings = [
"MM-dd-yyyy",
"dd-MM-yyyy",
"yyyy-MM-dd",
Expand All @@ -177,13 +175,10 @@ const listOfDateFormatStrings = [
"MMM d, yyyy",
];

export const dateFormats = listOfDateFormatStrings.map((format) => ({
value: format,
str: `${format} - ${getDateCopy("08/31/2022", {
dateFormat: format,
dateOnly: true,
})}`,
}));
export enum TimeFormat {
TwelveHour = "h:mm:ss aa",
TwentyFourHour = "H:mm:ss",
}

export const notificationFields = {
patchFinish: "Patch finish",
Expand Down
6 changes: 6 additions & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2910,6 +2910,7 @@ export type User = {
__typename?: "User";
displayName: Scalars["String"]["output"];
emailAddress: Scalars["String"]["output"];
parsleyFilters: Array<ParsleyFilter>;
patches: Patches;
permissions: Permissions;
subscriptions?: Maybe<Array<GeneralSubscription>>;
Expand Down Expand Up @@ -2949,6 +2950,7 @@ export type UserSettings = {
region?: Maybe<Scalars["String"]["output"]>;
slackMemberId?: Maybe<Scalars["String"]["output"]>;
slackUsername?: Maybe<Scalars["String"]["output"]>;
timeFormat?: Maybe<Scalars["String"]["output"]>;
timezone?: Maybe<Scalars["String"]["output"]>;
useSpruceOptions?: Maybe<UseSpruceOptions>;
};
Expand All @@ -2964,6 +2966,7 @@ export type UserSettingsInput = {
region?: InputMaybe<Scalars["String"]["input"]>;
slackMemberId?: InputMaybe<Scalars["String"]["input"]>;
slackUsername?: InputMaybe<Scalars["String"]["input"]>;
timeFormat?: InputMaybe<Scalars["String"]["input"]>;
timezone?: InputMaybe<Scalars["String"]["input"]>;
useSpruceOptions?: InputMaybe<UseSpruceOptionsInput>;
};
Expand Down Expand Up @@ -5407,6 +5410,7 @@ export type BaseVersionAndTaskQuery = {
execution: number;
id: string;
projectIdentifier?: string | null;
status: string;
baseTask?: {
__typename?: "Task";
execution: number;
Expand Down Expand Up @@ -6171,6 +6175,7 @@ export type LastMainlineCommitQuery = {
__typename?: "Task";
execution: number;
id: string;
order: number;
status: string;
} | null> | null;
} | null> | null;
Expand Down Expand Up @@ -8720,6 +8725,7 @@ export type UserSettingsQuery = {
region?: string | null;
slackMemberId?: string | null;
slackUsername?: string | null;
timeFormat?: string | null;
timezone?: string | null;
githubUser?: {
__typename?: "GithubUser";
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/base-version-and-task.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ query BaseVersionAndTask($taskId: String!) {
execution
id
projectIdentifier
status
versionMetadata {
baseVersion {
id
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/last-mainline-commit.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ query LastMainlineCommit(
tasks {
execution
id
order
status
}
}
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/user-settings.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ query UserSettings {
region
slackMemberId
slackUsername
timeFormat
timezone
useSpruceOptions {
hasUsedMainlineCommitsBefore
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useDateFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { useUserTimeZone } from "./useUserTimeZone";
export const useDateFormat = () => {
const timezone = useUserTimeZone();
const { userSettings } = useUserSettings();
const { dateFormat } = userSettings || {};
const { dateFormat, timeFormat } = userSettings || {};

return (date: string | number | Date, options: DateCopyOptions = {}) =>
getDateCopy(date, {
tz: timezone,
dateFormat,
timeFormat,
...options,
});
};
Loading

0 comments on commit 92b3f7b

Please sign in to comment.