From d33ae4fba32830816f0cdfa73b13b98d521d09e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:43:08 +0100 Subject: [PATCH 1/2] chore(deps): bump cross-spawn in /web/crux (#1019) Bumps and [cross-spawn](https://github.com/moxystudio/node-cross-spawn). These dependencies needed to be updated together. Updates `cross-spawn` from 7.0.3 to 7.0.6 - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) Updates `cross-spawn` from 6.0.5 to 7.0.6 - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- web/crux/package-lock.json | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/web/crux/package-lock.json b/web/crux/package-lock.json index 2bbbb24df..2a82c190d 100644 --- a/web/crux/package-lock.json +++ b/web/crux/package-lock.json @@ -4570,9 +4570,10 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -11255,9 +11256,10 @@ } }, "node_modules/run-applescript/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "license": "MIT", "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", From c41d5a291b00c335c3571375cd5946056d8e048b Mon Sep 17 00:00:00 2001 From: Bence Date: Wed, 27 Nov 2024 16:01:23 +0100 Subject: [PATCH 2/2] feat: add image order column (#1020) * feat: image order column * feat: fix orders in database * fix: language & NaN order * fix: default column --------- Co-authored-by: Levente Orban --- web/crux-ui/locales/en/images.json | 3 ++- .../projects/versions/version-view-list.tsx | 10 +++++++++- web/crux-ui/src/elements/dyo-table.tsx | 2 +- .../migration.sql | 11 +++++++++++ web/crux/src/app/image/image.service.ts | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 web/crux/prisma/migrations/20241126252000_normalize_image_order/migration.sql diff --git a/web/crux-ui/locales/en/images.json b/web/crux-ui/locales/en/images.json index 51975459b..eb72e6cb4 100644 --- a/web/crux-ui/locales/en/images.json +++ b/web/crux-ui/locales/en/images.json @@ -24,5 +24,6 @@ "unknownTag": "unknown", "invalidImageFormat": "Invalid format, please use 'NAME[:TAG]'", "tagRequired": "Tag is required", - "uncheckedRegistryExplanation": "Please be aware that you are using an unchecked registry. The tag you enter will be used directly, which means if the tag does not exist, the deployment will fail." + "uncheckedRegistryExplanation": "Please be aware that you are using an unchecked registry. The tag you enter will be used directly, which means if the tag does not exist, the deployment will fail.", + "order": "Order" } diff --git a/web/crux-ui/src/components/projects/versions/version-view-list.tsx b/web/crux-ui/src/components/projects/versions/version-view-list.tsx index d968e3bb6..da3103116 100644 --- a/web/crux-ui/src/components/projects/versions/version-view-list.tsx +++ b/web/crux-ui/src/components/projects/versions/version-view-list.tsx @@ -2,7 +2,7 @@ import { DyoCard } from '@app/elements/dyo-card' import DyoIcon from '@app/elements/dyo-icon' import DyoLink from '@app/elements/dyo-link' import DyoModal, { DyoConfirmationModal } from '@app/elements/dyo-modal' -import DyoTable, { DyoColumn, sortDate, sortString } from '@app/elements/dyo-table' +import DyoTable, { DyoColumn, sortDate, sortNumber, sortString } from '@app/elements/dyo-table' import useConfirmation from '@app/hooks/use-confirmation' import useTeamRoutes from '@app/hooks/use-team-routes' import { DeleteImageMessage, VersionImage, WS_TYPE_DELETE_IMAGE } from '@app/models' @@ -54,6 +54,14 @@ const VersionViewList = (props: VersionViewListProps) => { <> + `#${data.order + 1}`} + /> (props: React.PropsWithChildren>) => { return ( {columns.map((col, index) => { - const cellData = col.field ? getField(it, col.field) : col.body ? col.body(it, index) : null + const cellData = col.field ? getField(it, col.field) : col.body ? col.body(it, rowIndex) : null const paddingClass = index === 0 ? 'pl-6' : index === columns.length - 1 ? 'pr-6' : null const cursorClass = click && !col.preventClickThrough ? 'cursor-pointer' : null diff --git a/web/crux/prisma/migrations/20241126252000_normalize_image_order/migration.sql b/web/crux/prisma/migrations/20241126252000_normalize_image_order/migration.sql new file mode 100644 index 000000000..d3007b824 --- /dev/null +++ b/web/crux/prisma/migrations/20241126252000_normalize_image_order/migration.sql @@ -0,0 +1,11 @@ +-- Create temp table +SELECT "versionId", MIN("order") "order" INTO "_prisma_migrations_NormalizeOrder" FROM "Image" GROUP BY "versionId"; + +-- Normalize orders +UPDATE "Image" "img" SET "order" = "order" - ( + SELECT "order" FROM "_prisma_migrations_NormalizeOrder" "norm" + WHERE "norm"."versionId" = "img"."versionId" +); + +-- Drop temp table +DROP TABLE "_prisma_migrations_NormalizeOrder"; diff --git a/web/crux/src/app/image/image.service.ts b/web/crux/src/app/image/image.service.ts index 01cc04b9d..6d1aea352 100644 --- a/web/crux/src/app/image/image.service.ts +++ b/web/crux/src/app/image/image.service.ts @@ -109,7 +109,7 @@ export default class ImageService { }, }) - const lastOrder = lastImageOrder?.order ?? 0 + const lastOrder = lastImageOrder?.order ?? -1 let order = lastOrder + 1 // we need the generated uuids, so we can't use createMany