Skip to content

Commit

Permalink
[master] fix(app): add version name ordering in app version lists (#4443
Browse files Browse the repository at this point in the history
)

fix(app): add version name ordering in app version lists

Add 'versionName' ordering parameter to useAppVersionList hook calls in BasicInfoForm
and AppVersionSelector components to ensure consistent version display order

Signed-off-by: leioy <[email protected]>
Co-authored-by: leioy <[email protected]>
  • Loading branch information
ks-ci-bot and Leioy authored Jan 17, 2025
1 parent c635bc1 commit cb29fd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export function BasicInfoForm({
}: Props): JSX.Element {
const { workspace } = useParams();
const [initData, setInitData] = useState<Partial<AppBasicInfoFormData>>();
const { data: versions } = useAppVersionList({ appName }, { status: versionStatus });
const { data: versions } = useAppVersionList(
{ appName },
{ status: versionStatus, order: 'versionName' },
);
const sortedVersions = useMemo(
() =>
(versions || [])
Expand Down
13 changes: 9 additions & 4 deletions packages/shared/src/components/Apps/AppVersionSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ export function AppVersionSelector({
selectedVersionChange,
}: Props): JSX.Element {
const [selectedVersion, setSelectedVersion] = useState<string>('');
const { data: versions = [] } = useAppVersionList({
workspace,
appName: appDetail.metadata.name,
});
const { data: versions = [] } = useAppVersionList(
{
workspace,
appName: appDetail.metadata.name,
},
{
order: 'versionName',
},
);
const versionOptions = useMemo(() => {
return versions?.map(({ metadata, spec }) => ({
label: spec.versionName,
Expand Down

0 comments on commit cb29fd6

Please sign in to comment.