Skip to content

Commit

Permalink
Refresh commits button for self-hosted version. Useful when webhooks …
Browse files Browse the repository at this point in the history
…are not yet set up
  • Loading branch information
laszlocph committed Aug 14, 2024
1 parent fad167e commit 338fb10
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions web/src/views/repo/commitView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function CommitView(props) {
const [commitEvents, setCommitEvents] = useState(reduxState.commitEvents)
const [branches, setBranches] = useState()
const [selectedBranch, setSelectedBranch] = useState(queryParams.get("branch") ?? '')
const [scmUrl, setScmUrl] = useState(reduxState.settings.scmUrl)
const [settings, setSettigns] = useState(reduxState.settings)
const [envConfigs, setEnvConfigs] = useState(reduxState.envConfigs[repoName])
const [envs, setEnvs] = useState(reduxState.envs)
const [connectedAgents, setConnectedAgents] = useState(reduxState.connectedAgents)
Expand All @@ -36,7 +36,7 @@ export function CommitView(props) {
setEnvConfigs(reduxState.envConfigs[repoName])
setEnvs(reduxState.envs)
setConnectedAgents(reduxState.connectedAgents)
setScmUrl(reduxState.settings.scmUrl)
setSettigns(reduxState.settings)

const queueLength = reduxState.repoRefreshQueue.filter(r => r === repoName).length;
setRefreshQueue(prevQueueLength => {
Expand Down Expand Up @@ -198,12 +198,27 @@ export function CommitView(props) {
gimletClient={gimletClient}
/>
}
<div className="w-96 mb-4 lg:mb-8">
<Dropdown
items={branches}
value={selectedBranch}
changeHandler={setSelectedBranch}
/>
<div className="mb-4 lg:mb-8 flex">
<div className='flex-grow'>
<div className='w-96'>
<Dropdown
items={branches}
value={selectedBranch}
changeHandler={setSelectedBranch}
/>
</div>
</div>
{settings.instance === "" &&
<button
type="button"
className='secondaryButton'
onClick={() => {
gimletClient.triggerCommitSync(owner, repo)
}}
>
Refresh
</button>
}
</div>
<div className="card p-4">
<Commits
Expand All @@ -219,7 +234,7 @@ export function CommitView(props) {
store={store}
owner={owner}
fetchNextCommitsWidgets={fetchNextCommitsWidgets}
scmUrl={scmUrl}
scmUrl={settings.scmUrl}
/>
</div>
</div>
Expand Down

0 comments on commit 338fb10

Please sign in to comment.