Skip to content

Commit

Permalink
Rever conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Jan 30, 2024
1 parent f436505 commit a5c664c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ export const ChangeRequestOverview: FC = () => {
changeRequest.environment,
);

const conflictCount = changeRequest.features.filter(
(feature) => feature.conflict,
).length;

const getCurrentState = (): PlausibleChangeRequestState => {
switch (changeRequest.state) {
case 'Scheduled':
Expand All @@ -128,15 +124,9 @@ export const ChangeRequestOverview: FC = () => {

const onApplyChanges = async () => {
try {
await changeState(
projectId,
Number(id),
getCurrentState(),
conflictCount,
{
state: 'Applied',
},
);
await changeState(projectId, Number(id), getCurrentState(), {
state: 'Applied',
});
setShowApplyScheduledDialog(false);
refetchChangeRequest();
refetchChangeRequestOpen();
Expand All @@ -152,16 +142,10 @@ export const ChangeRequestOverview: FC = () => {

const onScheduleChangeRequest = async (scheduledDate: Date) => {
try {
await changeState(
projectId,
Number(id),
getCurrentState(),
conflictCount,
{
state: 'Scheduled',
scheduledAt: scheduledDate.toISOString(),
},
);
await changeState(projectId, Number(id), getCurrentState(), {
state: 'Scheduled',
scheduledAt: scheduledDate.toISOString(),
});
setShowScheduleChangeDialog(false);
refetchChangeRequest();
refetchChangeRequestOpen();
Expand Down Expand Up @@ -192,15 +176,9 @@ export const ChangeRequestOverview: FC = () => {

const onCancelChanges = async () => {
try {
await changeState(
projectId,
Number(id),
getCurrentState(),
conflictCount,
{
state: 'Cancelled',
},
);
await changeState(projectId, Number(id), getCurrentState(), {
state: 'Cancelled',
});
setShowCancelDialog(false);
refetchChangeRequest();
refetchChangeRequestOpen();
Expand All @@ -216,16 +194,10 @@ export const ChangeRequestOverview: FC = () => {

const onReject = async (comment?: string) => {
try {
await changeState(
projectId,
Number(id),
getCurrentState(),
conflictCount,
{
state: 'Rejected',
comment,
},
);
await changeState(projectId, Number(id), getCurrentState(), {
state: 'Rejected',
comment,
});
setShowRejectDialog(false);
setToastData({
type: 'success',
Expand All @@ -241,15 +213,9 @@ export const ChangeRequestOverview: FC = () => {

const onApprove = async () => {
try {
await changeState(
projectId,
Number(id),
getCurrentState(),
conflictCount,
{
state: 'Approved',
},
);
await changeState(projectId, Number(id), getCurrentState(), {
state: 'Approved',
});
refetchChangeRequest();
refetchChangeRequestOpen();
setToastData({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const ChangeRequestSidebar: VFC<IChangeRequestSidebarProps> = ({

const onReview = async (draftId: number, comment?: string) => {
try {
await changeState(project, draftId, 'Draft', 0, {
await changeState(project, draftId, 'Draft', {
state: 'In review',
comment,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const useChangeRequestApi = () => {
project: string,
changeRequestId: number,
previousState: PlausibleChangeRequestState,
conflictCount: number,
payload: {
state:
| 'Approved'
Expand All @@ -77,7 +76,6 @@ export const useChangeRequestApi = () => {
eventType: payload.state,
previousState,
id: getUniqueChangeRequestId(uiConfig, changeRequestId),
conflictCount,
},
});

Expand Down

0 comments on commit a5c664c

Please sign in to comment.