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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
0ade3a07
Commit
0ade3a07
authored
Aug 16, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates Vue component for trigger variables block in job log page
Regenerate pot files Remove `#` Remove empty lines
parent
ce18246c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
161 additions
and
0 deletions
+161
-0
app/assets/javascripts/jobs/components/trigger_block.vue
app/assets/javascripts/jobs/components/trigger_block.vue
+84
-0
changelogs/unreleased/50101-trigger.yml
changelogs/unreleased/50101-trigger.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/javascripts/jobs/trigger_value_spec.js
spec/javascripts/jobs/trigger_value_spec.js
+66
-0
No files found.
app/assets/javascripts/jobs/components/trigger_block.vue
0 → 100644
View file @
0ade3a07
<
script
>
export
default
{
props
:
{
shortToken
:
{
type
:
String
,
required
:
false
,
default
:
null
,
},
variables
:
{
type
:
Object
,
required
:
false
,
default
:
()
=>
({}),
},
},
data
()
{
return
{
areVariablesVisible
:
false
,
};
},
computed
:
{
hasVariables
()
{
return
Object
.
keys
(
this
.
variables
).
length
>
0
;
},
},
methods
:
{
revealVariables
()
{
this
.
areVariablesVisible
=
true
;
},
},
};
</
script
>
<
template
>
<div
class=
"build-widget block"
>
<h4
class=
"title"
>
{{
__
(
'
Trigger
'
)
}}
</h4>
<p
v-if=
"shortToken"
class=
"js-short-token"
>
<span
class=
"build-light-text"
>
{{
__
(
'
Token
'
)
}}
</span>
{{
shortToken
}}
</p>
<p
v-if=
"hasVariables"
>
<button
type=
"button"
class=
"btn btn-default group js-reveal-variables"
@
click=
"revealVariables"
>
{{
__
(
'
Reveal Variables
'
)
}}
</button>
</p>
<dl
v-if=
"areVariablesVisible"
class=
"js-build-variables trigger-build-variables"
>
<template
v-for=
"(value, key) in variables"
>
<dt
:key=
"`$
{key}-variable`"
class="js-build-variable trigger-build-variable"
>
{{
key
}}
</dt>
<dd
:key=
"`$
{key}-value`"
class="js-build-value trigger-build-value"
>
{{
value
}}
</dd>
</
template
>
</dl>
</div>
</template>
changelogs/unreleased/50101-trigger.yml
0 → 100644
View file @
0ade3a07
---
title
:
Creates Vue component for trigger variables block in job log page
merge_request
:
author
:
type
:
other
locale/gitlab.pot
View file @
0ade3a07
...
@@ -4649,6 +4649,9 @@ msgstr ""
...
@@ -4649,6 +4649,9 @@ msgstr ""
msgid "Retry verification"
msgid "Retry verification"
msgstr ""
msgstr ""
msgid "Reveal Variables"
msgstr ""
msgid "Reveal value"
msgid "Reveal value"
msgid_plural "Reveal values"
msgid_plural "Reveal values"
msgstr[0] ""
msgstr[0] ""
...
@@ -5784,6 +5787,9 @@ msgstr ""
...
@@ -5784,6 +5787,9 @@ msgstr ""
msgid "Trending"
msgid "Trending"
msgstr ""
msgstr ""
msgid "Trigger"
msgstr ""
msgid "Trigger this manual action"
msgid "Trigger this manual action"
msgstr ""
msgstr ""
...
...
spec/javascripts/jobs/trigger_value_spec.js
0 → 100644
View file @
0ade3a07
import
Vue
from
'
vue
'
;
import
component
from
'
~/jobs/components/trigger_block.vue
'
;
import
mountComponent
from
'
../helpers/vue_mount_component_helper
'
;
describe
(
'
Trigger block
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
component
);
let
vm
;
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
with short token
'
,
()
=>
{
it
(
'
renders short token
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
shortToken
:
'
0a666b2
'
,
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-short-token
'
).
textContent
).
toContain
(
'
0a666b2
'
);
});
});
describe
(
'
without short token
'
,
()
=>
{
it
(
'
does not render short token
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{});
expect
(
vm
.
$el
.
querySelector
(
'
.js-short-token
'
)).
toBeNull
();
});
});
describe
(
'
with variables
'
,
()
=>
{
describe
(
'
reveal variables
'
,
()
=>
{
it
(
'
reveals variables on click
'
,
done
=>
{
vm
=
mountComponent
(
Component
,
{
variables
:
{
key
:
'
value
'
,
variable
:
'
foo
'
,
},
});
vm
.
$el
.
querySelector
(
'
.js-reveal-variables
'
).
click
();
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-build-variables
'
)).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-build-variables
'
).
textContent
).
toContain
(
'
key
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-build-variables
'
).
textContent
).
toContain
(
'
value
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-build-variables
'
).
textContent
).
toContain
(
'
variable
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-build-variables
'
).
textContent
).
toContain
(
'
foo
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
});
describe
(
'
without variables
'
,
()
=>
{
it
(
'
does not render variables
'
,
()
=>
{
vm
=
mountComponent
(
Component
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-reveal-variables
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-build-variables
'
)).
toBeNull
();
});
});
});
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