-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from jadmsaadaot/SUBMIT-task#149-B
Integrate UI Package status with newly implemented package.status
- Loading branch information
Showing
13 changed files
with
152 additions
and
51 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
submit-api/migrations/versions/e1e1b81ad5c8_rename_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
""" Rename aggregated_item_statuses to status | ||
Revision ID: e1e1b81ad5c8 | ||
Revises: 8dff03f931d7 | ||
Create Date: 2024-10-16 11:09:18.732646 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects.postgresql import ENUM, ARRAY | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'e1e1b81ad5c8' | ||
down_revision = '8dff03f931d7' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Remove the existing status column | ||
op.drop_column('packages', 'status') | ||
|
||
# Rename aggregated_item_statuses to status | ||
op.alter_column( | ||
'packages', | ||
'aggregated_item_statuses', | ||
new_column_name='status', | ||
existing_type=ARRAY( | ||
ENUM('NEW_SUBMISSION', 'IN_REVIEW', 'APPROVED', 'REJECTED', 'SUBMITTED', name='packagestatus')), | ||
nullable=False | ||
) | ||
|
||
|
||
def downgrade(): | ||
# Add the status column back | ||
|
||
# Rename status back to aggregated_item_statuses | ||
op.alter_column( | ||
'packages', | ||
'status', | ||
new_column_name='aggregated_item_statuses', | ||
existing_type=ARRAY(ENUM('NEW_SUBMISSION', 'IN_REVIEW', 'APPROVED', 'REJECTED', 'SUBMITTED', name='packagestatus')), | ||
nullable=False | ||
) | ||
op.add_column( | ||
'packages', | ||
sa.Column('status', ENUM('NEW_SUBMISSION', 'IN_REVIEW', 'APPROVED', 'REJECTED', 'SUBMITTED', name='packagestatus'), nullable=True) | ||
) | ||
# populate status column with the first member of the existing aggregated_item_statuses or 'NEW_SUBMISSION' if empty | ||
op.execute( | ||
"UPDATE packages SET status = COALESCE(aggregated_item_statuses[1], 'NEW_SUBMISSION')" | ||
) | ||
# make status column not nullable | ||
op.alter_column('packages', 'status', nullable=False) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
submit-web/src/components/PackageStatusChip/PackageStatusChipStack.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { PackageStatus } from "@/models/Package"; | ||
import { Box, Stack } from "@mui/material"; | ||
import PackageStatusChip from "."; | ||
|
||
type PackageStatusChipStackProps = { | ||
status: PackageStatus[]; | ||
}; | ||
export const PackageStatusChipStack = ({ | ||
status, | ||
}: PackageStatusChipStackProps) => { | ||
return ( | ||
<Box sx={{ display: "inline-block" }}> | ||
<Stack direction="column" spacing={1} width={"fit-content"}> | ||
{status.map((value) => ( | ||
<PackageStatusChip key={value} status={value} /> | ||
))} | ||
</Stack> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.