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 {
return
__
(
'
Create file
'
);
},
formLabelName
()
{
if
(
this
.
type
===
'
tree
'
)
{
return
__
(
'
Directory name
'
);
}
return
__
(
'
File name
'
);
},
},
mounted
()
{
this
.
$refs
.
fieldName
.
focus
();
...
...
@@ -83,7 +76,7 @@ export default {
>
<fieldset
class=
"form-group append-bottom-0"
>
<label
class=
"label-light col-sm-3"
>
{{
formLabelName
}}
{{
__
(
'
Name
'
)
}}
</label>
<div
class=
"col-sm-9"
>
<input
...
...
app/assets/javascripts/ide/stores/actions.js
View file @
be45d454
...
...
@@ -112,6 +112,14 @@ export const updateDelayViewerUpdated = ({ commit }, 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/file
'
;
export
*
from
'
./actions/project
'
;
...
...
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
be45d454
...
...
@@ -127,6 +127,8 @@ export const updateFilesAfterCommit = (
},
{
root
:
true
},
);
dispatch
(
'
updateTempFlagForEntry
'
,
{
entry
,
tempFile
:
false
},
{
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';
export
const
ADD_PENDING_TAB
=
'
ADD_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';
import
fileMutations
from
'
./mutations/file
'
;
import
treeMutations
from
'
./mutations/tree
'
;
import
branchMutations
from
'
./mutations/branch
'
;
import
{
sortTree
}
from
'
./utils
'
;
export
default
{
[
types
.
SET_INITIAL_DATA
](
state
,
data
)
{
...
...
@@ -68,7 +69,7 @@ export default {
f
=>
foundEntry
.
tree
.
find
(
e
=>
e
.
path
===
f
.
path
)
===
undefined
,
);
Object
.
assign
(
foundEntry
,
{
tree
:
foundEntry
.
tree
.
concat
(
tree
),
tree
:
sortTree
(
foundEntry
.
tree
.
concat
(
tree
)
),
});
}
...
...
@@ -81,10 +82,16 @@ export default {
if
(
!
foundEntry
)
{
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
)
{
Object
.
assign
(
state
,
{
viewer
,
...
...
app/assets/javascripts/ide/stores/utils.js
View file @
be45d454
...
...
@@ -32,6 +32,7 @@ export const dataStructure = () => ({
raw
:
''
,
content
:
''
,
parentTreeUrl
:
''
,
parentPath
:
''
,
renderError
:
false
,
base64
:
false
,
editorRow
:
1
,
...
...
@@ -63,6 +64,7 @@ export const decorateData = entity => {
previewMode
,
file_lock
,
html
,
parentPath
=
''
,
}
=
entity
;
return
{
...
...
@@ -79,6 +81,7 @@ export const decorateData = entity => {
opened
,
active
,
parentTreeUrl
,
parentPath
,
changed
,
renderError
,
content
,
...
...
@@ -119,8 +122,8 @@ const sortTreesByTypeAndName = (a, b) => {
}
else
if
(
a
.
type
===
'
blob
'
&&
b
.
type
===
'
tree
'
)
{
return
1
;
}
if
(
a
.
name
.
toLowerCase
()
<
b
.
name
.
toLowerCase
()
)
return
-
1
;
if
(
a
.
name
.
toLowerCase
()
>
b
.
name
.
toLowerCase
()
)
return
1
;
if
(
a
.
name
<
b
.
name
)
return
-
1
;
if
(
a
.
name
>
b
.
name
)
return
1
;
return
0
;
};
...
...
app/assets/javascripts/ide/stores/workers/files_decorator_worker.js
View file @
be45d454
...
...
@@ -29,6 +29,7 @@ self.addEventListener('message', e => {
tempFile
,
changed
:
tempFile
,
opened
:
tempFile
,
parentPath
:
parentFolder
?
parentFolder
.
path
:
null
,
});
Object
.
assign
(
acc
,
{
...
...
@@ -66,6 +67,7 @@ self.addEventListener('message', e => {
content
,
base64
,
previewMode
:
viewerInformationForPath
(
blobName
),
parentPath
:
fileFolder
?
fileFolder
.
path
:
null
,
});
Object
.
assign
(
acc
,
{
...
...
app/assets/javascripts/vue_shared/components/file_icon.vue
View file @
be45d454
<
script
>
import
getIconForFile
from
'
./file_icon/file_icon_map
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
icon
from
'
../../vue_shared/components/icon.vue
'
;
import
getIconForFile
from
'
./file_icon/file_icon_map
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_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
Sample configuration:
...
...
@@ -15,7 +15,7 @@
/>
*/
export
default
{
export
default
{
components
:
{
loadingIcon
,
icon
,
...
...
@@ -68,7 +68,7 @@
return
this
.
size
?
`s
${
this
.
size
}
`
:
''
;
},
},
};
};
</
script
>
<
template
>
<span>
...
...
@@ -82,6 +82,7 @@
v-if=
"!loading && folder"
:name=
"folderIconName"
:size=
"size"
css-classes=
"folder-icon"
/>
<loading-icon
v-if=
"loading"
...
...
app/assets/stylesheets/pages/repo.scss
View file @
be45d454
...
...
@@ -85,12 +85,10 @@
}
}
&
.folder
{
svg
{
.folder-icon
{
fill
:
$gl-text-color-secondary
;
}
}
}
a
{
color
:
$gl-text-color
;
...
...
@@ -429,7 +427,7 @@
.projects-sidebar
{
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
flex
:
1
;
.context-header
{
width
:
auto
;
...
...
spec/javascripts/ide/stores/actions_spec.js
View file @
be45d454
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
actions
from
'
~/ide/stores/actions
'
;
import
store
from
'
~/ide/stores
'
;
import
router
from
'
~/ide/ide_router
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
import
testAction
from
'
../../helpers/vuex_action_helper
'
;
describe
(
'
Multi-file store actions
'
,
()
=>
{
beforeEach
(()
=>
{
...
...
@@ -191,9 +193,7 @@ describe('Multi-file store actions', () => {
})
.
then
(
f
=>
{
expect
(
f
.
tempFile
).
toBeTruthy
();
expect
(
store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
.
length
).
toBe
(
1
,
);
expect
(
store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
.
length
).
toBe
(
1
);
done
();
})
...
...
@@ -303,4 +303,47 @@ describe('Multi-file store actions', () => {
.
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', () => {
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