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
35421dd0
Commit
35421dd0
authored
Jun 05, 2020
by
Himanshu Kapoor
Committed by
Ezekiel Kigbo
Jun 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove 3 dead properties on files
- permalink - commitsPath - blamePath
parent
bb396938
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
3 additions
and
165 deletions
+3
-165
app/assets/javascripts/ide/lib/files.js
app/assets/javascripts/ide/lib/files.js
+0
-2
app/assets/javascripts/ide/stores/mutation_types.js
app/assets/javascripts/ide/stores/mutation_types.js
+0
-1
app/assets/javascripts/ide/stores/mutations.js
app/assets/javascripts/ide/stores/mutations.js
+1
-9
app/assets/javascripts/ide/stores/mutations/tree.js
app/assets/javascripts/ide/stores/mutations/tree.js
+0
-5
app/assets/javascripts/ide/stores/state.js
app/assets/javascripts/ide/stores/state.js
+0
-2
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+2
-22
spec/frontend/ide/lib/files_spec.js
spec/frontend/ide/lib/files_spec.js
+0
-4
spec/frontend/ide/stores/actions/file_spec.js
spec/frontend/ide/stores/actions/file_spec.js
+0
-22
spec/frontend/ide/stores/mutations/file_spec.js
spec/frontend/ide/stores/mutations/file_spec.js
+0
-8
spec/frontend/ide/stores/mutations_spec.js
spec/frontend/ide/stores/mutations_spec.js
+0
-26
spec/frontend/ide/stores/utils_spec.js
spec/frontend/ide/stores/utils_spec.js
+0
-64
No files found.
app/assets/javascripts/ide/lib/files.js
View file @
35421dd0
...
...
@@ -49,7 +49,6 @@ export const decorateFiles = ({
path
,
url
:
`/
${
projectId
}
/tree/
${
branchId
}
/-/
${
path
}
/`
,
type
:
'
tree
'
,
parentTreeUrl
:
parentFolder
?
parentFolder
.
url
:
`/
${
projectId
}
/tree/
${
branchId
}
/`
,
tempFile
,
changed
:
tempFile
,
opened
:
tempFile
,
...
...
@@ -86,7 +85,6 @@ export const decorateFiles = ({
path
,
url
:
`/
${
projectId
}
/blob/
${
branchId
}
/-/
${
path
}
`
,
type
:
'
blob
'
,
parentTreeUrl
:
fileFolder
?
fileFolder
.
url
:
`/
${
projectId
}
/blob/
${
branchId
}
`
,
tempFile
,
changed
:
tempFile
,
content
,
...
...
app/assets/javascripts/ide/stores/mutation_types.js
View file @
35421dd0
...
...
@@ -27,7 +27,6 @@ export const TOGGLE_BRANCH_OPEN = 'TOGGLE_BRANCH_OPEN';
export
const
SET_DIRECTORY_DATA
=
'
SET_DIRECTORY_DATA
'
;
export
const
TOGGLE_TREE_OPEN
=
'
TOGGLE_TREE_OPEN
'
;
export
const
SET_TREE_OPEN
=
'
SET_TREE_OPEN
'
;
export
const
SET_LAST_COMMIT_URL
=
'
SET_LAST_COMMIT_URL
'
;
export
const
CREATE_TREE
=
'
CREATE_TREE
'
;
export
const
REMOVE_ALL_CHANGES_FILES
=
'
REMOVE_ALL_CHANGES_FILES
'
;
...
...
app/assets/javascripts/ide/stores/mutations.js
View file @
35421dd0
...
...
@@ -65,14 +65,10 @@ export default {
// NOTE: We can't clone `entry` in any of the below assignments because
// we need `state.entries` and the `entry.tree` to reference the same object.
if
(
!
foundEntry
)
{
if
(
!
foundEntry
||
foundEntry
.
deleted
)
{
Object
.
assign
(
state
.
entries
,
{
[
key
]:
entry
,
});
}
else
if
(
foundEntry
.
deleted
)
{
Object
.
assign
(
state
.
entries
,
{
[
key
]:
Object
.
assign
(
entry
,
{
replaces
:
true
}),
});
}
else
{
const
tree
=
entry
.
tree
.
filter
(
f
=>
foundEntry
.
tree
.
find
(
e
=>
e
.
path
===
f
.
path
)
===
undefined
,
...
...
@@ -147,7 +143,6 @@ export default {
raw
:
file
.
content
,
changed
:
Boolean
(
changedFile
),
staged
:
false
,
replaces
:
false
,
lastCommitSha
:
lastCommit
.
commit
.
id
,
prevId
:
undefined
,
...
...
@@ -164,9 +159,6 @@ export default {
Object
.
assign
(
state
.
entries
[
file
.
path
],
{
rawPath
:
file
.
rawPath
.
replace
(
regex
,
file
.
path
),
permalink
:
file
.
permalink
.
replace
(
regex
,
file
.
path
),
commitsPath
:
file
.
commitsPath
.
replace
(
regex
,
file
.
path
),
blamePath
:
file
.
blamePath
.
replace
(
regex
,
file
.
path
),
});
}
},
...
...
app/assets/javascripts/ide/stores/mutations/tree.js
View file @
35421dd0
...
...
@@ -34,11 +34,6 @@ export default {
Object
.
assign
(
selectedTree
,
{
tree
});
},
[
types
.
SET_LAST_COMMIT_URL
](
state
,
{
tree
=
state
,
url
})
{
Object
.
assign
(
tree
,
{
lastCommitPath
:
url
,
});
},
[
types
.
REMOVE_ALL_CHANGES_FILES
](
state
)
{
Object
.
assign
(
state
,
{
changedFiles
:
[],
...
...
app/assets/javascripts/ide/stores/state.js
View file @
35421dd0
...
...
@@ -9,10 +9,8 @@ export default () => ({
stagedFiles
:
[],
endpoints
:
{},
lastCommitMsg
:
''
,
lastCommitPath
:
''
,
loading
:
false
,
openFiles
:
[],
parentTreeUrl
:
''
,
trees
:
{},
projects
:
{},
panelResizing
:
false
,
...
...
app/assets/javascripts/ide/stores/utils.js
View file @
35421dd0
...
...
@@ -19,8 +19,6 @@ export const dataStructure = () => ({
active
:
false
,
changed
:
false
,
staged
:
false
,
replaces
:
false
,
lastCommitPath
:
''
,
lastCommitSha
:
''
,
lastCommit
:
{
id
:
''
,
...
...
@@ -29,16 +27,10 @@ export const dataStructure = () => ({
updatedAt
:
''
,
author
:
''
,
},
blamePath
:
''
,
commitsPath
:
''
,
permalink
:
''
,
rawPath
:
''
,
binary
:
false
,
html
:
''
,
raw
:
''
,
content
:
''
,
parentTreeUrl
:
''
,
renderError
:
false
,
base64
:
false
,
editorRow
:
1
,
editorColumn
:
1
,
...
...
@@ -63,19 +55,16 @@ export const decorateData = entity => {
url
,
name
,
path
,
renderError
,
content
=
''
,
tempFile
=
false
,
active
=
false
,
opened
=
false
,
changed
=
false
,
parentTreeUrl
=
''
,
base64
=
false
,
binary
=
false
,
rawPath
=
''
,
previewMode
,
file_lock
,
html
,
parentPath
=
''
,
}
=
entity
;
...
...
@@ -91,25 +80,17 @@ export const decorateData = entity => {
tempFile
,
opened
,
active
,
parentTreeUrl
,
changed
,
renderError
,
content
,
base64
,
binary
,
rawPath
,
previewMode
,
file_lock
,
html
,
parentPath
,
});
};
export
const
findEntry
=
(
tree
,
type
,
name
,
prop
=
'
name
'
)
=>
tree
.
find
(
f
=>
f
.
type
===
type
&&
f
[
prop
]
===
name
);
export
const
findIndexOfFile
=
(
state
,
file
)
=>
state
.
findIndex
(
f
=>
f
.
path
===
file
.
path
);
export
const
setPageTitle
=
title
=>
{
document
.
title
=
title
;
};
...
...
@@ -124,7 +105,7 @@ export const commitActionForFile = file => {
return
commitActionTypes
.
move
;
}
else
if
(
file
.
deleted
)
{
return
commitActionTypes
.
delete
;
}
else
if
(
file
.
tempFile
&&
!
file
.
replaces
)
{
}
else
if
(
file
.
tempFile
)
{
return
commitActionTypes
.
create
;
}
...
...
@@ -156,8 +137,7 @@ export const createCommitPayload = ({
previous_path
:
f
.
prevPath
||
undefined
,
content
:
f
.
prevPath
&&
!
f
.
changed
?
null
:
f
.
content
||
undefined
,
encoding
:
f
.
base64
?
'
base64
'
:
'
text
'
,
last_commit_id
:
newBranch
||
f
.
deleted
||
f
.
prevPath
||
f
.
replaces
?
undefined
:
f
.
lastCommitSha
,
last_commit_id
:
newBranch
||
f
.
deleted
||
f
.
prevPath
?
undefined
:
f
.
lastCommitSha
,
})),
start_sha
:
newBranch
?
rootGetters
.
lastCommit
.
id
:
undefined
,
});
...
...
spec/frontend/ide/lib/files_spec.js
View file @
35421dd0
...
...
@@ -11,7 +11,6 @@ const createEntries = paths => {
const
createUrl
=
base
=>
(
type
===
'
tree
'
?
`
${
base
}
/`
:
base
);
const
{
name
,
parent
}
=
splitParent
(
path
);
const
parentEntry
=
acc
[
parent
];
const
previewMode
=
viewerInformationForPath
(
name
);
acc
[
path
]
=
{
...
...
@@ -26,9 +25,6 @@ const createEntries = paths => {
previewMode
,
binary
:
(
previewMode
&&
previewMode
.
binary
)
||
false
,
parentPath
:
parent
,
parentTreeUrl
:
parentEntry
?
parentEntry
.
url
:
createUrl
(
`/
${
TEST_PROJECT_ID
}
/
${
type
}
/
${
TEST_BRANCH_ID
}
`
),
}),
tree
:
children
.
map
(
childName
=>
expect
.
objectContaining
({
name
:
childName
})),
};
...
...
spec/frontend/ide/stores/actions/file_spec.js
View file @
35421dd0
...
...
@@ -44,7 +44,6 @@ describe('IDE store file actions', () => {
localFile
=
file
(
'
testFile
'
);
localFile
.
active
=
true
;
localFile
.
opened
=
true
;
localFile
.
parentTreeUrl
=
'
parentTreeUrl
'
;
store
.
state
.
openFiles
.
push
(
localFile
);
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
...
...
@@ -254,13 +253,8 @@ describe('IDE store file actions', () => {
mock
.
onGet
(
`
${
RELATIVE_URL_ROOT
}
/test/test/-/7297abc/
${
localFile
.
path
}
`
).
replyOnce
(
200
,
{
blame_path
:
'
blame_path
'
,
commits_path
:
'
commits_path
'
,
permalink
:
'
permalink
'
,
raw_path
:
'
raw_path
'
,
binary
:
false
,
html
:
'
123
'
,
render_error
:
''
,
},
{
'
page-title
'
:
'
testing getFileData
'
,
...
...
@@ -281,17 +275,6 @@ describe('IDE store file actions', () => {
.
catch
(
done
.
fail
);
});
it
(
'
sets the file data
'
,
done
=>
{
store
.
dispatch
(
'
getFileData
'
,
{
path
:
localFile
.
path
})
.
then
(()
=>
{
expect
(
localFile
.
blamePath
).
toBe
(
'
blame_path
'
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
sets document title with the branchId
'
,
done
=>
{
store
.
dispatch
(
'
getFileData
'
,
{
path
:
localFile
.
path
})
...
...
@@ -348,13 +331,8 @@ describe('IDE store file actions', () => {
mock
.
onGet
(
`
${
RELATIVE_URL_ROOT
}
/test/test/-/7297abc/old-dull-file`
).
replyOnce
(
200
,
{
blame_path
:
'
blame_path
'
,
commits_path
:
'
commits_path
'
,
permalink
:
'
permalink
'
,
raw_path
:
'
raw_path
'
,
binary
:
false
,
html
:
'
123
'
,
render_error
:
''
,
},
{
'
page-title
'
:
'
testing old-dull-file
'
,
...
...
spec/frontend/ide/stores/mutations/file_spec.js
View file @
35421dd0
...
...
@@ -60,22 +60,14 @@ describe('IDE store file mutations', () => {
it
(
'
sets extra file data
'
,
()
=>
{
mutations
.
SET_FILE_DATA
(
localState
,
{
data
:
{
blame_path
:
'
blame
'
,
commits_path
:
'
commits
'
,
permalink
:
'
permalink
'
,
raw_path
:
'
raw
'
,
binary
:
true
,
render_error
:
'
render_error
'
,
},
file
:
localFile
,
});
expect
(
localFile
.
blamePath
).
toBe
(
'
blame
'
);
expect
(
localFile
.
commitsPath
).
toBe
(
'
commits
'
);
expect
(
localFile
.
permalink
).
toBe
(
'
permalink
'
);
expect
(
localFile
.
rawPath
).
toBe
(
'
raw
'
);
expect
(
localFile
.
binary
).
toBeTruthy
();
expect
(
localFile
.
renderError
).
toBe
(
'
render_error
'
);
expect
(
localFile
.
raw
).
toBeNull
();
expect
(
localFile
.
baseRaw
).
toBeNull
();
});
...
...
spec/frontend/ide/stores/mutations_spec.js
View file @
35421dd0
...
...
@@ -120,24 +120,6 @@ describe('Multi-file store mutations', () => {
expect
(
localState
.
trees
[
'
gitlab-ce/master
'
].
tree
.
length
).
toEqual
(
1
);
expect
(
localState
.
entries
.
test
.
tempFile
).
toEqual
(
true
);
});
it
(
'
marks entry as replacing previous entry if the old one has been deleted
'
,
()
=>
{
const
tmpFile
=
file
(
'
test
'
);
localState
.
entries
.
test
=
{
...
tmpFile
,
deleted
:
true
};
mutations
.
CREATE_TMP_ENTRY
(
localState
,
{
data
:
{
entries
:
{
test
:
{
...
tmpFile
,
tempFile
:
true
,
changed
:
true
},
},
treeList
:
[
tmpFile
],
},
projectId
:
'
gitlab-ce
'
,
branchId
:
'
master
'
,
});
expect
(
localState
.
trees
[
'
gitlab-ce/master
'
].
tree
.
length
).
toEqual
(
1
);
expect
(
localState
.
entries
.
test
.
replaces
).
toEqual
(
true
);
});
});
describe
(
'
UPDATE_TEMP_FLAG
'
,
()
=>
{
...
...
@@ -273,10 +255,6 @@ describe('Multi-file store mutations', () => {
...
file
(
'
test
'
),
prevPath
:
'
testing-123
'
,
rawPath
:
`
${
TEST_HOST
}
/testing-123`
,
permalink
:
`
${
TEST_HOST
}
/testing-123`
,
commitsPath
:
`
${
TEST_HOST
}
/testing-123`
,
blamePath
:
`
${
TEST_HOST
}
/testing-123`
,
replaces
:
true
,
};
localState
.
entries
.
test
=
f
;
localState
.
changedFiles
.
push
(
f
);
...
...
@@ -291,10 +269,6 @@ describe('Multi-file store mutations', () => {
expect
(
f
).
toEqual
(
expect
.
objectContaining
({
rawPath
:
`
${
TEST_HOST
}
/test`
,
permalink
:
`
${
TEST_HOST
}
/test`
,
commitsPath
:
`
${
TEST_HOST
}
/test`
,
blamePath
:
`
${
TEST_HOST
}
/test`
,
replaces
:
false
,
prevId
:
undefined
,
prevPath
:
undefined
,
prevName
:
undefined
,
...
...
spec/frontend/ide/stores/utils_spec.js
View file @
35421dd0
...
...
@@ -28,61 +28,6 @@ describe('Multi-file store utils', () => {
});
});
describe
(
'
findIndexOfFile
'
,
()
=>
{
let
localState
;
beforeEach
(()
=>
{
localState
=
[
{
path
:
'
1
'
,
},
{
path
:
'
2
'
,
},
];
});
it
(
'
finds in the index of an entry by path
'
,
()
=>
{
const
index
=
utils
.
findIndexOfFile
(
localState
,
{
path
:
'
2
'
,
});
expect
(
index
).
toBe
(
1
);
});
});
describe
(
'
findEntry
'
,
()
=>
{
let
localState
;
beforeEach
(()
=>
{
localState
=
{
tree
:
[
{
type
:
'
tree
'
,
name
:
'
test
'
,
},
{
type
:
'
blob
'
,
name
:
'
file
'
,
},
],
};
});
it
(
'
returns an entry found by name
'
,
()
=>
{
const
foundEntry
=
utils
.
findEntry
(
localState
.
tree
,
'
tree
'
,
'
test
'
);
expect
(
foundEntry
.
type
).
toBe
(
'
tree
'
);
expect
(
foundEntry
.
name
).
toBe
(
'
test
'
);
});
it
(
'
returns undefined when no entry found
'
,
()
=>
{
const
foundEntry
=
utils
.
findEntry
(
localState
.
tree
,
'
blob
'
,
'
test
'
);
expect
(
foundEntry
).
toBeUndefined
();
});
});
describe
(
'
createCommitPayload
'
,
()
=>
{
it
(
'
returns API payload
'
,
()
=>
{
const
state
=
{
...
...
@@ -106,7 +51,6 @@ describe('Multi-file store utils', () => {
},
{
...
file
(
'
deletedFile
'
),
path
:
'
deletedFile
'
,
deleted
:
true
},
{
...
file
(
'
renamedFile
'
),
path
:
'
renamedFile
'
,
prevPath
:
'
prevPath
'
},
{
...
file
(
'
replacingFile
'
),
path
:
'
replacingFile
'
,
replaces
:
true
},
],
currentBranchId
:
'
master
'
,
};
...
...
@@ -154,14 +98,6 @@ describe('Multi-file store utils', () => {
last_commit_id
:
undefined
,
previous_path
:
'
prevPath
'
,
},
{
action
:
commitActionTypes
.
update
,
file_path
:
'
replacingFile
'
,
content
:
undefined
,
encoding
:
'
text
'
,
last_commit_id
:
undefined
,
previous_path
:
undefined
,
},
],
start_sha
:
undefined
,
});
...
...
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