-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
203 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Tonic from '@socketsupply/tonic' | ||
import { exec } from 'socket:child_process' | ||
|
||
// TODO(@heapwolf): this should be a component | ||
class GitStatus extends Tonic { | ||
async render () { | ||
const app = this.props.app | ||
const currentProject = app.state.currentProject | ||
|
||
const { data: dataProject } = await app.db.projects.get(currentProject.projectId) | ||
|
||
let gitStatus = { stdout: '', stderr: '' } | ||
|
||
// | ||
// Try to get the status of the project to tell the user what | ||
// has changed and help them decide if they should publish. | ||
// | ||
try { | ||
gitStatus = await exec('git status --porcelain', { cwd: dataProject.path }) | ||
} catch (err) { | ||
gitStatus.stderr = err.message | ||
} | ||
|
||
if (gitStatus?.stderr.includes('command not found')) { | ||
return this.html` | ||
<tonic-toaster-inline | ||
id="git-not-installed" | ||
dismiss="false" | ||
display="true" | ||
>Git is not installed and is required to use this program. | ||
</tonic-toaster-inline> | ||
` | ||
} | ||
|
||
return this.html` | ||
<h2>Git Integration</h2> | ||
<tonic-textarea | ||
id="git-status" | ||
rows="10" | ||
label="Git Status" | ||
readonly="true" | ||
resize="none" | ||
>${gitStatus.stderr || gitStatus.stdout}</tonic-textarea> | ||
` | ||
} | ||
} | ||
|
||
export default GitStatus | ||
export { GitStatus } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Tonic from '@socketsupply/tonic' | ||
import { exec } from 'socket:child_process' | ||
|
||
class PatchRequests extends Tonic { | ||
async render () { | ||
const app = this.props.app | ||
|
||
const { data: dataPatches } = await app.db.patches.readAll() | ||
|
||
let patches = [] | ||
|
||
for (const [patchId, patch] of dataPatches.entries()) { | ||
patches.push(this.html` | ||
<tr> | ||
<td> | ||
<tonic-button type="icon" symbol-id="plus-icon" data-event="apply" data-value="${patchId}"></tonic-button> | ||
<tonic-button type="icon" symbol-id="edit-icon" data-event="load" data-value="${patchId}"></tonic-button> | ||
</td> | ||
<td>${patch.author}</td> | ||
<td>${patch.date}</td> | ||
<td>${patch.parent}</td> | ||
<td>${patch.message}</td> | ||
</tr> | ||
`) | ||
} | ||
|
||
return this.html` | ||
<h2>Patch Requests</h2> | ||
<table class="patches"> | ||
<thead> | ||
<th>Actions</th> | ||
<th>Author</th> | ||
<th>Date</th> | ||
<th>Parent</th> | ||
<th>Commit Message</th> | ||
</thead> | ||
<tbody> | ||
${patches} | ||
<tbody> | ||
</table> | ||
` | ||
} | ||
} | ||
|
||
export default PatchRequests | ||
export { PatchRequests } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
patch-requests table { | ||
font-family: var(--tonic-monospace); | ||
width: 100%; | ||
} | ||
|
||
patch-requests table thead { | ||
text-align: left; | ||
} | ||
|
||
patch-requests table tr th { | ||
height: 40px; | ||
border-bottom: 1px solid var(--tonic-border); | ||
color: var(--tonic-medium, #999); | ||
font-weight: 500; | ||
font: 12px/14px var(--tonic-subheader, 'Arial', sans-serif); | ||
text-transform: uppercase; | ||
letter-spacing: 1px; | ||
} | ||
|
||
patch-requests table td { | ||
padding: 8px 0px; | ||
border-bottom: 1px solid var(--tonic-border); | ||
} | ||
|
||
patch-requests table td { | ||
min-width: 120px; | ||
} | ||
|
||
patch-requests table tr:last-of-type td { | ||
border-bottom: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.