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

Prevent recursive component tree by displaying SSH keys alert #3026

Merged
merged 1 commit into from
Jun 25, 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
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ export default defineComponent({
selectedKeys.value = sshKeysManagement.list().filter(_key => _key.isActive === true);
// TODO: Remove the below `selectedKeys.value = [selectedKeys.value[0]];` to make the user select more than one key
// after fixing this issue: https://github.com/threefoldtech/tf-images/issues/231
selectedKeys.value = [selectedKeys.value[0]];
if (selectedKeys.value.length) {
selectedKeys.value = [selectedKeys.value[0]];
}
handleKeys();
emit("selectedKeys", selectedKeysString.value);
});
Expand Down Expand Up @@ -173,7 +175,9 @@ export default defineComponent({
}

function handleKeys() {
selectedKeysString.value = selectedKeys.value.map(_key => _key.publicKey).join("\n\n");
if (selectedKeys.value.length) {
selectedKeysString.value = selectedKeys.value.map(_key => _key.publicKey).join("\n\n");
}
}

/* interact with form_validator */
Expand Down
10 changes: 6 additions & 4 deletions packages/playground/src/components/view_layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
/>

<template v-if="requireSSH && !ssh">
<VAlert variant="tonal" type="error" :text="title + ' requires public ssh key.'" class="mb-4" />
<SshkeyView />
<VAlert variant="tonal" type="error" class="mb-4">
{{ title }} requires a public SSH key. You can generate or import it from the
<router-link :to="DashboardRoutes.Deploy.SSHKey">SSH Keys</router-link> page.
</VAlert>
</template>
<slot v-else :key="tick" />

Expand All @@ -21,12 +23,11 @@
import { computed, onMounted, onUnmounted, ref } from "vue";
import { useRoute } from "vue-router";

import { DashboardRoutes } from "@/router/routes";
import { useProfileManager } from "@/stores";
import SshkeyView from "@/views/sshkey_view.vue";

export default {
name: "ViewLayout",
components: { SshkeyView },
setup() {
const route = useRoute();
const profileManager = useProfileManager();
Expand Down Expand Up @@ -55,6 +56,7 @@ export default {
requireSSH: computed(() => route.meta.requireSSH),
tick,
viewLayoutContainer,
DashboardRoutes,
};
},
};
Expand Down
Loading