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
00827a74
Commit
00827a74
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 33 files - 15 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
333bad89
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
123 additions
and
123 deletions
+123
-123
app/assets/javascripts/ide/components/commit_sidebar/list_item.vue
...s/javascripts/ide/components/commit_sidebar/list_item.vue
+1
-1
app/assets/javascripts/ide/components/file_templates/bar.vue
app/assets/javascripts/ide/components/file_templates/bar.vue
+1
-1
app/assets/javascripts/ide/components/file_templates/dropdown.vue
...ts/javascripts/ide/components/file_templates/dropdown.vue
+1
-1
app/assets/javascripts/ide/components/ide.vue
app/assets/javascripts/ide/components/ide.vue
+1
-1
app/assets/javascripts/ide/components/ide_sidebar_nav.vue
app/assets/javascripts/ide/components/ide_sidebar_nav.vue
+1
-1
app/assets/javascripts/ide/components/new_dropdown/upload.vue
...assets/javascripts/ide/components/new_dropdown/upload.vue
+4
-4
app/assets/javascripts/ide/components/panes/collapsible_sidebar.vue
.../javascripts/ide/components/panes/collapsible_sidebar.vue
+3
-3
app/assets/javascripts/ide/components/preview/clientside.vue
app/assets/javascripts/ide/components/preview/clientside.vue
+3
-3
app/assets/javascripts/ide/components/preview/navigator.vue
app/assets/javascripts/ide/components/preview/navigator.vue
+1
-1
app/assets/javascripts/ide/components/repo_commit_section.vue
...assets/javascripts/ide/components/repo_commit_section.vue
+2
-2
app/assets/javascripts/ide/components/repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+5
-5
app/assets/javascripts/ide/ide_router.js
app/assets/javascripts/ide/ide_router.js
+5
-5
app/assets/javascripts/ide/lib/common/disposable.js
app/assets/javascripts/ide/lib/common/disposable.js
+2
-2
app/assets/javascripts/ide/lib/common/model.js
app/assets/javascripts/ide/lib/common/model.js
+2
-2
app/assets/javascripts/ide/lib/create_file_diff.js
app/assets/javascripts/ide/lib/create_file_diff.js
+5
-5
app/assets/javascripts/ide/lib/decorations/controller.js
app/assets/javascripts/ide/lib/decorations/controller.js
+1
-1
app/assets/javascripts/ide/lib/diff/controller.js
app/assets/javascripts/ide/lib/diff/controller.js
+3
-3
app/assets/javascripts/ide/lib/diff/diff.js
app/assets/javascripts/ide/lib/diff/diff.js
+1
-1
app/assets/javascripts/ide/lib/diff/diff_worker.js
app/assets/javascripts/ide/lib/diff/diff_worker.js
+1
-1
app/assets/javascripts/ide/lib/editor.js
app/assets/javascripts/ide/lib/editor.js
+6
-6
app/assets/javascripts/ide/lib/editor_options.js
app/assets/javascripts/ide/lib/editor_options.js
+2
-2
app/assets/javascripts/ide/lib/editorconfig/parser.js
app/assets/javascripts/ide/lib/editorconfig/parser.js
+5
-5
app/assets/javascripts/ide/lib/editorconfig/rules_mapper.js
app/assets/javascripts/ide/lib/editorconfig/rules_mapper.js
+6
-6
app/assets/javascripts/ide/lib/errors.js
app/assets/javascripts/ide/lib/errors.js
+7
-7
app/assets/javascripts/ide/lib/files.js
app/assets/javascripts/ide/lib/files.js
+3
-3
app/assets/javascripts/ide/lib/mirror.js
app/assets/javascripts/ide/lib/mirror.js
+13
-13
app/assets/javascripts/ide/services/index.js
app/assets/javascripts/ide/services/index.js
+4
-4
app/assets/javascripts/ide/services/terminals.js
app/assets/javascripts/ide/services/terminals.js
+1
-1
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+6
-6
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+10
-10
app/assets/javascripts/ide/stores/actions/merge_request.js
app/assets/javascripts/ide/stores/actions/merge_request.js
+9
-9
app/assets/javascripts/ide/stores/actions/project.js
app/assets/javascripts/ide/stores/actions/project.js
+6
-6
app/assets/javascripts/ide/stores/actions/tree.js
app/assets/javascripts/ide/stores/actions/tree.js
+2
-2
No files found.
app/assets/javascripts/ide/components/commit_sidebar/list_item.vue
View file @
00827a74
...
...
@@ -63,7 +63,7 @@ export default {
return
this
.
openPendingTab
({
file
:
this
.
file
,
keyPrefix
:
this
.
keyPrefix
,
}).
then
(
changeViewer
=>
{
}).
then
(
(
changeViewer
)
=>
{
if
(
changeViewer
)
{
this
.
updateViewer
(
viewerTypes
.
diff
);
}
...
...
app/assets/javascripts/ide/components/file_templates/bar.vue
View file @
00827a74
...
...
@@ -29,7 +29,7 @@ export default {
'
undoFileTemplate
'
,
]),
setInitialType
()
{
const
initialTemplateType
=
this
.
templateTypes
.
find
(
t
=>
t
.
name
===
this
.
activeFile
.
name
);
const
initialTemplateType
=
this
.
templateTypes
.
find
(
(
t
)
=>
t
.
name
===
this
.
activeFile
.
name
);
if
(
initialTemplateType
)
{
this
.
setSelectedTemplateType
(
initialTemplateType
);
...
...
app/assets/javascripts/ide/components/file_templates/dropdown.vue
View file @
00827a74
...
...
@@ -44,7 +44,7 @@ export default {
computed
:
{
...
mapState
(
'
fileTemplates
'
,
[
'
templates
'
,
'
isLoading
'
]),
outputData
()
{
return
(
this
.
isAsyncData
?
this
.
templates
:
this
.
data
).
filter
(
t
=>
{
return
(
this
.
isAsyncData
?
this
.
templates
:
this
.
data
).
filter
(
(
t
)
=>
{
if
(
!
this
.
searchable
)
return
true
;
return
t
.
name
.
toLowerCase
().
indexOf
(
this
.
search
.
toLowerCase
())
>=
0
;
...
...
app/assets/javascripts/ide/components/ide.vue
View file @
00827a74
...
...
@@ -73,7 +73,7 @@ export default {
},
},
mounted
()
{
window
.
onbeforeunload
=
e
=>
this
.
onBeforeUnload
(
e
);
window
.
onbeforeunload
=
(
e
)
=>
this
.
onBeforeUnload
(
e
);
if
(
this
.
themeName
)
document
.
querySelector
(
'
.navbar-gitlab
'
).
classList
.
add
(
`theme-
${
this
.
themeName
}
`
);
...
...
app/assets/javascripts/ide/components/ide_sidebar_nav.vue
View file @
00827a74
...
...
@@ -37,7 +37,7 @@ export default {
},
methods
:
{
isActiveTab
(
tab
)
{
return
this
.
isOpen
&&
tab
.
views
.
some
(
view
=>
view
.
name
===
this
.
currentView
);
return
this
.
isOpen
&&
tab
.
views
.
some
(
(
view
)
=>
view
.
name
===
this
.
currentView
);
},
buttonClasses
(
tab
)
{
return
[
...
...
app/assets/javascripts/ide/components/new_dropdown/upload.vue
View file @
00827a74
...
...
@@ -30,7 +30,7 @@ export default {
const
rawContent
=
encodedContent
?
atob
(
encodedContent
)
:
''
;
const
isText
=
isTextFile
({
content
:
rawContent
,
mimeType
,
name
});
const
emitCreateEvent
=
content
=>
const
emitCreateEvent
=
(
content
)
=>
this
.
$emit
(
'
create
'
,
{
name
:
`
${
this
.
path
?
`
${
this
.
path
}
/`
:
''
}${
name
}
`
,
type
:
'
blob
'
,
...
...
@@ -42,7 +42,7 @@ export default {
if
(
isText
)
{
const
reader
=
new
FileReader
();
reader
.
addEventListener
(
'
load
'
,
e
=>
emitCreateEvent
(
e
.
target
.
result
),
{
once
:
true
});
reader
.
addEventListener
(
'
load
'
,
(
e
)
=>
emitCreateEvent
(
e
.
target
.
result
),
{
once
:
true
});
reader
.
readAsText
(
file
);
}
else
{
emitCreateEvent
(
rawContent
);
...
...
@@ -51,11 +51,11 @@ export default {
readFile
(
file
)
{
const
reader
=
new
FileReader
();
reader
.
addEventListener
(
'
load
'
,
e
=>
this
.
createFile
(
e
.
target
,
file
),
{
once
:
true
});
reader
.
addEventListener
(
'
load
'
,
(
e
)
=>
this
.
createFile
(
e
.
target
,
file
),
{
once
:
true
});
reader
.
readAsDataURL
(
file
);
},
openFile
()
{
Array
.
from
(
this
.
$refs
.
fileUpload
.
files
).
forEach
(
file
=>
this
.
readFile
(
file
));
Array
.
from
(
this
.
$refs
.
fileUpload
.
files
).
forEach
(
(
file
)
=>
this
.
readFile
(
file
));
},
startFileUpload
()
{
this
.
$refs
.
fileUpload
.
click
();
...
...
app/assets/javascripts/ide/components/panes/collapsible_sidebar.vue
View file @
00827a74
...
...
@@ -35,13 +35,13 @@ export default {
return
`
${
this
.
side
}
Pane`
;
},
tabs
()
{
return
this
.
extensionTabs
.
filter
(
tab
=>
tab
.
show
);
return
this
.
extensionTabs
.
filter
(
(
tab
)
=>
tab
.
show
);
},
tabViews
()
{
return
this
.
tabs
.
map
(
tab
=>
tab
.
views
).
flat
();
return
this
.
tabs
.
map
(
(
tab
)
=>
tab
.
views
).
flat
();
},
aliveTabViews
()
{
return
this
.
tabViews
.
filter
(
view
=>
this
.
isAliveView
(
view
.
name
));
return
this
.
tabViews
.
filter
(
(
view
)
=>
this
.
isAliveView
(
view
.
name
));
},
},
methods
:
{
...
...
app/assets/javascripts/ide/components/preview/clientside.vue
View file @
00827a74
...
...
@@ -108,7 +108,7 @@ export default {
.
then
(()
=>
{
this
.
initManager
();
this
.
listener
=
listen
(
e
=>
{
this
.
listener
=
listen
(
(
e
)
=>
{
switch
(
e
.
type
)
{
case
'
done
'
:
this
.
sandpackReady
=
true
;
...
...
@@ -139,8 +139,8 @@ export default {
const
settings
=
{
fileResolver
:
{
isFile
:
p
=>
Promise
.
resolve
(
Boolean
(
this
.
entries
[
createPathWithExt
(
p
)])),
readFile
:
p
=>
this
.
loadFileContent
(
createPathWithExt
(
p
)).
then
(
content
=>
content
),
isFile
:
(
p
)
=>
Promise
.
resolve
(
Boolean
(
this
.
entries
[
createPathWithExt
(
p
)])),
readFile
:
(
p
)
=>
this
.
loadFileContent
(
createPathWithExt
(
p
)).
then
((
content
)
=>
content
),
},
...(
bundlerURL
?
{
bundlerURL
}
:
{}),
};
...
...
app/assets/javascripts/ide/components/preview/navigator.vue
View file @
00827a74
...
...
@@ -31,7 +31,7 @@ export default {
},
},
mounted
()
{
this
.
listener
=
listen
(
e
=>
{
this
.
listener
=
listen
(
(
e
)
=>
{
switch
(
e
.
type
)
{
case
'
urlchange
'
:
this
.
onUrlChange
(
e
);
...
...
app/assets/javascripts/ide/components/repo_commit_section.vue
View file @
00827a74
...
...
@@ -41,12 +41,12 @@ export default {
file
,
keyPrefix
:
file
.
staged
?
stageKeys
.
staged
:
stageKeys
.
unstaged
,
})
.
then
(
changeViewer
=>
{
.
then
(
(
changeViewer
)
=>
{
if
(
changeViewer
)
{
this
.
updateViewer
(
'
diff
'
);
}
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
throw
e
;
});
},
...
...
app/assets/javascripts/ide/components/repo_editor.vue
View file @
00827a74
...
...
@@ -219,7 +219,7 @@ export default {
.
then
(()
=>
{
this
.
createEditorInstance
();
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
flash
(
__
(
'
Error setting up editor. Please try again.
'
),
'
alert
'
,
...
...
@@ -281,7 +281,7 @@ export default {
this
.
model
.
updateOptions
(
this
.
rules
);
this
.
model
.
onChange
(
model
=>
{
this
.
model
.
onChange
(
(
model
)
=>
{
const
{
file
}
=
model
;
if
(
!
file
.
active
)
return
;
...
...
@@ -329,7 +329,7 @@ export default {
}
},
fetchEditorconfigRules
()
{
return
getRulesWithTraversal
(
this
.
file
.
path
,
path
=>
{
return
getRulesWithTraversal
(
this
.
file
.
path
,
(
path
)
=>
{
const
entry
=
this
.
entries
[
path
];
if
(
!
entry
)
return
Promise
.
resolve
(
null
);
...
...
@@ -339,7 +339,7 @@ export default {
return
this
.
getFileData
({
path
:
entry
.
path
,
makeFileActive
:
false
}).
then
(()
=>
this
.
getRawFileData
({
path
:
entry
.
path
}),
);
}).
then
(
rules
=>
{
}).
then
(
(
rules
)
=>
{
this
.
rules
=
mapRulesToMonaco
(
rules
);
});
},
...
...
@@ -353,7 +353,7 @@ export default {
event
.
preventDefault
();
event
.
stopImmediatePropagation
();
return
readFileAsDataURL
(
file
).
then
(
content
=>
{
return
readFileAsDataURL
(
file
).
then
(
(
content
)
=>
{
const
parentPath
=
getPathParent
(
this
.
file
.
path
);
const
path
=
`
${
parentPath
?
`
${
parentPath
}
/`
:
''
}${
file
.
name
}
`
;
...
...
app/assets/javascripts/ide/ide_router.js
View file @
00827a74
...
...
@@ -39,7 +39,7 @@ const EmptyRouterComponent = {
},
};
export
const
createRouter
=
store
=>
{
export
const
createRouter
=
(
store
)
=>
{
const
router
=
new
IdeRouter
({
mode
:
'
history
'
,
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
'
/-/ide/
'
),
...
...
@@ -54,11 +54,11 @@ export const createRouter = store => {
},
{
path
:
'
:targetmode(edit|tree|blob)/:branchid+/
'
,
redirect
:
to
=>
joinPaths
(
to
.
path
,
'
/-/
'
),
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
'
/-/
'
),
},
{
path
:
'
:targetmode(edit|tree|blob)
'
,
redirect
:
to
=>
joinPaths
(
to
.
path
,
'
/master/-/
'
),
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
'
/master/-/
'
),
},
{
path
:
'
merge_requests/:mrid
'
,
...
...
@@ -66,7 +66,7 @@ export const createRouter = store => {
},
{
path
:
''
,
redirect
:
to
=>
joinPaths
(
to
.
path
,
'
/edit/master/-/
'
),
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
'
/edit/master/-/
'
),
},
],
},
...
...
@@ -110,7 +110,7 @@ export const createRouter = store => {
});
}
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
flash
(
__
(
'
Error while loading the project data. Please try again.
'
),
'
alert
'
,
...
...
app/assets/javascripts/ide/lib/common/disposable.js
View file @
00827a74
...
...
@@ -4,11 +4,11 @@ export default class Disposable {
}
add
(...
disposers
)
{
disposers
.
forEach
(
disposer
=>
this
.
disposers
.
add
(
disposer
));
disposers
.
forEach
(
(
disposer
)
=>
this
.
disposers
.
add
(
disposer
));
}
dispose
()
{
this
.
disposers
.
forEach
(
disposer
=>
disposer
.
dispose
());
this
.
disposers
.
forEach
(
(
disposer
)
=>
disposer
.
dispose
());
this
.
disposers
.
clear
();
}
}
app/assets/javascripts/ide/lib/common/model.js
View file @
00827a74
...
...
@@ -75,7 +75,7 @@ export default class Model {
}
onChange
(
cb
)
{
this
.
events
.
add
(
this
.
disposable
.
add
(
this
.
model
.
onDidChangeContent
(
e
=>
cb
(
this
,
e
))));
this
.
events
.
add
(
this
.
disposable
.
add
(
this
.
model
.
onDidChangeContent
(
(
e
)
=>
cb
(
this
,
e
))));
}
onDispose
(
cb
)
{
...
...
@@ -121,7 +121,7 @@ export default class Model {
dispose
()
{
if
(
!
this
.
model
.
isDisposed
())
this
.
applyCustomOptions
();
this
.
events
.
forEach
(
cb
=>
{
this
.
events
.
forEach
(
(
cb
)
=>
{
if
(
typeof
cb
===
'
function
'
)
cb
();
});
...
...
app/assets/javascripts/ide/lib/create_file_diff.js
View file @
00827a74
...
...
@@ -12,13 +12,13 @@ const NEW_LINE = '\n';
*
* - Removes "=======" separator added at the beginning
*/
const
cleanTwoFilesPatch
=
text
=>
text
.
replace
(
/^
(
=+
\s
*
)
/
,
''
);
const
cleanTwoFilesPatch
=
(
text
)
=>
text
.
replace
(
/^
(
=+
\s
*
)
/
,
''
);
const
endsWithNewLine
=
val
=>
!
val
||
val
[
val
.
length
-
1
]
===
NEW_LINE
;
const
endsWithNewLine
=
(
val
)
=>
!
val
||
val
[
val
.
length
-
1
]
===
NEW_LINE
;
const
addEndingNewLine
=
val
=>
(
endsWithNewLine
(
val
)
?
val
:
val
+
NEW_LINE
);
const
addEndingNewLine
=
(
val
)
=>
(
endsWithNewLine
(
val
)
?
val
:
val
+
NEW_LINE
);
const
removeEndingNewLine
=
val
=>
(
endsWithNewLine
(
val
)
?
val
.
substr
(
0
,
val
.
length
-
1
)
:
val
);
const
removeEndingNewLine
=
(
val
)
=>
(
endsWithNewLine
(
val
)
?
val
.
substr
(
0
,
val
.
length
-
1
)
:
val
);
const
diffHead
=
(
prevPath
,
newPath
=
''
)
=>
`diff --git "a/
${
prevPath
}
" "b/
${
newPath
||
prevPath
}
"`
;
...
...
@@ -37,7 +37,7 @@ const createDiffBody = (path, content, isCreate) => {
const
chunkHead
=
isCreate
?
`@@ -0,0 +1,
${
lines
.
length
}
@@`
:
`@@ -1,
${
lines
.
length
}
+0,0 @@`
;
const
chunk
=
lines
.
map
(
line
=>
`
${
prefix
}${
line
}
`
)
.
map
(
(
line
)
=>
`
${
prefix
}${
line
}
`
)
.
concat
(
!
hasNewLine
?
[
NO_NEW_LINE
]
:
[])
.
join
(
NEW_LINE
);
...
...
app/assets/javascripts/ide/lib/decorations/controller.js
View file @
00827a74
...
...
@@ -11,7 +11,7 @@ export default class DecorationsController {
const
modelDecorations
=
this
.
decorations
.
get
(
model
.
url
);
const
decorations
=
[];
modelDecorations
.
forEach
(
val
=>
decorations
.
push
(...
val
));
modelDecorations
.
forEach
(
(
val
)
=>
decorations
.
push
(...
val
));
return
decorations
;
}
...
...
app/assets/javascripts/ide/lib/diff/controller.js
View file @
00827a74
...
...
@@ -3,7 +3,7 @@ import { throttle } from 'lodash';
import
DirtyDiffWorker
from
'
./diff_worker
'
;
import
Disposable
from
'
../common/disposable
'
;
export
const
getDiffChangeType
=
change
=>
{
export
const
getDiffChangeType
=
(
change
)
=>
{
if
(
change
.
modified
)
{
return
'
modified
'
;
}
else
if
(
change
.
added
)
{
...
...
@@ -15,7 +15,7 @@ export const getDiffChangeType = change => {
return
''
;
};
export
const
getDecorator
=
change
=>
({
export
const
getDecorator
=
(
change
)
=>
({
range
:
new
Range
(
change
.
lineNumber
,
1
,
change
.
endLineNumber
,
1
),
options
:
{
isWholeLine
:
true
,
...
...
@@ -71,7 +71,7 @@ export default class DirtyDiffController {
}
decorate
({
data
})
{
const
decorations
=
data
.
changes
.
map
(
change
=>
getDecorator
(
change
));
const
decorations
=
data
.
changes
.
map
(
(
change
)
=>
getDecorator
(
change
));
const
model
=
this
.
modelManager
.
getModel
(
data
.
path
);
this
.
decorationsController
.
addDecorations
(
model
,
'
dirtyDiff
'
,
decorations
);
}
...
...
app/assets/javascripts/ide/lib/diff/diff.js
View file @
00827a74
...
...
@@ -11,7 +11,7 @@ export const computeDiff = (originalContent, newContent) => {
let
lineNumber
=
1
;
return
changes
.
reduce
((
acc
,
change
)
=>
{
const
findOnLine
=
acc
.
find
(
c
=>
c
.
lineNumber
===
lineNumber
);
const
findOnLine
=
acc
.
find
(
(
c
)
=>
c
.
lineNumber
===
lineNumber
);
if
(
findOnLine
)
{
Object
.
assign
(
findOnLine
,
change
,
{
...
...
app/assets/javascripts/ide/lib/diff/diff_worker.js
View file @
00827a74
import
{
computeDiff
}
from
'
./diff
'
;
// eslint-disable-next-line no-restricted-globals
self
.
addEventListener
(
'
message
'
,
e
=>
{
self
.
addEventListener
(
'
message
'
,
(
e
)
=>
{
const
{
data
}
=
e
;
// eslint-disable-next-line no-restricted-globals
...
...
app/assets/javascripts/ide/lib/editor.js
View file @
00827a74
...
...
@@ -12,7 +12,7 @@ import { clearDomElement } from '~/editor/utils';
import
{
registerLanguages
}
from
'
../utils
'
;
function
setupThemes
()
{
themes
.
forEach
(
theme
=>
{
themes
.
forEach
(
(
theme
)
=>
{
monacoEditor
.
defineTheme
(
theme
.
name
,
theme
.
data
);
});
}
...
...
@@ -108,7 +108,7 @@ export default class Editor {
this
.
instance
.
updateOptions
(
editorOptions
.
reduce
((
acc
,
obj
)
=>
{
Object
.
keys
(
obj
).
forEach
(
key
=>
{
Object
.
keys
(
obj
).
forEach
(
(
key
)
=>
{
Object
.
assign
(
acc
,
{
[
key
]:
obj
[
key
](
model
),
});
...
...
@@ -177,7 +177,7 @@ export default class Editor {
onPositionChange
(
cb
)
{
if
(
!
this
.
instance
.
onDidChangeCursorPosition
)
return
;
this
.
disposable
.
add
(
this
.
instance
.
onDidChangeCursorPosition
(
e
=>
cb
(
this
.
instance
,
e
)));
this
.
disposable
.
add
(
this
.
instance
.
onDidChangeCursorPosition
(
(
e
)
=>
cb
(
this
.
instance
,
e
)));
}
updateDiffView
()
{
...
...
@@ -213,14 +213,14 @@ export default class Editor {
addCommands
()
{
const
{
store
}
=
this
;
const
getKeyCode
=
key
=>
{
const
getKeyCode
=
(
key
)
=>
{
const
monacoKeyMod
=
key
.
indexOf
(
'
KEY_
'
)
===
0
;
return
monacoKeyMod
?
KeyCode
[
key
]
:
KeyMod
[
key
];
};
keymap
.
forEach
(
command
=>
{
const
keybindings
=
command
.
bindings
.
map
(
binding
=>
{
keymap
.
forEach
(
(
command
)
=>
{
const
keybindings
=
command
.
bindings
.
map
(
(
binding
)
=>
{
const
keys
=
binding
.
split
(
'
+
'
);
// eslint-disable-next-line no-bitwise
...
...
app/assets/javascripts/ide/lib/editor_options.js
View file @
00827a74
...
...
@@ -31,7 +31,7 @@ export const defaultModelOptions = {
export
const
editorOptions
=
[
{
readOnly
:
model
=>
Boolean
(
model
.
file
.
file_lock
),
quickSuggestions
:
model
=>
!
(
model
.
language
===
'
markdown
'
),
readOnly
:
(
model
)
=>
Boolean
(
model
.
file
.
file_lock
),
quickSuggestions
:
(
model
)
=>
!
(
model
.
language
===
'
markdown
'
),
},
];
app/assets/javascripts/ide/lib/editorconfig/parser.js
View file @
00827a74
...
...
@@ -2,7 +2,7 @@ import { parseString } from 'editorconfig/src/lib/ini';
import
minimatch
from
'
minimatch
'
;
import
{
getPathParents
}
from
'
../../utils
'
;
const
dirname
=
path
=>
path
.
replace
(
/
\.
editorconfig$/
,
''
);
const
dirname
=
(
path
)
=>
path
.
replace
(
/
\.
editorconfig$/
,
''
);
function
isRootConfig
(
config
)
{
return
config
.
some
(([
pattern
,
rules
])
=>
!
pattern
&&
rules
?.
root
===
'
true
'
);
...
...
@@ -44,16 +44,16 @@ function getRulesWithConfigs(filePath, configFiles = [], rules = {}) {
export
function
getRulesWithTraversal
(
filePath
,
getFileContent
)
{
const
editorconfigPaths
=
[
...
getPathParents
(
filePath
).
map
(
x
=>
`
${
x
}
/.editorconfig`
),
...
getPathParents
(
filePath
).
map
(
(
x
)
=>
`
${
x
}
/.editorconfig`
),
'
.editorconfig
'
,
];
return
Promise
.
all
(
editorconfigPaths
.
map
(
path
=>
getFileContent
(
path
).
then
(
content
=>
({
path
,
content
}))),
).
then
(
results
=>
editorconfigPaths
.
map
(
(
path
)
=>
getFileContent
(
path
).
then
((
content
)
=>
({
path
,
content
}))),
).
then
(
(
results
)
=>
getRulesWithConfigs
(
filePath
,
results
.
filter
(
x
=>
x
.
content
),
results
.
filter
(
(
x
)
=>
x
.
content
),
),
);
}
app/assets/javascripts/ide/lib/editorconfig/rules_mapper.js
View file @
00827a74
import
{
isBoolean
,
isNumber
}
from
'
lodash
'
;
const
map
=
(
key
,
validValues
)
=>
value
=>
const
map
=
(
key
,
validValues
)
=>
(
value
)
=>
value
in
validValues
?
{
[
key
]:
validValues
[
value
]
}
:
{};
const
bool
=
key
=>
value
=>
(
isBoolean
(
value
)
?
{
[
key
]:
value
}
:
{});
const
bool
=
(
key
)
=>
(
value
)
=>
(
isBoolean
(
value
)
?
{
[
key
]:
value
}
:
{});
const
int
=
(
key
,
isValid
)
=>
value
=>
const
int
=
(
key
,
isValid
)
=>
(
value
)
=>
isNumber
(
value
)
&&
isValid
(
value
)
?
{
[
key
]:
Math
.
trunc
(
value
)
}
:
{};
const
rulesMapper
=
{
indent_style
:
map
(
'
insertSpaces
'
,
{
tab
:
false
,
space
:
true
}),
indent_size
:
int
(
'
tabSize
'
,
n
=>
n
>
0
),
tab_width
:
int
(
'
tabSize
'
,
n
=>
n
>
0
),
indent_size
:
int
(
'
tabSize
'
,
(
n
)
=>
n
>
0
),
tab_width
:
int
(
'
tabSize
'
,
(
n
)
=>
n
>
0
),
trim_trailing_whitespace
:
bool
(
'
trimTrailingWhitespace
'
),
end_of_line
:
map
(
'
endOfLine
'
,
{
crlf
:
1
,
lf
:
0
}),
insert_final_newline
:
bool
(
'
insertFinalNewline
'
),
};
const
parseValue
=
x
=>
{
const
parseValue
=
(
x
)
=>
{
let
value
=
typeof
x
===
'
string
'
?
x
.
toLowerCase
()
:
x
;
if
(
/^
[
0-9.-
]
+$/
.
test
(
value
))
value
=
Number
(
value
);
if
(
value
===
'
true
'
)
value
=
true
;
...
...
app/assets/javascripts/ide/lib/errors.js
View file @
00827a74
...
...
@@ -6,17 +6,17 @@ const CODEOWNERS_REGEX = /Push.*protected branches.*CODEOWNERS/;
const
BRANCH_CHANGED_REGEX
=
/changed.*since.*start.*edit/
;
const
BRANCH_ALREADY_EXISTS
=
/branch.*already.*exists/
;
const
createNewBranchAndCommit
=
store
=>
const
createNewBranchAndCommit
=
(
store
)
=>
store
.
dispatch
(
'
commit/updateCommitAction
'
,
consts
.
COMMIT_TO_NEW_BRANCH
)
.
then
(()
=>
store
.
dispatch
(
'
commit/commitChanges
'
));
export
const
createUnexpectedCommitError
=
message
=>
({
export
const
createUnexpectedCommitError
=
(
message
)
=>
({
title
:
__
(
'
Unexpected error
'
),
messageHTML
:
escape
(
message
)
||
__
(
'
Could not commit. An unexpected error occurred.
'
),
});
export
const
createCodeownersCommitError
=
message
=>
({
export
const
createCodeownersCommitError
=
(
message
)
=>
({
title
:
__
(
'
CODEOWNERS rule violation
'
),
messageHTML
:
escape
(
message
),
primaryAction
:
{
...
...
@@ -25,7 +25,7 @@ export const createCodeownersCommitError = message => ({
},
});
export
const
createBranchChangedCommitError
=
message
=>
({
export
const
createBranchChangedCommitError
=
(
message
)
=>
({
title
:
__
(
'
Branch changed
'
),
messageHTML
:
`
${
escape
(
message
)}
<br/><br/>
${
__
(
'
Would you like to create a new branch?
'
)}
`
,
primaryAction
:
{
...
...
@@ -34,19 +34,19 @@ export const createBranchChangedCommitError = message => ({
},
});
export
const
branchAlreadyExistsCommitError
=
message
=>
({
export
const
branchAlreadyExistsCommitError
=
(
message
)
=>
({
title
:
__
(
'
Branch already exists
'
),
messageHTML
:
`
${
escape
(
message
)}
<br/><br/>
${
__
(
'
Would you like to try auto-generating a branch name?
'
,
)}
`
,
primaryAction
:
{
text
:
__
(
'
Create new branch
'
),
callback
:
store
=>
callback
:
(
store
)
=>
store
.
dispatch
(
'
commit/addSuffixToBranchName
'
).
then
(()
=>
createNewBranchAndCommit
(
store
)),
},
});
export
const
parseCommitError
=
e
=>
{
export
const
parseCommitError
=
(
e
)
=>
{
const
{
message
}
=
e
?.
response
?.
data
||
{};
if
(
!
message
)
{
...
...
app/assets/javascripts/ide/lib/files.js
View file @
00827a74
import
{
decorateData
,
sortTree
}
from
'
../stores/utils
'
;
export
const
splitParent
=
path
=>
{
export
const
splitParent
=
(
path
)
=>
{
const
idx
=
path
.
lastIndexOf
(
'
/
'
);
return
{
...
...
@@ -32,7 +32,7 @@ export const decorateFiles = ({
let
file
;
let
parentPath
;
const
insertParent
=
path
=>
{
const
insertParent
=
(
path
)
=>
{
if
(
!
path
)
{
return
null
;
}
else
if
(
entries
[
path
])
{
...
...
@@ -67,7 +67,7 @@ export const decorateFiles = ({
return
tree
;
};
data
.
forEach
(
path
=>
{
data
.
forEach
(
(
path
)
=>
{
const
{
parent
,
name
}
=
splitParent
(
path
);
const
fileFolder
=
parent
&&
insertParent
(
parent
);
...
...
app/assets/javascripts/ide/lib/mirror.js
View file @
00827a74
...
...
@@ -12,23 +12,23 @@ export const MSG_CONNECTION_ERROR = __('Could not connect to Web IDE file mirror
const
noop
=
()
=>
{};
export
const
SERVICE_DELAY
=
8000
;
const
cancellableWait
=
time
=>
{
const
cancellableWait
=
(
time
)
=>
{
let
timeoutId
=
0
;
const
cancel
=
()
=>
clearTimeout
(
timeoutId
);
const
promise
=
new
Promise
(
resolve
=>
{
const
promise
=
new
Promise
(
(
resolve
)
=>
{
timeoutId
=
setTimeout
(
resolve
,
time
);
});
return
[
promise
,
cancel
];
};
const
isErrorResponse
=
error
=>
error
&&
error
.
code
!==
0
;
const
isErrorResponse
=
(
error
)
=>
error
&&
error
.
code
!==
0
;
const
isErrorPayload
=
payload
=>
payload
&&
payload
.
status_code
!==
200
;
const
isErrorPayload
=
(
payload
)
=>
payload
&&
payload
.
status_code
!==
200
;
const
getErrorFromResponse
=
data
=>
{
const
getErrorFromResponse
=
(
data
)
=>
{
if
(
isErrorResponse
(
data
.
error
))
{
return
{
message
:
data
.
error
.
Message
};
}
else
if
(
isErrorPayload
(
data
.
payload
))
{
...
...
@@ -38,9 +38,9 @@ const getErrorFromResponse = data => {
return
null
;
};
const
getFullPath
=
path
=>
mergeUrlParams
({
service
:
SERVICE_NAME
},
getWebSocketUrl
(
path
));
const
getFullPath
=
(
path
)
=>
mergeUrlParams
({
service
:
SERVICE_NAME
},
getWebSocketUrl
(
path
));
const
createWebSocket
=
fullPath
=>
const
createWebSocket
=
(
fullPath
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
const
socket
=
new
WebSocket
(
fullPath
,
[
PROTOCOL
]);
const
resetCallbacks
=
()
=>
{
...
...
@@ -59,7 +59,7 @@ const createWebSocket = fullPath =>
};
});
export
const
canConnect
=
({
services
=
[]
})
=>
services
.
some
(
name
=>
name
===
SERVICE_NAME
);
export
const
canConnect
=
({
services
=
[]
})
=>
services
.
some
(
(
name
)
=>
name
===
SERVICE_NAME
);
export
const
createMirror
=
()
=>
{
let
socket
=
null
;
...
...
@@ -71,23 +71,23 @@ export const createMirror = () => {
cancelHandler
=
noop
;
};
const
onCancelConnect
=
fn
=>
{
const
onCancelConnect
=
(
fn
)
=>
{
cancelHandler
=
fn
;
};
const
receiveMessage
=
ev
=>
{
const
receiveMessage
=
(
ev
)
=>
{
const
handle
=
nextMessageHandler
;
nextMessageHandler
=
noop
;
handle
(
JSON
.
parse
(
ev
.
data
));
};
const
onNextMessage
=
fn
=>
{
const
onNextMessage
=
(
fn
)
=>
{
nextMessageHandler
=
fn
;
};
const
waitForNextMessage
=
()
=>
new
Promise
((
resolve
,
reject
)
=>
{
onNextMessage
(
data
=>
{
onNextMessage
(
(
data
)
=>
{
const
err
=
getErrorFromResponse
(
data
);
if
(
err
)
{
...
...
@@ -133,7 +133,7 @@ export const createMirror = () => {
return
wait
.
then
(()
=>
createWebSocket
(
fullPath
))
.
then
(
newSocket
=>
{
.
then
(
(
newSocket
)
=>
{
socket
=
newSocket
;
socket
.
onmessage
=
receiveMessage
;
});
...
...
app/assets/javascripts/ide/services/index.js
View file @
00827a74
...
...
@@ -4,9 +4,9 @@ import Api from '~/api';
import
getUserPermissions
from
'
../queries/getUserPermissions.query.graphql
'
;
import
{
query
}
from
'
./gql
'
;
const
fetchApiProjectData
=
projectPath
=>
Api
.
project
(
projectPath
).
then
(({
data
})
=>
data
);
const
fetchApiProjectData
=
(
projectPath
)
=>
Api
.
project
(
projectPath
).
then
(({
data
})
=>
data
);
const
fetchGqlProjectData
=
projectPath
=>
const
fetchGqlProjectData
=
(
projectPath
)
=>
query
({
query
:
getUserPermissions
,
variables
:
{
projectPath
},
...
...
@@ -31,7 +31,7 @@ export default {
return
axios
.
get
(
file
.
rawPath
,
{
transformResponse
:
[
f
=>
f
],
transformResponse
:
[
(
f
)
=>
f
],
...
options
,
})
.
then
(({
data
})
=>
data
);
...
...
@@ -54,7 +54,7 @@ export default {
escapeFileUrl
(
filePath
),
),
{
transformResponse
:
[
f
=>
f
],
transformResponse
:
[
(
f
)
=>
f
],
},
)
.
then
(({
data
})
=>
data
);
...
...
app/assets/javascripts/ide/services/terminals.js
View file @
00827a74
import
axios
from
'
~/lib/utils/axios_utils
'
;
export
const
baseUrl
=
projectPath
=>
`/
${
projectPath
}
/ide_terminals`
;
export
const
baseUrl
=
(
projectPath
)
=>
`/
${
projectPath
}
/ide_terminals`
;
export
const
checkConfig
=
(
projectPath
,
branch
)
=>
axios
.
post
(
`
${
baseUrl
(
projectPath
)}
/check_config`
,
{
...
...
app/assets/javascripts/ide/stores/actions.js
View file @
00827a74
...
...
@@ -20,7 +20,7 @@ export const redirectToUrl = (self, url) => visitUrl(url);
export
const
setInitialData
=
({
commit
},
data
)
=>
commit
(
types
.
SET_INITIAL_DATA
,
data
);
export
const
discardAllChanges
=
({
state
,
commit
,
dispatch
})
=>
{
state
.
changedFiles
.
forEach
(
file
=>
dispatch
(
'
restoreOriginalFile
'
,
file
.
path
));
state
.
changedFiles
.
forEach
(
(
file
)
=>
dispatch
(
'
restoreOriginalFile
'
,
file
.
path
));
commit
(
types
.
REMOVE_ALL_CHANGES_FILES
);
};
...
...
@@ -106,7 +106,7 @@ export const stageAllChanges = ({ state, commit, dispatch, getters }) => {
commit
(
types
.
SET_LAST_COMMIT_MSG
,
''
);
state
.
changedFiles
.
forEach
(
file
=>
state
.
changedFiles
.
forEach
(
(
file
)
=>
commit
(
types
.
STAGE_CHANGE
,
{
path
:
file
.
path
,
diffInfo
:
getters
.
getDiffInfo
(
file
.
path
)
}),
);
...
...
@@ -123,7 +123,7 @@ export const stageAllChanges = ({ state, commit, dispatch, getters }) => {
export
const
unstageAllChanges
=
({
state
,
commit
,
dispatch
,
getters
})
=>
{
const
openFile
=
state
.
openFiles
[
0
];
state
.
stagedFiles
.
forEach
(
file
=>
state
.
stagedFiles
.
forEach
(
(
file
)
=>
commit
(
types
.
UNSTAGE_CHANGE
,
{
path
:
file
.
path
,
diffInfo
:
getters
.
getDiffInfo
(
file
.
path
)
}),
);
...
...
@@ -194,7 +194,7 @@ export const deleteEntry = ({ commit, dispatch, state }, path) => {
if
(
entry
.
opened
)
dispatch
(
'
closeFile
'
,
entry
);
if
(
isTree
)
{
entry
.
tree
.
forEach
(
f
=>
dispatch
(
'
deleteEntry
'
,
f
.
path
));
entry
.
tree
.
forEach
(
(
f
)
=>
dispatch
(
'
deleteEntry
'
,
f
.
path
));
}
commit
(
types
.
DELETE_ENTRY
,
path
);
...
...
@@ -221,7 +221,7 @@ export const renameEntry = ({ dispatch, commit, state, getters }, { path, name,
commit
(
types
.
RENAME_ENTRY
,
{
path
,
name
,
parentPath
});
if
(
entry
.
type
===
'
tree
'
)
{
state
.
entries
[
newPath
].
tree
.
forEach
(
f
=>
{
state
.
entries
[
newPath
].
tree
.
forEach
(
(
f
)
=>
{
dispatch
(
'
renameEntry
'
,
{
path
:
f
.
path
,
name
:
f
.
name
,
...
...
@@ -280,7 +280,7 @@ export const getBranchData = ({ commit, state }, { projectId, branchId, force =
commit
(
types
.
SET_BRANCH_WORKING_REFERENCE
,
{
projectId
,
branchId
,
reference
:
id
});
resolve
(
data
);
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
if
(
e
.
response
.
status
===
404
)
{
reject
(
e
);
}
else
{
...
...
app/assets/javascripts/ide/stores/actions/file.js
View file @
00827a74
...
...
@@ -14,7 +14,7 @@ import { viewerTypes, stageKeys } from '../../constants';
export
const
closeFile
=
({
commit
,
state
,
dispatch
,
getters
},
file
)
=>
{
const
{
path
}
=
file
;
const
indexOfClosedFile
=
state
.
openFiles
.
findIndex
(
f
=>
f
.
key
===
file
.
key
);
const
indexOfClosedFile
=
state
.
openFiles
.
findIndex
(
(
f
)
=>
f
.
key
===
file
.
key
);
const
fileWasActive
=
file
.
active
;
if
(
file
.
pending
)
{
...
...
@@ -108,7 +108,7 @@ export const getFileData = (
.
catch
(()
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred while loading the file.
'
),
action
:
payload
=>
action
:
(
payload
)
=>
dispatch
(
'
getFileData
'
,
payload
).
then
(()
=>
dispatch
(
'
setErrorMessage
'
,
null
)),
actionText
:
__
(
'
Please try again
'
),
actionPayload
:
{
path
,
makeFileActive
},
...
...
@@ -125,13 +125,13 @@ export const setFileMrChange = ({ commit }, { file, mrChange }) => {
export
const
getRawFileData
=
({
state
,
commit
,
dispatch
,
getters
},
{
path
})
=>
{
const
file
=
state
.
entries
[
path
];
const
stagedFile
=
state
.
stagedFiles
.
find
(
f
=>
f
.
path
===
path
);
const
stagedFile
=
state
.
stagedFiles
.
find
(
(
f
)
=>
f
.
path
===
path
);
const
fileDeletedAndReadded
=
getters
.
isFileDeletedAndReadded
(
path
);
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
file
,
forceValue
:
true
});
return
service
.
getRawFileData
(
fileDeletedAndReadded
?
stagedFile
:
file
)
.
then
(
raw
=>
{
.
then
(
(
raw
)
=>
{
if
(
!
(
file
.
tempFile
&&
!
file
.
prevPath
&&
!
fileDeletedAndReadded
))
commit
(
types
.
SET_FILE_RAW_DATA
,
{
file
,
raw
,
fileDeletedAndReadded
});
...
...
@@ -139,7 +139,7 @@ export const getRawFileData = ({ state, commit, dispatch, getters }, { path }) =
const
baseSha
=
(
getters
.
currentMergeRequest
&&
getters
.
currentMergeRequest
.
baseCommitSha
)
||
''
;
return
service
.
getBaseRawFileData
(
file
,
state
.
currentProjectId
,
baseSha
).
then
(
baseRaw
=>
{
return
service
.
getBaseRawFileData
(
file
,
state
.
currentProjectId
,
baseSha
).
then
(
(
baseRaw
)
=>
{
commit
(
types
.
SET_FILE_BASE_RAW_DATA
,
{
file
,
baseRaw
,
...
...
@@ -149,10 +149,10 @@ export const getRawFileData = ({ state, commit, dispatch, getters }, { path }) =
}
return
raw
;
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred while loading the file content.
'
),
action
:
payload
=>
action
:
(
payload
)
=>
dispatch
(
'
getRawFileData
'
,
payload
).
then
(()
=>
dispatch
(
'
setErrorMessage
'
,
null
)),
actionText
:
__
(
'
Please try again
'
),
actionPayload
:
{
path
},
...
...
@@ -178,7 +178,7 @@ export const changeFileContent = ({ commit, state, getters }, { path, content })
content
,
});
const
indexOfChangedFile
=
state
.
changedFiles
.
findIndex
(
f
=>
f
.
path
===
path
);
const
indexOfChangedFile
=
state
.
changedFiles
.
findIndex
(
(
f
)
=>
f
.
path
===
path
);
if
(
file
.
changed
&&
indexOfChangedFile
===
-
1
)
{
commit
(
types
.
STAGE_CHANGE
,
{
path
,
diffInfo
:
getters
.
getDiffInfo
(
path
)
});
...
...
@@ -225,7 +225,7 @@ export const discardFileChanges = ({ dispatch, state, commit, getters }, path) =
.
then
(()
=>
{
dispatch
(
'
router/push
'
,
getters
.
getUrlForPath
(
file
.
path
),
{
root
:
true
});
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
throw
e
;
});
}
...
...
@@ -275,7 +275,7 @@ export const unstageChange = ({ commit, dispatch, getters }, path) => {
export
const
openPendingTab
=
({
commit
,
dispatch
,
getters
,
state
},
{
file
,
keyPrefix
})
=>
{
if
(
getters
.
activeFile
&&
getters
.
activeFile
.
key
===
`
${
keyPrefix
}
-
${
file
.
key
}
`
)
return
false
;
state
.
openFiles
.
forEach
(
f
=>
eventHub
.
$emit
(
`editor.update.model.dispose.
${
f
.
key
}
`
));
state
.
openFiles
.
forEach
(
(
f
)
=>
eventHub
.
$emit
(
`editor.update.model.dispose.
${
f
.
key
}
`
));
commit
(
types
.
ADD_PENDING_TAB
,
{
file
,
keyPrefix
});
...
...
app/assets/javascripts/ide/stores/actions/merge_request.js
View file @
00827a74
...
...
@@ -33,7 +33,7 @@ export const getMergeRequestsForBranch = (
commit
(
types
.
SET_CURRENT_MERGE_REQUEST
,
`
${
currentMR
.
iid
}
`
);
}
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
flash
(
__
(
`Error fetching merge requests for
${
branchId
}
`
),
'
alert
'
,
...
...
@@ -66,7 +66,7 @@ export const getMergeRequestData = (
.
catch
(()
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred while loading the merge request.
'
),
action
:
payload
=>
action
:
(
payload
)
=>
dispatch
(
'
getMergeRequestData
'
,
payload
).
then
(()
=>
dispatch
(
'
setErrorMessage
'
,
null
),
),
...
...
@@ -99,7 +99,7 @@ export const getMergeRequestChanges = (
.
catch
(()
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred while loading the merge request changes.
'
),
action
:
payload
=>
action
:
(
payload
)
=>
dispatch
(
'
getMergeRequestChanges
'
,
payload
).
then
(()
=>
dispatch
(
'
setErrorMessage
'
,
null
),
),
...
...
@@ -121,8 +121,8 @@ export const getMergeRequestVersions = (
if
(
!
state
.
projects
[
projectId
].
mergeRequests
[
mergeRequestId
].
versions
.
length
||
force
)
{
service
.
getProjectMergeRequestVersions
(
targetProjectId
||
projectId
,
mergeRequestId
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
.
then
(
(
res
)
=>
res
.
data
)
.
then
(
(
data
)
=>
{
commit
(
types
.
SET_MERGE_REQUEST_VERSIONS
,
{
projectPath
:
projectId
,
mergeRequestId
,
...
...
@@ -133,7 +133,7 @@ export const getMergeRequestVersions = (
.
catch
(()
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred while loading the merge request version data.
'
),
action
:
payload
=>
action
:
(
payload
)
=>
dispatch
(
'
getMergeRequestVersions
'
,
payload
).
then
(()
=>
dispatch
(
'
setErrorMessage
'
,
null
),
),
...
...
@@ -156,7 +156,7 @@ export const openMergeRequest = (
targetProjectId
,
mergeRequestId
,
})
.
then
(
mr
=>
{
.
then
(
(
mr
)
=>
{
dispatch
(
'
setCurrentBranchId
'
,
mr
.
source_branch
);
return
dispatch
(
'
getBranchData
'
,
{
...
...
@@ -186,7 +186,7 @@ export const openMergeRequest = (
mergeRequestId
,
}),
)
.
then
(
mrChanges
=>
{
.
then
(
(
mrChanges
)
=>
{
if
(
mrChanges
.
changes
.
length
)
{
dispatch
(
'
updateActivityBarView
'
,
leftSidebarViews
.
review
.
name
);
}
...
...
@@ -210,7 +210,7 @@ export const openMergeRequest = (
}
});
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
flash
(
__
(
'
Error while loading the merge request. Please try again.
'
));
throw
e
;
});
app/assets/javascripts/ide/stores/actions/project.js
View file @
00827a74
...
...
@@ -11,8 +11,8 @@ export const getProjectData = ({ commit, state }, { namespace, projectId, force
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
state
});
service
.
getProjectData
(
namespace
,
projectId
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
.
then
(
(
res
)
=>
res
.
data
)
.
then
(
(
data
)
=>
{
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
state
});
commit
(
types
.
SET_PROJECT
,
{
projectPath
:
`
${
namespace
}
/
${
projectId
}
`
,
project
:
data
});
commit
(
types
.
SET_CURRENT_PROJECT
,
`
${
namespace
}
/
${
projectId
}
`
);
...
...
@@ -61,7 +61,7 @@ export const createNewBranchFromDefault = ({ state, dispatch, getters }, branch)
.
catch
(()
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred creating the new branch.
'
),
action
:
payload
=>
dispatch
(
'
createNewBranchFromDefault
'
,
payload
),
action
:
(
payload
)
=>
dispatch
(
'
createNewBranchFromDefault
'
,
payload
),
actionText
:
__
(
'
Please try again
'
),
actionPayload
:
branch
,
});
...
...
@@ -76,7 +76,7 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => {
},
false
,
),
action
:
payload
=>
dispatch
(
'
createNewBranchFromDefault
'
,
payload
),
action
:
(
payload
)
=>
dispatch
(
'
createNewBranchFromDefault
'
,
payload
),
actionText
:
__
(
'
Create branch
'
),
actionPayload
:
branchId
,
});
...
...
@@ -102,7 +102,7 @@ export const loadFile = ({ dispatch, state }, { basePath }) => {
if
(
basePath
)
{
const
path
=
basePath
.
slice
(
-
1
)
===
'
/
'
?
basePath
.
slice
(
0
,
-
1
)
:
basePath
;
const
treeEntryKey
=
Object
.
keys
(
state
.
entries
).
find
(
key
=>
key
===
path
&&
!
state
.
entries
[
key
].
pending
,
(
key
)
=>
key
===
path
&&
!
state
.
entries
[
key
].
pending
,
);
const
treeEntry
=
state
.
entries
[
treeEntryKey
];
...
...
@@ -144,7 +144,7 @@ export const loadBranch = ({ dispatch, getters, state }, { projectId, branchId }
ref
:
branch
.
commit
.
id
,
});
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
dispatch
(
'
showBranchNotFoundError
'
,
branchId
);
throw
err
;
});
...
...
app/assets/javascripts/ide/stores/actions/tree.js
View file @
00827a74
...
...
@@ -87,10 +87,10 @@ export const getFiles = ({ state, commit, dispatch }, payload = {}) => {
resolve
();
})
.
catch
(
e
=>
{
.
catch
(
(
e
)
=>
{
dispatch
(
'
setErrorMessage
'
,
{
text
:
__
(
'
An error occurred while loading all the files.
'
),
action
:
actionPayload
=>
action
:
(
actionPayload
)
=>
dispatch
(
'
getFiles
'
,
actionPayload
).
then
(()
=>
dispatch
(
'
setErrorMessage
'
,
null
)),
actionText
:
__
(
'
Please try again
'
),
actionPayload
:
{
projectId
,
branchId
},
...
...
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