mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
Add constructor
This commit is contained in:
@@ -15,15 +15,28 @@ type State = {
|
|||||||
loadingBranches: boolean,
|
loadingBranches: boolean,
|
||||||
loadingDefaultBranch: boolean,
|
loadingDefaultBranch: boolean,
|
||||||
submitPending: boolean,
|
submitPending: boolean,
|
||||||
error: Error,
|
error?: Error,
|
||||||
branches: Branch[],
|
branches: Branch[],
|
||||||
selectedBranchName: string,
|
selectedBranchName?: string,
|
||||||
defaultBranchChanged: boolean
|
defaultBranchChanged: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
const GIT_CONFIG_CONTENT_TYPE = "application/vnd.scmm-gitConfig+json";
|
const GIT_CONFIG_CONTENT_TYPE = "application/vnd.scmm-gitConfig+json";
|
||||||
|
|
||||||
class RepositoryConfig extends React.Component<Props, State> {
|
class RepositoryConfig extends React.Component<Props, State> {
|
||||||
|
|
||||||
|
constructor(props: Props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
loadingBranches: true,
|
||||||
|
loadingDefaultBranch: true,
|
||||||
|
submitPending: false,
|
||||||
|
branches: [],
|
||||||
|
defaultBranchChanged: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { repository } = this.props;
|
const { repository } = this.props;
|
||||||
this.setState({ ...this.state, loadingBranches: true });
|
this.setState({ ...this.state, loadingBranches: true });
|
||||||
@@ -53,10 +66,10 @@ class RepositoryConfig extends React.Component<Props, State> {
|
|||||||
|
|
||||||
branchSelected = (branch: Branch) => {
|
branchSelected = (branch: Branch) => {
|
||||||
if (!branch) {
|
if (!branch) {
|
||||||
this.setState({ ...this.state, selectedBranchName: null });
|
this.setState({ ...this.state, selectedBranchName: null , defaultBranchChanged: false});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({ ...this.state, selectedBranchName: branch.name });
|
this.setState({ ...this.state, selectedBranchName: branch.name, defaultBranchChanged: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
submit = (event: Event) => {
|
submit = (event: Event) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user