Skip to content

Commit

Permalink
(1) Only show first line in a commit
Browse files Browse the repository at this point in the history
(2) Correctly set update type in commits
(3) Show completed times in UI
  • Loading branch information
leinelissen committed Nov 2, 2020
1 parent 8a131fd commit 2e576d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/app/screens/Requests/components/ProviderOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ function ProviderOverlay({ selectedProvider, status }: Props): JSX.Element {
fixedWidth
/>
Last check: <i>{status?.lastCheck ? formatDistanceToNow(status.lastCheck) + ' ago' : 'never'}</i>
{status?.completed &&
<>
<br />
<FontAwesomeIcon
icon={faCheck}
style={{ marginRight: 8 }}
fixedWidth
/>
Completed: <i>{formatDistanceToNow(status?.completed)} ago</i>
</>
}
</span>
</Section>
{status?.dispatched ?
Expand Down
3 changes: 2 additions & 1 deletion src/main/lib/repository/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ class Repository extends EventEmitter {

return {
oid: commit.sha(),
message: commit.message(),
// Only show the first line of a commit
message: commit.message().split('\n')[0],
author: {
email: author.email(),
name: author.name(),
Expand Down
4 changes: 2 additions & 2 deletions src/main/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ProviderManager extends EventEmitter {
}

// Alternatively, we save the files and attempt to commit
const changedFiles = await this.saveFilesAndCommit(files, key, `Auto-update ${new Date().toLocaleString()}`);
const changedFiles = await this.saveFilesAndCommit(files, key, `Auto-update ${new Date().toLocaleString()}`, ProviderUpdateType.UPDATE);

// GUARD: Only log stuff if new data is found
if (changedFiles) {
Expand Down Expand Up @@ -276,7 +276,7 @@ class ProviderManager extends EventEmitter {
// If it is complete now, we'll fetch the data and parse it
const dirPath = path.join(REPOSITORY_PATH, key);
const files = await instance.parseDataRequest(dirPath);
const changedFiles = await this.saveFilesAndCommit(files, key, `Data Request [${key}] ${new Date().toLocaleString()}`);
const changedFiles = await this.saveFilesAndCommit(files, key, `Data Request [${key}] ${new Date().toLocaleString()}`, ProviderUpdateType.DATA_REQUEST);
Notifications.success(`The data request for ${key} was successfully completed. ${changedFiles} files were changed.`);

// Set the flag for completion
Expand Down

0 comments on commit 2e576d8

Please sign in to comment.