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

Show alpha warning for service instances #512

Merged
merged 5 commits into from Aug 23, 2018

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Aug 20, 2018

Fixes #475

[EDIT]

screen shot 2018-08-21 at 15 26 12

Copy link
Contributor

@migmartri migmartri left a comment

Choose a reason for hiding this comment

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

Personally I'd not bother with adding logic to "hide" the warning message unless we make it permanent by storing the setting in local storage or something. Which I do not think is worth doing either since this is temporary.

On its current shape, in my opinion, the fact that we allow people to temporarily hide it is more annoying than useful.

I'd just personally add the warning by using a generic warning flash message and the "alpha" suffix in the menu, all this trying to reduce the amount of code added.

@@ -49,6 +49,10 @@ export const errorCatalog = createAction(
type: "ERROR_CATALOG",
}),
);
export const receiveDisableAlphaWarning = createAction("DISABLE_WARNING", () => ({
showAlphaWarning: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to pass showAlphaWarning in the action?

@@ -15,6 +16,7 @@ import {
} from "../ErrorAlert";
import PageHeader from "../PageHeader";
import SearchFilter from "../SearchFilter";
import AlphaWarning from "./AlphaWarning";
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of creating another warning message I'd try to reuse the generic ones that we already have.

@andresmgot
Copy link
Contributor Author

I am fine removing the logic to hide the message

Copy link
Contributor

@migmartri migmartri left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

It would be good to start adding simple tests for new functionality that we add. That way we can set the stage for further development tests

Copy link
Contributor

@prydonius prydonius left a comment

Choose a reason for hiding this comment

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

thanks for this 🙏

</MessageAlert>,
);
expect(wrapper.text()).toContain("test");
expect(wrapper.find(".message__content").text()).toContain("test");
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add some snapshots here so we can tell if things have structurally changed? I think they can be useful as indicators of changes, and also can be easier for writing simple tests like this where you're just checking content.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to raise a discussion for that. I don't find snapshots very helpful because it doesn't allow you to express intentionality. How would you say that the important part of the snapshot is that it renders a element with the class message_content with the text test?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with that, I think snapshots are useful in addition to more specific assertions as they can catch unexpected structural changes.

@@ -41,7 +41,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
to: "/charts",
},
{
children: "Service Instances",
children: "Service Instances (Alpha)",
Copy link
Contributor

Choose a reason for hiding this comment

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

I would lowercase alpha


it("renders the warning for alpha feature", () => {
const wrapper = shallow(
<InstanceListView
Copy link
Contributor

Choose a reason for hiding this comment

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

you may be able to simplify this by casting a smaller object to the InstanceListViewProps (e.g. https://github.com/kubeapps/kubeapps/blob/ea625419021199bc82a1365d75d5ab60c0660fa7/dashboard/src/components/SchemaForm/FieldTemplate.test.tsx#L8), we may need to export InstanceListViewProps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could omit some of the parameters but not all of them. Thanks!

@@ -20,7 +21,7 @@ import { InstanceCardList } from "./InstanceCardList";
export interface InstanceListViewProps {
brokers: IServiceBroker[];
classes: IClusterServiceClass[];
error: Error;
error: Error | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be error?: Error? Sometimes Typescript complains about this though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't but I can omit the error parameter so I don't need that change.

@@ -4,17 +4,20 @@ import { Info } from "react-feather";
import ErrorPageHeader from "./ErrorAlertHeader";

interface IMessageAlertPageProps {
header: string;
header?: string;
type?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: level might be a better word for this

@andresmgot
Copy link
Contributor Author

I am going to merge this PR to unblock a possible release but let me know if we should review the snapshot policy

@andresmgot andresmgot merged commit 5bedab7 into vmware-tanzu:master Aug 23, 2018
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