Protoboard wizard updates (#4601)

* fix background color, increase icon size

* Remove suggest dashboards button, auto-suggest dashboards

* style updates

* Add selected dashboard count to next button

* add label getter

* Skip loads completion card instead of exiting wizard
pull/4603/head
Daniel Campbell 2018-10-16 14:33:54 -07:00 committed by GitHub
parent e15a8acef7
commit 3be556d230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 115 additions and 47 deletions

View File

@ -6,7 +6,7 @@
.card-select--card {
min-width: 100%;
min-height: 100%;
background-color: $g1-raven;
background-color: $g2-kevlar;
border-radius: $radius;
border: $ix-border solid transparent;
transition: border-color 0.2s ease, background-color 0.2s ease;
@ -71,7 +71,7 @@
min-width: 100%;
display: inline-block;
position: absolute;
bottom: 5%;
bottom: 10%;
font-family: $ix-text-font;
color: $ix-text-default;
font-size: $ix-text-base;

View File

@ -2,8 +2,8 @@
position: relative;
svg {
margin: 0 20%;
width: 60%;
margin: 0 10%;
width: 80%;
}
.protoboard-icon--shape {

View File

@ -170,18 +170,16 @@ class WizardController extends PureComponent<Props, State> {
private get skipLink() {
const {handleSkip, skipLinkText} = this.props
const {steps} = this.state
if (handleSkip) {
return (
<button
className="btn btn-xs btn-primary btn-link wizard-skip-link"
onClick={handleSkip}
>
{skipLinkText}
</button>
)
}
return null
return (
<button
className="btn btn-xs btn-primary btn-link wizard-skip-link"
onClick={handleSkip || this.jumpToStep(steps.length - 1)}
>
{skipLinkText}
</button>
)
}
private get switchLink() {

View File

@ -11,6 +11,8 @@
position: relative;
min-width: 100%;
min-height: 100%;
background-color: $g0-obsidian;
@include gradient-v($g2-kevlar,$g0-obsidian);
}
.wizard-container {
@ -18,7 +20,7 @@
display: inline-flex;
border-radius: $radius;
width: 60%;
min-width: 800px;
max-width: 1200px;
min-width: 700px;
max-width: 1000px;
background-color: $g1-raven;
}

View File

@ -11,9 +11,10 @@
}
.wizard-step--child {
padding: 0 $ix-marg-d $ix-marg-d $ix-marg-d;
padding: 0 $ix-marg-d $ix-marg-b $ix-marg-d;
margin: $ix-marg-b auto;
overflow-y: auto;
max-height: 30vh;
max-height: 45vh;
min-height: 10vh;
position: relative;
z-index: 10;

View File

@ -40,6 +40,12 @@ exports[`WizardController with multiple children matches snapshot with two child
>
step child 1
</WizardStep>
<button
className="btn btn-xs btn-primary btn-link wizard-skip-link"
onClick={[Function]}
>
skip
</button>
</div>
`;
@ -82,6 +88,12 @@ exports[`WizardController with multiple children with first step complete matche
>
step child 2
</WizardStep>
<button
className="btn btn-xs btn-primary btn-link wizard-skip-link"
onClick={[Function]}
>
skip
</button>
</div>
`;
@ -120,5 +132,11 @@ exports[`WizardController with one child matches snapshot with one child 1`] = `
>
only step child
</WizardStep>
<button
className="btn btn-xs btn-primary btn-link wizard-skip-link"
onClick={[Function]}
>
skip
</button>
</div>
`;

View File

@ -32,6 +32,7 @@ interface State {
dashboardError: boolean
dashboardsCreated: Protoboard[]
hasNextOnDashboard: boolean
selectedDashboards: number
}
@ErrorHandling
@ -59,6 +60,7 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
dashboardError: false,
dashboardsCreated: [],
hasNextOnDashboard: false,
selectedDashboards: 0,
}
}
@ -103,12 +105,15 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
tipText="Select Dashboards you would like to create:"
isComplete={this.isDashboardComplete}
isErrored={dashboardError}
nextLabel={this.dashboardNextLabel}
onNext={this.handleDashboardNext}
previousLabel="Go Back"
>
<DashboardStep
ref={c => (this.dashboardStepRef = c && c.getWrappedInstance())}
source={source}
dashboardsCreated={dashboardsCreated}
countSelected={this.countSelected}
/>
</WizardStep>
<WizardStep
@ -184,6 +189,22 @@ class ConnectionWizard extends PureComponent<Props & WithRouterProps, State> {
return response
}
private countSelected = (selectedDashboards: number) => {
this.setState({selectedDashboards})
}
private get dashboardNextLabel(): string {
const {selectedDashboards} = this.state
if (selectedDashboards) {
return `Create ${selectedDashboards} Dashboard${
selectedDashboards > 1 ? 's' : ''
}`
}
return 'Next'
}
// KapacitorStep
private isKapacitorComplete = () => {
const {kapacitor} = this.state

View File

@ -17,7 +17,6 @@
font-weight: 600;
font-size: 14.5px;
line-height: 1.55em;
color: #a4a8b6;
margin-bottom: 3px;
margin-left: 2px;
color: $g12-forge;
margin: $ix-marg-b 0 $ix-marg-a 2px;
}

View File

@ -44,6 +44,7 @@ interface Props {
notify: typeof notifyAction
dashboardsCreated: Protoboard[]
source: Source
countSelected: (selectedDashboards: number) => void
}
@ErrorHandling
@ -64,7 +65,8 @@ class DashboardStep extends Component<Props, State> {
public async componentDidMount() {
const protoboards = await getProtoboards()
this.setState({protoboards})
this.props.countSelected(0)
this.setState({protoboards}, this.handleSuggest)
}
public next = async (): Promise<NextReturn> => {
@ -106,12 +108,6 @@ class DashboardStep extends Component<Props, State> {
placeholder="Filter by name..."
onSearch={this.setSearchTerm}
/>
<button
className="btn btn-sm btn-primary"
onClick={this.handleSuggest}
>
Suggest dashboards
</button>
</div>
{this.suggestedDashboardCards}
{this.dashboardCards}
@ -194,21 +190,23 @@ class DashboardStep extends Component<Props, State> {
const {protoboards} = this.state
const {source, notify} = this.props
const suggestedProtoboardsList = await getSuggestedProtoboards(
source,
protoboards
)
if (source) {
const suggestedProtoboardsList = await getSuggestedProtoboards(
source,
protoboards
)
if (suggestedProtoboardsList.length === 0) {
notify(notifyNoSuggestedDashboards())
return
if (suggestedProtoboardsList.length === 0) {
notify(notifyNoSuggestedDashboards())
return
}
const suggestedProtoboards = protoboards.filter(p =>
suggestedProtoboardsList.includes(p.meta.name)
)
this.setState({suggestedProtoboards})
}
const suggestedProtoboards = protoboards.filter(p =>
suggestedProtoboardsList.includes(p.meta.name)
)
this.setState({suggestedProtoboards})
}
private toggleChecked = (id: string) => () => {
@ -225,11 +223,22 @@ class DashboardStep extends Component<Props, State> {
newSelected[id] = true
}
this.setState({
selected: newSelected,
})
this.setState(
{
selected: newSelected,
},
this.countSelectedDashboards
)
}
}
private countSelectedDashboards = () => {
const {countSelected} = this.props
const {selected} = this.state
const selectedDashboards = _.filter(selected, v => v === true).length
countSelected(selectedDashboards)
}
}
const mdtp = {

View File

@ -1,6 +1,7 @@
.wizard-step--bookend {
text-align: center;
.auth-logo {
margin: $ix-marg-d auto;
margin: 0 auto $ix-marg-d auto;
}
}

View File

@ -30,6 +30,7 @@ interface State {
dashboardError: boolean
dashboardsCreated: Protoboard[]
hasNextOnDashboard: boolean
selectedDashboards: number
}
@ErrorHandling
@ -51,6 +52,7 @@ class OnboardingWizard extends PureComponent<Props, State> {
dashboardError: false,
dashboardsCreated: [],
hasNextOnDashboard: false,
selectedDashboards: 0,
}
}
@ -68,7 +70,6 @@ class OnboardingWizard extends PureComponent<Props, State> {
<Notifications />
<WizardFullScreen
skipLinkText={'skip'}
handleSkip={this.handleCompletionNext}
switchLinkText={'switch organizations'}
handleSwitch={this.resetAndGotoPurgatory}
isUsingAuth={isUsingAuth}
@ -109,6 +110,7 @@ class OnboardingWizard extends PureComponent<Props, State> {
tipText="Select dashboards you would like to create:"
isComplete={this.isDashboardComplete}
isErrored={dashboardError}
nextLabel={this.dashboardNextLabel}
onNext={this.handleDashboardNext}
previousLabel="Go Back"
>
@ -116,6 +118,7 @@ class OnboardingWizard extends PureComponent<Props, State> {
ref={c => (this.dashboardStepRef = c && c.getWrappedInstance())}
dashboardsCreated={dashboardsCreated}
source={source}
countSelected={this.countSelected}
/>
</WizardStep>
<WizardStep
@ -194,6 +197,22 @@ class OnboardingWizard extends PureComponent<Props, State> {
return response
}
private countSelected = (selectedDashboards: number) => {
this.setState({selectedDashboards})
}
private get dashboardNextLabel(): string {
const {selectedDashboards} = this.state
if (selectedDashboards) {
return `Create ${selectedDashboards} Dashboard${
selectedDashboards > 1 ? 's' : ''
}`
}
return 'Next'
}
// KapacitorStep
private isKapacitorComplete = () => {
const {kapacitor} = this.state