-
Notifications
You must be signed in to change notification settings - Fork 120
[PoC] Add cloud providers via configuration #1436
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
Changes from 8 commits
f180778
859ce48
91a854b
94212d1
243af79
c92f994
24761c3
99f13c5
cb04234
7d2bb3c
63724f1
e0e86a8
cb2c2ff
ed706cd
9f97095
046ed03
ee7f4cb
7275264
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,9 @@ SPDX-License-Identifier: Apache-2.0 | |
| </template> | ||
|
|
||
| <script> | ||
| import { mapState } from 'vuex' | ||
| import startsWith from 'lodash/startsWith' | ||
| import get from 'lodash/get' | ||
|
|
||
| export default { | ||
| props: { | ||
|
|
@@ -30,60 +32,35 @@ export default { | |
| } | ||
| }, | ||
| computed: { | ||
| ...mapState([ | ||
| 'cfg' | ||
| ]), | ||
| iconSrc () { | ||
| switch (this.value) { | ||
| // infrastructures | ||
| case 'azure': | ||
| return require('@/assets/azure.svg') | ||
| case 'aws': | ||
| return require('@/assets/aws.svg') | ||
| case 'gcp': | ||
| return require('@/assets/gcp.svg') | ||
| case 'openstack': | ||
| return require('@/assets/openstack.svg') | ||
| case 'alicloud': | ||
| return require('@/assets/alicloud.svg') | ||
| case 'vsphere': | ||
| return require('@/assets/vsphere.svg') | ||
| case 'metal': | ||
| return require('@/assets/metal.svg') | ||
| const customCloudProviderIcon = get(this.cfg, ['customCloudProviders', this.value, 'icon']) | ||
| if (customCloudProviderIcon) { | ||
| return customCloudProviderIcon | ||
| } | ||
|
|
||
| // dns | ||
| case 'aws-route53': | ||
| return require('@/assets/aws-route53.svg') | ||
| case 'azure-dns': | ||
| // If filename is different from value you need to specify this below | ||
| switch (this.value) { | ||
| case 'azure-private-dns': | ||
| return require('@/assets/azure-dns.svg') | ||
| case 'google-clouddns': | ||
| return require('@/assets/google-clouddns.svg') | ||
| case 'openstack-designate': | ||
| return require('@/assets/openstack.svg') | ||
| case 'alicloud-dns': | ||
| return require('@/assets/alicloud-dns.png') | ||
| case 'cloudflare-dns': | ||
| return require('@/assets/cloudflare-dns.svg') | ||
| case 'infoblox-dns': | ||
| return require('@/assets/infoblox-dns.svg') | ||
| case 'netlify-dns': | ||
| return require('@/assets/netlify-dns.svg') | ||
|
|
||
| // os | ||
| case 'coreos': | ||
| return require('@/assets/coreos.svg') | ||
| case 'suse-jeos': | ||
| return require('@/assets/suse.svg') | ||
| case 'suse-chost': | ||
| return require('@/assets/suse.svg') | ||
| case 'ubuntu': | ||
| return require('@/assets/ubuntu.svg') | ||
| case 'gardenlinux': | ||
| return require('@/assets/gardenlinux.svg') | ||
| case 'flatcar': | ||
| return require('@/assets/flatcar.svg') | ||
| case 'hcloud': | ||
| return require('@/assets/hcloud.svg') | ||
| } | ||
| return undefined | ||
|
|
||
| try { | ||
| return require(`@/assets/${this.value}.svg`) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tested this. I think it will not work as expected because there is a webpack build step involved which creates hash values for the assets and returns a pathname with the hash value. In this case webpack cannot know the path and the require will not work at runtime??
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are probably right. I did not think about the webpack build step. I need to adjust this anyway to support images mounted via configuration. I will revert the other changes |
||
| } catch (err) { | ||
| return undefined | ||
| } | ||
| }, | ||
| isMdiIcon () { | ||
| return startsWith(this.value, 'mdi-') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.