Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATCH: fix: add AVOID_SPACE_DELETION env var (default to false) #500

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ VUE_APP_BACKEND_BASE_URL=http://localhost:8000
# Authentication settings
VUE_APP_IAM_BASE_URL=https://iam.bimdata.io
VUE_APP_OIDC_CLIENT_ID=<YOUR CLIENT ID>
# can be a comma separated list of identity providers
# Comma separated list of identity providers
VUE_APP_AUTHORIZED_IDENTITY_PROVIDERS=bimdataconnect

# Maptiler auth token used by maplibre
Expand All @@ -23,37 +23,29 @@ VUE_APP_URL_DOCUMENTATION=https://developers.bimdata.io
VUE_APP_URL_MARKETPLACE=https://marketplace.bimdata.io
VUE_APP_URL_OLD_PLATFORM=https://platform-old.bimdata.io

# Guided Tour config
VUE_APP_GUIDED_TOUR_ENABLED=false

# Subscription config
# Subscription feature will be enabled if "true"
VUE_APP_SUBSCRIPTION_ENABLED=false
# Paddle "sandbox" mode will be enabled if "true"
VUE_APP_PADDLE_SANDBOX=false

# Translate IFC entities will be enabled if "true"
VUE_APP_TRANSLATE_IFC_TYPE=false

# Notifications config
VUE_APP_NOTIFICATION_ENABLED=true

# Vendor ID from Paddle
VUE_APP_PADDLE_VENDOR_ID=
# Plans/Product IDs from Paddle
VUE_APP_PRO_PLAN_ID=
VUE_APP_DATAPACK_PLAN_ID=

# Amount of storage available with free plan
# => 300 MB = 300 * 1024^2
# Amount of storage available with free plan in bytes (e.g. 300 MB = 300 * 1024^2)
VUE_APP_FREE_PLAN_STORAGE=314572800

# Amount of base storage available with pro plan
# => 10 GB = 10 * 1024^3
# Amount of base storage available with pro plan in bytes (e.g. 10 GB = 10 * 1024^3)
VUE_APP_PRO_PLAN_STORAGE=10737418240

# Projects config
# Number of days for which a project is considered "New" after its creation
VUE_APP_PROJECT_STATUS_LIMIT_NEW=5
# Number of days since last update for which a project is considered "Active"
VUE_APP_PROJECT_STATUS_LIMIT_ACTIVE=15

# Features
VUE_APP_GUIDED_TOUR_ENABLED=false
VUE_APP_TRANSLATE_IFC_TYPE=false
VUE_APP_NOTIFICATION_ENABLED=true
VUE_APP_AVOID_SPACE_DELETION=false
1 change: 1 addition & 0 deletions etc/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ declare -A vars_to_placeholders=(
[VUE_APP_GUIDED_TOUR_ENABLED]="ENV.VUE_APP_GUIDED_TOUR_ENABLED"
[VUE_APP_TRANSLATE_IFC_TYPE]="ENV.VUE_APP_TRANSLATE_IFC_TYPE"
[VUE_APP_NOTIFICATION_ENABLED]="ENV.VUE_APP_NOTIFICATION_ENABLED"
[VUE_APP_AVOID_SPACE_DELETION]="ENV.VUE_APP_AVOID_SPACE_DELETION"
)

# Function to compute the hash of a resource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import { provide, ref } from "vue";
import { useToggle } from "../../../../../composables/toggle.js";
import { IS_SPACE_DELETION_ENABLED } from "../../../../../config/spaces.js";
import { useSpaces } from "../../../../../state/spaces.js";
import { useUser } from "../../../../../state/user.js";
// Components
Expand Down Expand Up @@ -142,7 +143,7 @@ const removeImage = async () => {
{{ $t("SpaceCardActionMenu.removeImageButtonText") }}
</BIMDataButton>
<BIMDataButton
v-if="isSpaceAdmin(space)"
v-if="IS_SPACE_DELETION_ENABLED && isSpaceAdmin(space)"
data-test-id="btn-open-delete"
color="high"
ghost
Expand Down
8 changes: 7 additions & 1 deletion src/config/spaces.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const AVOID_SPACE_DELETION = ENV.VUE_APP_AVOID_SPACE_DELETION;
const IS_SPACE_DELETION_ENABLED = AVOID_SPACE_DELETION !== "true";

const SPACE_ROLE = Object.freeze({
ADMIN: 100,
USER: 50
});

export { SPACE_ROLE };
export {
IS_SPACE_DELETION_ENABLED,
SPACE_ROLE
};
Loading