Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
7a8af429
Commit
7a8af429
authored
May 03, 2018
by
André Luís
Committed by
Phil Hughes
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Web IDE Commit Panel
parent
0108cdf9
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
169 additions
and
61 deletions
+169
-61
app/assets/javascripts/ide/components/commit_sidebar/empty_state.vue
...javascripts/ide/components/commit_sidebar/empty_state.vue
+3
-19
app/assets/javascripts/ide/components/commit_sidebar/success_message.vue
...scripts/ide/components/commit_sidebar/success_message.vue
+39
-0
app/assets/javascripts/ide/components/repo_commit_section.vue
...assets/javascripts/ide/components/repo_commit_section.vue
+24
-9
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+6
-0
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+3
-1
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+4
-0
app/assets/javascripts/ide/stores/mutation_types.js
app/assets/javascripts/ide/stores/mutation_types.js
+1
-0
app/assets/javascripts/ide/stores/mutations.js
app/assets/javascripts/ide/stores/mutations.js
+5
-0
app/assets/javascripts/ide/stores/state.js
app/assets/javascripts/ide/stores/state.js
+1
-0
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+19
-0
changelogs/unreleased/ide-improve-commit-panel.yml
changelogs/unreleased/ide-improve-commit-panel.yml
+5
-0
spec/javascripts/ide/components/commit_sidebar/empty_state_spec.js
...scripts/ide/components/commit_sidebar/empty_state_spec.js
+0
-32
spec/javascripts/ide/components/commit_sidebar/success_message_spec.js
...pts/ide/components/commit_sidebar/success_message_spec.js
+35
-0
spec/javascripts/ide/stores/actions/file_spec.js
spec/javascripts/ide/stores/actions/file_spec.js
+14
-0
spec/javascripts/ide/stores/mutations_spec.js
spec/javascripts/ide/stores/mutations_spec.js
+10
-0
No files found.
app/assets/javascripts/ide/components/commit_sidebar/empty_state.vue
View file @
7a8af429
...
@@ -15,17 +15,10 @@ export default {
...
@@ -15,17 +15,10 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
committedStateSvgPath
:
{
type
:
String
,
required
:
true
,
},
},
},
computed
:
{
computed
:
{
...
mapState
([
'
lastCommitMsg
'
,
'
rightPanelCollapsed
'
]),
...
mapState
([
'
lastCommitMsg
'
,
'
rightPanelCollapsed
'
,
'
changedFiles
'
,
'
stagedFiles
'
]),
...
mapGetters
([
'
collapseButtonIcon
'
,
'
collapseButtonTooltip
'
]),
...
mapGetters
([
'
collapseButtonIcon
'
,
'
collapseButtonTooltip
'
]),
statusSvg
()
{
return
this
.
lastCommitMsg
?
this
.
committedStateSvgPath
:
this
.
noChangesStateSvgPath
;
},
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
toggleRightPanelCollapsed
'
]),
...
mapActions
([
'
toggleRightPanelCollapsed
'
]),
...
@@ -35,6 +28,7 @@ export default {
...
@@ -35,6 +28,7 @@ export default {
<
template
>
<
template
>
<div
<div
v-if=
"!lastCommitMsg"
class=
"multi-file-commit-panel-section ide-commit-empty-state js-empty-state"
class=
"multi-file-commit-panel-section ide-commit-empty-state js-empty-state"
>
>
<header
<header
...
@@ -64,12 +58,11 @@ export default {
...
@@ -64,12 +58,11 @@ export default {
v-if=
"!rightPanelCollapsed"
v-if=
"!rightPanelCollapsed"
>
>
<div
class=
"svg-content svg-80"
>
<div
class=
"svg-content svg-80"
>
<img
:src=
"
statusSvg
"
/>
<img
:src=
"
noChangesStateSvgPath
"
/>
</div>
</div>
<div
class=
"append-right-default prepend-left-default"
>
<div
class=
"append-right-default prepend-left-default"
>
<div
<div
class=
"text-content text-center"
class=
"text-content text-center"
v-if=
"!lastCommitMsg"
>
>
<h4>
<h4>
{{
__
(
'
No changes
'
)
}}
{{
__
(
'
No changes
'
)
}}
...
@@ -78,15 +71,6 @@ export default {
...
@@ -78,15 +71,6 @@ export default {
{{
__
(
'
Edit files in the editor and commit changes here
'
)
}}
{{
__
(
'
Edit files in the editor and commit changes here
'
)
}}
</p>
</p>
</div>
</div>
<div
class=
"text-content text-center"
v-else
>
<h4>
{{
__
(
'
All changes are committed
'
)
}}
</h4>
<p
v-html=
"lastCommitMsg"
></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
app/assets/javascripts/ide/components/commit_sidebar/success_message.vue
0 → 100644
View file @
7a8af429
<
script
>
import
{
mapState
}
from
'
vuex
'
;
export
default
{
props
:
{
committedStateSvgPath
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
...
mapState
([
'
lastCommitMsg
'
]),
},
};
</
script
>
<
template
>
<div
class=
"multi-file-commit-panel-success-message"
aria-live=
"assertive"
>
<div
class=
"svg-content svg-80"
>
<img
:src=
"committedStateSvgPath"
alt=
""
/>
</div>
<div
class=
"append-right-default prepend-left-default"
>
<div
class=
"text-content text-center"
>
<h4>
{{
__
(
'
All changes are committed
'
)
}}
</h4>
<p
v-html=
"lastCommitMsg"
></p>
</div>
</div>
</div>
</
template
>
app/assets/javascripts/ide/components/repo_commit_section.vue
View file @
7a8af429
...
@@ -7,6 +7,7 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue';
...
@@ -7,6 +7,7 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue';
import
CommitFilesList
from
'
./commit_sidebar/list.vue
'
;
import
CommitFilesList
from
'
./commit_sidebar/list.vue
'
;
import
EmptyState
from
'
./commit_sidebar/empty_state.vue
'
;
import
EmptyState
from
'
./commit_sidebar/empty_state.vue
'
;
import
CommitMessageField
from
'
./commit_sidebar/message_field.vue
'
;
import
CommitMessageField
from
'
./commit_sidebar/message_field.vue
'
;
import
SuccessMessage
from
'
./commit_sidebar/success_message.vue
'
;
import
*
as
consts
from
'
../stores/modules/commit/constants
'
;
import
*
as
consts
from
'
../stores/modules/commit/constants
'
;
import
Actions
from
'
./commit_sidebar/actions.vue
'
;
import
Actions
from
'
./commit_sidebar/actions.vue
'
;
...
@@ -16,6 +17,7 @@ export default {
...
@@ -16,6 +17,7 @@ export default {
Icon
,
Icon
,
CommitFilesList
,
CommitFilesList
,
EmptyState
,
EmptyState
,
SuccessMessage
,
Actions
,
Actions
,
LoadingButton
,
LoadingButton
,
CommitMessageField
,
CommitMessageField
,
...
@@ -34,9 +36,15 @@ export default {
...
@@ -34,9 +36,15 @@ export default {
},
},
},
},
computed
:
{
computed
:
{
...
mapState
([
'
changedFiles
'
,
'
stagedFiles
'
,
'
rightPanelCollapsed
'
]),
showStageUnstageArea
()
{
return
!!
(
this
.
someUncommitedChanges
||
this
.
lastCommitMsg
||
!
this
.
unusedSeal
);
},
someUncommitedChanges
()
{
return
!!
(
this
.
changedFiles
.
length
||
this
.
stagedFiles
.
length
);
},
...
mapState
([
'
changedFiles
'
,
'
stagedFiles
'
,
'
rightPanelCollapsed
'
,
'
lastCommitMsg
'
,
'
unusedSeal
'
]),
...
mapState
(
'
commit
'
,
[
'
commitMessage
'
,
'
submitCommitLoading
'
]),
...
mapState
(
'
commit
'
,
[
'
commitMessage
'
,
'
submitCommitLoading
'
]),
...
mapGetters
(
'
commit
'
,
[
'
commitButtonDisabled
'
,
'
discardDraftButtonDisabled
'
,
'
branchName
'
]),
...
mapGetters
(
'
commit
'
,
[
'
commitButtonDisabled
'
,
'
discardDraftButtonDisabled
'
]),
},
},
methods
:
{
methods
:
{
...
mapActions
(
'
commit
'
,
[
...
mapActions
(
'
commit
'
,
[
...
@@ -69,7 +77,7 @@ export default {
...
@@ -69,7 +77,7 @@ export default {
</
template
>
</
template
>
</deprecated-modal>
</deprecated-modal>
<
template
<
template
v-if=
"
changedFiles.length || stagedFiles.length
"
v-if=
"
showStageUnstageArea
"
>
>
<commit-files-list
<commit-files-list
icon-name=
"unstaged"
icon-name=
"unstaged"
...
@@ -89,11 +97,23 @@ export default {
...
@@ -89,11 +97,23 @@ export default {
:show-toggle=
"false"
:show-toggle=
"false"
:staged-list=
"true"
:staged-list=
"true"
/>
/>
</
template
>
<empty-state
v-if=
"unusedSeal"
:no-changes-state-svg-path=
"noChangesStateSvgPath"
/>
<div
class=
"multi-file-commit-panel-bottom"
>
<form
<form
class=
"form-horizontal multi-file-commit-form"
class=
"form-horizontal multi-file-commit-form"
@
submit.prevent.stop=
"commitChanges"
@
submit.prevent.stop=
"commitChanges"
v-if=
"!rightPanelCollapsed"
v-if=
"!rightPanelCollapsed"
>
>
<success-message
v-if=
"lastCommitMsg && !someUncommitedChanges"
:committed-state-svg-path=
"committedStateSvgPath"
/>
<commit-message-field
<commit-message-field
:text=
"commitMessage"
:text=
"commitMessage"
@
input=
"updateCommitMessage"
@
input=
"updateCommitMessage"
...
@@ -117,11 +137,6 @@ export default {
...
@@ -117,11 +137,6 @@ export default {
</button>
</button>
</div>
</div>
</form>
</form>
</
template
>
</div>
<empty-state
v-else
:no-changes-state-svg-path=
"noChangesStateSvgPath"
:committed-state-svg-path=
"committedStateSvgPath"
/>
</div>
</div>
</template>
</template>
app/assets/javascripts/ide/stores/actions.js
View file @
7a8af429
...
@@ -149,6 +149,12 @@ export const updateTempFlagForEntry = ({ commit, dispatch, state }, { file, temp
...
@@ -149,6 +149,12 @@ export const updateTempFlagForEntry = ({ commit, dispatch, state }, { file, temp
export
const
toggleFileFinder
=
({
commit
},
fileFindVisible
)
=>
export
const
toggleFileFinder
=
({
commit
},
fileFindVisible
)
=>
commit
(
types
.
TOGGLE_FILE_FINDER
,
fileFindVisible
);
commit
(
types
.
TOGGLE_FILE_FINDER
,
fileFindVisible
);
export
const
burstUnusedSeal
=
({
state
,
commit
})
=>
{
if
(
state
.
unusedSeal
)
{
commit
(
types
.
BURST_UNUSED_SEAL
);
}
};
export
*
from
'
./actions/tree
'
;
export
*
from
'
./actions/tree
'
;
export
*
from
'
./actions/file
'
;
export
*
from
'
./actions/file
'
;
export
*
from
'
./actions/project
'
;
export
*
from
'
./actions/project
'
;
...
...
app/assets/javascripts/ide/stores/actions/file.js
View file @
7a8af429
...
@@ -117,7 +117,7 @@ export const getRawFileData = ({ state, commit, dispatch }, { path, baseSha }) =
...
@@ -117,7 +117,7 @@ export const getRawFileData = ({ state, commit, dispatch }, { path, baseSha }) =
});
});
};
};
export
const
changeFileContent
=
({
state
,
commit
},
{
path
,
content
})
=>
{
export
const
changeFileContent
=
({
commit
,
dispatch
,
state
},
{
path
,
content
})
=>
{
const
file
=
state
.
entries
[
path
];
const
file
=
state
.
entries
[
path
];
commit
(
types
.
UPDATE_FILE_CONTENT
,
{
path
,
content
});
commit
(
types
.
UPDATE_FILE_CONTENT
,
{
path
,
content
});
...
@@ -128,6 +128,8 @@ export const changeFileContent = ({ state, commit }, { path, content }) => {
...
@@ -128,6 +128,8 @@ export const changeFileContent = ({ state, commit }, { path, content }) => {
}
else
if
(
!
file
.
changed
&&
indexOfChangedFile
!==
-
1
)
{
}
else
if
(
!
file
.
changed
&&
indexOfChangedFile
!==
-
1
)
{
commit
(
types
.
REMOVE_FILE_FROM_CHANGED
,
path
);
commit
(
types
.
REMOVE_FILE_FROM_CHANGED
,
path
);
}
}
dispatch
(
'
burstUnusedSeal
'
,
{},
{
root
:
true
});
};
};
export
const
setFileLanguage
=
({
getters
,
commit
},
{
fileLanguage
})
=>
{
export
const
setFileLanguage
=
({
getters
,
commit
},
{
fileLanguage
})
=>
{
...
...
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
7a8af429
...
@@ -182,6 +182,10 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState }) =
...
@@ -182,6 +182,10 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState }) =
}
}
commit
(
rootTypes
.
CLEAR_STAGED_CHANGES
,
null
,
{
root
:
true
});
commit
(
rootTypes
.
CLEAR_STAGED_CHANGES
,
null
,
{
root
:
true
});
setTimeout
(()
=>
{
commit
(
rootTypes
.
SET_LAST_COMMIT_MSG
,
''
,
{
root
:
true
});
},
5000
);
})
})
.
then
(()
=>
dispatch
(
'
updateCommitAction
'
,
consts
.
COMMIT_TO_CURRENT_BRANCH
));
.
then
(()
=>
dispatch
(
'
updateCommitAction
'
,
consts
.
COMMIT_TO_CURRENT_BRANCH
));
})
})
...
...
app/assets/javascripts/ide/stores/mutation_types.js
View file @
7a8af429
...
@@ -61,3 +61,4 @@ export const REMOVE_PENDING_TAB = 'REMOVE_PENDING_TAB';
...
@@ -61,3 +61,4 @@ export const REMOVE_PENDING_TAB = 'REMOVE_PENDING_TAB';
export
const
UPDATE_TEMP_FLAG
=
'
UPDATE_TEMP_FLAG
'
;
export
const
UPDATE_TEMP_FLAG
=
'
UPDATE_TEMP_FLAG
'
;
export
const
TOGGLE_FILE_FINDER
=
'
TOGGLE_FILE_FINDER
'
;
export
const
TOGGLE_FILE_FINDER
=
'
TOGGLE_FILE_FINDER
'
;
export
const
BURST_UNUSED_SEAL
=
'
BURST_UNUSED_SEAL
'
;
app/assets/javascripts/ide/stores/mutations.js
View file @
7a8af429
...
@@ -128,6 +128,11 @@ export default {
...
@@ -128,6 +128,11 @@ export default {
}),
}),
});
});
},
},
[
types
.
BURST_UNUSED_SEAL
](
state
)
{
Object
.
assign
(
state
,
{
unusedSeal
:
false
,
});
},
...
projectMutations
,
...
projectMutations
,
...
mergeRequestMutation
,
...
mergeRequestMutation
,
...
fileMutations
,
...
fileMutations
,
...
...
app/assets/javascripts/ide/stores/state.js
View file @
7a8af429
...
@@ -18,5 +18,6 @@ export default () => ({
...
@@ -18,5 +18,6 @@ export default () => ({
entries
:
{},
entries
:
{},
viewer
:
'
editor
'
,
viewer
:
'
editor
'
,
delayViewerUpdated
:
false
,
delayViewerUpdated
:
false
,
unusedSeal
:
true
,
fileFindVisible
:
false
,
fileFindVisible
:
false
,
});
});
app/assets/stylesheets/pages/repo.scss
View file @
7a8af429
...
@@ -549,6 +549,7 @@
...
@@ -549,6 +549,7 @@
margin-bottom
:
0
;
margin-bottom
:
0
;
border-bottom
:
1px
solid
$white-dark
;
border-bottom
:
1px
solid
$white-dark
;
padding
:
$gl-btn-padding
0
;
padding
:
$gl-btn-padding
0
;
min-height
:
56px
;
}
}
.multi-file-commit-panel-header-title
{
.multi-file-commit-panel-header-title
{
...
@@ -673,6 +674,24 @@
...
@@ -673,6 +674,24 @@
}
}
}
}
.multi-file-commit-panel-bottom
{
position
:
relative
;
.multi-file-commit-panel-success-message
{
position
:
absolute
;
top
:
1px
;
left
:
3px
;
bottom
:
0
;
right
:
0
;
z-index
:
10
;
background
:
$gray-light
;
overflow
:
auto
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
}
}
.dirty-diff
{
.dirty-diff
{
// !important need to override monaco inline style
// !important need to override monaco inline style
width
:
4px
!
important
;
width
:
4px
!
important
;
...
...
changelogs/unreleased/ide-improve-commit-panel.yml
0 → 100644
View file @
7a8af429
---
title
:
Improve interaction on WebIDE commit panel
merge_request
:
author
:
type
:
changed
spec/javascripts/ide/components/commit_sidebar/empty_state_spec.js
View file @
7a8af429
...
@@ -24,42 +24,10 @@ describe('IDE commit panel empty state', () => {
...
@@ -24,42 +24,10 @@ describe('IDE commit panel empty state', () => {
resetStore
(
vm
.
$store
);
resetStore
(
vm
.
$store
);
});
});
describe
(
'
statusSvg
'
,
()
=>
{
it
(
'
uses noChangesStateSvgPath when commit message is empty
'
,
()
=>
{
expect
(
vm
.
statusSvg
).
toBe
(
'
no-changes
'
);
expect
(
vm
.
$el
.
querySelector
(
'
img
'
).
getAttribute
(
'
src
'
)).
toBe
(
'
no-changes
'
,
);
});
it
(
'
uses committedStateSvgPath when commit message exists
'
,
done
=>
{
vm
.
$store
.
state
.
lastCommitMsg
=
'
testing
'
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
statusSvg
).
toBe
(
'
committed-state
'
);
expect
(
vm
.
$el
.
querySelector
(
'
img
'
).
getAttribute
(
'
src
'
)).
toBe
(
'
committed-state
'
,
);
done
();
});
});
});
it
(
'
renders no changes text when last commit message is empty
'
,
()
=>
{
it
(
'
renders no changes text when last commit message is empty
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
No changes
'
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
No changes
'
);
});
});
it
(
'
renders last commit message when it exists
'
,
done
=>
{
vm
.
$store
.
state
.
lastCommitMsg
=
'
testing commit message
'
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
testing commit message
'
);
done
();
});
});
describe
(
'
toggle button
'
,
()
=>
{
describe
(
'
toggle button
'
,
()
=>
{
it
(
'
calls store action
'
,
()
=>
{
it
(
'
calls store action
'
,
()
=>
{
spyOn
(
vm
,
'
toggleRightPanelCollapsed
'
);
spyOn
(
vm
,
'
toggleRightPanelCollapsed
'
);
...
...
spec/javascripts/ide/components/commit_sidebar/success_message_spec.js
0 → 100644
View file @
7a8af429
import
Vue
from
'
vue
'
;
import
store
from
'
~/ide/stores
'
;
import
successMessage
from
'
~/ide/components/commit_sidebar/success_message.vue
'
;
import
{
createComponentWithStore
}
from
'
../../../helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../../helpers
'
;
describe
(
'
IDE commit panel successful commit state
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
successMessage
);
vm
=
createComponentWithStore
(
Component
,
store
,
{
committedStateSvgPath
:
'
committed-state
'
,
});
vm
.
$mount
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
resetStore
(
vm
.
$store
);
});
it
(
'
renders last commit message when it exists
'
,
done
=>
{
vm
.
$store
.
state
.
lastCommitMsg
=
'
testing commit message
'
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
testing commit message
'
);
done
();
});
});
});
spec/javascripts/ide/stores/actions/file_spec.js
View file @
7a8af429
...
@@ -398,6 +398,20 @@ describe('IDE store file actions', () => {
...
@@ -398,6 +398,20 @@ describe('IDE store file actions', () => {
})
})
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
it
(
'
bursts unused seal
'
,
done
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
{
expect
(
store
.
state
.
unusedSeal
).
toBe
(
false
);
done
();
})
.
catch
(
done
.
fail
);
});
});
});
describe
(
'
discardFileChanges
'
,
()
=>
{
describe
(
'
discardFileChanges
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/mutations_spec.js
View file @
7a8af429
...
@@ -116,4 +116,14 @@ describe('Multi-file store mutations', () => {
...
@@ -116,4 +116,14 @@ describe('Multi-file store mutations', () => {
expect
(
localState
.
fileFindVisible
).
toBe
(
true
);
expect
(
localState
.
fileFindVisible
).
toBe
(
true
);
});
});
});
});
describe
(
'
BURST_UNUSED_SEAL
'
,
()
=>
{
it
(
'
updates unusedSeal
'
,
()
=>
{
expect
(
localState
.
unusedSeal
).
toBe
(
true
);
mutations
.
BURST_UNUSED_SEAL
(
localState
);
expect
(
localState
.
unusedSeal
).
toBe
(
false
);
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment