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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
be45d454
Commit
be45d454
authored
Apr 10, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs with IDE new directory
Closes #44838
parent
d8dd75ca
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
151 additions
and
70 deletions
+151
-70
app/assets/javascripts/ide/components/new_dropdown/modal.vue
app/assets/javascripts/ide/components/new_dropdown/modal.vue
+1
-8
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+8
-0
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+2
-0
app/assets/javascripts/ide/stores/mutation_types.js
app/assets/javascripts/ide/stores/mutation_types.js
+2
-0
app/assets/javascripts/ide/stores/mutations.js
app/assets/javascripts/ide/stores/mutations.js
+9
-2
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+5
-2
app/assets/javascripts/ide/stores/workers/files_decorator_worker.js
.../javascripts/ide/stores/workers/files_decorator_worker.js
+2
-0
app/assets/javascripts/vue_shared/components/file_icon.vue
app/assets/javascripts/vue_shared/components/file_icon.vue
+51
-50
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+3
-5
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+46
-3
spec/javascripts/ide/stores/mutations_spec.js
spec/javascripts/ide/stores/mutations_spec.js
+22
-0
No files found.
app/assets/javascripts/ide/components/new_dropdown/modal.vue
View file @
be45d454
...
@@ -40,13 +40,6 @@ export default {
...
@@ -40,13 +40,6 @@ export default {
return
__
(
'
Create file
'
);
return
__
(
'
Create file
'
);
},
},
formLabelName
()
{
if
(
this
.
type
===
'
tree
'
)
{
return
__
(
'
Directory name
'
);
}
return
__
(
'
File name
'
);
},
},
},
mounted
()
{
mounted
()
{
this
.
$refs
.
fieldName
.
focus
();
this
.
$refs
.
fieldName
.
focus
();
...
@@ -83,7 +76,7 @@ export default {
...
@@ -83,7 +76,7 @@ export default {
>
>
<fieldset
class=
"form-group append-bottom-0"
>
<fieldset
class=
"form-group append-bottom-0"
>
<label
class=
"label-light col-sm-3"
>
<label
class=
"label-light col-sm-3"
>
{{
formLabelName
}}
{{
__
(
'
Name
'
)
}}
</label>
</label>
<div
class=
"col-sm-9"
>
<div
class=
"col-sm-9"
>
<input
<input
...
...
app/assets/javascripts/ide/stores/actions.js
View file @
be45d454
...
@@ -112,6 +112,14 @@ export const updateDelayViewerUpdated = ({ commit }, delay) => {
...
@@ -112,6 +112,14 @@ export const updateDelayViewerUpdated = ({ commit }, delay) => {
commit
(
types
.
UPDATE_DELAY_VIEWER_CHANGE
,
delay
);
commit
(
types
.
UPDATE_DELAY_VIEWER_CHANGE
,
delay
);
};
};
export
const
updateTempFlagForEntry
=
({
commit
,
dispatch
,
state
},
{
entry
,
tempFile
})
=>
{
commit
(
types
.
UPDATE_TEMP_FLAG
,
{
path
:
entry
.
path
,
tempFile
});
if
(
entry
.
parentPath
)
{
dispatch
(
'
updateTempFlagForEntry
'
,
{
entry
:
state
.
entries
[
entry
.
parentPath
],
tempFile
});
}
};
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/modules/commit/actions.js
View file @
be45d454
...
@@ -127,6 +127,8 @@ export const updateFilesAfterCommit = (
...
@@ -127,6 +127,8 @@ export const updateFilesAfterCommit = (
},
},
{
root
:
true
},
{
root
:
true
},
);
);
dispatch
(
'
updateTempFlagForEntry
'
,
{
entry
,
tempFile
:
false
},
{
root
:
true
});
});
});
commit
(
rootTypes
.
REMOVE_ALL_CHANGES_FILES
,
null
,
{
root
:
true
});
commit
(
rootTypes
.
REMOVE_ALL_CHANGES_FILES
,
null
,
{
root
:
true
});
...
...
app/assets/javascripts/ide/stores/mutation_types.js
View file @
be45d454
...
@@ -53,3 +53,5 @@ export const UPDATE_DELAY_VIEWER_CHANGE = 'UPDATE_DELAY_VIEWER_CHANGE';
...
@@ -53,3 +53,5 @@ export const UPDATE_DELAY_VIEWER_CHANGE = 'UPDATE_DELAY_VIEWER_CHANGE';
export
const
ADD_PENDING_TAB
=
'
ADD_PENDING_TAB
'
;
export
const
ADD_PENDING_TAB
=
'
ADD_PENDING_TAB
'
;
export
const
REMOVE_PENDING_TAB
=
'
REMOVE_PENDING_TAB
'
;
export
const
REMOVE_PENDING_TAB
=
'
REMOVE_PENDING_TAB
'
;
export
const
UPDATE_TEMP_FLAG
=
'
UPDATE_TEMP_FLAG
'
;
app/assets/javascripts/ide/stores/mutations.js
View file @
be45d454
...
@@ -4,6 +4,7 @@ import mergeRequestMutation from './mutations/merge_request';
...
@@ -4,6 +4,7 @@ import mergeRequestMutation from './mutations/merge_request';
import
fileMutations
from
'
./mutations/file
'
;
import
fileMutations
from
'
./mutations/file
'
;
import
treeMutations
from
'
./mutations/tree
'
;
import
treeMutations
from
'
./mutations/tree
'
;
import
branchMutations
from
'
./mutations/branch
'
;
import
branchMutations
from
'
./mutations/branch
'
;
import
{
sortTree
}
from
'
./utils
'
;
export
default
{
export
default
{
[
types
.
SET_INITIAL_DATA
](
state
,
data
)
{
[
types
.
SET_INITIAL_DATA
](
state
,
data
)
{
...
@@ -68,7 +69,7 @@ export default {
...
@@ -68,7 +69,7 @@ export default {
f
=>
foundEntry
.
tree
.
find
(
e
=>
e
.
path
===
f
.
path
)
===
undefined
,
f
=>
foundEntry
.
tree
.
find
(
e
=>
e
.
path
===
f
.
path
)
===
undefined
,
);
);
Object
.
assign
(
foundEntry
,
{
Object
.
assign
(
foundEntry
,
{
tree
:
foundEntry
.
tree
.
concat
(
tree
),
tree
:
sortTree
(
foundEntry
.
tree
.
concat
(
tree
)
),
});
});
}
}
...
@@ -81,10 +82,16 @@ export default {
...
@@ -81,10 +82,16 @@ export default {
if
(
!
foundEntry
)
{
if
(
!
foundEntry
)
{
Object
.
assign
(
state
.
trees
[
`
${
projectId
}
/
${
branchId
}
`
],
{
Object
.
assign
(
state
.
trees
[
`
${
projectId
}
/
${
branchId
}
`
],
{
tree
:
s
tate
.
trees
[
`
${
projectId
}
/
${
branchId
}
`
].
tree
.
concat
(
data
.
treeList
),
tree
:
s
ortTree
(
state
.
trees
[
`
${
projectId
}
/
${
branchId
}
`
].
tree
.
concat
(
data
.
treeList
)
),
});
});
}
}
},
},
[
types
.
UPDATE_TEMP_FLAG
](
state
,
{
path
,
tempFile
})
{
Object
.
assign
(
state
.
entries
[
path
],
{
tempFile
,
changed
:
tempFile
,
});
},
[
types
.
UPDATE_VIEWER
](
state
,
viewer
)
{
[
types
.
UPDATE_VIEWER
](
state
,
viewer
)
{
Object
.
assign
(
state
,
{
Object
.
assign
(
state
,
{
viewer
,
viewer
,
...
...
app/assets/javascripts/ide/stores/utils.js
View file @
be45d454
...
@@ -32,6 +32,7 @@ export const dataStructure = () => ({
...
@@ -32,6 +32,7 @@ export const dataStructure = () => ({
raw
:
''
,
raw
:
''
,
content
:
''
,
content
:
''
,
parentTreeUrl
:
''
,
parentTreeUrl
:
''
,
parentPath
:
''
,
renderError
:
false
,
renderError
:
false
,
base64
:
false
,
base64
:
false
,
editorRow
:
1
,
editorRow
:
1
,
...
@@ -63,6 +64,7 @@ export const decorateData = entity => {
...
@@ -63,6 +64,7 @@ export const decorateData = entity => {
previewMode
,
previewMode
,
file_lock
,
file_lock
,
html
,
html
,
parentPath
=
''
,
}
=
entity
;
}
=
entity
;
return
{
return
{
...
@@ -79,6 +81,7 @@ export const decorateData = entity => {
...
@@ -79,6 +81,7 @@ export const decorateData = entity => {
opened
,
opened
,
active
,
active
,
parentTreeUrl
,
parentTreeUrl
,
parentPath
,
changed
,
changed
,
renderError
,
renderError
,
content
,
content
,
...
@@ -119,8 +122,8 @@ const sortTreesByTypeAndName = (a, b) => {
...
@@ -119,8 +122,8 @@ const sortTreesByTypeAndName = (a, b) => {
}
else
if
(
a
.
type
===
'
blob
'
&&
b
.
type
===
'
tree
'
)
{
}
else
if
(
a
.
type
===
'
blob
'
&&
b
.
type
===
'
tree
'
)
{
return
1
;
return
1
;
}
}
if
(
a
.
name
.
toLowerCase
()
<
b
.
name
.
toLowerCase
()
)
return
-
1
;
if
(
a
.
name
<
b
.
name
)
return
-
1
;
if
(
a
.
name
.
toLowerCase
()
>
b
.
name
.
toLowerCase
()
)
return
1
;
if
(
a
.
name
>
b
.
name
)
return
1
;
return
0
;
return
0
;
};
};
...
...
app/assets/javascripts/ide/stores/workers/files_decorator_worker.js
View file @
be45d454
...
@@ -29,6 +29,7 @@ self.addEventListener('message', e => {
...
@@ -29,6 +29,7 @@ self.addEventListener('message', e => {
tempFile
,
tempFile
,
changed
:
tempFile
,
changed
:
tempFile
,
opened
:
tempFile
,
opened
:
tempFile
,
parentPath
:
parentFolder
?
parentFolder
.
path
:
null
,
});
});
Object
.
assign
(
acc
,
{
Object
.
assign
(
acc
,
{
...
@@ -66,6 +67,7 @@ self.addEventListener('message', e => {
...
@@ -66,6 +67,7 @@ self.addEventListener('message', e => {
content
,
content
,
base64
,
base64
,
previewMode
:
viewerInformationForPath
(
blobName
),
previewMode
:
viewerInformationForPath
(
blobName
),
parentPath
:
fileFolder
?
fileFolder
.
path
:
null
,
});
});
Object
.
assign
(
acc
,
{
Object
.
assign
(
acc
,
{
...
...
app/assets/javascripts/vue_shared/components/file_icon.vue
View file @
be45d454
<
script
>
<
script
>
import
getIconForFile
from
'
./file_icon/file_icon_map
'
;
import
getIconForFile
from
'
./file_icon/file_icon_map
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
icon
from
'
../../vue_shared/components/icon.vue
'
;
import
icon
from
'
../../vue_shared/components/icon.vue
'
;
/* This is a re-usable vue component for rendering a svg sprite
/* This is a re-usable vue component for rendering a svg sprite
icon
icon
Sample configuration:
Sample configuration:
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
/>
/>
*/
*/
export
default
{
export
default
{
components
:
{
components
:
{
loadingIcon
,
loadingIcon
,
icon
,
icon
,
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
return
this
.
size
?
`s
${
this
.
size
}
`
:
''
;
return
this
.
size
?
`s
${
this
.
size
}
`
:
''
;
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<span>
<span>
...
@@ -82,6 +82,7 @@
...
@@ -82,6 +82,7 @@
v-if=
"!loading && folder"
v-if=
"!loading && folder"
:name=
"folderIconName"
:name=
"folderIconName"
:size=
"size"
:size=
"size"
css-classes=
"folder-icon"
/>
/>
<loading-icon
<loading-icon
v-if=
"loading"
v-if=
"loading"
...
...
app/assets/stylesheets/pages/repo.scss
View file @
be45d454
...
@@ -85,12 +85,10 @@
...
@@ -85,12 +85,10 @@
}
}
}
}
&
.folder
{
.folder-icon
{
svg
{
fill
:
$gl-text-color-secondary
;
fill
:
$gl-text-color-secondary
;
}
}
}
}
}
a
{
a
{
color
:
$gl-text-color
;
color
:
$gl-text-color
;
...
@@ -429,7 +427,7 @@
...
@@ -429,7 +427,7 @@
.projects-sidebar
{
.projects-sidebar
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
height
:
100%
;
flex
:
1
;
.context-header
{
.context-header
{
width
:
auto
;
width
:
auto
;
...
...
spec/javascripts/ide/stores/actions_spec.js
View file @
be45d454
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
actions
from
'
~/ide/stores/actions
'
;
import
store
from
'
~/ide/stores
'
;
import
store
from
'
~/ide/stores
'
;
import
router
from
'
~/ide/ide_router
'
;
import
router
from
'
~/ide/ide_router
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
testAction
from
'
../../helpers/vuex_action_helper
'
;
describe
(
'
Multi-file store actions
'
,
()
=>
{
describe
(
'
Multi-file store actions
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -191,9 +193,7 @@ describe('Multi-file store actions', () => {
...
@@ -191,9 +193,7 @@ describe('Multi-file store actions', () => {
})
})
.
then
(
f
=>
{
.
then
(
f
=>
{
expect
(
f
.
tempFile
).
toBeTruthy
();
expect
(
f
.
tempFile
).
toBeTruthy
();
expect
(
store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
.
length
).
toBe
(
expect
(
store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
.
length
).
toBe
(
1
);
1
,
);
done
();
done
();
})
})
...
@@ -303,4 +303,47 @@ describe('Multi-file store actions', () => {
...
@@ -303,4 +303,47 @@ describe('Multi-file store actions', () => {
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
});
});
describe
(
'
updateTempFlagForEntry
'
,
()
=>
{
it
(
'
commits UPDATE_TEMP_FLAG
'
,
done
=>
{
const
f
=
{
...
file
(),
path
:
'
test
'
,
tempFile
:
true
,
};
store
.
state
.
entries
[
f
.
path
]
=
f
;
testAction
(
actions
.
updateTempFlagForEntry
,
{
entry
:
f
,
tempFile
:
false
},
store
.
state
,
[{
type
:
'
UPDATE_TEMP_FLAG
'
,
payload
:
{
path
:
f
.
path
,
tempFile
:
false
}
}],
[],
done
,
);
});
it
(
'
commits UPDATE_TEMP_FLAG and dispatches for parent
'
,
done
=>
{
const
parent
=
{
...
file
(),
path
:
'
testing
'
,
};
const
f
=
{
...
file
(),
path
:
'
test
'
,
parentPath
:
'
testing
'
,
};
store
.
state
.
entries
[
parent
.
path
]
=
parent
;
store
.
state
.
entries
[
f
.
path
]
=
f
;
testAction
(
actions
.
updateTempFlagForEntry
,
{
entry
:
f
,
tempFile
:
false
},
store
.
state
,
[{
type
:
'
UPDATE_TEMP_FLAG
'
,
payload
:
{
path
:
f
.
path
,
tempFile
:
false
}
}],
[{
type
:
'
updateTempFlagForEntry
'
,
payload
:
{
entry
:
parent
,
tempFile
:
false
}
}],
done
,
);
});
});
});
});
spec/javascripts/ide/stores/mutations_spec.js
View file @
be45d454
...
@@ -76,4 +76,26 @@ describe('Multi-file store mutations', () => {
...
@@ -76,4 +76,26 @@ describe('Multi-file store mutations', () => {
expect
(
localState
.
viewer
).
toBe
(
'
diff
'
);
expect
(
localState
.
viewer
).
toBe
(
'
diff
'
);
});
});
});
});
describe
(
'
UPDATE_TEMP_FLAG
'
,
()
=>
{
beforeEach
(()
=>
{
localState
.
entries
.
test
=
{
...
file
(),
tempFile
:
true
,
changed
:
true
,
};
});
it
(
'
updates tempFile flag
'
,
()
=>
{
mutations
.
UPDATE_TEMP_FLAG
(
localState
,
{
path
:
'
test
'
,
tempFile
:
false
});
expect
(
localState
.
entries
.
test
.
tempFile
).
toBe
(
false
);
});
it
(
'
updates changed flag
'
,
()
=>
{
mutations
.
UPDATE_TEMP_FLAG
(
localState
,
{
path
:
'
test
'
,
tempFile
:
false
});
expect
(
localState
.
entries
.
test
.
changed
).
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