Skip to content

Commit

Permalink
feat: improve git config + remote setup warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Jan 28, 2025
1 parent d12a31f commit 120ea6e
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 5 deletions.
53 changes: 51 additions & 2 deletions src/components/DrawerGit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
@click='gitSettings'
)
q-tooltip Git Settings
.drawer-git-setupwarn.q-mt-sm(v-if='isGitSetupIncomplete')
q-icon.q-mr-sm.animated.fadeIn.slower.infinite(name='mdi-alert')
span.text-orange-3 Git configuration is incomplete!
q-space
q-btn(
outline
color='dark-4'
size='sm'
label='Fix Now'
padding='xs sm'
text-color='orange-4'
@click='gitSettings'
)
template(v-if='!editorStore.isGitRepo')
q-btn.full-width.q-mt-sm(
icon='mdi-cloud-download'
Expand All @@ -63,7 +76,7 @@
@click='initRepo'
)
template(v-else)
.drawer-git-remote.q-mt-sm
.drawer-git-remote.q-mt-sm(v-if='hasGitRemotes')
q-icon.q-mr-sm(name='mdi-satellite-uplink')
span.text-grey-4 Remote: #[strong.text-white {{ editorStore.gitCurrentRemote }}]
q-space
Expand All @@ -74,6 +87,7 @@
padding='xs xs'
text-color='grey-5'
:loading='state.pullLoading'
:disable='!hasGitRemotes'
)
q-tooltip Pull...
q-menu(auto-close)
Expand Down Expand Up @@ -103,6 +117,7 @@
padding='xs xs'
text-color='grey-5'
:loading='state.pushLoading'
:disable='!hasGitRemotes'
)
q-tooltip Push...
q-menu(auto-close)
Expand All @@ -128,6 +143,19 @@
@click='manageRemotes'
)
q-tooltip Manage Remotes
.drawer-git-setupwarn.q-mt-sm(v-else)
q-icon.q-mr-sm(name='mdi-satellite-uplink')
span.text-orange-3 No remote configured!
q-space
q-btn(
outline
color='dark-4'
size='sm'
label='Manage'
padding='xs sm'
text-color='orange-4'
@click='manageRemotes'
)
.drawer-git-branch.q-mt-sm
q-icon.q-mr-sm(name='mdi-source-branch')
span.text-grey-4 Branch: #[strong.text-white {{ editorStore.gitCurrentBranch }}]
Expand Down Expand Up @@ -320,7 +348,7 @@
</template>

<script setup>
import { defineAsyncComponent, onActivated, reactive } from 'vue'
import { defineAsyncComponent, onActivated, reactive, computed } from 'vue'
import { useQuasar } from 'quasar'
import { useEditorStore } from 'src/stores/editor'
import { DateTime } from 'luxon'
Expand All @@ -344,6 +372,15 @@ const state = reactive({
history: []
})
// COMPUTED
const isGitSetupIncomplete = computed(() => {
return !editorStore.gitName || !editorStore.gitEmail
})
const hasGitRemotes = computed(() => {
return editorStore.gitRemotes?.length > 0
})
// METHODS
function humanizeDate (ts) {
Expand Down Expand Up @@ -679,7 +716,19 @@ onActivated(async () => {
</script>
<style lang="scss">
@use "sass:color";
.drawer-git {
&-setupwarn {
display: flex;
align-items: center;
font-size: 12px;
background-color: rgba($orange-5,.25);
color: $orange-5;
border-radius: 4px;
padding: 5px 8px;
border: 1px solid rgba($orange-5,.5);
}
&-remote, &-branch {
display: flex;
align-items: center;
Expand Down
7 changes: 4 additions & 3 deletions src/components/ManageRemotesDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ q-dialog(
q-input(
autofocus
v-model.number='state.newRemoteName'
placeholder='e.g. upstream'
placeholder='e.g. upstream or origin'
outlined
dense
clearable
Expand All @@ -63,11 +63,11 @@ q-dialog(
.row
.col-5
.text-body2 Repository URL
.text-caption.text-grey-5 The HTTPS Web URL of the repository
.text-caption.text-grey-5 The SSH or HTTPS URL of the repository
.col-7
q-input(
v-model.number='state.newRemoteUrl'
placeholder='e.g. https://github.com/rfc-editor/draft-abc-def-ghi.git'
placeholder='e.g. git@github.com/rfc-editor/draft-abc-def-ghi.git'
outlined
dense
clearable
Expand All @@ -94,6 +94,7 @@ q-dialog(
:loading='state.isLoading'
)
.remotes-main
.q-pa-md.q-pt-lg.text-grey-6(v-if='!(editorStore.gitRemotes?.length > 0)'): em No remote configured yet.
q-list(
padding
separator
Expand Down

0 comments on commit 120ea6e

Please sign in to comment.