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
c0097f59
Commit
c0097f59
authored
Jun 23, 2021
by
Frédéric Caplette
Committed by
Sarah Groff Hennigh-Palermo
Jun 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add browse template button in Pipeline editor
parent
153ec569
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
1 deletion
+108
-1
app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue
...ts/pipeline_editor/components/editor/ci_editor_header.vue
+38
-0
app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue
...scripts/pipeline_editor/components/editor/text_editor.vue
+1
-1
app/assets/javascripts/pipeline_editor/components/pipeline_editor_tabs.vue
...ripts/pipeline_editor/components/pipeline_editor_tabs.vue
+3
-0
app/assets/javascripts/pipeline_editor/constants.js
app/assets/javascripts/pipeline_editor/constants.js
+10
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/pipeline_editor/components/editor/ci_editor_header_spec.js
...ipeline_editor/components/editor/ci_editor_header_spec.js
+53
-0
No files found.
app/assets/javascripts/pipeline_editor/components/editor/ci_editor_header.vue
0 → 100644
View file @
c0097f59
<
script
>
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
import
Tracking
from
'
~/tracking
'
;
import
{
pipelineEditorTrackingOptions
,
TEMPLATE_REPOSITORY_URL
}
from
'
../../constants
'
;
export
default
{
i18n
:
{
browseTemplates
:
__
(
'
Browse templates
'
),
},
TEMPLATE_REPOSITORY_URL
,
components
:
{
GlButton
,
},
mixins
:
[
Tracking
.
mixin
()],
methods
:
{
trackTemplateBrowsing
()
{
const
{
label
,
actions
}
=
pipelineEditorTrackingOptions
;
this
.
track
(
actions
.
browse_templates
,
{
label
});
},
},
};
</
script
>
<
template
>
<div
class=
"gl-bg-gray-10 gl-p-3 gl-border-solid gl-border-gray-100 gl-border-1"
>
<gl-button
:href=
"$options.TEMPLATE_REPOSITORY_URL"
size=
"small"
icon=
"external-link"
target=
"_blank"
@
click=
"trackTemplateBrowsing"
>
{{
$options
.
i18n
.
browseTemplates
}}
</gl-button>
</div>
</
template
>
app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue
View file @
c0097f59
...
...
@@ -43,7 +43,7 @@ export default {
};
</
script
>
<
template
>
<div
class=
"gl-border-solid gl-border-gray-100 gl-border-1"
>
<div
class=
"gl-border-solid gl-border-gray-100 gl-border-1
gl-border-t-none!
"
>
<source-editor
ref=
"editor"
:file-name=
"ciConfigPath"
...
...
app/assets/javascripts/pipeline_editor/components/pipeline_editor_tabs.vue
View file @
c0097f59
...
...
@@ -16,6 +16,7 @@ import {
}
from
'
../constants
'
;
import
getAppStatus
from
'
../graphql/queries/client/app_status.graphql
'
;
import
CiConfigMergedPreview
from
'
./editor/ci_config_merged_preview.vue
'
;
import
CiEditorHeader
from
'
./editor/ci_editor_header.vue
'
;
import
TextEditor
from
'
./editor/text_editor.vue
'
;
import
CiLint
from
'
./lint/ci_lint.vue
'
;
import
EditorTab
from
'
./ui/editor_tab.vue
'
;
...
...
@@ -49,6 +50,7 @@ export default {
},
components
:
{
CiConfigMergedPreview
,
CiEditorHeader
,
CiLint
,
EditorTab
,
GlAlert
,
...
...
@@ -107,6 +109,7 @@ export default {
data-testid=
"editor-tab"
@
click=
"setCurrentTab($options.tabConstants.CREATE_TAB)"
>
<ci-editor-header
/>
<text-editor
:value=
"ciFileContent"
v-on=
"$listeners"
/>
</editor-tab>
<editor-tab
...
...
app/assets/javascripts/pipeline_editor/constants.js
View file @
c0097f59
...
...
@@ -33,3 +33,13 @@ export const BRANCH_PAGINATION_LIMIT = 20;
export
const
BRANCH_SEARCH_DEBOUNCE
=
'
500
'
;
export
const
STARTER_TEMPLATE_NAME
=
'
Getting-Started
'
;
export
const
pipelineEditorTrackingOptions
=
{
label
:
'
pipeline_editor
'
,
actions
:
{
browse_templates
:
'
browse_templates
'
,
},
};
export
const
TEMPLATE_REPOSITORY_URL
=
'
https://gitlab.com/gitlab-org/gitlab-foss/tree/master/lib/gitlab/ci/templates
'
;
locale/gitlab.pot
View file @
c0097f59
...
...
@@ -5579,6 +5579,9 @@ msgstr ""
msgid "Browse files"
msgstr ""
msgid "Browse templates"
msgstr ""
msgid "BuildArtifacts|An error occurred while fetching the artifacts"
msgstr ""
...
...
spec/frontend/pipeline_editor/components/editor/ci_editor_header_spec.js
0 → 100644
View file @
c0097f59
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
CiEditorHeader
from
'
~/pipeline_editor/components/editor/ci_editor_header.vue
'
;
import
{
pipelineEditorTrackingOptions
,
TEMPLATE_REPOSITORY_URL
,
}
from
'
~/pipeline_editor/constants
'
;
describe
(
'
CI Editor Header
'
,
()
=>
{
let
wrapper
;
let
trackingSpy
=
null
;
const
createComponent
=
()
=>
{
wrapper
=
shallowMount
(
CiEditorHeader
,
{});
};
const
findLinkBtn
=
()
=>
wrapper
.
findComponent
(
GlButton
);
afterEach
(()
=>
{
wrapper
.
destroy
();
unmockTracking
();
});
describe
(
'
link button
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
trackingSpy
=
mockTracking
(
undefined
,
wrapper
.
element
,
jest
.
spyOn
);
});
it
(
'
finds the browse template button
'
,
()
=>
{
expect
(
findLinkBtn
().
exists
()).
toBe
(
true
);
});
it
(
'
contains the link to the template repo
'
,
()
=>
{
expect
(
findLinkBtn
().
attributes
(
'
href
'
)).
toBe
(
TEMPLATE_REPOSITORY_URL
);
});
it
(
'
has the external-link icon
'
,
()
=>
{
expect
(
findLinkBtn
().
props
(
'
icon
'
)).
toBe
(
'
external-link
'
);
});
it
(
'
tracks the click on the browse button
'
,
async
()
=>
{
const
{
label
,
actions
}
=
pipelineEditorTrackingOptions
;
await
findLinkBtn
().
vm
.
$emit
(
'
click
'
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
actions
.
browse_templates
,
{
label
,
});
});
});
});
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