Skip to content
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

Backport harvester cloud creds warning #11580

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading