Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ba3a81ab
Commit
ba3a81ab
authored
Dec 04, 2017
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ux: Add CTA for empty lists
parent
15f46b85
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
149 additions
and
3 deletions
+149
-3
public/app/core/angular_wrappers.ts
+2
-0
public/app/core/components/EmptyListCTA/EmptyListCTA.jest.tsx
+22
-0
public/app/core/components/EmptyListCTA/EmptyListCTA.tsx
+34
-0
public/app/core/components/EmptyListCTA/__snapshots__/EmptyListCTA.jest.tsx.snap
+38
-0
public/app/features/plugins/partials/ds_list.html
+12
-1
public/sass/_grafana.scss
+1
-0
public/sass/_variables.scss
+5
-2
public/sass/base/_type.scss
+2
-0
public/sass/components/_buttons.scss
+11
-0
public/sass/components/_empty_list_cta.scss
+22
-0
No files found.
public/app/core/angular_wrappers.ts
View file @
ba3a81ab
import
{
react2AngularDirective
}
from
'app/core/utils/react2angular'
;
import
{
PasswordStrength
}
from
'./components/PasswordStrength'
;
import
PageHeader
from
'./components/PageHeader'
;
import
EmptyListCTA
from
'./components/EmptyListCTA/EmptyListCTA'
;
export
function
registerAngularDirectives
()
{
react2AngularDirective
(
'passwordStrength'
,
PasswordStrength
,
[
'password'
]);
react2AngularDirective
(
'pageHeader'
,
PageHeader
,
[
'model'
,
"noTabs"
]);
react2AngularDirective
(
'emptyListCta'
,
EmptyListCTA
,
[
'model'
]);
}
public/app/core/components/EmptyListCTA/EmptyListCTA.jest.tsx
0 → 100644
View file @
ba3a81ab
import
React
from
'react'
;
import
renderer
from
'react-test-renderer'
;
import
EmptyListCTA
from
'./EmptyListCTA'
;
const
model
=
{
title
:
'Title'
,
buttonIcon
:
'ga css class'
,
buttonLink
:
'http://url/to/destination'
,
buttonTitle
:
'Click me'
,
proTip
:
'This is a tip'
,
proTipLink
:
'http://url/to/tip/destination'
,
proTipLinkTitle
:
'Learn more'
,
proTipTarget
:
'_blank'
};
describe
(
'CollorPalette'
,
()
=>
{
it
(
'renders correctly'
,
()
=>
{
const
tree
=
renderer
.
create
(<
EmptyListCTA
model=
{
model
}
/>).
toJSON
();
expect
(
tree
).
toMatchSnapshot
();
});
});
public/app/core/components/EmptyListCTA/EmptyListCTA.tsx
0 → 100644
View file @
ba3a81ab
import
React
,
{
Component
}
from
'react'
;
export
interface
IProps
{
model
:
any
;
}
class
EmptyListCTA
extends
Component
<
IProps
,
any
>
{
render
()
{
const
{
title
,
buttonIcon
,
buttonLink
,
buttonTitle
,
proTip
,
proTipLink
,
proTipLinkTitle
,
proTipTarget
}
=
this
.
props
.
model
;
return
(
<
div
className=
"empty-list-cta p-t-2 p-b-1"
>
<
div
className=
"empty-list-cta__title"
>
{
title
}
</
div
>
<
a
href=
{
buttonLink
}
className=
"empty-list-cta__button btn btn-xlarge btn-success"
><
i
className=
{
buttonIcon
}
/>
{
buttonTitle
}
</
a
>
<
div
className=
"empty-list-cta__pro-tip"
>
<
i
className=
"fa fa-rocket"
/>
ProTip:
{
proTip
}
<
a
className=
"text-link empty-list-cta__pro-tip-link"
href=
{
proTipLink
}
target=
{
proTipTarget
}
>
{
proTipLinkTitle
}
</
a
>
</
div
>
</
div
>
);
}
}
export
default
EmptyListCTA
;
public/app/core/components/EmptyListCTA/__snapshots__/EmptyListCTA.jest.tsx.snap
0 → 100644
View file @
ba3a81ab
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`CollorPalette renders correctly 1`] = `
<div
className="empty-list-cta p-t-2 p-b-1"
>
<div
className="empty-list-cta__title"
>
Title
</div>
<a
className="empty-list-cta__button btn btn-xlarge btn-success"
href="http://url/to/destination"
>
<i
className="ga css class"
/>
Click me
</a>
<div
className="empty-list-cta__pro-tip"
>
<i
className="fa fa-rocket"
/>
ProTip:
This is a tip
<a
className="text-link empty-list-cta__pro-tip-link"
href="http://url/to/tip/destination"
target="_blank"
>
Learn more
</a>
</div>
</div>
`;
public/app/features/plugins/partials/ds_list.html
View file @
ba3a81ab
<page-header
model=
"ctrl.navModel"
></page-header>
<div
class=
"page-container page-body"
>
<div
ng-if=
"ctrl.datasources.length"
>
<div
class=
"page-action-bar"
>
<div
class=
"page-action-bar__spacer"
></div>
<a
class=
"page-header__cta btn btn-success"
href=
"datasources/new"
>
...
...
@@ -39,8 +40,18 @@
</li>
</ol>
</section>
</div>
<div
ng-if=
"ctrl.datasources.length === 0"
>
<em>
No data sources defined
</em>
<empty-list-cta
model=
"{
title: 'There are no data sources defined yet',
buttonIcon: 'gicon gicon-dashboard-new',
buttonLink: '/datasources/new',
buttonTitle: 'Add data source',
proTip: 'You can also define data sources through configuration files.',
proTipLink: 'http://docs.grafana.org/administration/provisioning/#datasources',
proTipLinkTitle: 'Learn more',
proTipTarget: '_blank'
}"
/>
</div>
</div>
public/sass/_grafana.scss
View file @
ba3a81ab
...
...
@@ -86,6 +86,7 @@
@import
"components/dashboard_grid"
;
@import
"components/dashboard_list"
;
@import
"components/page_header"
;
@import
"components/empty_list_cta"
;
// PAGES
...
...
public/sass/_variables.scss
View file @
ba3a81ab
...
...
@@ -218,8 +218,11 @@ $btn-font-weight: 500 !default;
$btn-padding-x-sm
:
.5rem
!
default
;
$btn-padding-y-sm
:
.25rem
!
default
;
$btn-padding-x-lg
:
1
.5rem
!
default
;
$btn-padding-y-lg
:
.75rem
!
default
;
$btn-padding-x-lg
:
21px
!
default
;
$btn-padding-y-lg
:
11px
!
default
;
$btn-padding-x-xl
:
21px
!
default
;
$btn-padding-y-xl
:
11px
!
default
;
$btn-border-radius
:
3px
;
...
...
public/sass/base/_type.scss
View file @
ba3a81ab
...
...
@@ -48,6 +48,8 @@ a.text-success:hover,
a
.text-success
:focus
{
color
:
darken
(
$success-text-color
,
10%
);
}
a
{
cursor
:
pointer
;
}
.text-link
{
text-decoration
:
underline
;
}
a
:focus
{
outline
:
0
none
!
important
;
}
...
...
public/sass/components/_buttons.scss
View file @
ba3a81ab
...
...
@@ -51,10 +51,21 @@
// Button Sizes
// --------------------------------------------------
// XLarge
.btn-xlarge
{
@include
button-size
(
$btn-padding-y-xl
,
$btn-padding-x-xl
,
$font-size-lg
,
$btn-border-radius
);
font-weight
:
normal
;
padding-bottom
:
$btn-padding-y-xl
-
3
;
.gicon
{
font-size
:
31px
;
margin-right
:
1rem
;
}
}
// Large
.btn-large
{
@include
button-size
(
$btn-padding-y-lg
,
$btn-padding-x-lg
,
$font-size-lg
,
$btn-border-radius
);
font-weight
:
normal
;
}
.btn-small
{
...
...
public/sass/components/_empty_list_cta.scss
0 → 100644
View file @
ba3a81ab
.empty-list-cta
{
background-color
:
$search-filter-box-bg
;
text-align
:
center
;
}
.empty-list-cta__title
{
padding-bottom
:
30px
;
font-style
:
italic
;
}
.empty-list-cta__button
{
margin-bottom
:
50px
;
}
.empty-list-cta__pro-tip
{
padding-bottom
:
20px
;
}
.empty-list-cta__pro-tip-link
{
margin-left
:
5px
;
}
\ No newline at end of file
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