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

feat: enable custom domain edition only on turbo and legacy spaces #1087

Merged
merged 2 commits into from
Jan 9, 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
17 changes: 9 additions & 8 deletions apps/ui/src/components/FormSpaceAdvanced.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { getValidator } from '@/helpers/validation';
import { NetworkID } from '@/types';
import { NetworkID, Space } from '@/types';

const CHILDREN_LIMIT = 16;

Expand Down Expand Up @@ -47,7 +47,7 @@ const isPrivate = defineModel<boolean>('isPrivate', { required: true });

const props = defineProps<{
networkId: NetworkID;
spaceId: string;
space: Space;
isController: boolean;
}>();

Expand Down Expand Up @@ -106,11 +106,11 @@ const formErrors = computed(() => {
}
);

if (parent.value === props.spaceId) {
if (parent.value === props.space.id) {
errors.parent = 'Space cannot be a parent of itself';
}

if (child.value === props.spaceId) {
if (child.value === props.space.id) {
errors.child = 'Space cannot be a sub-space of itself';
}

Expand Down Expand Up @@ -178,11 +178,11 @@ watchEffect(() => {
</div>
<div class="flex flex-wrap gap-2">
<div
v-for="(space, i) in children"
:key="space"
v-for="(childSpace, i) in children"
:key="childSpace"
class="flex items-center gap-2 rounded-lg border px-3 py-2 w-fit"
>
<span>{{ space }}</span>
<span>{{ childSpace }}</span>
<button type="button" @click="deleteChild(i)">
<IH-x-mark class="w-[16px]" />
</button>
Expand Down Expand Up @@ -210,6 +210,7 @@ watchEffect(() => {
v-model="customDomain"
:definition="CUSTOM_DOMAIN_DEFINITION"
:error="formErrors.customDomain"
:disabled="!space.turbo && !space.additionalRawData?.domain"
/>
<UiSwitch v-model="isPrivate" title="Hide space from homepage" />
</div>
Expand Down Expand Up @@ -238,7 +239,7 @@ watchEffect(() => {
<teleport to="#modal">
<ModalDeleteSpace
:open="isDeleteSpaceModalOpen"
:space-id="spaceId"
:space-id="space.id"
@confirm="emit('deleteSpace')"
@close="isDeleteSpaceModalOpen = false"
/>
Expand Down
4 changes: 4 additions & 0 deletions apps/ui/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ a,

input {
@apply outline-none;

&[disabled] {
@apply cursor-not-allowed;
}
}

.choice-bg {
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/views/Space/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ watchEffect(() => setTitle(`Edit settings - ${props.space.name}`));
v-model:custom-domain="customDomain"
v-model:is-private="isPrivate"
:network-id="space.network"
:space-id="space.id"
:space="space"
:is-controller="isController"
@delete-space="handleSpaceDelete"
@update-validity="
Expand Down