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

Fix worker deploying k8s/caprover #3005

Merged
merged 1 commit into from
Jun 23, 2024
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: 11 additions & 6 deletions packages/playground/src/components/manage_worker_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
<slot name="list"></slot>
</template>

<form-validator v-model="valid" v-else>
<slot name="deploy"></slot>
</form-validator>
<d-tabs v-else :tabs="[{ title: 'Config', value: 'config' }]">
<template #config>
<slot name="deploy"></slot>
</template>
</d-tabs>

<template #footer-actions>
<template #footer-actions="{ validateBeforeDeploy }">
<v-btn color="anchor" v-if="!deleting" @click="$emit('close')"> Close </v-btn>
<v-btn
color="error"
Expand All @@ -34,7 +36,11 @@
>
Delete
</v-btn>
<v-btn color="secondary" :disabled="!valid" @click="$emit('deploy', layout)" v-if="showType === 1">
<v-btn
color="secondary"
@click="validateBeforeDeploy(() => $emit('deploy', layout), false)"
v-if="showType === 1"
>
Deploy
</v-btn>
</template>
Expand Down Expand Up @@ -74,7 +80,6 @@ const emits = defineEmits<{

const layout = ref();
const showType = ref(props.workers.length === 0 ? 1 : 0);
const valid = ref(true);
const deletingDialog = ref(false);

function onDelete() {
Expand Down
5 changes: 3 additions & 2 deletions packages/playground/src/components/weblet_layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ provideService({
},
});

function validateBeforeDeploy(fn: () => void) {
function validateBeforeDeploy(fn: () => void, documentScrollend = true) {
const forms = __forms;

let errorInput: [number, any, boolean] | null = null;
Expand Down Expand Up @@ -243,7 +243,8 @@ function validateBeforeDeploy(fn: () => void) {
return;
}

document.addEventListener("scrollend", _improveUx, { once: true });
documentScrollend && document.addEventListener("scrollend", _improveUx, { once: true });
!documentScrollend && setTimeout(_improveUx, 500);
_input.scrollIntoView({ behavior: "smooth", block: "center" });

async function _improveUx() {
Expand Down
Loading