feat(instances): show networks empty box

This commit is contained in:
Sara Vieira 2018-03-02 12:16:20 +00:00 committed by Sérgio Ramos
parent 11c41272d0
commit c673822cad
4 changed files with 655 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import React from 'react';
import styled from 'styled-components';
import { Margin, Padding } from 'styled-components-spacing';
import Flex from 'styled-flex-component';
import { isNot } from 'styled-is';
import is, { isNot } from 'styled-is';
import remcalc from 'remcalc';
import { H3, Card } from 'joyent-ui-toolkit';
@ -16,6 +16,10 @@ const NoPackagesTitle = styled(H3)`
const FullWidthCard = styled(Card)`
width: calc(100% - ${remcalc(2)});
${is('transparent')`
background: transparent;
`};
${isNot('borderTop')`
border-top: none;
`};

View File

@ -40,7 +40,15 @@ import createClient from '@state/apollo-client';
import parseError from '@state/parse-error';
import { Forms, Values } from '@root/constants';
const { IC_F, IC_NAME_F, IC_IMG_F, IC_PKG_F_SELECT, IC_NW_F, IC_US_F, IC_FW_F_ENABLED } = Forms;
const {
IC_F,
IC_NAME_F,
IC_IMG_F,
IC_PKG_F_SELECT,
IC_NW_F,
IC_US_F,
IC_FW_F_ENABLED
} = Forms;
const {
IC_MD_V_MD,

View File

@ -9,6 +9,14 @@ exports[`renders <Networks /> without throwing 1`] = `
margin-bottom: 1.125rem;
}
.c11 {
margin-bottom: 0.75rem;
}
.c9 {
padding: 2.25rem;
}
.c5 {
color: rgba(73,73,73,1);
line-height: 1.5rem;
@ -75,6 +83,69 @@ exports[`renders <Networks /> without throwing 1`] = `
margin-top: 1.5rem;
}
.c10 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: start;
-webkit-justify-content: flex-start;
-ms-flex-pack: start;
justify-content: flex-start;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c8 {
box-sizing: content-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
border-width: 0.0625rem;
border-style: solid;
-webkit-transition: all 300ms ease;
transition: all 300ms ease;
color: rgba(73,73,73,1);
background-color: rgb(255,255,255);
border-color: rgb(216,216,216);
}
.c12 {
color: rgb(151,151,151);
text-align: center;
}
.c7 {
width: calc(100% - 0.125rem);
background: transparent;
}
@media only screen and (min-width:48em) {
.c0 {
width: 46rem;
@ -154,6 +225,252 @@ exports[`renders <Networks /> without throwing 1`] = `
>
Networks attached to this instance
</h3>
<div
className="c7 c8"
disabled={false}
name="card"
>
<div
className="c9"
>
<div
className="c10"
>
<div
className="c11"
>
<svg
height={60}
viewBox="0 0 79 60"
width={79}
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<title>
Guilty_Salamander
</title>
<desc>
Created using Figma
</desc>
<use
fill="#FAA427"
transform="translate(23.8 22)"
xlinkHref="#a"
/>
<use
fill="#F3722C"
transform="translate(27.3 25.5)"
xlinkHref="#b"
/>
<use
fill="#FAA427"
transform="translate(4.8 32.1)"
xlinkHref="#c"
/>
<use
fill="#F3722C"
transform="translate(12.2 31.8)"
xlinkHref="#d"
/>
<use
fill="#FAA427"
transform="translate(54.4 31.9)"
xlinkHref="#e"
/>
<use
fill="#F3722C"
transform="translate(54.4 32)"
xlinkHref="#f"
/>
<use
fill="#FAA427"
transform="translate(15.8 26.8)"
xlinkHref="#g"
/>
<use
fill="#FAA427"
transform="translate(5)"
xlinkHref="#h"
/>
<use
fill="#FAFBFC"
transform="rotate(-15.13 41.037 5.45)"
xlinkHref="#i"
/>
<use
fill="#412B13"
transform="rotate(-15.13 67.273 -24.78)"
xlinkHref="#j"
/>
<use
fill="#F3722C"
transform="translate(2.2 8)"
xlinkHref="#k"
/>
<use
fill="#FAFBFC"
transform="rotate(-74.87 40.46 -20.511)"
xlinkHref="#l"
/>
<use
fill="#412B13"
transform="rotate(-74.87 41.364 -22.098)"
xlinkHref="#m"
/>
<use
fill="#F3722C"
transform="translate(52.1 8)"
xlinkHref="#n"
/>
<use
fill="#F3722C"
transform="translate(31.5 34.3)"
xlinkHref="#o"
/>
<use
fill="#F3722C"
transform="translate(14.3)"
xlinkHref="#p"
/>
<use
fill="#F3722C"
transform="translate(30.9 18.9)"
xlinkHref="#q"
/>
<use
fill="#F3722C"
transform="translate(37.6 18.9)"
xlinkHref="#r"
/>
<use
fill="#FAA427"
transform="translate(27.4 53.9)"
xlinkHref="#s"
/>
<use
fill="#FAA427"
transform="translate(39.1 53.9)"
xlinkHref="#t"
/>
<use
fill="#F3722C"
transform="translate(27.4 53.9)"
xlinkHref="#u"
/>
<use
fill="#342013"
transform="translate(28.6 26.2)"
xlinkHref="#v"
/>
<use
fill="#FFF"
transform="translate(32.6 28.7)"
xlinkHref="#w"
/>
<defs>
<path
d="M54.921 36.053L0 0l1.413 24.908c.359 6.249 5.752 11.145 12.283 11.145H54.92z"
id="a"
/>
<path
d="M42.12 32.526L13.47 0 0 23.737c.282 4.924 4.527 8.778 9.672 8.778l32.448.01z"
id="b"
/>
<path
d="M3.326 17.01a3.312 3.312 0 0 1-1.545-6.25C6.059 8.52 8.482 2.226 8.52 2.165a3.313 3.313 0 0 1 6.216 2.296c-.133.354-3.312 8.717-9.86 12.145-.475.26-1.008.4-1.55.403z"
id="c"
/>
<path
d="M5.079 9.205A28.654 28.654 0 0 0 7.287 4.75a3.312 3.312 0 1 0-6.183-2.296C.781 3.234.412 3.996 0 4.734c1.33 1.181 3.544 3.152 5.079 4.471z"
id="d"
/>
<path
d="M11.682 17.27a3.312 3.312 0 0 0 1.545-6.248C8.95 8.78 6.526 2.487 6.504 2.427A3.312 3.312 0 1 0 .316 4.723c.126.353 3.312 8.717 9.853 12.145.464.254.983.393 1.513.403z"
id="e"
/>
<path
d="M2.45 9.01A28.33 28.33 0 0 1 .242 4.553a3.312 3.312 0 1 1 6.21-2.296c.326.78.695 1.54 1.104 2.28C6.187 5.719 3.973 7.69 2.45 9.009z"
id="f"
/>
<path
d="M35.159 0H6.542A6.542 6.542 0 0 0 0 6.542v14.016a6.542 6.542 0 0 0 6.542 6.541h28.617a6.541 6.541 0 0 0 6.541-6.541V6.542A6.542 6.542 0 0 0 35.16 0z"
id="g"
/>
<path
d="M54.254 0H9.026A9.026 9.026 0 0 0 0 9.026v17.207a9.026 9.026 0 0 0 9.026 9.025h45.228a9.026 9.026 0 0 0 9.025-9.026V9.027A9.026 9.026 0 0 0 54.253 0z"
id="h"
/>
<path
d="M9.721 18.637c5.37 0 9.721-4.172 9.721-9.319C19.442 4.172 15.09 0 9.722 0 4.351 0 0 4.172 0 9.318c0 5.147 4.352 9.319 9.721 9.319z"
id="i"
/>
<path
d="M5.19 9.959c2.865 0 5.188-2.23 5.188-4.98C10.378 2.23 8.055 0 5.19 0S0 2.23 0 4.98c0 2.75 2.323 4.979 5.19 4.979z"
id="j"
/>
<path
d="M7.262.351C2.078 1.753-1.018 6.921.306 11.89l18.77-5.073C17.705 1.847 12.411-1.045 7.261.35z"
id="k"
/>
<path
d="M9.318 19.442c5.147 0 9.319-4.352 9.319-9.72C18.637 4.351 14.465 0 9.318 0 4.172 0 0 4.352 0 9.721c0 5.37 4.172 9.721 9.318 9.721z"
id="l"
/>
<path
d="M4.98 10.378c2.75 0 4.979-2.323 4.979-5.189S7.729 0 4.979 0C2.23 0 0 2.323 0 5.19c0 2.865 2.23 5.188 4.98 5.188z"
id="m"
/>
<path
d="M11.819.351c5.178 1.402 8.28 6.57 6.95 11.538L0 6.816C1.347 1.847 6.635-1.045 11.819.35z"
id="n"
/>
<path
d="M5.106 4.897A5.007 5.007 0 0 0 10.218 0H0a5.001 5.001 0 0 0 5.106 4.897z"
id="o"
/>
<path
d="M0 0l22.258 18.498L44.516 0H0z"
id="p"
/>
<path
d="M2.445 0A2.396 2.396 0 0 0 0 2.342h4.885a2.39 2.39 0 0 0-2.44-2.34z"
id="q"
/>
<path
d="M2.462 0A2.396 2.396 0 0 0 0 2.343h4.885A2.39 2.39 0 0 0 2.462 0z"
id="r"
/>
<path
d="M0 0h6.227v3.091A3.047 3.047 0 0 1 3.18 6.14h-.127A3.047 3.047 0 0 1 .006 3.09V0H0z"
id="s"
/>
<path
d="M.006 0H6.22v3.091A3.047 3.047 0 0 1 3.174 6.14h-.127A3.047 3.047 0 0 1 0 3.09V0h.006z"
id="t"
/>
<path
d="M31.328 0H0v1.474h31.328V0z"
id="u"
/>
<path
d="M15.422 1.503A17.422 17.422 0 0 0 8.113.002 17.4 17.4 0 0 0 .805 1.503a1.457 1.457 0 0 0 .629 2.76h2.572V4.06a1.579 1.579 0 0 1 2.126-1.468 6.194 6.194 0 0 0 3.963 0 1.574 1.574 0 0 1 2.12 1.468v.204h2.572a1.463 1.463 0 0 0 .635-2.76z"
id="v"
/>
<path
d="M6.072.104a6.194 6.194 0 0 1-3.963 0A1.579 1.579 0 0 0 0 1.573v.204h8.209v-.204A1.573 1.573 0 0 0 6.072.104z"
id="w"
/>
</defs>
</svg>
</div>
<h3
className="c12 c6"
>
You have no networks attached to this instance
</h3>
</div>
</div>
</div>
</div>
`;
@ -166,10 +483,18 @@ exports[`renders <Networks error /> without throwing 1`] = `
margin-bottom: 1.125rem;
}
.c17 {
margin-bottom: 0.75rem;
}
.c7 {
margin-bottom: 1.5rem;
}
.c15 {
padding: 2.25rem;
}
.c5 {
color: rgba(73,73,73,1);
line-height: 1.5rem;
@ -253,6 +578,37 @@ exports[`renders <Networks error /> without throwing 1`] = `
margin: 0;
}
.c16 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: start;
-webkit-justify-content: flex-start;
-ms-flex-pack: start;
justify-content: flex-start;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.c8 {
display: -webkit-box;
display: -webkit-flex;
@ -279,6 +635,38 @@ exports[`renders <Networks error /> without throwing 1`] = `
padding: 1.125rem 1.125rem;
}
.c14 {
box-sizing: content-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
position: relative;
border-width: 0.0625rem;
border-style: solid;
-webkit-transition: all 300ms ease;
transition: all 300ms ease;
color: rgba(73,73,73,1);
background-color: rgb(255,255,255);
border-color: rgb(216,216,216);
}
.c18 {
color: rgb(151,151,151);
text-align: center;
}
.c13 {
width: calc(100% - 0.125rem);
background: transparent;
}
@media only screen and (min-width:48em) {
.c0 {
width: 46rem;
@ -383,6 +771,252 @@ exports[`renders <Networks error /> without throwing 1`] = `
</div>
</div>
</div>
<div
className="c13 c14"
disabled={false}
name="card"
>
<div
className="c15"
>
<div
className="c16"
>
<div
className="c17"
>
<svg
height={60}
viewBox="0 0 79 60"
width={79}
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<title>
Guilty_Salamander
</title>
<desc>
Created using Figma
</desc>
<use
fill="#FAA427"
transform="translate(23.8 22)"
xlinkHref="#a"
/>
<use
fill="#F3722C"
transform="translate(27.3 25.5)"
xlinkHref="#b"
/>
<use
fill="#FAA427"
transform="translate(4.8 32.1)"
xlinkHref="#c"
/>
<use
fill="#F3722C"
transform="translate(12.2 31.8)"
xlinkHref="#d"
/>
<use
fill="#FAA427"
transform="translate(54.4 31.9)"
xlinkHref="#e"
/>
<use
fill="#F3722C"
transform="translate(54.4 32)"
xlinkHref="#f"
/>
<use
fill="#FAA427"
transform="translate(15.8 26.8)"
xlinkHref="#g"
/>
<use
fill="#FAA427"
transform="translate(5)"
xlinkHref="#h"
/>
<use
fill="#FAFBFC"
transform="rotate(-15.13 41.037 5.45)"
xlinkHref="#i"
/>
<use
fill="#412B13"
transform="rotate(-15.13 67.273 -24.78)"
xlinkHref="#j"
/>
<use
fill="#F3722C"
transform="translate(2.2 8)"
xlinkHref="#k"
/>
<use
fill="#FAFBFC"
transform="rotate(-74.87 40.46 -20.511)"
xlinkHref="#l"
/>
<use
fill="#412B13"
transform="rotate(-74.87 41.364 -22.098)"
xlinkHref="#m"
/>
<use
fill="#F3722C"
transform="translate(52.1 8)"
xlinkHref="#n"
/>
<use
fill="#F3722C"
transform="translate(31.5 34.3)"
xlinkHref="#o"
/>
<use
fill="#F3722C"
transform="translate(14.3)"
xlinkHref="#p"
/>
<use
fill="#F3722C"
transform="translate(30.9 18.9)"
xlinkHref="#q"
/>
<use
fill="#F3722C"
transform="translate(37.6 18.9)"
xlinkHref="#r"
/>
<use
fill="#FAA427"
transform="translate(27.4 53.9)"
xlinkHref="#s"
/>
<use
fill="#FAA427"
transform="translate(39.1 53.9)"
xlinkHref="#t"
/>
<use
fill="#F3722C"
transform="translate(27.4 53.9)"
xlinkHref="#u"
/>
<use
fill="#342013"
transform="translate(28.6 26.2)"
xlinkHref="#v"
/>
<use
fill="#FFF"
transform="translate(32.6 28.7)"
xlinkHref="#w"
/>
<defs>
<path
d="M54.921 36.053L0 0l1.413 24.908c.359 6.249 5.752 11.145 12.283 11.145H54.92z"
id="a"
/>
<path
d="M42.12 32.526L13.47 0 0 23.737c.282 4.924 4.527 8.778 9.672 8.778l32.448.01z"
id="b"
/>
<path
d="M3.326 17.01a3.312 3.312 0 0 1-1.545-6.25C6.059 8.52 8.482 2.226 8.52 2.165a3.313 3.313 0 0 1 6.216 2.296c-.133.354-3.312 8.717-9.86 12.145-.475.26-1.008.4-1.55.403z"
id="c"
/>
<path
d="M5.079 9.205A28.654 28.654 0 0 0 7.287 4.75a3.312 3.312 0 1 0-6.183-2.296C.781 3.234.412 3.996 0 4.734c1.33 1.181 3.544 3.152 5.079 4.471z"
id="d"
/>
<path
d="M11.682 17.27a3.312 3.312 0 0 0 1.545-6.248C8.95 8.78 6.526 2.487 6.504 2.427A3.312 3.312 0 1 0 .316 4.723c.126.353 3.312 8.717 9.853 12.145.464.254.983.393 1.513.403z"
id="e"
/>
<path
d="M2.45 9.01A28.33 28.33 0 0 1 .242 4.553a3.312 3.312 0 1 1 6.21-2.296c.326.78.695 1.54 1.104 2.28C6.187 5.719 3.973 7.69 2.45 9.009z"
id="f"
/>
<path
d="M35.159 0H6.542A6.542 6.542 0 0 0 0 6.542v14.016a6.542 6.542 0 0 0 6.542 6.541h28.617a6.541 6.541 0 0 0 6.541-6.541V6.542A6.542 6.542 0 0 0 35.16 0z"
id="g"
/>
<path
d="M54.254 0H9.026A9.026 9.026 0 0 0 0 9.026v17.207a9.026 9.026 0 0 0 9.026 9.025h45.228a9.026 9.026 0 0 0 9.025-9.026V9.027A9.026 9.026 0 0 0 54.253 0z"
id="h"
/>
<path
d="M9.721 18.637c5.37 0 9.721-4.172 9.721-9.319C19.442 4.172 15.09 0 9.722 0 4.351 0 0 4.172 0 9.318c0 5.147 4.352 9.319 9.721 9.319z"
id="i"
/>
<path
d="M5.19 9.959c2.865 0 5.188-2.23 5.188-4.98C10.378 2.23 8.055 0 5.19 0S0 2.23 0 4.98c0 2.75 2.323 4.979 5.19 4.979z"
id="j"
/>
<path
d="M7.262.351C2.078 1.753-1.018 6.921.306 11.89l18.77-5.073C17.705 1.847 12.411-1.045 7.261.35z"
id="k"
/>
<path
d="M9.318 19.442c5.147 0 9.319-4.352 9.319-9.72C18.637 4.351 14.465 0 9.318 0 4.172 0 0 4.352 0 9.721c0 5.37 4.172 9.721 9.318 9.721z"
id="l"
/>
<path
d="M4.98 10.378c2.75 0 4.979-2.323 4.979-5.189S7.729 0 4.979 0C2.23 0 0 2.323 0 5.19c0 2.865 2.23 5.188 4.98 5.188z"
id="m"
/>
<path
d="M11.819.351c5.178 1.402 8.28 6.57 6.95 11.538L0 6.816C1.347 1.847 6.635-1.045 11.819.35z"
id="n"
/>
<path
d="M5.106 4.897A5.007 5.007 0 0 0 10.218 0H0a5.001 5.001 0 0 0 5.106 4.897z"
id="o"
/>
<path
d="M0 0l22.258 18.498L44.516 0H0z"
id="p"
/>
<path
d="M2.445 0A2.396 2.396 0 0 0 0 2.342h4.885a2.39 2.39 0 0 0-2.44-2.34z"
id="q"
/>
<path
d="M2.462 0A2.396 2.396 0 0 0 0 2.343h4.885A2.39 2.39 0 0 0 2.462 0z"
id="r"
/>
<path
d="M0 0h6.227v3.091A3.047 3.047 0 0 1 3.18 6.14h-.127A3.047 3.047 0 0 1 .006 3.09V0H0z"
id="s"
/>
<path
d="M.006 0H6.22v3.091A3.047 3.047 0 0 1 3.174 6.14h-.127A3.047 3.047 0 0 1 0 3.09V0h.006z"
id="t"
/>
<path
d="M31.328 0H0v1.474h31.328V0z"
id="u"
/>
<path
d="M15.422 1.503A17.422 17.422 0 0 0 8.113.002 17.4 17.4 0 0 0 .805 1.503a1.457 1.457 0 0 0 .629 2.76h2.572V4.06a1.579 1.579 0 0 1 2.126-1.468 6.194 6.194 0 0 0 3.963 0 1.574 1.574 0 0 1 2.12 1.468v.204h2.572a1.463 1.463 0 0 0 .635-2.76z"
id="v"
/>
<path
d="M6.072.104a6.194 6.194 0 0 1-3.963 0A1.579 1.579 0 0 0 0 1.573v.204h8.209v-.204A1.573 1.573 0 0 0 6.072.104z"
id="w"
/>
</defs>
</svg>
</div>
<h3
className="c18 c6"
>
You have no networks attached to this instance
</h3>
</div>
</div>
</div>
</div>
`;

View File

@ -21,6 +21,7 @@ import {
import Network from '@components/network';
import Description from '@components/description';
import GetNetworks from '@graphql/list-instance-networks.gql';
import Empty from '@components/empty';
export const Networks = ({
networks = [],
@ -45,7 +46,7 @@ export const Networks = ({
</Margin>
<H3>Networks attached to this instance</H3>
{loading ? <StatusLoader /> : null}
{!loading && error ? (
{!loading && error && !networks.length ? (
<Margin bottom={4}>
<Message error>
<MessageTitle>Ooops!</MessageTitle>
@ -69,6 +70,11 @@ export const Networks = ({
readOnly
/>
))}
{!loading && !error && !networks.length ? (
<Empty transparent borderTop>
You have no networks attached to this instance
</Empty>
) : null}
</ViewContainer>
);