Skip to content

Commit

Permalink
Merge branch 'main' of github.com:evergreen-ci/ui into dependabot/npm…
Browse files Browse the repository at this point in the history
…_and_yarn/leafygreen-ui/text-input-13.0.2
  • Loading branch information
SupaJoon committed Apr 29, 2024
2 parents 95ec8d9 + 25afe96 commit 328b7ac
Show file tree
Hide file tree
Showing 31 changed files with 221 additions and 189 deletions.
8 changes: 4 additions & 4 deletions apps/parsley/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "parsley",
"private": true,
"version": "2.1.0",
"version": "2.1.2",
"scripts": {
"bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh",
"build": "tsc && GIT_SHA=`git rev-parse HEAD` APP_VERSION=$npm_package_version vite build",
Expand Down Expand Up @@ -106,8 +106,8 @@
"@types/jest-specific-snapshot": "0.5.9",
"@types/js-cookie": "3.0.4",
"@types/lodash.debounce": "4.0.7",
"@types/new-relic-browser": "1.230.2",
"@types/node": "^20.11.30",
"@types/new-relic-browser": "1.230.4",
"@types/node": "^20.12.7",
"@types/pluralize": "0.0.31",
"@types/prompts": "2.4.4",
"@types/react": "18.0.15",
Expand Down Expand Up @@ -152,7 +152,7 @@
"vite": "4.5.2",
"vite-plugin-checker": "0.6.2",
"vite-plugin-env-compatible": "1.1.1",
"vite-tsconfig-paths": "4.3.1",
"vite-tsconfig-paths": "4.3.2",
"web-streams-polyfill": "^3.2.1",
"whatwg-fetch": "3.6.17"
},
Expand Down
22 changes: 16 additions & 6 deletions apps/parsley/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1051,19 +1051,22 @@ export type Mutation = {
saveRepoSettingsForSection: RepoSettings;
saveSubscription: Scalars["Boolean"]["output"];
schedulePatch: Patch;
schedulePatchTasks?: Maybe<Scalars["String"]["output"]>;
scheduleTasks: Array<Task>;
scheduleUndispatchedBaseTasks?: Maybe<Array<Task>>;
setAnnotationMetadataLinks: Scalars["Boolean"]["output"];
setLastRevision: SetLastRevisionPayload;
/** @deprecated Use setVersionPriority instead */
setPatchPriority?: Maybe<Scalars["String"]["output"]>;
/** setPatchVisibility takes a list of patch ids and a boolean to set the visibility on the my patches queries */
setPatchVisibility: Array<Patch>;
setTaskPriority: Task;
setVersionPriority?: Maybe<Scalars["String"]["output"]>;
spawnHost: Host;
spawnVolume: Scalars["Boolean"]["output"];
/** @deprecated Use unscheduleVersionTasks instead */
unschedulePatchTasks?: Maybe<Scalars["String"]["output"]>;
unscheduleTask: Task;
unscheduleVersionTasks?: Maybe<Scalars["String"]["output"]>;
updateHostStatus: Scalars["Int"]["output"];
updateParsleySettings?: Maybe<UpdateParsleySettingsPayload>;
updatePublicKey: Array<PublicKey>;
Expand Down Expand Up @@ -1264,17 +1267,14 @@ export type MutationSchedulePatchArgs = {
patchId: Scalars["String"]["input"];
};

export type MutationSchedulePatchTasksArgs = {
patchId: Scalars["String"]["input"];
};

export type MutationScheduleTasksArgs = {
taskIds: Array<Scalars["String"]["input"]>;
versionId: Scalars["String"]["input"];
};

export type MutationScheduleUndispatchedBaseTasksArgs = {
patchId: Scalars["String"]["input"];
patchId?: InputMaybe<Scalars["String"]["input"]>;
versionId?: InputMaybe<Scalars["String"]["input"]>;
};

export type MutationSetAnnotationMetadataLinksArgs = {
Expand Down Expand Up @@ -1302,6 +1302,11 @@ export type MutationSetTaskPriorityArgs = {
taskId: Scalars["String"]["input"];
};

export type MutationSetVersionPriorityArgs = {
priority: Scalars["Int"]["input"];
versionId: Scalars["String"]["input"];
};

export type MutationSpawnHostArgs = {
spawnHostInput?: InputMaybe<SpawnHostInput>;
};
Expand All @@ -1319,6 +1324,11 @@ export type MutationUnscheduleTaskArgs = {
taskId: Scalars["String"]["input"];
};

export type MutationUnscheduleVersionTasksArgs = {
abort: Scalars["Boolean"]["input"];
versionId: Scalars["String"]["input"];
};

export type MutationUpdateHostStatusArgs = {
hostIds: Array<Scalars["String"]["input"]>;
notes?: InputMaybe<Scalars["String"]["input"]>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { save } from "./utils";

// TODO: https://jira.mongodb.org/browse/DEVPROD-6656 - Uncomment the Warnings assertions when the backend supports it
describe("general section", () => {
beforeEach(() => {
cy.visit("/distro/localhost/settings/general");
Expand All @@ -16,6 +17,7 @@ describe("general section", () => {
cy.contains("button", "Add alias").click();
cy.getInputByLabel("Alias").type("localhost-alias");
cy.getInputByLabel("Notes").type("this is a note");
// cy.getInputByLabel("Warnings").type("this is a warning");
cy.getInputByLabel("Disable shallow clone for this distro").check({
force: true,
});
Expand All @@ -27,6 +29,7 @@ describe("general section", () => {
cy.reload();
cy.getInputByLabel("Alias").should("have.value", "localhost-alias");
cy.getInputByLabel("Notes").should("have.value", "this is a note");
// cy.getInputByLabel("Warnings").should("have.value", "this is a warning");
cy.getInputByLabel("Disable shallow clone for this distro").should(
"be.checked",
);
Expand All @@ -35,6 +38,7 @@ describe("general section", () => {
// Undo changes.
cy.dataCy("delete-item-button").click();
cy.getInputByLabel("Notes").clear();
// cy.getInputByLabel("Warnings").clear();
cy.getInputByLabel("Disable shallow clone for this distro").uncheck({
force: true,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/spruce/cypress/integration/job_logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("Job logs page", () => {
cy.visit(`job-logs/DNE/0/job0`);
cy.validateToast(
"error",
"There was an error retrieving logs for this task: task not found",
"There was an error retrieving logs for this task",
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ describe("task history", () => {
it("shows an error message if mainline commit history could not be retrieved", () => {
cy.visit("/task-history/bogus-project/bogus-task");
cy.dataCy("loading-cell").should("have.length", 0);
cy.validateToast(
"error",
"There was an error loading the task history: Could not find project with id: bogus-project",
);
cy.validateToast("error", "There was an error loading the task history");
});

it("link from task page should link to the commit and scroll to it", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ describe("variant history", () => {
it("shows an error message if mainline commit history could not be retrieved", () => {
cy.visit("/variant-history/bogus-project/bogus-variant");
cy.dataCy("loading-cell").should("have.length", 0);
cy.validateToast(
"error",
"There was an error loading the variant history: Could not find project with id: bogus-project",
);
cy.validateToast("error", "There was an error loading the variant history");
});

it("should link to a specific commit from the project health page", () => {
Expand Down
10 changes: 5 additions & 5 deletions apps/spruce/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spruce",
"version": "4.1.7",
"version": "4.1.9",
"private": true,
"scripts": {
"bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh",
Expand Down Expand Up @@ -135,7 +135,7 @@
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-operations": "4.0.1",
"@graphql-eslint/eslint-plugin": "3.18.0",
"@graphql-eslint/eslint-plugin": "3.20.1",
"@originjs/vite-plugin-commonjs": "1.0.3",
"@sentry/vite-plugin": "2.16.0",
"@storybook/addon-actions": "7.6.6",
Expand All @@ -154,8 +154,8 @@
"@types/js-cookie": "^3.0.4",
"@types/lodash.debounce": "4.0.7",
"@types/lodash.throttle": "^4.1.9",
"@types/new-relic-browser": "0.1212.2",
"@types/node": "^20.11.30",
"@types/new-relic-browser": "1.230.4",
"@types/node": "^20.12.7",
"@types/pluralize": "0.0.33",
"@types/prompts": "2.4.9",
"@types/react": "18.2.0",
Expand Down Expand Up @@ -213,7 +213,7 @@
"vite-plugin-checker": "0.6.2",
"vite-plugin-env-compatible": "2.0.1",
"vite-plugin-imp": "2.4.0",
"vite-tsconfig-paths": "4.2.0"
"vite-tsconfig-paths": "4.3.2"
},
"resolutions": {
"has-symbols": "^1.0.2"
Expand Down
26 changes: 13 additions & 13 deletions apps/spruce/src/components/PatchActionButtons/DisableTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ import { Body } from "@leafygreen-ui/typography";
import Popconfirm from "components/Popconfirm";
import { useToastContext } from "context/toast";
import {
SetPatchPriorityMutation,
SetPatchPriorityMutationVariables,
SetVersionPriorityMutation,
SetVersionPriorityMutationVariables,
} from "gql/generated/types";
import { SET_PATCH_PRIORITY } from "gql/mutations";
import { SET_VERSION_PRIORITY } from "gql/mutations";

interface Props {
patchId: string;
versionId: string;
refetchQueries?: string[];
}
export const DisableTasks: React.FC<Props> = ({
patchId,
refetchQueries = [],
versionId,
}) => {
const dispatchToast = useToastContext();
const [open, setOpen] = useState(false);
const menuItemRef = useRef<HTMLDivElement>(null);

const [disablePatch] = useMutation<
SetPatchPriorityMutation,
SetPatchPriorityMutationVariables
>(SET_PATCH_PRIORITY, {
const [disableVersion] = useMutation<
SetVersionPriorityMutation,
SetVersionPriorityMutationVariables
>(SET_VERSION_PRIORITY, {
onCompleted: () => {
dispatchToast.success(`Tasks in this patch were disabled`);
dispatchToast.success("Tasks in this version were disabled");
},
onError: (err) => {
dispatchToast.error(`Unable to disable patch tasks: ${err.message}`);
dispatchToast.error(`Unable to disable version's tasks: ${err.message}`);
},
refetchQueries,
});
Expand All @@ -49,8 +49,8 @@ export const DisableTasks: React.FC<Props> = ({
<Popconfirm
align="left"
onConfirm={() => {
disablePatch({
variables: { patchId, priority: -1 },
disableVersion({
variables: { versionId, priority: -1 },
});
}}
open={open}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import {
import { SCHEDULE_UNDISPATCHED_BASE_TASKS } from "gql/mutations";

interface Props {
patchId: string;
versionId: string;
disabled: boolean;
}

export const ScheduleUndispatchedBaseTasks: React.FC<Props> = ({
disabled,
patchId,
versionId,
}) => {
const dispatchToast = useToastContext();
const [open, setOpen] = useState(false);
const menuItemRef = useRef<HTMLDivElement>(null);

const [scheduleBasePatchTasks] = useMutation<
const [scheduleBaseVersionTasks] = useMutation<
ScheduleUndispatchedBaseTasksMutation,
ScheduleUndispatchedBaseTasksMutationVariables
>(SCHEDULE_UNDISPATCHED_BASE_TASKS, {
Expand All @@ -36,7 +36,7 @@ export const ScheduleUndispatchedBaseTasks: React.FC<Props> = ({
});

const onConfirm = () => {
scheduleBasePatchTasks({ variables: { patchId } });
scheduleBaseVersionTasks({ variables: { versionId } });
};

return (
Expand Down
26 changes: 13 additions & 13 deletions apps/spruce/src/components/PatchActionButtons/UnscheduleTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ import { useVersionAnalytics } from "analytics";
import Popconfirm from "components/Popconfirm";
import { useToastContext } from "context/toast";
import {
UnschedulePatchTasksMutation,
UnschedulePatchTasksMutationVariables,
UnscheduleVersionTasksMutation,
UnscheduleVersionTasksMutationVariables,
} from "gql/generated/types";
import { UNSCHEDULE_PATCH_TASKS } from "gql/mutations";
import { UNSCHEDULE_VERSION_TASKS } from "gql/mutations";

interface props {
patchId: string;
refetchQueries?: string[];
disabled?: boolean;
refetchQueries?: string[];
versionId: string;
}
export const UnscheduleTasks: React.FC<props> = ({
disabled,
patchId,
refetchQueries = [],
versionId,
}) => {
const dispatchToast = useToastContext();
const { sendEvent } = useVersionAnalytics(patchId);
const { sendEvent } = useVersionAnalytics(versionId);

const [abort, setAbort] = useState(true);
const [open, setOpen] = useState(false);
const menuItemRef = useRef<HTMLDivElement>(null);

const [unschedulePatchTasks, { loading: loadingUnschedulePatchTasks }] =
const [unscheduleVersionTasks, { loading: loadingUnscheduleVersionTasks }] =
useMutation<
UnschedulePatchTasksMutation,
UnschedulePatchTasksMutationVariables
>(UNSCHEDULE_PATCH_TASKS, {
UnscheduleVersionTasksMutation,
UnscheduleVersionTasksMutationVariables
>(UNSCHEDULE_VERSION_TASKS, {
onCompleted: () => {
dispatchToast.success(
`All tasks were unscheduled ${
Expand All @@ -49,7 +49,7 @@ export const UnscheduleTasks: React.FC<props> = ({
});

const onConfirm = () => {
unschedulePatchTasks({ variables: { patchId, abort } });
unscheduleVersionTasks({ variables: { versionId, abort } });
sendEvent({ name: "Unschedule", abort });
};

Expand All @@ -59,7 +59,7 @@ export const UnscheduleTasks: React.FC<props> = ({
<MenuItem
active={open}
data-cy="unschedule-patch"
disabled={disabled || loadingUnschedulePatchTasks}
disabled={disabled || loadingUnscheduleVersionTasks}
onClick={() => setOpen(!open)}
>
Unschedule all tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const DropdownMenu: React.FC<Props> = ({
<ScheduleTasks key="schedule" versionId={patchId} disabled={!hasVersion} />,
<UnscheduleTasks
key="unschedule"
patchId={patchId}
versionId={patchId}
refetchQueries={refetchQueries}
disabled={!hasVersion}
/>,
Expand Down
Loading

0 comments on commit 328b7ac

Please sign in to comment.