Skip to content

Commit

Permalink
[INT] Fixed pkg not building with 2.0.0 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
eva-vashkevich committed Jul 26, 2024
1 parent 2be6154 commit 2c47e50
Show file tree
Hide file tree
Showing 7 changed files with 2,039 additions and 1,798 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ module.exports = {
}
}
]
};
};
16 changes: 7 additions & 9 deletions pkg/capi/edit/cluster.x-k8s.io.cluster/ClusterConfig.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang='ts'>
import Vue, { VueConstructor } from 'vue';
import { defineComponent, PropType } from 'vue';
import { set, clone } from '@shell/utils/object';
import { clear } from '@shell/utils/array';
import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue';
Expand Down Expand Up @@ -42,9 +42,7 @@ interface Step {
name: String
}
export default (Vue as VueConstructor<
Vue & InstanceType<typeof CreateEditView>
>).extend({
export default defineComponent({
name: 'ClusterConfig',
components: {
CruResource,
Expand Down Expand Up @@ -73,7 +71,7 @@ export default (Vue as VueConstructor<
default: ''
},
clusterClasses: {
type: Array,
type: Array as PropType<ClusterClass[]>,
required: true
}
},
Expand Down Expand Up @@ -136,7 +134,7 @@ export default (Vue as VueConstructor<
class: ''
},
variablesReady: true,
clusterClassObj: null,
clusterClassObj: null as ClusterClass | null,
loading: true
};
},
Expand Down Expand Up @@ -221,7 +219,7 @@ export default (Vue as VueConstructor<
return out;
function addType(obj: {[key: string]: any}) {
const id = obj?.metadata?.name;
const id = obj?.id;
const subtype = {
id,
obj,
Expand All @@ -239,7 +237,7 @@ export default (Vue as VueConstructor<
const split = unescape(name).split('/');
return x.metadata.namespace === split[0] && x.metadata.name === split[1];
});
}) || null;
if ( !!this.clusterClassObj ) {
this.setClass();
this.setNamespace();
Expand Down Expand Up @@ -307,7 +305,7 @@ export default (Vue as VueConstructor<
});
},
clickedType(obj: {[key:string]: any}) {
this.clusterClassObj = this.clusterClasses.find((x: ClusterClass) => x.metadata.name === obj.id);
this.clusterClassObj = this.clusterClasses.find((x: ClusterClass) => x.id === obj.id) || null;
this.setClass();
this.setNamespace();
},
Expand Down
6 changes: 2 additions & 4 deletions pkg/capi/edit/cluster.x-k8s.io.cluster/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import Vue, { VueConstructor } from 'vue';
import { defineComponent } from 'vue';
import { SUB_TYPE } from '@shell/config/query-params';
import { set } from '@shell/utils/object';
import CreateEditView from '@shell/mixins/create-edit-view';
Expand All @@ -9,9 +9,7 @@ import type { Route } from 'vue-router';
import { CAPI, QUERY_PARAMS, ClusterClass } from '../../types/capi';
import ClusterConfig from './ClusterConfig.vue';
export default (Vue as VueConstructor<
Vue & InstanceType<typeof CreateEditView>
>).extend({
export default defineComponent({
name: 'CreateCluster',
components: {
CruResource,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang='ts'>
import Vue, { VueConstructor } from 'vue';
import { defineComponent } from 'vue';
import { mapGetters } from 'vuex';
import CreateEditView from '@shell/mixins/create-edit-view';
import { clear } from '@shell/utils/array';
Expand Down Expand Up @@ -42,6 +42,8 @@ const customProviderSpec = {
version: ''
};
const providerTypes = ['infrastructure', 'bootstrap', 'controlPlane', 'addon' ];
interface Secret {
metadata: {
name: string,
Expand All @@ -53,9 +55,7 @@ interface Hash {
coreProviderSecret: Secret[]
}
export default (Vue as VueConstructor<
Vue & InstanceType<typeof CreateEditView>
>).extend({
export default defineComponent({
components: {
CruResource,
Loading,
Expand Down Expand Up @@ -109,12 +109,7 @@ export default (Vue as VueConstructor<
],
allNamespaces: [],
needCredential: providerDetails?.needCredentials || false,
typeOptions: [
{ label: this.t('capi.provider.type.infrastructure.label'), value: 'infrastructure' },
{ label: this.t('capi.provider.type.bootstrap.label'), value: 'bootstrap' },
{ label: this.t('capi.provider.type.controlPlane.label'), value: 'controlPlane' },
{ label: this.t('capi.provider.type.addon.label'), value: 'addon' }
]
};
},
computed: {
Expand All @@ -126,6 +121,9 @@ export default (Vue as VueConstructor<
url: urlValidator(this.$store.getters['i18n/t'])
};
},
typeOptions() {
return providerTypes.map((type)=>{return {label: this.t(`capi.provider.type.${type}.label`), value: type}});
},
showForm() {
return !!this.value.spec.credentials.rancherCloudCredentialNamespaceName || !this.needCredential;
},
Expand Down
12 changes: 7 additions & 5 deletions pkg/capi/edit/turtles-capi.cattle.io.capiprovider/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import Vue, { VueConstructor } from 'vue';
import { defineComponent } from 'vue';
import CreateEditView from '@shell/mixins/create-edit-view';
import CruResource from '@shell/components/CruResource.vue';
import SelectIconGrid from '@shell/components/SelectIconGrid.vue';
Expand All @@ -15,10 +15,11 @@ interface ProviderType {
icon: HTMLImageElement
disabled: boolean,
}
type Route = {
query: {[index: string]:any},
};
export default (Vue as VueConstructor<
Vue & InstanceType<typeof CreateEditView>
>).extend({
export default defineComponent({
name: 'CreateProvider',
components: {
Expand Down Expand Up @@ -52,7 +53,8 @@ export default (Vue as VueConstructor<
},
data() {
const subType: string = this.$route.query[SUB_TYPE] || null;
const route = this.$route as Route;
const subType: string | null = route?.query[SUB_TYPE] || null;
return { subType };
},
Expand Down
8 changes: 6 additions & 2 deletions pkg/capi/types/capi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ export interface CAPIClusterNetwork {
}

export interface ClusterClass {
id: string,
metadata: {
name: string,
namespace: string,
annotations?: {[key: string]: string}
},
spec: {
infrastructure: Object,
workers: Object,
controlPlane: Object
workers: {
machinePools: [],
machineDeployments: []
},
controlPlane: {ref: {name: string}}
}
}
export interface Provider {
Expand Down
Loading

0 comments on commit 2c47e50

Please sign in to comment.