Skip to content

Commit

Permalink
Auto generate release name (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmgot authored Dec 17, 2018
1 parent 84b6a15 commit e1b2f19
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"enzyme-adapter-react-16": "^1.1.1",
"js-yaml": "^3.10.0",
"lodash": "^4.17.11",
"moniker-native": "^0.1.6",
"protobufjs": "^6.8.4",
"qs": "^6.5.2",
"raf": "^3.4.0",
Expand Down
10 changes: 10 additions & 0 deletions dashboard/src/components/DeploymentForm/DeploymentForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,15 @@ it("renders the full DeploymentForm", () => {
const wrapper = shallow(
<DeploymentForm {...defaultProps} selected={{ versions, version: versions[0] }} />,
);
// Force static name
wrapper.setState({ releaseName: "bar" });
expect(wrapper).toMatchSnapshot();
});

it("renders a release name by default", () => {
const versions = [{ id: "foo", attributes: { version: "1.2.3" } }] as IChartVersion[];
const wrapper = shallow(
<DeploymentForm {...defaultProps} selected={{ versions, version: versions[0] }} />,
);
expect(wrapper.state("releaseName")).toBeTruthy();
});
3 changes: 2 additions & 1 deletion dashboard/src/components/DeploymentForm/DeploymentForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RouterAction } from "connected-react-router";
import * as Moniker from "moniker-native";
import * as React from "react";
import AceEditor from "react-ace";

Expand Down Expand Up @@ -46,7 +47,7 @@ class DeploymentForm extends React.Component<IDeploymentFormProps, IDeploymentFo
appValues: undefined,
isDeploying: false,
namespace: this.props.namespace,
releaseName: "",
releaseName: Moniker.choose(),
latestSubmittedReleaseName: "",
valuesModified: false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`renders the full DeploymentForm 1`] = `
pattern="[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*"
required={true}
title="Use lower case alphanumeric characters, '-' or '.'"
value=""
value="bar"
/>
</div>
<div>
Expand Down
5 changes: 5 additions & 0 deletions dashboard/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6776,6 +6776,11 @@ mock-socket@^8.0.2:
dependencies:
url-parse "^1.2.0"

moniker-native@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/moniker-native/-/moniker-native-0.1.6.tgz#019af026841c32c78edb420695c14b24dd095d09"
integrity sha1-AZrwJoQcMseO20IGlcFLJN0JXQk=

moo@^0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/moo/-/moo-0.4.3.tgz#3f847a26f31cf625a956a87f2b10fbc013bfd10e"
Expand Down

0 comments on commit e1b2f19

Please sign in to comment.