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
3f650038
Commit
3f650038
authored
Sep 03, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some bugs around with the template dropdowns
parent
5b84c2fb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
11 deletions
+28
-11
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+2
-1
app/assets/javascripts/ide/stores/mutations.js
app/assets/javascripts/ide/stores/mutations.js
+12
-1
app/assets/javascripts/ide/stores/mutations/file.js
app/assets/javascripts/ide/stores/mutations/file.js
+1
-1
app/assets/stylesheets/page_bundles/ide.scss
app/assets/stylesheets/page_bundles/ide.scss
+5
-0
spec/javascripts/ide/components/file_templates/bar_spec.js
spec/javascripts/ide/components/file_templates/bar_spec.js
+5
-5
spec/javascripts/ide/components/file_templates/dropdown_spec.js
...avascripts/ide/components/file_templates/dropdown_spec.js
+3
-3
No files found.
app/assets/javascripts/ide/stores/actions.js
View file @
3f650038
...
@@ -206,6 +206,7 @@ export const resetOpenFiles = ({ commit }) => commit(types.RESET_OPEN_FILES);
...
@@ -206,6 +206,7 @@ export const resetOpenFiles = ({ commit }) => commit(types.RESET_OPEN_FILES);
export
const
renameEntry
=
({
dispatch
,
commit
,
state
},
{
path
,
name
,
entryPath
=
null
})
=>
{
export
const
renameEntry
=
({
dispatch
,
commit
,
state
},
{
path
,
name
,
entryPath
=
null
})
=>
{
const
entry
=
state
.
entries
[
entryPath
||
path
];
const
entry
=
state
.
entries
[
entryPath
||
path
];
commit
(
types
.
RENAME_ENTRY
,
{
path
,
name
,
entryPath
});
commit
(
types
.
RENAME_ENTRY
,
{
path
,
name
,
entryPath
});
if
(
entry
.
type
===
'
tree
'
)
{
if
(
entry
.
type
===
'
tree
'
)
{
...
@@ -214,7 +215,7 @@ export const renameEntry = ({ dispatch, commit, state }, { path, name, entryPath
...
@@ -214,7 +215,7 @@ export const renameEntry = ({ dispatch, commit, state }, { path, name, entryPath
);
);
}
}
if
(
!
entryPath
)
{
if
(
!
entryPath
&&
!
entry
.
tempFile
)
{
dispatch
(
'
deleteEntry
'
,
path
);
dispatch
(
'
deleteEntry
'
,
path
);
}
}
};
};
...
...
app/assets/javascripts/ide/stores/mutations.js
View file @
3f650038
import
Vue
from
'
vue
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
projectMutations
from
'
./mutations/project
'
;
import
projectMutations
from
'
./mutations/project
'
;
import
mergeRequestMutation
from
'
./mutations/merge_request
'
;
import
mergeRequestMutation
from
'
./mutations/merge_request
'
;
...
@@ -226,7 +227,7 @@ export default {
...
@@ -226,7 +227,7 @@ export default {
path
:
newPath
,
path
:
newPath
,
name
:
entryPath
?
oldEntry
.
name
:
name
,
name
:
entryPath
?
oldEntry
.
name
:
name
,
tempFile
:
true
,
tempFile
:
true
,
prevPath
:
oldEntry
.
path
,
prevPath
:
oldEntry
.
tempFile
?
null
:
oldEntry
.
path
,
url
:
oldEntry
.
url
.
replace
(
new
RegExp
(
`
${
oldEntry
.
path
}
/?$`
),
newPath
),
url
:
oldEntry
.
url
.
replace
(
new
RegExp
(
`
${
oldEntry
.
path
}
/?$`
),
newPath
),
tree
:
[],
tree
:
[],
parentPath
,
parentPath
,
...
@@ -249,6 +250,16 @@ export default {
...
@@ -249,6 +250,16 @@ export default {
if
(
state
.
entries
[
newPath
].
opened
)
{
if
(
state
.
entries
[
newPath
].
opened
)
{
state
.
openFiles
.
push
(
state
.
entries
[
newPath
]);
state
.
openFiles
.
push
(
state
.
entries
[
newPath
]);
}
}
if
(
oldEntry
.
tempFile
)
{
const
filterMethod
=
f
=>
f
.
path
!==
oldEntry
.
path
;
state
.
openFiles
=
state
.
openFiles
.
filter
(
filterMethod
);
state
.
changedFiles
=
state
.
changedFiles
.
filter
(
filterMethod
);
parent
.
tree
=
parent
.
tree
.
filter
(
filterMethod
);
Vue
.
delete
(
state
.
entries
,
oldEntry
.
path
);
}
},
},
...
projectMutations
,
...
projectMutations
,
...
mergeRequestMutation
,
...
mergeRequestMutation
,
...
...
app/assets/javascripts/ide/stores/mutations/file.js
View file @
3f650038
...
@@ -55,7 +55,7 @@ export default {
...
@@ -55,7 +55,7 @@ export default {
f
=>
f
.
path
===
file
.
path
&&
f
.
pending
&&
!
(
f
.
tempFile
&&
!
f
.
prevPath
),
f
=>
f
.
path
===
file
.
path
&&
f
.
pending
&&
!
(
f
.
tempFile
&&
!
f
.
prevPath
),
);
);
if
(
file
.
tempFile
)
{
if
(
file
.
tempFile
&&
file
.
content
===
''
)
{
Object
.
assign
(
state
.
entries
[
file
.
path
],
{
Object
.
assign
(
state
.
entries
[
file
.
path
],
{
content
:
raw
,
content
:
raw
,
});
});
...
...
app/assets/stylesheets/page_bundles/ide.scss
View file @
3f650038
...
@@ -1451,4 +1451,9 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding;
...
@@ -1451,4 +1451,9 @@ $ide-tree-text-start: $ide-activity-bar-width + $ide-tree-padding;
.dropdown
{
.dropdown
{
min-width
:
180px
;
min-width
:
180px
;
}
}
.dropdown-menu
{
max-height
:
222px
;
overflow
:
hidden
;
}
}
}
spec/javascripts/ide/components/file_templates/bar_spec.js
View file @
3f650038
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
createStore
}
from
'
~/ide/stores
'
;
import
{
createStore
}
from
'
~/ide/stores
'
;
import
Bar
from
'
~/ide/components/file_templates/bar.vue
'
;
import
Bar
from
'
~/ide/components/file_templates/bar.vue
'
;
import
{
create
ComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
mount
ComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
,
file
}
from
'
../../helpers
'
;
import
{
resetStore
,
file
}
from
'
../../helpers
'
;
describe
(
'
IDE file templates bar component
'
,
()
=>
{
describe
(
'
IDE file templates bar component
'
,
()
=>
{
...
@@ -21,7 +21,7 @@ describe('IDE file templates bar component', () => {
...
@@ -21,7 +21,7 @@ describe('IDE file templates bar component', () => {
active
:
true
,
active
:
true
,
});
});
vm
=
createComponentWithStore
(
Component
,
store
).
$mount
(
);
vm
=
mountComponentWithStore
(
Component
,
{
store
}
);
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -35,7 +35,7 @@ describe('IDE file templates bar component', () => {
...
@@ -35,7 +35,7 @@ describe('IDE file templates bar component', () => {
});
});
it
(
'
calls setSelectedTemplateType when clicking item
'
,
()
=>
{
it
(
'
calls setSelectedTemplateType when clicking item
'
,
()
=>
{
spyOn
(
vm
,
'
setSelectedTemplateType
'
);
spyOn
(
vm
,
'
setSelectedTemplateType
'
)
.
and
.
stub
()
;
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
...
@@ -66,7 +66,7 @@ describe('IDE file templates bar component', () => {
...
@@ -66,7 +66,7 @@ describe('IDE file templates bar component', () => {
});
});
it
(
'
calls fetchTemplate on click
'
,
()
=>
{
it
(
'
calls fetchTemplate on click
'
,
()
=>
{
spyOn
(
vm
,
'
fetchTemplate
'
);
spyOn
(
vm
,
'
fetchTemplate
'
)
.
and
.
stub
()
;
vm
.
$el
vm
.
$el
.
querySelectorAll
(
'
.dropdown-content
'
)[
1
]
.
querySelectorAll
(
'
.dropdown-content
'
)[
1
]
...
@@ -90,7 +90,7 @@ describe('IDE file templates bar component', () => {
...
@@ -90,7 +90,7 @@ describe('IDE file templates bar component', () => {
});
});
it
(
'
calls undoFileTemplate when clicking undo button
'
,
()
=>
{
it
(
'
calls undoFileTemplate when clicking undo button
'
,
()
=>
{
spyOn
(
vm
,
'
undoFileTemplate
'
);
spyOn
(
vm
,
'
undoFileTemplate
'
)
.
and
.
stub
()
;
vm
.
$el
.
querySelector
(
'
.btn-default
'
).
click
();
vm
.
$el
.
querySelector
(
'
.btn-default
'
).
click
();
...
...
spec/javascripts/ide/components/file_templates/dropdown_spec.js
View file @
3f650038
...
@@ -32,7 +32,7 @@ describe('IDE file templates dropdown component', () => {
...
@@ -32,7 +32,7 @@ describe('IDE file templates dropdown component', () => {
});
});
it
(
'
calls async store method on Bootstrap dropdown event
'
,
()
=>
{
it
(
'
calls async store method on Bootstrap dropdown event
'
,
()
=>
{
spyOn
(
vm
,
'
fetchTemplateTypes
'
);
spyOn
(
vm
,
'
fetchTemplateTypes
'
)
.
and
.
stub
()
;
$
(
vm
.
$el
).
trigger
(
'
show.bs.dropdown
'
);
$
(
vm
.
$el
).
trigger
(
'
show.bs.dropdown
'
);
...
@@ -91,7 +91,7 @@ describe('IDE file templates dropdown component', () => {
...
@@ -91,7 +91,7 @@ describe('IDE file templates dropdown component', () => {
});
});
it
(
'
calls clickItem on click
'
,
done
=>
{
it
(
'
calls clickItem on click
'
,
done
=>
{
spyOn
(
vm
,
'
clickItem
'
);
spyOn
(
vm
,
'
clickItem
'
)
.
and
.
stub
()
;
vm
.
$store
.
state
.
fileTemplates
.
templates
=
[
vm
.
$store
.
state
.
fileTemplates
.
templates
=
[
{
{
...
@@ -158,7 +158,7 @@ describe('IDE file templates dropdown component', () => {
...
@@ -158,7 +158,7 @@ describe('IDE file templates dropdown component', () => {
});
});
it
(
'
calls clickItem on click
'
,
done
=>
{
it
(
'
calls clickItem on click
'
,
done
=>
{
spyOn
(
vm
,
'
clickItem
'
);
spyOn
(
vm
,
'
clickItem
'
)
.
and
.
stub
()
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
vm
.
$el
.
querySelector
(
'
.dropdown-content button
'
).
click
();
...
...
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