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

RCLOUD-1270: Hide version from footer for rba #9129

Closed
wants to merge 1 commit into from

Conversation

ocerda
Copy link
Contributor

@ocerda ocerda commented May 17, 2024

Is this a bugfix, or an enhancement? Please describe.
Change of behavior for rba

Describe the solution you've implemented
Adding the option to hide the version number from the footer

Describe alternatives you've considered

Additional context
https://pagerduty.atlassian.net/browse/RCLOUD-1270

@ocerda ocerda self-assigned this May 17, 2024
@ocerda ocerda marked this pull request as ready for review May 17, 2024 18:14
@ocerda ocerda force-pushed the RCLOUD-1270-hide-version-from-footer branch 2 times, most recently from 4ed19f0 to e7f825a Compare May 27, 2024 21:39
:icon="version.icon"
:color="version.color"
/>
<div v-if="!hideVersion">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity. Why increase the depth of the DOM, when you could change it with a

Suggested change
<div v-if="!hideVersion">
<template v-if="!hideVersion">

/>
</template>

<script lang="ts">
import { RootStore } from "../../../stores/RootStore";
import { defineComponent, inject } from "vue";
import InfoDisplay from "./RundeckInfo.vue";
import {getFeatureEnabled} from "@/library/services/featureConfig";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to use relative imports


export async function getFeatureEnabled(featureName: string) {
const resp = await api.get(`/feature/${featureName}`);
return !!resp.data.enabled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if resp is null?

Comment on lines 44 to 48
if (val !== null) {
this.hideVersion = val;
} else {
this.hideVersion = false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done in one line

Suggested change
if (val !== null) {
this.hideVersion = val;
} else {
this.hideVersion = false;
}
this.hideVersion = (val !== null) ? val : false;

@smartinellibenedetti
Copy link
Contributor

Just a heads-up, there are unit tests for the RundeckInfo component (RundeckInfo.spec.ts), could you please add a test for the new case?

Copy link
Contributor

@JoseOrtiz JoseOrtiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideal approach is to use data-test-id for fetching, but is up to you

Comment on lines 114 to 119
const rundeckVersionComponent = wrapper.findComponent({
name: "RundeckVersion",
});
const versionDisplayComponent = wrapper.findComponent({
name: "VersionDisplay",
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of testing is to check that what is shown to the user is tested, so we need to change this to the right behavior, that some divs inside those components are displayed, so you should change that find elements and then check its existance

Suggested change
const rundeckVersionComponent = wrapper.findComponent({
name: "RundeckVersion",
});
const versionDisplayComponent = wrapper.findComponent({
name: "VersionDisplay",
});
const rundeckVersionComponent = wrapper.find('div.rundeck-version-display');
const versionDisplayComponent = wrapper.find('span.rundeck-version-icon');

Please check if that works if you want to change it, I'm a bit rusty with those kind fo tests 😅

@ocerda ocerda force-pushed the RCLOUD-1270-hide-version-from-footer branch from 326b620 to 06b81ba Compare May 29, 2024 22:11
Copy link
Contributor

@JoseOrtiz JoseOrtiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but could you add a test for the display of div.rundeck-info-widget__group element?

@ocerda ocerda marked this pull request as draft May 30, 2024 21:11
@ocerda ocerda closed this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants