Skip to content

Commit

Permalink
backport harvester cloud creds warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Mo Mesgin authored and Mo Mesgin committed Aug 1, 2024
1 parent bc56037 commit 468400e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ cluster:
placeholder: 'Namespace/Name'
cluster: Imported Harvester Cluster
installGuestAgent: Install guest agent
tokenExpirationWarning: 'Warning: Harvester Cloud Credentials use an underlying authentication token that may have an expiry time - please see the following <a href="https://harvesterhci.io/kb/renew_harvester_cloud_credentials" target="_blank" rel="noopener nofollow">knowledge base article</a> for possible implications on management operations.'
description:
label: Cluster Description
placeholder: Any text you want that better describes this cluster
Expand Down
18 changes: 18 additions & 0 deletions shell/cloud-credential/__tests__/harvester.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { mount } from '@vue/test-utils';
import HarvesterCloudCreds from '@shell/cloud-credential/harvester.vue';

const mockStore = { getters: { 'i18n/t': jest.fn() } };

describe('cloud credentials: Harvester', () => {
const wrapper = mount(HarvesterCloudCreds, {
propsData: { value: {} },
mocks: { $store: mockStore }
});

it('should display the warning banner for token expiration', async() => {
const warningBanner = wrapper.find('[data-testid="harvester-token-expiration-warning-banner"]');

expect(warningBanner.exists()).toBe(true);
expect(warningBanner.isVisible()).toBe(true);
});
});
10 changes: 9 additions & 1 deletion shell/cloud-credential/harvester.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script>
import CreateEditView from '@shell/mixins/create-edit-view';
import LabeledSelect from '@shell/components/form/LabeledSelect';
import { Banner } from '@components/Banner';
import { get, set } from '@shell/utils/object';
import { MANAGEMENT, VIRTUAL_HARVESTER_PROVIDER } from '@shell/config/types';
export default {
components: { LabeledSelect },
components: { LabeledSelect, Banner },
mixins: [CreateEditView],
async fetch() {
Expand Down Expand Up @@ -97,6 +98,13 @@ export default {
<template>
<div>
<div class="row mb-10">
<Banner
color="warning"
label-key="cluster.credential.harvester.tokenExpirationWarning"
data-testid="harvester-token-expiration-warning-banner"
/>
</div>
<div class="row mb-10">
<div
class="col span-6"
Expand Down

0 comments on commit 468400e

Please sign in to comment.