From ee11ed1384ca3b0bb76eabb5de0e462cf47a0c9c Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Wed, 9 Oct 2024 14:34:54 +0530 Subject: [PATCH 1/4] [MOBIL-319] chore: combine user details and current workspace details in a single query (#1406) * chore: added user information query in dashboard * dev: removed print statements --- apiserver/plane/graphql/queries/dashboard.py | 36 ++++++++++++++++++++ apiserver/plane/graphql/schema.py | 2 ++ apiserver/plane/graphql/types/dashboard.py | 12 +++++++ 3 files changed, 50 insertions(+) create mode 100644 apiserver/plane/graphql/queries/dashboard.py create mode 100644 apiserver/plane/graphql/types/dashboard.py diff --git a/apiserver/plane/graphql/queries/dashboard.py b/apiserver/plane/graphql/queries/dashboard.py new file mode 100644 index 0000000000..85eb6b5abb --- /dev/null +++ b/apiserver/plane/graphql/queries/dashboard.py @@ -0,0 +1,36 @@ +from typing import Optional + +# Third-Party Imports +import strawberry +from asgiref.sync import sync_to_async + +# Strawberry Imports +from strawberry.types import Info +from strawberry.permission import PermissionExtension + + +# Module Imports +from plane.db.models import Workspace, Profile +from plane.graphql.types.dashboard import UserInformationType +from plane.graphql.permissions.workspace import IsAuthenticated + + +@strawberry.type +class userInformationQuery: + @strawberry.field( + extensions=[PermissionExtension(permissions=[IsAuthenticated()])] + ) + async def userInformation(self, info: Info) -> UserInformationType: + profile = await sync_to_async(Profile.objects.get)( + user=info.context.user + ) + + workspace_id = ( + profile.last_workspace_id if profile.last_workspace_id else None + ) + if workspace_id: + workspace = await sync_to_async(Workspace.objects.get)( + id=workspace_id + ) + + return UserInformationType(user=info.context.user, workspace=workspace) diff --git a/apiserver/plane/graphql/schema.py b/apiserver/plane/graphql/schema.py index 7085a9eccb..6236b9baca 100644 --- a/apiserver/plane/graphql/schema.py +++ b/apiserver/plane/graphql/schema.py @@ -46,6 +46,7 @@ from .queries.issues import ( IssuesSearchQuery, SubIssuesQuery, ) +from .queries.dashboard import userInformationQuery # mutations from .mutations.workspace import WorkspaceMutation, WorkspaceInviteMutation @@ -125,6 +126,7 @@ class Query( ModuleIssueUserPropertyQuery, IssueRelationQuery, IssuesSearchQuery, + userInformationQuery, ): pass diff --git a/apiserver/plane/graphql/types/dashboard.py b/apiserver/plane/graphql/types/dashboard.py new file mode 100644 index 0000000000..ebf21b86ac --- /dev/null +++ b/apiserver/plane/graphql/types/dashboard.py @@ -0,0 +1,12 @@ +# strawberry imports +import strawberry + +# module imports +from plane.graphql.types.users import UserType +from plane.graphql.types.workspace import WorkspaceType + + +@strawberry.type +class UserInformationType: + user: UserType + workspace: WorkspaceType From 73d317ec66e64f19ea72a94e3efabd6844132520 Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Thu, 10 Oct 2024 15:24:38 +0530 Subject: [PATCH 2/4] fix: typo fixes --- web/ee/components/workspace/activation-modal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ee/components/workspace/activation-modal.tsx b/web/ee/components/workspace/activation-modal.tsx index e9696bace6..6f5f7b220b 100644 --- a/web/ee/components/workspace/activation-modal.tsx +++ b/web/ee/components/workspace/activation-modal.tsx @@ -61,7 +61,7 @@ export const SubscriptionActivationModal: FC = obs handleClose(); handleSuccessModalToggle(true); } catch { - setErrors("Your license is invalid or already in use. For any queries contact support@plane.so ."); + setErrors("Your license is invalid or already in use. For any queries contact support@plane.so"); } finally { setLoader(false); } From fecc9572845f8fafb274d18bc378da8bc4b1c88e Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Thu, 10 Oct 2024 16:54:01 +0530 Subject: [PATCH 3/4] fix: cloud workflow build args --- .github/workflows/build-branch-cloud.yml | 65 +++++++++++++----------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-branch-cloud.yml b/.github/workflows/build-branch-cloud.yml index 2a01dc9e4b..271bb77fcf 100644 --- a/.github/workflows/build-branch-cloud.yml +++ b/.github/workflows/build-branch-cloud.yml @@ -68,6 +68,7 @@ jobs: build_prerelease: ${{ steps.set_env_variables.outputs.BUILD_PRERELEASE }} release_version: ${{ steps.set_env_variables.outputs.RELEASE_VERSION }} vault_secrets: ${{ steps.get_vault_secrets.outputs.VAULT_SECRETS }} + build_args: ${{ steps.prepare_build_args.outputs.BUILD_ARGS }} steps: - id: set_env_variables name: Set Environment Variables @@ -147,6 +148,35 @@ jobs: VAULT_SECRETS=$(cat vault_secrets.json | base64 -w 0) echo "VAULT_SECRETS=${VAULT_SECRETS}" >> $GITHUB_OUTPUT + - name: Prepare Docker Build Args + id: prepare_build_args + if: ${{github.event.inputs.useVaultSecrets == 'true'}} + run: | + BUILD_ARGS="" + add_build_arg() { + if [ -n "$2" ]; then + BUILD_ARGS="$BUILD_ARGS $1=$2" + fi + } + add_build_arg "NEXT_PUBLIC_API_BASE_URL" "${{ env.NEXT_PUBLIC_API_BASE_URL }}" + add_build_arg "NEXT_PUBLIC_API_BASE_PATH" "${{ env.NEXT_PUBLIC_API_BASE_PATH }}" + + add_build_arg "NEXT_PUBLIC_ADMIN_BASE_URL" "${{ env.NEXT_PUBLIC_ADMIN_BASE_URL }}" + add_build_arg "NEXT_PUBLIC_ADMIN_BASE_PATH" "${{ env.NEXT_PUBLIC_ADMIN_BASE_PATH }}" + + add_build_arg "NEXT_PUBLIC_SPACE_BASE_URL" "${{ env.NEXT_PUBLIC_SPACE_BASE_URL }}" + add_build_arg "NEXT_PUBLIC_SPACE_BASE_PATH" "${{ env.NEXT_PUBLIC_SPACE_BASE_PATH }}" + + add_build_arg "NEXT_PUBLIC_LIVE_BASE_URL" "${{ env.NEXT_PUBLIC_LIVE_BASE_URL }}" + add_build_arg "NEXT_PUBLIC_LIVE_BASE_PATH" "${{ env.NEXT_PUBLIC_LIVE_BASE_PATH }}" + + add_build_arg "NEXT_PUBLIC_SILO_BASE_URL" "${{ env.NEXT_PUBLIC_SILO_BASE_URL }}" + add_build_arg "NEXT_PUBLIC_SILO_BASE_PATH" "${{ env.NEXT_PUBLIC_SILO_BASE_PATH }}" + + add_build_arg "NEXT_PUBLIC_WEB_BASE_URL" "${{ env.NEXT_PUBLIC_WEB_BASE_URL }}" + + echo "BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_OUTPUT + - id: checkout_files name: Checkout Files uses: actions/checkout@v4 @@ -197,14 +227,10 @@ jobs: runs-on: ubuntu-20.04 needs: [branch_build_setup] steps: - - name: Load Vault Secrets - run: | - echo ${{ needs.branch_build_setup.outputs.vault_secrets }} | base64 -d > vault_secrets.json - jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' vault_secrets.json >> $GITHUB_ENV - - id: checkout_files name: Checkout Files uses: actions/checkout@v4 + - name: Admin Build and Push uses: ./.github/actions/build-push-action with: @@ -227,14 +253,7 @@ jobs: buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} - build-args: | - NEXT_PUBLIC_WEB_BASE_URL=${{ env.NEXT_PUBLIC_WEB_BASE_URL }} - NEXT_PUBLIC_SPACE_BASE_URL=${{ env.NEXT_PUBLIC_SPACE_BASE_URL }} - NEXT_PUBLIC_ADMIN_BASE_URL=${{ env.NEXT_PUBLIC_ADMIN_BASE_URL }} - NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }} - NEXT_PUBLIC_ADMIN_BASE_PATH=${{ env.NEXT_PUBLIC_ADMIN_BASE_PATH }} - NEXT_PUBLIC_SPACE_BASE_PATH=${{ env.NEXT_PUBLIC_SPACE_BASE_PATH }} - NEXT_PUBLIC_API_BASE_PATH=${{ env.NEXT_PUBLIC_API_BASE_PATH }} + build-args: ${{ needs.branch_build_setup.outputs.build_args }} branch_build_push_web: if: ${{ needs.branch_build_setup.outputs.build_web == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} @@ -270,16 +289,7 @@ jobs: buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} - build-args: | - NEXT_PUBLIC_WEB_BASE_URL=${{ env.NEXT_PUBLIC_WEB_BASE_URL }} - NEXT_PUBLIC_SPACE_BASE_URL=${{ env.NEXT_PUBLIC_SPACE_BASE_URL }} - NEXT_PUBLIC_ADMIN_BASE_URL=${{ env.NEXT_PUBLIC_ADMIN_BASE_URL }} - NEXT_PUBLIC_LIVE_BASE_URL=${{ env.NEXT_PUBLIC_LIVE_BASE_URL }} - NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }} - NEXT_PUBLIC_ADMIN_BASE_PATH=${{ env.NEXT_PUBLIC_ADMIN_BASE_PATH }} - NEXT_PUBLIC_SPACE_BASE_PATH=${{ env.NEXT_PUBLIC_SPACE_BASE_PATH }} - NEXT_PUBLIC_API_BASE_PATH=${{ env.NEXT_PUBLIC_API_BASE_PATH }} - NEXT_PUBLIC_LIVE_BASE_PATH=${{ env.NEXT_PUBLIC_LIVE_BASE_PATH }} + build-args: ${{ needs.branch_build_setup.outputs.build_args }} branch_build_push_space: if: ${{ needs.branch_build_setup.outputs.build_space == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} @@ -315,14 +325,7 @@ jobs: buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} buildx-endpoint: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} - build-args: | - NEXT_PUBLIC_WEB_BASE_URL=${{ env.NEXT_PUBLIC_WEB_BASE_URL }} - NEXT_PUBLIC_SPACE_BASE_URL=${{ env.NEXT_PUBLIC_SPACE_BASE_URL }} - NEXT_PUBLIC_ADMIN_BASE_URL=${{ env.NEXT_PUBLIC_ADMIN_BASE_URL }} - NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }} - NEXT_PUBLIC_ADMIN_BASE_PATH=${{ env.NEXT_PUBLIC_ADMIN_BASE_PATH }} - NEXT_PUBLIC_SPACE_BASE_PATH=${{ env.NEXT_PUBLIC_SPACE_BASE_PATH }} - NEXT_PUBLIC_API_BASE_PATH=${{ env.NEXT_PUBLIC_API_BASE_PATH }} + build-args: ${{ needs.branch_build_setup.outputs.build_args }} branch_build_push_live: if: ${{ needs.branch_build_setup.outputs.build_live == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} From 0aa11d3917a21c19afe5bc860f8127e214640713 Mon Sep 17 00:00:00 2001 From: "M. Palanikannan" <73993394+Palanikannan1437@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:28:42 +0530 Subject: [PATCH 4/4] regression: image aspect ratio fix (#1435) --- .../custom-image/components/image-block.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/editor/src/core/extensions/custom-image/components/image-block.tsx b/packages/editor/src/core/extensions/custom-image/components/image-block.tsx index f067ee9478..2492413196 100644 --- a/packages/editor/src/core/extensions/custom-image/components/image-block.tsx +++ b/packages/editor/src/core/extensions/custom-image/components/image-block.tsx @@ -62,7 +62,7 @@ export const CustomImageBlock: React.FC = (props) => { const [size, setSize] = useState({ width: ensurePixelString(width, "35%"), height: ensurePixelString(height, "auto"), - aspectRatio: aspectRatio || 1, + aspectRatio: aspectRatio || null, }); const [isResizing, setIsResizing] = useState(false); const [initialResizeComplete, setInitialResizeComplete] = useState(false); @@ -102,17 +102,17 @@ export const CustomImageBlock: React.FC = (props) => { } setEditorContainer(closestEditorContainer); - const aspectRatio = img.naturalWidth / img.naturalHeight; + const aspectRatioCalculated = img.naturalWidth / img.naturalHeight; if (width === "35%") { const editorWidth = closestEditorContainer.clientWidth; const initialWidth = Math.max(editorWidth * 0.35, MIN_SIZE); - const initialHeight = initialWidth / aspectRatio; + const initialHeight = initialWidth / aspectRatioCalculated; const initialComputedSize = { width: `${Math.round(initialWidth)}px` satisfies Pixel, height: `${Math.round(initialHeight)}px` satisfies Pixel, - aspectRatio: aspectRatio, + aspectRatio: aspectRatioCalculated, }; setSize(initialComputedSize); @@ -122,9 +122,10 @@ export const CustomImageBlock: React.FC = (props) => { ); } else { // as the aspect ratio in not stored for old images, we need to update the attrs - if (!aspectRatio) { + // or if aspectRatioCalculated from the image's width and height doesn't match stored aspectRatio then also we'll update the attrs + if (!aspectRatio || aspectRatio !== aspectRatioCalculated) { setSize((prevSize) => { - const newSize = { ...prevSize, aspectRatio }; + const newSize = { ...prevSize, aspectRatio: aspectRatioCalculated }; updateAttributesSafely( newSize, "Failed to update attributes while initializing images with width but no aspect ratio:" @@ -213,7 +214,7 @@ export const CustomImageBlock: React.FC = (props) => { onMouseDown={handleImageMouseDown} style={{ width: size.width, - aspectRatio: size.aspectRatio, + ...(size.aspectRatio && { aspectRatio: size.aspectRatio }), }} > {showImageLoader && ( @@ -239,7 +240,7 @@ export const CustomImageBlock: React.FC = (props) => { })} style={{ width: size.width, - aspectRatio: size.aspectRatio, + ...(size.aspectRatio && { aspectRatio: size.aspectRatio }), }} /> {showImageUtils && (