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
Léo-Paul Géneau
gitlab-ce
Commits
8369ea89
Commit
8369ea89
authored
Aug 16, 2018
by
Filipa Lacerda
Committed by
Phil Hughes
Aug 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates empty state component for job log view
parent
a7045bd3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
0 deletions
+171
-0
app/assets/javascripts/jobs/components/empty_state.vue
app/assets/javascripts/jobs/components/empty_state.vue
+76
-0
changelogs/unreleased/50101-empty-state-component.yml
changelogs/unreleased/50101-empty-state-component.yml
+5
-0
spec/javascripts/jobs/empty_state_spec.js
spec/javascripts/jobs/empty_state_spec.js
+90
-0
No files found.
app/assets/javascripts/jobs/components/empty_state.vue
0 → 100644
View file @
8369ea89
<
script
>
export
default
{
props
:
{
illustrationPath
:
{
type
:
String
,
required
:
true
,
},
illustrationSizeClass
:
{
type
:
String
,
required
:
true
,
},
title
:
{
type
:
String
,
required
:
true
,
},
content
:
{
type
:
String
,
required
:
false
,
default
:
null
,
},
action
:
{
type
:
Object
,
required
:
false
,
default
:
null
,
validator
(
value
)
{
return
(
value
===
null
||
(
Object
.
prototype
.
hasOwnProperty
.
call
(
value
,
'
link
'
)
&&
Object
.
prototype
.
hasOwnProperty
.
call
(
value
,
'
method
'
)
&&
Object
.
prototype
.
hasOwnProperty
.
call
(
value
,
'
title
'
))
);
},
},
},
};
</
script
>
<
template
>
<div
class=
"row empty-state"
>
<div
class=
"col-12"
>
<div
:class=
"illustrationSizeClass"
class=
"svg-content"
>
<img
:src=
"illustrationPath"
/>
</div>
</div>
<div
class=
"col-12"
>
<div
class=
"text-content"
>
<h4
class=
"js-job-empty-state-title text-center"
>
{{
title
}}
</h4>
<p
v-if=
"content"
class=
"js-job-empty-state-content"
>
{{
content
}}
</p>
<div
v-if=
"action"
class=
"text-center"
>
<a
:href=
"action.link"
:data-method=
"action.method"
class=
"js-job-empty-state-action btn btn-primary"
>
{{
action
.
title
}}
</a>
</div>
</div>
</div>
</div>
</
template
>
changelogs/unreleased/50101-empty-state-component.yml
0 → 100644
View file @
8369ea89
---
title
:
Creates empty state vue component for job view
merge_request
:
author
:
type
:
other
spec/javascripts/jobs/empty_state_spec.js
0 → 100644
View file @
8369ea89
import
Vue
from
'
vue
'
;
import
component
from
'
~/jobs/components/empty_state.vue
'
;
import
mountComponent
from
'
../helpers/vue_mount_component_helper
'
;
describe
(
'
Empty State
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
component
);
let
vm
;
const
props
=
{
illustrationPath
:
'
illustrations/pending_job_empty.svg
'
,
illustrationSizeClass
:
'
svg-430
'
,
title
:
'
This job has not started yet
'
,
};
const
content
=
'
This job is in pending state and is waiting to be picked by a runner
'
;
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
renders image and title
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
...
props
,
content
,
});
});
it
(
'
renders img with provided path and size
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
img
'
).
getAttribute
(
'
src
'
)).
toEqual
(
props
.
illustrationPath
);
expect
(
vm
.
$el
.
querySelector
(
'
.svg-content
'
).
classList
).
toContain
(
props
.
illustrationSizeClass
);
});
it
(
'
renders provided title
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-title
'
).
textContent
.
trim
()).
toEqual
(
props
.
title
,
);
});
});
describe
(
'
with content
'
,
()
=>
{
it
(
'
renders content
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
...
props
,
content
,
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-content
'
).
textContent
.
trim
()).
toEqual
(
content
,
);
});
});
describe
(
'
without content
'
,
()
=>
{
it
(
'
does not render content
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
...
props
,
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-content
'
)).
toBeNull
();
});
});
describe
(
'
with action
'
,
()
=>
{
it
(
'
renders action
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
...
props
,
content
,
action
:
{
link
:
'
runner
'
,
title
:
'
Check runner
'
,
method
:
'
post
'
,
},
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-action
'
).
getAttribute
(
'
href
'
)).
toEqual
(
'
runner
'
,
);
});
});
describe
(
'
without action
'
,
()
=>
{
it
(
'
does not render action
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
...
props
,
content
,
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-job-empty-state-action
'
)).
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