Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Function initialise git repository * Add isGit to repository settings object * Create model for initializing git repository * Import initalizeGitRepository model * Toggle git intialize model with some conditionals * Create function for validating git repository * Rename params name to path * Move git init function to git directory * Remove dots from initalizeGitRepositoy modal title * Run action to update vuex store and localStorage * Save the isGit value to new repository object * Change "Go back" button to outlineButton * Fix codacy review issues https://app.codacy.com/app/thermal/thermal/pullRequest?prid=3606025
- Loading branch information
1 parent
edeff6b
commit 28b4c23
Showing
6 changed files
with
122 additions
and
2 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,76 @@ | ||
<template> | ||
<div | ||
v-if="isGitRepository" | ||
class="model--small isgit" | ||
> | ||
<div class="model__section model__header"> | ||
<h6 class="model__header__title"> | ||
Git not found | ||
</h6> | ||
</div> | ||
<div class="model__section model__body"> | ||
By default git will be initalized at the root of the project. | ||
</div> | ||
<div class="model__section model__footer"> | ||
<outlineButton | ||
text="Go back" | ||
appearance="outline" | ||
border-color="00adb5" | ||
margin-left="auto" | ||
@click.native="switchRepository" | ||
/> | ||
<primaryButton | ||
text="Initalize git" | ||
margin-left=".5rem" | ||
@click.native="initalizeGit" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import primaryButton from "../buttons/primaryButton"; | ||
import outlineButton from "../buttons/outlineButton"; | ||
import gitInit from "../../git/init"; | ||
export default { | ||
name: "InitalizeGitRepository", | ||
components: { | ||
primaryButton, | ||
outlineButton | ||
}, | ||
computed: { | ||
currentRepository() { | ||
return this.$store.getters["workspace/currentRepository"]; | ||
}, | ||
isGitRepository() { | ||
return (this.$router.history.current.matched[0].path.slice(1) === "repository") && (this.currentRepository.isGit === false); | ||
} | ||
}, | ||
methods: { | ||
switchRepository() { | ||
this.$store.commit("model/toggleModelPlaceholder"); | ||
this.$store.dispatch("workspace/switchWorkspaceRepository"); | ||
this.$router.push({ name: "welcome" }); | ||
}, | ||
initalizeGit() { | ||
gitInit(this.currentRepository.path); | ||
this.$store.commit("model/toggleModelPlaceholder"); | ||
this.$store.dispatch({ | ||
type: "repository/updateIsGit", | ||
isGit: true | ||
}); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="sass"> | ||
.model | ||
&__header | ||
border-bottom: 1px solid #eee | ||
&__body | ||
border-bottom: 1px solid #eee | ||
</style> |
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,8 @@ | ||
import git from "simple-git/promise"; | ||
|
||
const init = async (path) => { | ||
let initaliseRepository = git(path); | ||
await initaliseRepository.init(); | ||
}; | ||
|
||
export default init; |
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