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
Boxiang Sun
gitlab-ce
Commits
18599961
Commit
18599961
authored
Jun 12, 2019
by
Paul Slaughter
Committed by
Phil Hughes
Jun 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract ide_status_list from ide_status_bar
**Why?** The ide_status_list will be used and extended in EE.
parent
1e970f62
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
23 deletions
+124
-23
app/assets/javascripts/ide/components/ide.vue
app/assets/javascripts/ide/components/ide.vue
+1
-1
app/assets/javascripts/ide/components/ide_status_bar.vue
app/assets/javascripts/ide/components/ide_status_bar.vue
+3
-13
app/assets/javascripts/ide/components/ide_status_list.vue
app/assets/javascripts/ide/components/ide_status_list.vue
+23
-0
app/assets/stylesheets/page_bundles/ide.scss
app/assets/stylesheets/page_bundles/ide.scss
+6
-9
spec/frontend/ide/components/ide_status_list_spec.js
spec/frontend/ide/components/ide_status_list_spec.js
+91
-0
No files found.
app/assets/javascripts/ide/components/ide.vue
View file @
18599961
...
...
@@ -146,7 +146,7 @@ export default {
</div>
<component
:is=
"rightPaneComponent"
v-if=
"currentProjectId"
/>
</div>
<ide-status-bar
:file=
"activeFile"
/>
<ide-status-bar
/>
<new-modal
/>
</article>
</template>
app/assets/javascripts/ide/components/ide_status_bar.vue
View file @
18599961
<
script
>
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
IdeStatusList
from
'
ee_else_ce/ide/components/ide_status_list.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
timeAgoMixin
from
'
~/vue_shared/mixins/timeago
'
;
...
...
@@ -12,18 +13,12 @@ export default {
icon
,
userAvatarImage
,
CiIcon
,
IdeStatusList
,
},
directives
:
{
tooltip
,
},
mixins
:
[
timeAgoMixin
],
props
:
{
file
:
{
type
:
Object
,
required
:
false
,
default
:
null
,
},
},
data
()
{
return
{
lastCommitFormatedAge
:
null
,
...
...
@@ -125,11 +120,6 @@ export default {
>
{{
lastCommitFormatedAge
}}
</time
>
</div>
<div
v-if=
"file"
class=
"ide-status-file"
>
{{
file
.
name
}}
</div>
<div
v-if=
"file"
class=
"ide-status-file"
>
{{
file
.
eol
}}
</div>
<div
v-if=
"file && !file.binary"
class=
"ide-status-file"
>
{{
file
.
editorRow
}}
:
{{
file
.
editorColumn
}}
</div>
<div
v-if=
"file"
class=
"ide-status-file"
>
{{
file
.
fileLanguage
}}
</div>
<ide-status-list
class=
"ml-auto"
/>
</footer>
</
template
>
app/assets/javascripts/ide/components/ide_status_list.vue
0 → 100644
View file @
18599961
<
script
>
import
{
mapGetters
}
from
'
vuex
'
;
export
default
{
computed
:
{
...
mapGetters
([
'
activeFile
'
]),
},
};
</
script
>
<
template
>
<div
class=
"ide-status-list d-flex"
>
<template
v-if=
"activeFile"
>
<div
class=
"ide-status-file"
>
{{
activeFile
.
name
}}
</div>
<div
class=
"ide-status-file"
>
{{
activeFile
.
eol
}}
</div>
<div
v-if=
"!activeFile.binary"
class=
"ide-status-file"
>
{{
activeFile
.
editorRow
}}
:
{{
activeFile
.
editorColumn
}}
</div>
<div
class=
"ide-status-file"
>
{{
activeFile
.
fileLanguage
}}
</div>
</
template
>
<slot></slot>
</div>
</template>
app/assets/stylesheets/page_bundles/ide.scss
View file @
18599961
...
...
@@ -396,10 +396,6 @@ $ide-commit-header-height: 48px;
font-size
:
inherit
;
}
>
div
+
div
{
padding-left
:
$gl-padding
;
}
svg
{
vertical-align
:
sub
;
}
...
...
@@ -410,13 +406,14 @@ $ide-commit-header-height: 48px;
}
}
.ide-status-list
{
>
div
+
div
{
padding-left
:
$gl-padding
;
}
}
.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
.multi-file-preview-holder
{
...
...
spec/frontend/ide/components/ide_status_list_spec.js
0 → 100644
View file @
18599961
import
Vuex
from
'
vuex
'
;
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
IdeStatusList
from
'
~/ide/components/ide_status_list
'
;
const
TEST_FILE
=
{
name
:
'
lorem.md
'
,
eol
:
'
LF
'
,
editorRow
:
3
,
editorColumn
:
23
,
fileLanguage
:
'
markdown
'
,
};
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
describe
(
'
ide/components/ide_status_list
'
,
()
=>
{
let
activeFile
;
let
store
;
let
wrapper
;
const
createComponent
=
(
options
=
{})
=>
{
store
=
new
Vuex
.
Store
({
getters
:
{
activeFile
:
()
=>
activeFile
,
},
});
wrapper
=
shallowMount
(
localVue
.
extend
(
IdeStatusList
),
{
localVue
,
sync
:
false
,
store
,
...
options
,
});
};
beforeEach
(()
=>
{
activeFile
=
TEST_FILE
;
});
afterEach
(()
=>
{
wrapper
.
destroy
();
store
=
null
;
wrapper
=
null
;
});
const
getEditorPosition
=
file
=>
`
${
file
.
editorRow
}
:
${
file
.
editorColumn
}
`
;
describe
(
'
with regular file
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
});
it
(
'
shows file name
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
TEST_FILE
.
name
);
});
it
(
'
shows file eol
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
TEST_FILE
.
name
);
});
it
(
'
shows file editor position
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
getEditorPosition
(
TEST_FILE
));
});
it
(
'
shows file language
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
TEST_FILE
.
fileLanguage
);
});
});
describe
(
'
with binary file
'
,
()
=>
{
beforeEach
(()
=>
{
activeFile
.
binary
=
true
;
createComponent
();
});
it
(
'
does not show file editor position
'
,
()
=>
{
expect
(
wrapper
.
text
()).
not
.
toContain
(
getEditorPosition
(
TEST_FILE
));
});
});
it
(
'
adds slot as child of list
'
,
()
=>
{
createComponent
({
slots
:
{
default
:
[
'
<div class="js-test">Hello</div>
'
,
'
<div class="js-test">World</div>
'
],
},
});
expect
(
wrapper
.
find
(
'
.ide-status-list
'
).
findAll
(
'
.js-test
'
).
length
).
toEqual
(
2
);
});
});
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