|
|
@@ -7,7 +7,11 @@ import { ChartType, RepoType, StorageType } from '../../../../shared/types';
|
|
|
import { Context } from '../../../../shared/Context';
|
|
|
|
|
|
import ImageSelector from '../../../../components/image-selector/ImageSelector';
|
|
|
+import RepoSelector from '../../../../components/repo-selector/RepoSelector';
|
|
|
import SaveButton from '../../../../components/SaveButton';
|
|
|
+import Heading from '../../../../components/values-form/Heading';
|
|
|
+import Helper from '../../../../components/values-form/Helper';
|
|
|
+import InputRow from '../../../../components/values-form/InputRow';
|
|
|
|
|
|
type PropsType = {
|
|
|
currentChart: ChartType,
|
|
|
@@ -16,18 +20,26 @@ type PropsType = {
|
|
|
};
|
|
|
|
|
|
type StateType = {
|
|
|
+ sourceType: string,
|
|
|
selectedImageUrl: string | null,
|
|
|
selectedTag: string | null,
|
|
|
saveValuesStatus: string | null,
|
|
|
values: string,
|
|
|
+ selectedRepo: RepoType | null,
|
|
|
+ selectedBranch: string,
|
|
|
+ subdirectory: string,
|
|
|
};
|
|
|
|
|
|
export default class SettingsSection extends Component<PropsType, StateType> {
|
|
|
state = {
|
|
|
+ sourceType: 'registry',
|
|
|
selectedImageUrl: '',
|
|
|
selectedTag: '',
|
|
|
values: '',
|
|
|
saveValuesStatus: null as (string | null),
|
|
|
+ selectedRepo: null as RepoType | null,
|
|
|
+ selectedBranch: '',
|
|
|
+ subdirectory: '',
|
|
|
}
|
|
|
|
|
|
// TODO: read in set image from form context instead of config
|
|
|
@@ -80,11 +92,16 @@ export default class SettingsSection extends Component<PropsType, StateType> {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- render() {
|
|
|
- return (
|
|
|
- <Wrapper>
|
|
|
- <StyledSettingsSection>
|
|
|
- <Subtitle>Connected source</Subtitle>
|
|
|
+ renderSourceSection = () => {
|
|
|
+ if (this.state.sourceType === 'registry') {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Helper>
|
|
|
+ Specify a container image and tag
|
|
|
+ <Highlight onClick={() => this.setState({ sourceType: 'repo' })}>
|
|
|
+ or link a repo
|
|
|
+ </Highlight>.
|
|
|
+ </Helper>
|
|
|
<ImageSelector
|
|
|
selectedImageUrl={this.state.selectedImageUrl}
|
|
|
selectedTag={this.state.selectedTag}
|
|
|
@@ -93,6 +110,42 @@ export default class SettingsSection extends Component<PropsType, StateType> {
|
|
|
forceExpanded={true}
|
|
|
setCurrentView={this.props.setCurrentView}
|
|
|
/>
|
|
|
+ </>
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Helper>
|
|
|
+ Select a repo to conenct to
|
|
|
+ <Highlight onClick={() => this.setState({ sourceType: 'registry' })}>
|
|
|
+ or link a container registry
|
|
|
+ </Highlight>.
|
|
|
+ </Helper>
|
|
|
+ <RepoSelector
|
|
|
+ forceExpanded={true}
|
|
|
+ selectedRepo={this.state.selectedRepo}
|
|
|
+ selectedBranch={this.state.selectedBranch}
|
|
|
+ subdirectory={this.state.subdirectory}
|
|
|
+ setSelectedRepo={(x: RepoType) => this.setState({ selectedRepo: x })}
|
|
|
+ setSelectedBranch={(x: string) => this.setState({ selectedBranch: x })}
|
|
|
+ setSubdirectory={(x: string) => this.setState({ subdirectory: x })}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ <Wrapper>
|
|
|
+ <StyledSettingsSection>
|
|
|
+ <Heading>Connected source</Heading>
|
|
|
+ {this.renderSourceSection()}
|
|
|
+ <Heading>Redeploy Webhook</Heading>
|
|
|
+ <Helper>Programmatically deploy by calling this secret webhook.</Helper>
|
|
|
+ <Webhook>
|
|
|
+ <div>https://api.getporter.dev/deploy/sdkdkalasdkfjdslk?commit=???</div>
|
|
|
+ <i className="material-icons">content_copy</i>
|
|
|
+ </Webhook>
|
|
|
</StyledSettingsSection>
|
|
|
<SaveButton
|
|
|
text='Save Settings'
|
|
|
@@ -108,19 +161,44 @@ export default class SettingsSection extends Component<PropsType, StateType> {
|
|
|
|
|
|
SettingsSection.contextType = Context;
|
|
|
|
|
|
-const Subtitle = styled.div`
|
|
|
- color: #aaaabb;
|
|
|
+const Webhook = styled.div`
|
|
|
+ width: 100%;
|
|
|
+ border: 1px solid #ffffff55;
|
|
|
+ background: #ffffff11;
|
|
|
+ border-radius: 3px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
font-size: 13px;
|
|
|
- margin-bottom: 15px;
|
|
|
- margin-top: 20px;
|
|
|
+ padding-left: 10px;
|
|
|
+ color: #aaaabb;
|
|
|
+ height: 40px;
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 40px;
|
|
|
+
|
|
|
+ > div {
|
|
|
+ user-select: all;
|
|
|
+ }
|
|
|
+
|
|
|
+ > i {
|
|
|
+ padding: 5px;
|
|
|
+ background: #ffffff22;
|
|
|
+ border-radius: 5px;
|
|
|
+ position: absolute;
|
|
|
+ right: 10px;
|
|
|
+ font-size: 14px;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ :hover {
|
|
|
+ background: #ffffff44;
|
|
|
+ }
|
|
|
+ }
|
|
|
`;
|
|
|
|
|
|
-const Heading = styled.div`
|
|
|
- color: white;
|
|
|
- font-weight: 500;
|
|
|
- font-size: 16px;
|
|
|
- margin-top: 35px;
|
|
|
- margin-bottom: 22px;
|
|
|
+const Highlight = styled.div`
|
|
|
+ color: #949effff;
|
|
|
+ text-decoration: underline;
|
|
|
+ margin-left: 5px;
|
|
|
+ cursor: pointer;
|
|
|
`;
|
|
|
|
|
|
const Wrapper = styled.div`
|
|
|
@@ -132,7 +210,7 @@ const StyledSettingsSection = styled.div`
|
|
|
width: 100%;
|
|
|
height: calc(100% - 60px);
|
|
|
background: #ffffff11;
|
|
|
- padding: 15px 35px 50px;
|
|
|
+ padding: 0 35px;
|
|
|
position: relative;
|
|
|
border-radius: 5px;
|
|
|
overflow: auto;
|