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
b7f3d747
Commit
b7f3d747
authored
May 07, 2018
by
André Luís
Committed by
Phil Hughes
May 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Clean up bottom status bar Web IDE"
parent
68b71df6
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
364 additions
and
70 deletions
+364
-70
app/assets/javascripts/ide/components/ide.vue
app/assets/javascripts/ide/components/ide.vue
+50
-48
app/assets/javascripts/ide/components/ide_status_bar.vue
app/assets/javascripts/ide/components/ide_status_bar.vue
+76
-20
app/assets/javascripts/ide/stores/actions/project.js
app/assets/javascripts/ide/stores/actions/project.js
+23
-0
app/assets/javascripts/ide/stores/getters.js
app/assets/javascripts/ide/stores/getters.js
+6
-0
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+5
-1
app/assets/javascripts/ide/stores/mutation_types.js
app/assets/javascripts/ide/stores/mutation_types.js
+1
-0
app/assets/javascripts/ide/stores/mutations/branch.js
app/assets/javascripts/ide/stores/mutations/branch.js
+5
-0
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+1
-0
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+16
-1
changelogs/unreleased/44833-ide-clean-up-status-bar.yml
changelogs/unreleased/44833-ide-clean-up-status-bar.yml
+5
-0
spec/javascripts/ide/components/ide_status_bar_spec.js
spec/javascripts/ide/components/ide_status_bar_spec.js
+63
-0
spec/javascripts/ide/stores/actions/project_spec.js
spec/javascripts/ide/stores/actions/project_spec.js
+71
-0
spec/javascripts/ide/stores/getters_spec.js
spec/javascripts/ide/stores/getters_spec.js
+20
-0
spec/javascripts/ide/stores/mutations/branch_spec.js
spec/javascripts/ide/stores/mutations/branch_spec.js
+22
-0
No files found.
app/assets/javascripts/ide/components/ide.vue
View file @
b7f3d747
...
@@ -65,6 +65,7 @@ export default {
...
@@ -65,6 +65,7 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<article
class=
"ide"
>
<div
<div
class=
"ide-view"
class=
"ide-view"
>
>
...
@@ -89,9 +90,6 @@ export default {
...
@@ -89,9 +90,6 @@ export default {
class=
"multi-file-edit-pane-content"
class=
"multi-file-edit-pane-content"
:file=
"activeFile"
:file=
"activeFile"
/>
/>
<ide-status-bar
:file=
"activeFile"
/>
</
template
>
</
template
>
<
template
<
template
v-else
v-else
...
@@ -122,4 +120,8 @@ export default {
...
@@ -122,4 +120,8 @@ export default {
</
template
>
</
template
>
</div>
</div>
</div>
</div>
<ide-status-bar
:file=
"activeFile"
/>
</article>
</template>
</template>
app/assets/javascripts/ide/components/ide_status_bar.vue
View file @
b7f3d747
<
script
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
timeAgoMixin
from
'
~/vue_shared/mixins/timeago
'
;
import
timeAgoMixin
from
'
~/vue_shared/mixins/timeago
'
;
import
userAvatarImage
from
'
../../vue_shared/components/user_avatar/user_avatar_image.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
icon
,
icon
,
userAvatarImage
,
},
},
directives
:
{
directives
:
{
tooltip
,
tooltip
,
...
@@ -14,40 +17,93 @@ export default {
...
@@ -14,40 +17,93 @@ export default {
props
:
{
props
:
{
file
:
{
file
:
{
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
false
,
default
:
null
,
},
},
data
()
{
return
{
lastCommitFormatedAge
:
null
,
};
},
computed
:
{
...
mapGetters
([
'
currentProject
'
,
'
lastCommit
'
]),
},
mounted
()
{
this
.
startTimer
();
},
beforeDestroy
()
{
if
(
this
.
intervalId
)
{
clearInterval
(
this
.
intervalId
);
}
},
methods
:
{
startTimer
()
{
this
.
intervalId
=
setInterval
(()
=>
{
this
.
commitAgeUpdate
();
},
1000
);
},
commitAgeUpdate
()
{
if
(
this
.
lastCommit
)
{
this
.
lastCommitFormatedAge
=
this
.
timeFormated
(
this
.
lastCommit
.
committed_date
);
}
},
getCommitPath
(
shortSha
)
{
return
`
${
this
.
currentProject
.
web_url
}
/commit/
${
shortSha
}
`
;
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"ide-status-bar"
>
<footer
class=
"ide-status-bar"
>
<div>
<div
<div
v-if=
"file.lastCommit && file.lastCommit.id"
>
class=
"ide-status-branch"
Last commit:
v-if=
"lastCommit && lastCommitFormatedAge"
>
<icon
name=
"commit"
/>
<a
<a
v-tooltip
v-tooltip
:title=
"file.lastCommit.message"
class=
"commit-sha"
:href=
"file.lastCommit.url"
:title=
"lastCommit.message"
:href=
"getCommitPath(lastCommit.short_id)"
>
{{
lastCommit
.
short_id
}}
</a>
by
{{
lastCommit
.
author_name
}}
<time
v-tooltip
data-placement=
"top"
data-container=
"body"
:datetime=
"lastCommit.committed_date"
:title=
"tooltipTitle(lastCommit.committed_date)"
>
>
{{
timeFormated
(
file
.
lastCommit
.
updatedAt
)
}}
by
{{
lastCommitFormatedAge
}}
{{
file
.
lastCommit
.
author
}}
</time>
</a>
</div>
</div>
</div>
<div
class=
"text-right"
>
<div
v-if=
"file"
class=
"ide-status-file"
>
{{
file
.
name
}}
{{
file
.
name
}}
</div>
</div>
<div
class=
"text-right"
>
<div
v-if=
"file"
class=
"ide-status-file"
>
{{
file
.
eol
}}
{{
file
.
eol
}}
</div>
</div>
<div
<div
class=
"
text-right
"
class=
"
ide-status-file
"
v-if=
"!file.binary"
>
v-if=
"
file &&
!file.binary"
>
{{
file
.
editorRow
}}
:
{{
file
.
editorColumn
}}
{{
file
.
editorRow
}}
:
{{
file
.
editorColumn
}}
</div>
</div>
<div
class=
"text-right"
>
<div
v-if=
"file"
class=
"ide-status-file"
>
{{
file
.
fileLanguage
}}
{{
file
.
fileLanguage
}}
</div>
</div>
</
div
>
</
footer
>
</
template
>
</
template
>
app/assets/javascripts/ide/stores/actions/project.js
View file @
b7f3d747
...
@@ -72,3 +72,26 @@ export const getBranchData = (
...
@@ -72,3 +72,26 @@ export const getBranchData = (
resolve
(
state
.
projects
[
`
${
projectId
}
`
].
branches
[
branchId
]);
resolve
(
state
.
projects
[
`
${
projectId
}
`
].
branches
[
branchId
]);
}
}
});
});
export
const
refreshLastCommitData
=
(
{
commit
,
state
,
dispatch
},
{
projectId
,
branchId
}
=
{},
)
=>
service
.
getBranchData
(
projectId
,
branchId
)
.
then
(({
data
})
=>
{
commit
(
types
.
SET_BRANCH_COMMIT
,
{
projectId
,
branchId
,
commit
:
data
.
commit
,
});
})
.
catch
(()
=>
{
flash
(
'
Error loading last commit.
'
,
'
alert
'
,
document
,
null
,
false
,
true
,
);
});
app/assets/javascripts/ide/stores/getters.js
View file @
b7f3d747
...
@@ -81,5 +81,11 @@ export const getUnstagedFilesCountForPath = state => path =>
...
@@ -81,5 +81,11 @@ export const getUnstagedFilesCountForPath = state => path =>
export
const
getStagedFilesCountForPath
=
state
=>
path
=>
export
const
getStagedFilesCountForPath
=
state
=>
path
=>
getChangesCountForFiles
(
state
.
stagedFiles
,
path
);
getChangesCountForFiles
(
state
.
stagedFiles
,
path
);
export
const
lastCommit
=
(
state
,
getters
)
=>
{
const
branch
=
getters
.
currentProject
&&
getters
.
currentProject
.
branches
[
state
.
currentBranchId
];
return
branch
?
branch
.
commit
:
null
;
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
export
default
()
=>
{};
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
b7f3d747
...
@@ -210,7 +210,11 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
...
@@ -210,7 +210,11 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
);
);
}
}
})
})
.
then
(()
=>
dispatch
(
'
updateCommitAction
'
,
consts
.
COMMIT_TO_CURRENT_BRANCH
));
.
then
(()
=>
dispatch
(
'
updateCommitAction
'
,
consts
.
COMMIT_TO_CURRENT_BRANCH
))
.
then
(()
=>
dispatch
(
'
refreshLastCommitData
'
,
{
projectId
:
rootState
.
currentProjectId
,
branchId
:
rootState
.
currentBranchId
,
},
{
root
:
true
}));
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
let
errMsg
=
__
(
'
Error committing changes. Please try again.
'
);
let
errMsg
=
__
(
'
Error committing changes. Please try again.
'
);
...
...
app/assets/javascripts/ide/stores/mutation_types.js
View file @
b7f3d747
...
@@ -20,6 +20,7 @@ export const SET_MERGE_REQUEST_VERSIONS = 'SET_MERGE_REQUEST_VERSIONS';
...
@@ -20,6 +20,7 @@ export const SET_MERGE_REQUEST_VERSIONS = 'SET_MERGE_REQUEST_VERSIONS';
// Branch Mutation Types
// Branch Mutation Types
export
const
SET_BRANCH
=
'
SET_BRANCH
'
;
export
const
SET_BRANCH
=
'
SET_BRANCH
'
;
export
const
SET_BRANCH_COMMIT
=
'
SET_BRANCH_COMMIT
'
;
export
const
SET_BRANCH_WORKING_REFERENCE
=
'
SET_BRANCH_WORKING_REFERENCE
'
;
export
const
SET_BRANCH_WORKING_REFERENCE
=
'
SET_BRANCH_WORKING_REFERENCE
'
;
export
const
TOGGLE_BRANCH_OPEN
=
'
TOGGLE_BRANCH_OPEN
'
;
export
const
TOGGLE_BRANCH_OPEN
=
'
TOGGLE_BRANCH_OPEN
'
;
...
...
app/assets/javascripts/ide/stores/mutations/branch.js
View file @
b7f3d747
...
@@ -23,4 +23,9 @@ export default {
...
@@ -23,4 +23,9 @@ export default {
workingReference
:
reference
,
workingReference
:
reference
,
});
});
},
},
[
types
.
SET_BRANCH_COMMIT
](
state
,
{
projectId
,
branchId
,
commit
})
{
Object
.
assign
(
state
.
projects
[
projectId
].
branches
[
branchId
],
{
commit
,
});
},
};
};
app/assets/stylesheets/framework/variables.scss
View file @
b7f3d747
...
@@ -230,6 +230,7 @@ $row-hover: $blue-50;
...
@@ -230,6 +230,7 @@ $row-hover: $blue-50;
$row-hover-border
:
$blue-200
;
$row-hover-border
:
$blue-200
;
$progress-color
:
#c0392b
;
$progress-color
:
#c0392b
;
$header-height
:
40px
;
$header-height
:
40px
;
$ide-statusbar-height
:
27px
;
$fixed-layout-width
:
1280px
;
$fixed-layout-width
:
1280px
;
$limited-layout-width
:
990px
;
$limited-layout-width
:
990px
;
$limited-layout-width-sm
:
790px
;
$limited-layout-width-sm
:
790px
;
...
...
app/assets/stylesheets/pages/repo.scss
View file @
b7f3d747
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
margin-top
:
0
;
margin-top
:
0
;
border-top
:
1px
solid
$white-dark
;
border-top
:
1px
solid
$white-dark
;
border-bottom
:
1px
solid
$white-dark
;
border-bottom
:
1px
solid
$white-dark
;
padding-bottom
:
$ide-statusbar-height
;
&
.is-collapsed
{
&
.is-collapsed
{
.ide-file-list
{
.ide-file-list
{
...
@@ -375,7 +376,13 @@
...
@@ -375,7 +376,13 @@
padding
:
$gl-bar-padding
$gl-padding
;
padding
:
$gl-bar-padding
$gl-padding
;
background
:
$white-light
;
background
:
$white-light
;
display
:
flex
;
display
:
flex
;
justify-content
:
flex-end
;
justify-content
:
space-between
;
height
:
$ide-statusbar-height
;
position
:
absolute
;
bottom
:
0
;
left
:
0
;
width
:
100%
;
>
div
+
div
{
>
div
+
div
{
padding-left
:
$gl-padding
;
padding-left
:
$gl-padding
;
...
@@ -386,6 +393,14 @@
...
@@ -386,6 +393,14 @@
}
}
}
}
.ide-status-file
{
text-align
:
right
;
.ide-status-branch
+
&
,
&
:first-child
{
margin-left
:
auto
;
}
}
// Not great, but this is to deal with our current output
// Not great, but this is to deal with our current output
.multi-file-preview-holder
{
.multi-file-preview-holder
{
height
:
100%
;
height
:
100%
;
...
...
changelogs/unreleased/44833-ide-clean-up-status-bar.yml
0 → 100644
View file @
b7f3d747
---
title
:
Clean up WebIDE status bar and add useful info
merge_request
:
author
:
type
:
changed
spec/javascripts/ide/components/ide_status_bar_spec.js
0 → 100644
View file @
b7f3d747
import
Vue
from
'
vue
'
;
import
store
from
'
~/ide/stores
'
;
import
ideStatusBar
from
'
~/ide/components/ide_status_bar.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../helpers
'
;
import
{
projectData
}
from
'
../mock_data
'
;
describe
(
'
ideStatusBar
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
ideStatusBar
);
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
projects
.
abcproject
=
projectData
;
vm
=
createComponentWithStore
(
Component
,
store
).
$mount
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
resetStore
(
vm
.
$store
);
});
it
(
'
renders the statusbar
'
,
()
=>
{
expect
(
vm
.
$el
.
className
).
toBe
(
'
ide-status-bar
'
);
});
describe
(
'
mounted
'
,
()
=>
{
it
(
'
triggers a setInterval
'
,
()
=>
{
expect
(
vm
.
intervalId
).
not
.
toBe
(
null
);
});
});
describe
(
'
commitAgeUpdate
'
,
()
=>
{
beforeEach
(
function
()
{
jasmine
.
clock
().
install
();
spyOn
(
vm
,
'
commitAgeUpdate
'
).
and
.
callFake
(()
=>
{});
vm
.
startTimer
();
});
afterEach
(
function
()
{
jasmine
.
clock
().
uninstall
();
});
it
(
'
gets called every second
'
,
()
=>
{
expect
(
vm
.
commitAgeUpdate
).
not
.
toHaveBeenCalled
();
jasmine
.
clock
().
tick
(
1100
);
expect
(
vm
.
commitAgeUpdate
.
calls
.
count
()).
toEqual
(
1
);
jasmine
.
clock
().
tick
(
1000
);
expect
(
vm
.
commitAgeUpdate
.
calls
.
count
()).
toEqual
(
2
);
});
});
describe
(
'
getCommitPath
'
,
()
=>
{
it
(
'
returns the path to the commit details
'
,
()
=>
{
expect
(
vm
.
getCommitPath
(
'
abc123de
'
)).
toBe
(
'
/commit/abc123de
'
);
});
});
});
spec/javascripts/ide/stores/actions/project_spec.js
0 → 100644
View file @
b7f3d747
import
{
refreshLastCommitData
,
}
from
'
~/ide/stores/actions
'
;
import
store
from
'
~/ide/stores
'
;
import
service
from
'
~/ide/services
'
;
import
{
resetStore
}
from
'
../../helpers
'
;
import
testAction
from
'
../../../helpers/vuex_action_helper
'
;
describe
(
'
IDE store project actions
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
projects
.
abcproject
=
{};
});
afterEach
(()
=>
{
resetStore
(
store
);
});
describe
(
'
refreshLastCommitData
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
master
'
;
store
.
state
.
projects
.
abcproject
=
{
branches
:
{
master
:
{
commit
:
null
,
},
},
};
});
it
(
'
calls the service
'
,
done
=>
{
spyOn
(
service
,
'
getBranchData
'
).
and
.
returnValue
(
Promise
.
resolve
({
data
:
{
commit
:
{
id
:
'
123
'
},
},
}),
);
store
.
dispatch
(
'
refreshLastCommitData
'
,
{
projectId
:
store
.
state
.
currentProjectId
,
branchId
:
store
.
state
.
currentBranchId
,
})
.
then
(()
=>
{
expect
(
service
.
getBranchData
).
toHaveBeenCalledWith
(
'
abcproject
'
,
'
master
'
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
commits getBranchData
'
,
done
=>
{
testAction
(
refreshLastCommitData
,
{},
{},
[{
type
:
'
SET_BRANCH_COMMIT
'
,
payload
:
{
projectId
:
'
abcproject
'
,
branchId
:
'
master
'
,
commit
:
{
id
:
'
123
'
},
},
}],
// mutations
[],
// action
done
,
);
});
});
});
spec/javascripts/ide/stores/getters_spec.js
View file @
b7f3d747
...
@@ -141,4 +141,24 @@ describe('IDE store getters', () => {
...
@@ -141,4 +141,24 @@ describe('IDE store getters', () => {
expect
(
getters
.
getChangesInFolder
(
localState
)(
'
test
'
)).
toBe
(
2
);
expect
(
getters
.
getChangesInFolder
(
localState
)(
'
test
'
)).
toBe
(
2
);
});
});
});
});
describe
(
'
lastCommit
'
,
()
=>
{
it
(
'
returns the last commit of the current branch on the current project
'
,
()
=>
{
const
commitTitle
=
'
Example commit title
'
;
const
localGetters
=
{
currentProject
:
{
branches
:
{
'
example-branch
'
:
{
commit
:
{
title
:
commitTitle
,
},
},
},
},
};
localState
.
currentBranchId
=
'
example-branch
'
;
expect
(
getters
.
lastCommit
(
localState
,
localGetters
).
title
).
toBe
(
commitTitle
);
});
});
});
});
spec/javascripts/ide/stores/mutations/branch_spec.js
View file @
b7f3d747
...
@@ -15,4 +15,26 @@ describe('Multi-file store branch mutations', () => {
...
@@ -15,4 +15,26 @@ describe('Multi-file store branch mutations', () => {
expect
(
localState
.
currentBranchId
).
toBe
(
'
master
'
);
expect
(
localState
.
currentBranchId
).
toBe
(
'
master
'
);
});
});
});
});
describe
(
'
SET_BRANCH_COMMIT
'
,
()
=>
{
it
(
'
sets the last commit on current project
'
,
()
=>
{
localState
.
projects
=
{
Example
:
{
branches
:
{
master
:
{},
},
},
};
mutations
.
SET_BRANCH_COMMIT
(
localState
,
{
projectId
:
'
Example
'
,
branchId
:
'
master
'
,
commit
:
{
title
:
'
Example commit
'
,
},
});
expect
(
localState
.
projects
.
Example
.
branches
.
master
.
commit
.
title
).
toBe
(
'
Example commit
'
);
});
});
});
});
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