BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9f3bf824
Commit
9f3bf824
authored
May 31, 2018
by
Sam Beckham
Committed by
Phil Hughes
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Remove links from Web IDE unexpectedly navigate you to a different page"
parent
b8198897
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
87 deletions
+23
-87
external_link.vue
app/assets/javascripts/ide/components/external_link.vue
+7
-50
repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+3
-3
45520-remove-links-from-web-ide.yml
changelogs/unreleased/45520-remove-links-from-web-ide.yml
+5
-0
external_link_spec.js
spec/javascripts/ide/components/external_link_spec.js
+8
-34
No files found.
app/assets/javascripts/ide/components/
ide_file_buttons
.vue
→
app/assets/javascripts/ide/components/
external_link
.vue
View file @
9f3bf824
<
script
>
<
script
>
import
{
__
}
from
'~/locale'
;
import
tooltip
from
'~/vue_shared/directives/tooltip'
;
import
Icon
from
'~/vue_shared/components/icon.vue'
;
import
Icon
from
'~/vue_shared/components/icon.vue'
;
export
default
{
export
default
{
components
:
{
components
:
{
Icon
,
Icon
,
},
},
directives
:
{
tooltip
,
},
props
:
{
props
:
{
file
:
{
file
:
{
type
:
Object
,
type
:
Object
,
...
@@ -18,12 +13,7 @@ export default {
...
@@ -18,12 +13,7 @@ export default {
},
},
computed
:
{
computed
:
{
showButtons
()
{
showButtons
()
{
return
(
return
this
.
file
.
permalink
;
this
.
file
.
rawPath
||
this
.
file
.
blamePath
||
this
.
file
.
commitsPath
||
this
.
file
.
permalink
);
},
rawDownloadButtonLabel
()
{
return
this
.
file
.
binary
?
__
(
'Download'
)
:
__
(
'Raw'
);
},
},
},
},
};
};
...
@@ -32,51 +22,18 @@ export default {
...
@@ -32,51 +22,18 @@ export default {
<
template
>
<
template
>
<div
<div
v-if=
"showButtons"
v-if=
"showButtons"
class=
"
float
-right ide-btn-group"
class=
"
pull
-right ide-btn-group"
>
>
<a
<a
v-tooltip
v-if=
"!file.binary"
:href=
"file.blamePath"
:title=
"__('Blame')"
class=
"btn btn-sm btn-transparent blame"
>
<icon
name=
"blame"
:size=
"16"
/>
</a>
<a
v-tooltip
:href=
"file.commitsPath"
:title=
"__('History')"
class=
"btn btn-sm btn-transparent history"
>
<icon
name=
"history"
:size=
"16"
/>
</a>
<a
v-tooltip
:href=
"file.permalink"
:href=
"file.permalink"
:title=
"__('Permalink')"
class=
"btn btn-sm btn-transparent permalink"
>
<icon
name=
"link"
:size=
"16"
/>
</a>
<a
v-tooltip
:href=
"file.rawPath"
target=
"_blank"
target=
"_blank"
class=
"btn btn-sm btn-transparent prepend-left-10 raw
"
:title=
"s__('IDE|Open in file view')
"
rel=
"noopener noreferrer"
rel=
"noopener noreferrer"
:title=
"rawDownloadButtonLabel"
>
>
<span
class=
"vertical-align-middle"
>
Open in file view
</span>
<icon
<icon
name=
"download"
name=
"external-link"
css-classes=
"vertical-align-middle space-right"
:size=
"16"
:size=
"16"
/>
/>
</a>
</a>
...
...
app/assets/javascripts/ide/components/repo_editor.vue
View file @
9f3bf824
...
@@ -6,12 +6,12 @@ import ContentViewer from '~/vue_shared/components/content_viewer/content_viewer
...
@@ -6,12 +6,12 @@ import ContentViewer from '~/vue_shared/components/content_viewer/content_viewer
import
{
activityBarViews
,
viewerTypes
}
from
'../constants'
;
import
{
activityBarViews
,
viewerTypes
}
from
'../constants'
;
import
monacoLoader
from
'../monaco_loader'
;
import
monacoLoader
from
'../monaco_loader'
;
import
Editor
from
'../lib/editor'
;
import
Editor
from
'../lib/editor'
;
import
IdeFileButtons
from
'./ide_file_buttons
.vue'
;
import
ExternalLink
from
'./external_link
.vue'
;
export
default
{
export
default
{
components
:
{
components
:
{
ContentViewer
,
ContentViewer
,
IdeFileButtons
,
ExternalLink
,
},
},
props
:
{
props
:
{
file
:
{
file
:
{
...
@@ -224,7 +224,7 @@ export default {
...
@@ -224,7 +224,7 @@ export default {
</a>
</a>
</li>
</li>
</ul>
</ul>
<
ide-file-buttons
<
external-link
:file=
"file"
:file=
"file"
/>
/>
</div>
</div>
...
...
changelogs/unreleased/45520-remove-links-from-web-ide.yml
0 → 100644
View file @
9f3bf824
---
title
:
Change the IDE file buttons for an "Open in file view" button
merge_request
:
19129
author
:
Sam Beckham
type
:
changed
spec/javascripts/ide/components/
ide_file_buttons
_spec.js
→
spec/javascripts/ide/components/
external_link
_spec.js
View file @
9f3bf824
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
repoFileButtons
from
'~/ide/components/ide_file_buttons
.vue'
;
import
externalLink
from
'~/ide/components/external_link
.vue'
;
import
createVueComponent
from
'../../helpers/vue_mount_component_helper'
;
import
createVueComponent
from
'../../helpers/vue_mount_component_helper'
;
import
{
file
}
from
'../helpers'
;
import
{
file
}
from
'../helpers'
;
describe
(
'
RepoFileButtons
'
,
()
=>
{
describe
(
'
ExternalLink
'
,
()
=>
{
const
activeFile
=
file
();
const
activeFile
=
file
();
let
vm
;
let
vm
;
function
createComponent
()
{
function
createComponent
()
{
const
RepoFileButtons
=
Vue
.
extend
(
repoFileButtons
);
const
ExternalLink
=
Vue
.
extend
(
externalLink
);
activeFile
.
rawPath
=
'test'
;
activeFile
.
permalink
=
'test'
;
activeFile
.
blamePath
=
'test'
;
activeFile
.
commitsPath
=
'test'
;
return
createVueComponent
(
RepoFileButtons
,
{
return
createVueComponent
(
ExternalLink
,
{
file
:
activeFile
,
file
:
activeFile
,
});
});
}
}
...
@@ -23,38 +21,14 @@ describe('RepoFileButtons', () => {
...
@@ -23,38 +21,14 @@ describe('RepoFileButtons', () => {
vm
.
$destroy
();
vm
.
$destroy
();
});
});
it
(
'renders Raw, Blame, History and Permalink'
,
done
=>
{
it
(
'renders the external link with the correct href'
,
done
=>
{
vm
=
createComponent
();
vm
.
$nextTick
(()
=>
{
const
raw
=
vm
.
$el
.
querySelector
(
'.raw'
);
const
blame
=
vm
.
$el
.
querySelector
(
'.blame'
);
const
history
=
vm
.
$el
.
querySelector
(
'.history'
);
expect
(
raw
.
href
).
toMatch
(
`/
${
activeFile
.
rawPath
}
`
);
expect
(
raw
.
getAttribute
(
'data-original-title'
)).
toEqual
(
'Raw'
);
expect
(
blame
.
href
).
toMatch
(
`/
${
activeFile
.
blamePath
}
`
);
expect
(
blame
.
getAttribute
(
'data-original-title'
)).
toEqual
(
'Blame'
);
expect
(
history
.
href
).
toMatch
(
`/
${
activeFile
.
commitsPath
}
`
);
expect
(
history
.
getAttribute
(
'data-original-title'
)).
toEqual
(
'History'
);
expect
(
vm
.
$el
.
querySelector
(
'.permalink'
).
getAttribute
(
'data-original-title'
)).
toEqual
(
'Permalink'
,
);
done
();
});
});
it
(
'renders Download'
,
done
=>
{
activeFile
.
binary
=
true
;
activeFile
.
binary
=
true
;
vm
=
createComponent
();
vm
=
createComponent
();
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
const
raw
=
vm
.
$el
.
querySelector
(
'.raw'
);
const
openLink
=
vm
.
$el
.
querySelector
(
'a'
);
expect
(
raw
.
href
).
toMatch
(
`/
${
activeFile
.
rawPath
}
`
);
expect
(
raw
.
getAttribute
(
'data-original-title'
)).
toEqual
(
'Download'
);
expect
(
openLink
.
href
).
toMatch
(
`/
${
activeFile
.
permalink
}
`
);
done
();
done
();
});
});
});
});
...
...
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