Skip to content

Commit f0ac1e1

Browse files
Merge pull request #3026 from threefoldtech/development_fix_sshkey_issue
Prevent recursive component tree by displaying SSH keys alert
2 parents 76de227 + ad991ce commit f0ac1e1

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/playground/src/components/ssh_keys/ManageSshDeployemnt.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ export default defineComponent({
134134
selectedKeys.value = sshKeysManagement.list().filter(_key => _key.isActive === true);
135135
// TODO: Remove the below `selectedKeys.value = [selectedKeys.value[0]];` to make the user select more than one key
136136
// after fixing this issue: https://github.com/threefoldtech/tf-images/issues/231
137-
selectedKeys.value = [selectedKeys.value[0]];
137+
if (selectedKeys.value.length) {
138+
selectedKeys.value = [selectedKeys.value[0]];
139+
}
138140
handleKeys();
139141
emit("selectedKeys", selectedKeysString.value);
140142
});
@@ -173,7 +175,9 @@ export default defineComponent({
173175
}
174176
175177
function handleKeys() {
176-
selectedKeysString.value = selectedKeys.value.map(_key => _key.publicKey).join("\n\n");
178+
if (selectedKeys.value.length) {
179+
selectedKeysString.value = selectedKeys.value.map(_key => _key.publicKey).join("\n\n");
180+
}
177181
}
178182
179183
/* interact with form_validator */

packages/playground/src/components/view_layout.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
/>
77

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

@@ -21,12 +23,11 @@
2123
import { computed, onMounted, onUnmounted, ref } from "vue";
2224
import { useRoute } from "vue-router";
2325
26+
import { DashboardRoutes } from "@/router/routes";
2427
import { useProfileManager } from "@/stores";
25-
import SshkeyView from "@/views/sshkey_view.vue";
2628
2729
export default {
2830
name: "ViewLayout",
29-
components: { SshkeyView },
3031
setup() {
3132
const route = useRoute();
3233
const profileManager = useProfileManager();
@@ -55,6 +56,7 @@ export default {
5556
requireSSH: computed(() => route.meta.requireSSH),
5657
tick,
5758
viewLayoutContainer,
59+
DashboardRoutes,
5860
};
5961
},
6062
};

0 commit comments

Comments
 (0)