Skip to content

Commit

Permalink
show status text when not scrolled down
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed May 1, 2023
1 parent 7f1b1fb commit e0f1efe
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
4 changes: 3 additions & 1 deletion web/src/views/GitInput.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineComponent
hide_result:
type: Boolean
default: false
emits: [ 'success' ]
emits: [ 'executed', 'success' ]
###*
# To summarize all logic below: There are `options` (checkboxes) and `command` (txt input),
# both editable, the former modifying the latter but being locked when the latter is changed by hand.
Expand Down Expand Up @@ -119,6 +119,8 @@ export default defineComponent
else
console.warn e
return
finally
emit 'executed'
if not props.hide_result
data.value = result
emit 'success', result
Expand Down
5 changes: 3 additions & 2 deletions web/src/views/MainView.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default
}
invisible_branch_tips_of_visible_branches_elems = computed =>
row = -1
connection_fake_commit.value?.vis
(connection_fake_commit.value?.vis
.map (v, i) =>
return null if not v.branch or v.char == ' '
row++
Expand All @@ -215,7 +215,7 @@ export default
style:
left: 0 + store.vis_v_width.value * i + 'px'
top: 0 + row * 19 + 'px'
.filter(is_truthy)
.filter(is_truthy)) or []



Expand Down Expand Up @@ -268,4 +268,5 @@ export default
refresh_main_view: store.refresh_main_view
selected_git_action: store.selected_git_action
commit_context_menu_provider
git_status: store.git_status
}
10 changes: 9 additions & 1 deletion web/src/views/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
i.codicon.codicon-refresh
#quick-branch-tips
all-branches @branch_selected="scroll_to_branch_tip($event)"
#git-status v-if="!invisible_branch_tips_of_visible_branches_elems.length"
| Status: {{ git_status }}
button v-for="branch_elem of invisible_branch_tips_of_visible_branches_elems" @click="scroll_to_branch_tip(branch_elem.branch.name)" title="Jump to branch tip" v-bind="branch_elem.bind"
ref-tip :git_ref="branch_elem.branch"
#branches-connection
Expand Down Expand Up @@ -106,9 +108,15 @@ details.config
#quick-branch-tips, #branches-connection, #log.scroller
padding-left var(--container-padding)
#branches-connection
height 100px
:deep(>.vis>svg>line.vis-v)
stroke-dasharray 4
#git-status
color #555
height 100px
position fixed
overflow auto
width 100%
white-space pre-line
#quick-branch-tips
position sticky
z-index 1
Expand Down
2 changes: 2 additions & 0 deletions web/src/views/SelectedGitAction.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export default defineComponent
success = =>
if not keep_open.value
selected_git_action.value = null
executed = =>
refresh_main_view()

{
keep_open
success
executed
selected_git_action
}
2 changes: 1 addition & 1 deletion web/src/views/SelectedGitAction.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="slm">
.selected-input
p Execute Git command
git-input :git_action="selected_git_action" @success="success()"
git-input :git_action="selected_git_action" @success="success()" @executed="executed()"
label.row.align-center.gap-5
input type="checkbox" v-model="keep_open"
| Keep window open after success
Expand Down
5 changes: 4 additions & 1 deletion web/src/views/store.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ export branches = ref []
# which is also not necessary because HEAD is then also visible as a branch tip.
export head_branch = ref ''
export vis_max_length = ref 0
export git_status = ref ''

export git_run_log = (###* @type string ### log_args) =>
sep = '^%^%^%^%^'
log_args = log_args.replace(" --pretty=VSCode", " --pretty=format:\"#{sep}%h#{sep}%an#{sep}%ae#{sep}%at#{sep}%D#{sep}%s\"")
stash_refs = try await git 'reflog show --format="%h" stash' catch then ""
log_args = log_args.replace("stash_refs", stash_refs.replaceAll('\n', ' '))
# errors will be handled by GitInput
[ log_data, stash_data ] = await Promise.all [
[ log_data, stash_data, status_data ] = await Promise.all [
git log_args
try await git 'stash list --format="%h %gd"'
git 'status'
]
return if not log_data
parsed = parse log_data, sep
Expand All @@ -55,6 +57,7 @@ export git_run_log = (###* @type string ### log_args) =>
# todo rename to vis_max_amount
vis_max_length.value = parsed.vis_max_length
head_branch.value = await git 'rev-parse --abbrev-ref HEAD'
git_status.value = status_data
``###* @type {Ref<Ref<GitInputModel|null>|null>} ###
export main_view_git_input_ref = ref null
export refresh_main_view = =>
Expand Down

0 comments on commit e0f1efe

Please sign in to comment.