Add commit author and email to frontend settings

This commit is contained in:
2024-11-30 21:21:54 +01:00
parent d5d2792689
commit 68ad70b0b7
2 changed files with 44 additions and 4 deletions

View File

@@ -16,13 +16,15 @@ const GitSettings = ({
gitToken, gitToken,
gitAutoCommit, gitAutoCommit,
gitCommitMsgTemplate, gitCommitMsgTemplate,
gitCommitName,
gitCommitEmail,
onInputChange, onInputChange,
}) => { }) => {
return ( return (
<Stack spacing="md"> <Stack spacing="md">
<Grid gutter="md" align="center"> <Grid gutter="md" align="center">
<Grid.Col span={6}> <Grid.Col span={6}>
<Text size="sm">Enable Git</Text> <Text size="sm">Enable Git Repository</Text>
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<Group justify="flex-end"> <Group justify="flex-end">
@@ -41,6 +43,7 @@ const GitSettings = ({
<Grid.Col span={6}> <Grid.Col span={6}>
<TextInput <TextInput
value={gitUrl} value={gitUrl}
description="The URL of your Git repository"
onChange={(event) => onChange={(event) =>
onInputChange('gitUrl', event.currentTarget.value) onInputChange('gitUrl', event.currentTarget.value)
} }
@@ -50,11 +53,12 @@ const GitSettings = ({
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<Text size="sm">Git Username</Text> <Text size="sm">Username</Text>
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<TextInput <TextInput
value={gitUser} value={gitUser}
description="The username used to authenticate with the repository"
onChange={(event) => onChange={(event) =>
onInputChange('gitUser', event.currentTarget.value) onInputChange('gitUser', event.currentTarget.value)
} }
@@ -64,11 +68,12 @@ const GitSettings = ({
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<Text size="sm">Git Token</Text> <Text size="sm">Access Token</Text>
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<PasswordInput <PasswordInput
value={gitToken} value={gitToken}
description="Personal access token with repository read/write permissions"
onChange={(event) => onChange={(event) =>
onInputChange('gitToken', event.currentTarget.value) onInputChange('gitToken', event.currentTarget.value)
} }
@@ -78,7 +83,7 @@ const GitSettings = ({
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<Text size="sm">Auto Commit</Text> <Text size="sm">Commit on Save</Text>
</Grid.Col> </Grid.Col>
<Grid.Col span={6}> <Grid.Col span={6}>
<Group justify="flex-end"> <Group justify="flex-end">
@@ -98,6 +103,7 @@ const GitSettings = ({
<Grid.Col span={6}> <Grid.Col span={6}>
<TextInput <TextInput
value={gitCommitMsgTemplate} value={gitCommitMsgTemplate}
description="Template for automated commit messages. Use ${filename} and ${action} as a placeholder."
onChange={(event) => onChange={(event) =>
onInputChange('gitCommitMsgTemplate', event.currentTarget.value) onInputChange('gitCommitMsgTemplate', event.currentTarget.value)
} }
@@ -105,6 +111,36 @@ const GitSettings = ({
placeholder="Enter commit message template" placeholder="Enter commit message template"
/> />
</Grid.Col> </Grid.Col>
<Grid.Col span={6}>
<Text size="sm">Commit Author</Text>
</Grid.Col>
<Grid.Col span={6}>
<TextInput
value={gitCommitName}
description="Name to appear in commit history. Leave empty to use Git username."
onChange={(event) =>
onInputChange('gitCommitName', event.currentTarget.value)
}
disabled={!gitEnabled}
placeholder="Enter commit author name."
/>
</Grid.Col>
<Grid.Col span={6}>
<Text size="sm">Commit Author Email</Text>
</Grid.Col>
<Grid.Col span={6}>
<TextInput
value={gitCommitEmail}
description="Email address to associate with your commits"
onChange={(event) =>
onInputChange('gitCommitEmail', event.currentTarget.value)
}
disabled={!gitEnabled}
placeholder="Enter commit author email."
/>
</Grid.Col>
</Grid> </Grid>
</Stack> </Stack>
); );

View File

@@ -74,6 +74,8 @@ const WorkspaceSettings = () => {
gitToken: currentWorkspace.gitToken, gitToken: currentWorkspace.gitToken,
gitAutoCommit: currentWorkspace.gitAutoCommit, gitAutoCommit: currentWorkspace.gitAutoCommit,
gitCommitMsgTemplate: currentWorkspace.gitCommitMsgTemplate, gitCommitMsgTemplate: currentWorkspace.gitCommitMsgTemplate,
gitCommitName: currentWorkspace.gitCommitName,
gitCommitEmail: currentWorkspace.gitCommitEmail,
}; };
dispatch({ type: 'INIT_SETTINGS', payload: settings }); dispatch({ type: 'INIT_SETTINGS', payload: settings });
} }
@@ -204,6 +206,8 @@ const WorkspaceSettings = () => {
gitToken={state.localSettings.gitToken} gitToken={state.localSettings.gitToken}
gitAutoCommit={state.localSettings.gitAutoCommit} gitAutoCommit={state.localSettings.gitAutoCommit}
gitCommitMsgTemplate={state.localSettings.gitCommitMsgTemplate} gitCommitMsgTemplate={state.localSettings.gitCommitMsgTemplate}
gitCommitName={state.localSettings.gitCommitName}
gitCommitEmail={state.localSettings.gitCommitEmail}
onInputChange={handleInputChange} onInputChange={handleInputChange}
/> />
</Accordion.Panel> </Accordion.Panel>