Skip to content

Commit

Permalink
Tidying up ready to review
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-cox committed Jan 9, 2025
1 parent fb203f9 commit 86ae345
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 26 deletions.
12 changes: 0 additions & 12 deletions shell/components/Questions/Reference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,6 @@ export default {
:all-resources-settings="allResourceSettings"
@update:value="!$fetchState.pending && $emit('update:value', $event)"
/>
<!--
<LabeledSelect
:mode="mode"
:options="options"
:disabled="$fetchState.pending || disabled"
:label="displayLabel"
:placeholder="question.description"
:required="question.required"
:value="value"
:tooltip="displayTooltip"
@update:value="!$fetchState.pending && $emit('update:value', $event)"
/> -->
</div>
<div class="col span-6 mt-10">
{{ typeSchema.attributes.kind }}<span v-if="isNamespaced"> in namespace {{ targetNamespace }}</span>
Expand Down
2 changes: 1 addition & 1 deletion shell/detail/catalog.cattle.io.app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
async fetch() {
const promises = {
catalog: this.$store.dispatch('catalog/load'),
allOperations: this.$store.dispatch('cluster/findAll', { type: CATALOG.OPERATION }), // TODO: RC Round 2
allOperations: this.$store.dispatch('cluster/findAll', { type: CATALOG.OPERATION }),
secret: this.value.fetchValues(true),
};
Expand Down
4 changes: 2 additions & 2 deletions shell/detail/networking.k8s.io.ingress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CreateEditView from '@shell/mixins/create-edit-view';
import Rules from '@shell/edit/networking.k8s.io.ingress/Rules';
import ResourceTabs from '@shell/components/form/ResourceTabs';
import Tab from '@shell/components/Tabbed/Tab';
import IngressHelper from '@shell/utils/ingress';
import IngressDetailEditHelper from '@shell/utils/ingress';
export default {
name: 'CRUIngress',
Expand All @@ -16,7 +16,7 @@ export default {
},
mixins: [CreateEditView],
async fetch() {
this.ingressHelper = new IngressHelper({
this.ingressHelper = new IngressDetailEditHelper({
$store: this.$store,
namespace: this.value.metadata.namespace
});
Expand Down
2 changes: 1 addition & 1 deletion shell/dialog/RollbackWorkloadDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default {
},
fetch() {
// Fetch revisions of the current workload
this.$store.dispatch('cluster/findAll', { type: this.revisionsType }) // TODO: RC workload
this.$store.dispatch('cluster/findAll', { type: this.revisionsType })
.then(( response ) => {
const allRevisions = response;
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/autoscaling.horizontalpodautoscaler/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default {
},
async loadWorkloads() {
await Promise.all(
Object.values(SCALABLE_WORKLOAD_TYPES).map((type) => this.$store.dispatch('cluster/findAll', { type }) // TODO: RC workload
Object.values(SCALABLE_WORKLOAD_TYPES).map((type) => this.$store.dispatch('cluster/findAll', { type })
)
);
},
Expand Down
8 changes: 3 additions & 5 deletions shell/edit/networking.k8s.io.ingress/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { allHash } from '@shell/utils/promise';
import { SECRET, SERVICE, INGRESS_CLASS } from '@shell/config/types';
import { INGRESS_CLASS } from '@shell/config/types';
import NameNsDescription from '@shell/components/form/NameNsDescription';
import CreateEditView from '@shell/mixins/create-edit-view';
import FormValidation from '@shell/mixins/form-validation';
Expand All @@ -10,14 +10,12 @@ import Labels from '@shell/components/form/Labels';
import Error from '@shell/components/form/Error';
import Tabbed from '@shell/components/Tabbed';
import { get, set } from '@shell/utils/object';
import { SECRET_TYPES as TYPES } from '@shell/config/secret';
import DefaultBackend from './DefaultBackend';
import Certificates from './Certificates';
import Rules from './Rules';
import IngressClass from './IngressClass';
import Loading from '@shell/components/Loading';
import { FilterArgs, PaginationParamFilter } from '@shell/types/store/pagination.types';
import IngressHelper from '@shell/utils/ingress';
import IngressDetailEditHelper from '@shell/utils/ingress';
export default {
name: 'CRUIngress',
Expand Down Expand Up @@ -51,7 +49,7 @@ export default {
},
async fetch() {
this.ingressHelper = new IngressHelper({
this.ingressHelper = new IngressDetailEditHelper({
$store: this.$store,
namespace: this.value.metadata.namespace
});
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/resources.cattle.io.backup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
const hash = await allHash({
catalog: this.$store.dispatch('catalog/load'),
resourceSet: this.$store.dispatch('cluster/find', { type: BACKUP_RESTORE.RESOURCE_SET, id: this.value?.spec?.resourceSetName || 'rancher-resource-set' }),
apps: this.$store.dispatch('cluster/findAll', { type: CATALOG.APP }) // TODO: RC APP
apps: this.$store.dispatch('cluster/findAll', { type: CATALOG.APP })
});
this.apps = hash.apps;
Expand Down
2 changes: 1 addition & 1 deletion shell/edit/ui.cattle.io.navlink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default {
},
async fetch() {
this.services = await this.$store
.dispatch('cluster/findAll', { type: SERVICE }); // TODO: RC SERVICE
.dispatch('cluster/findAll', { type: SERVICE });
},
methods: {
/**
Expand Down
21 changes: 19 additions & 2 deletions shell/utils/ingress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { SECRET, SERVICE } from '@shell/config/types';
import { SECRET_TYPES as TYPES } from '@shell/config/secret';
import { VuexStore } from '@shell/types/store/vuex';

class IngressHelper {
/**
* Helper class for common functionality shared between the detail and edit ingress pages
*
* This could be an untyped mixin.. but this setups up us better for the future
*/
class IngressDetailEditHelper {
private $store: VuexStore;
private namespace: string;

Expand All @@ -17,10 +22,22 @@ class IngressHelper {
this.namespace = namespace;
}

/**
* Fetch services that will either be used to show
* - Create - the possible rule's target service
* - Edit - the selected and possible rule's target service
* - Detail - the selected rule's target service
*/
async fetchServices(args?: { namespace: string}): Promise<any[]> {
return this.$store.dispatch('cluster/findAll', { type: SERVICE, opt: { namespaced: args?.namespace || this.namespace } });
}

/**
* Fetch secrets that will either be used to show
* - Create - the possible secrets to use as a certificates
* - Edit - the selected and possible secrets to use as a certificates
* - Detail - the selected secrets to use as certificates
*/
async fetchSecrets(args?: { namespace: string}): Promise<any[]> {
return this.$store.dispatch('cluster/findAll', { type: SECRET, opt: { namespaced: args?.namespace || this.namespace } });
}
Expand All @@ -44,4 +61,4 @@ class IngressHelper {
}
}

export default IngressHelper;
export default IngressDetailEditHelper;

0 comments on commit 86ae345

Please sign in to comment.