-
Notifications
You must be signed in to change notification settings - Fork 1
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
6 changed files
with
97 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
# Navigating github | ||
github_tab <- tabPanel( | ||
title = "Connect to GitHub", | ||
fluidPage( | ||
fluidRow( | ||
column(width = 12, | ||
shinydashboard::box(width = NULL, | ||
status = "danger", | ||
solidHeader = TRUE, | ||
title = "Create a new repo", | ||
textInput("username", "Enter GitHub username"), | ||
textInput("password", "Enter GitHub password"), | ||
helpText(" "), | ||
uiOutput("git_project_name"), | ||
textInput("repo_URL", "Enter GitHub repo URL"), | ||
actionButton("create_github", "Create GitHub repo"), | ||
actionButton("push", "Push"), | ||
actionButton("pull", "Pull"), | ||
uiOutput("git_text")) | ||
) | ||
) | ||
) | ||
) |
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,56 @@ | ||
|
||
################################################################################ | ||
################################# Create Repo ################################## | ||
################################################################################ | ||
|
||
# Select project | ||
output$git_project_name <- renderUI({ | ||
req(rv$working_dir, rv$projects_available) | ||
selectInput("git_project_name", | ||
'Select the project you want to create a new repo for', | ||
rv$projects_available, | ||
selected = basename(rv$working_dir)) | ||
}) | ||
|
||
|
||
|
||
# Create a new repo if one does not exist with the current project name | ||
observeEvent(input$create_github, { | ||
# Check all the info is in there | ||
if (input$username == "") { | ||
output$git_text <- renderText("<br><font color='red'>Please enter a username</font>") | ||
} else if (input$password == "") { | ||
output$git_text <- renderText("<br><font color='red'>Please enter a password</font>") | ||
} else if (input$repo_URL == "") { | ||
output$git_text <- renderText("<br><font color='red'>Please enter a repo URL first</font>") | ||
|
||
# If a project already exists, throw an error | ||
} else if (file.exists(file.path("projects", input$git_project_name))) { | ||
output$git_text <- renderText("<br>A project with this project name already exists") | ||
|
||
# When everything is correct | ||
} else { | ||
# Create new project the new project directory | ||
create_github_repo(input$git_project_name) | ||
output$git_text <- renderText(paste0("Created new repo called: ", | ||
input$git_project_name)) | ||
} | ||
}) | ||
|
||
################################################################################ | ||
############################## Push/pull buttons ############################### | ||
################################################################################ | ||
|
||
# Run push button | ||
observeEvent(input$push, { | ||
req(input$git_project_name) | ||
gert::git_push(repo = file.path("projects", input$git_project_name)) | ||
}) | ||
|
||
# Run pull button | ||
observeEvent(input$pull, { | ||
req(input$git_project_name) | ||
gert::git_pull(repo = file.path("projects", input$git_project_name)) | ||
}) | ||
|
||
|
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