shwstppr commented on issue #6569:
URL: https://github.com/apache/cloudstack/issues/6569#issuecomment-1195022676

   UUID for SSHKeyPair was added only in 4.16.0. 
https://github.com/apache/cloudstack/pull/5103/files#diff-57c8dd809042b11cd4a14741e2f797e968f23a9cc7bf7b875864397f32d68582R32-R35
   Keypairs added earlier than that do not have UUID. This is why they are 
listed using the name.
   @utchoang we may do something like the following but this would solve it 
only for keypair list. This won't work infocard as resource.keypair will only 
have the name
   ```
   diff --git a/ui/src/components/view/ListView.vue 
b/ui/src/components/view/ListView.vue
   index 292460541a..981152fe21 100644
   --- a/ui/src/components/view/ListView.vue
   +++ b/ui/src/components/view/ListView.vue
   @@ -98,7 +98,7 @@
            </span>
    
            <span v-if="record.hasannotations">
   -          <span v-if="record.id && $route.path !== '/ssh'">
   +          <span v-if="record.id">
                <router-link :to="{ path: $route.path + '/' + record.id }">{{ 
text }}</router-link>
                <router-link :to="{ path: $route.path + '/' + record.id, query: 
{ tab: 'comments' } }"><message-filled style="padding-left: 10px" 
size="small"/></router-link>
              </span>
   @@ -110,7 +110,7 @@
              <router-link :to="{ path: $route.path + '/' + record.name }" 
v-else>{{ $t(text.toLowerCase()) }}</router-link>
            </span>
            <span v-else>
   -          <router-link :to="{ path: $route.path + '/' + record.id }" 
v-if="record.id && $route.path !== '/ssh'">{{ text }}</router-link>
   +          <router-link :to="{ path: $route.path + '/' + record.id }" 
v-if="record.id">{{ text }}</router-link>
              <router-link :to="{ path: $route.path + '/' + record.name }" 
v-else>{{ text }}</router-link>
            </span>
          </span>
   diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
   index ff75a6d269..e8397c0b2d 100644
   --- a/ui/src/views/AutogenView.vue
   +++ b/ui/src/views/AutogenView.vue
   @@ -851,8 +851,11 @@ export default {
          if (this.$route.params && this.$route.params.id) {
            params.id = this.$route.params.id
            if (['listSSHKeyPairs'].includes(this.apiName)) {
   -          delete params.id
   -          params.name = this.$route.params.id
   +          const regexExp = 
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi
   +          if (!regexExp.test(params.id)) {
   +            delete params.id
   +            params.name = this.$route.params.id
   +          }
            }
            if (['listPublicIpAddresses'].includes(this.apiName)) {
              params.allocatedonly = false
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to