-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add template variable subpage UI #11810
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
ui/src/organizations/components/CreateVariableOverlay.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Create Variable Overlay Styles | ||
----------------------------------------------------------------------------- | ||
*/ | ||
|
||
@import 'src/style/modules'; | ||
|
||
.overlay-flux-editor { | ||
position: relative; | ||
height: 300px; | ||
} | ||
|
||
.overlay-flux-editor--spacing { | ||
margin-bottom: $ix-marg-c; | ||
} |
116 changes: 116 additions & 0 deletions
116
ui/src/organizations/components/CreateVariableOverlay.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Libraries | ||
import React, {PureComponent, ChangeEvent} from 'react' | ||
|
||
// Styles | ||
import 'src/organizations/components/CreateVariableOverlay.scss' | ||
|
||
// Components | ||
import { | ||
Form, | ||
OverlayBody, | ||
OverlayHeading, | ||
OverlayContainer, | ||
Input, | ||
ComponentColor, | ||
ComponentStatus, | ||
ButtonType, | ||
OverlayFooter, | ||
} from 'src/clockface' | ||
import {Button} from '@influxdata/clockface' | ||
import FluxEditor from 'src/shared/components/FluxEditor' | ||
|
||
interface Props { | ||
onCreateVariable: () => void | ||
onCloseModal: () => void | ||
} | ||
|
||
interface State { | ||
name: string | ||
script: string | ||
nameInputStatus: ComponentStatus | ||
errorMessage: string | ||
} | ||
|
||
export default class CreateOrgOverlay extends PureComponent<Props, State> { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
name: '', | ||
script: '', | ||
nameInputStatus: ComponentStatus.Default, | ||
errorMessage: '', | ||
} | ||
} | ||
|
||
public render() { | ||
const {onCloseModal} = this.props | ||
const {nameInputStatus, name, script} = this.state | ||
|
||
return ( | ||
<OverlayContainer maxWidth={1000}> | ||
<OverlayHeading | ||
title="Create Variable" | ||
onDismiss={this.props.onCloseModal} | ||
/> | ||
|
||
<Form> | ||
<OverlayBody> | ||
<div className="overlay-flux-editor--spacing"> | ||
<Form.Element label="Name"> | ||
<Input | ||
placeholder="Give your variable a name" | ||
name="name" | ||
autoFocus={true} | ||
value={name} | ||
onChange={this.handleChangeInput} | ||
status={nameInputStatus} | ||
/> | ||
</Form.Element> | ||
</div> | ||
|
||
<Form.Element label="Value"> | ||
<div className="overlay-flux-editor"> | ||
<FluxEditor | ||
script={script} | ||
onChangeScript={this.handleChangeScript} | ||
visibility="visible" | ||
suggestions={[]} | ||
/> | ||
</div> | ||
</Form.Element> | ||
|
||
<OverlayFooter> | ||
<Button | ||
text="Cancel" | ||
color={ComponentColor.Danger} | ||
onClick={onCloseModal} | ||
/> | ||
<Button | ||
text="Create" | ||
type={ButtonType.Submit} | ||
onClick={this.handleCreateVariable} | ||
color={ComponentColor.Primary} | ||
/> | ||
</OverlayFooter> | ||
</OverlayBody> | ||
</Form> | ||
</OverlayContainer> | ||
) | ||
} | ||
|
||
private handleCreateVariable = () => { | ||
this.props.onCloseModal() | ||
} | ||
|
||
private handleChangeInput = (e: ChangeEvent<HTMLInputElement>) => { | ||
const {value, name} = e.target | ||
|
||
const newState = {...this.state} | ||
newState[name] = value | ||
this.setState(newState) | ||
} | ||
|
||
private handleChangeScript = (script: string): void => { | ||
this.setState({script}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Libraries | ||
import React, {PureComponent, ChangeEvent} from 'react' | ||
import _ from 'lodash' | ||
|
||
// Components | ||
import TabbedPageHeader from 'src/shared/components/tabbed_page/TabbedPageHeader' | ||
import CreateVariableOverlay from 'src/organizations/components/CreateVariableOverlay' | ||
import {Button} from '@influxdata/clockface' | ||
import {Input, ComponentColor, IconFont, OverlayTechnology} from 'src/clockface' | ||
|
||
// Types | ||
import {OverlayState} from 'src/types' | ||
|
||
interface Props {} | ||
|
||
interface State { | ||
searchTerm: string | ||
overlayState: OverlayState | ||
} | ||
|
||
export default class Variables extends PureComponent<Props, State> { | ||
constructor(props: Props) { | ||
super(props) | ||
this.state = { | ||
searchTerm: '', | ||
overlayState: OverlayState.Closed, | ||
} | ||
} | ||
|
||
public render() { | ||
const {searchTerm, overlayState} = this.state | ||
|
||
return ( | ||
<> | ||
<TabbedPageHeader> | ||
<Input | ||
icon={IconFont.Search} | ||
placeholder="Filter variables..." | ||
widthPixels={290} | ||
value={searchTerm} | ||
onChange={this.handleFilterChange} | ||
onBlur={this.handleFilterBlur} | ||
/> | ||
<Button | ||
text="Create Variable" | ||
icon={IconFont.Plus} | ||
color={ComponentColor.Primary} | ||
onClick={this.handleOpenModal} | ||
/> | ||
</TabbedPageHeader> | ||
<OverlayTechnology visible={overlayState === OverlayState.Open}> | ||
<CreateVariableOverlay | ||
onCreateVariable={this.handleCreateVariable} | ||
onCloseModal={this.handleCloseModal} | ||
/> | ||
</OverlayTechnology> | ||
</> | ||
) | ||
} | ||
|
||
private handleFilterChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
const {value} = e.target | ||
this.setState({searchTerm: value}) | ||
} | ||
|
||
private handleFilterBlur() {} | ||
|
||
private handleOpenModal = (): void => { | ||
this.setState({overlayState: OverlayState.Open}) | ||
} | ||
|
||
private handleCloseModal = (): void => { | ||
this.setState({overlayState: OverlayState.Closed}) | ||
} | ||
|
||
private handleCreateVariable() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.