Skip to content

Commit e6111c9

Browse files
momesginMo Mesgin
andauthored
respect selected version when performing install as new instance + styling (#17433)
Co-authored-by: Mo Mesgin <mmesgin@Mos-M2-MacBook-Pro.local>
1 parent 920680f commit e6111c9

3 files changed

Lines changed: 40 additions & 4 deletions

File tree

shell/mixins/chart.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ export default {
386386
// Use those values to check for a catalog app resource.
387387
// If found, set the form to edit mode. If not, set the
388388
// form to create mode.
389-
// This is a hard blocker - installing a new instance is NOT allowed.
390389

390+
// This is a hard blocker - installing a new instance is NOT allowed.
391391
this.canInstallNew = false;
392392

393393
try {
@@ -410,11 +410,10 @@ export default {
410410
if ( targetNamespace && targetName ) {
411411
// If the app name and namespace values are not provided in the
412412
// query, fall back on target values defined in the Helm chart itself.
413-
414413
// Ask to install a special chart with fixed namespace/name
415414
// or edit it if there's an existing install.
416-
// This is a hard blocker - installing a new instance is NOT allowed.
417415

416+
// This is a hard blocker - installing a new instance is NOT allowed.
418417
this.canInstallNew = false;
419418

420419
try {

shell/pages/c/_cluster/apps/charts/__tests__/chart.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,40 @@ describe('page: Chart Detail', () => {
361361
openSpy.mockRestore();
362362
});
363363
});
364+
365+
describe('methods: installNewInstance', () => {
366+
it('should navigate to install page with correct query parameters', () => {
367+
const mockRouterPush = jest.fn();
368+
const thisContext = {
369+
$router: { push: mockRouterPush },
370+
$route: { params: { cluster: 'local' } },
371+
$store: { getters: { productId: 'explorer' } },
372+
query: {
373+
repoType: 'cluster',
374+
repoName: 'rancher-charts',
375+
chartName: 'my-chart',
376+
versionName: '1.2.3',
377+
deprecated: 'false'
378+
}
379+
};
380+
381+
(Chart.methods!.installNewInstance as () => void).call(thisContext);
382+
383+
expect(mockRouterPush).toHaveBeenCalledWith({
384+
name: 'c-cluster-apps-charts-install',
385+
params: {
386+
cluster: 'local',
387+
product: 'explorer',
388+
},
389+
query: {
390+
'repo-type': 'cluster',
391+
repo: 'rancher-charts',
392+
chart: 'my-chart',
393+
version: '1.2.3',
394+
deprecated: 'false',
395+
'new-instance': null
396+
}
397+
});
398+
});
399+
});
364400
});

shell/pages/c/_cluster/apps/charts/chart.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ export default {
306306
[REPO_TYPE]: this.query.repoType,
307307
[REPO]: this.query.repoName,
308308
[CHART]: this.query.chartName,
309+
[VERSION]: this.query.versionName,
309310
[DEPRECATED]: this.query.deprecated,
310311
[NEW_APP_INSTANCE]: _FLAGGED,
311312
}
@@ -834,7 +835,7 @@ export default {
834835
display: flex;
835836
align-items: flex-start;
836837
flex-shrink: 0;
837-
gap: 8px;
838+
gap: 16px;
838839
839840
.installed-apps-selector {
840841
width: 340px;

0 commit comments

Comments
 (0)