-
Notifications
You must be signed in to change notification settings - Fork 408
Implement detail page skeleton #80
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bae7917
Add reducer for detail page
4760ce6
Initial pass on the detail page skeleton
16be9b9
Wire up power buttons, tweak styles
ccf4056
Extend reducers/actions & add tests for edit mode
682cada
Implement editing Linode label/group
2991ff2
Tweak dropdown styles
ebce1be
Disable save/cancel while request is pending
fbac333
Set up stubs for detail page tests
53e84af
Move button styles to top level stylesheet
15597d2
Add tab hover
c9bf5ec
Add button styles
00ebe16
Merge pull request #84 from eatonphil/feature/detail-page-skeleton
ddevault 401421f
Darken the header background color
f33cd34
Add tests for commitChanges action
4143e52
Implement detail page tests, except for editing UI
3e52a11
Flesh out detail page tests
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 hidden or 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 |
|---|---|---|
|
|
@@ -4,4 +4,5 @@ npm-debug.log | |
| dist | ||
| src/secrets.js | ||
| xunit.xml | ||
| coverage | ||
| coverage | ||
| .sass-cache/ | ||
This file contains hidden or 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,33 @@ | ||
| .card { | ||
| header { | ||
| background-color: $linode-lightish-gray; | ||
| padding: 2rem; | ||
| } | ||
|
|
||
| .react-tabs { | ||
| [role=tablist] { | ||
| background-color: $linode-lightish-gray; | ||
| padding: 0 2rem; | ||
| border-color: $linode-gray; | ||
| } | ||
|
|
||
| [role=tab] { | ||
| color: $linode-dark-gray; | ||
| border-radius: 0; | ||
| margin-right: 1.5rem; | ||
| padding: 3px 12px; | ||
|
|
||
| &[selected], | ||
| &:hover { | ||
| color: $linode-black; | ||
| border-color: $linode-gray; | ||
| background: white; | ||
| border-bottom: 0; | ||
| } | ||
| } | ||
|
|
||
| [role=tabpanel] { | ||
| padding: 2rem; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ export default function Dropdown(props) { | |
|
|
||
| Dropdown.propTypes = { | ||
| elements: PropTypes.arrayOf(PropTypes.shape({ | ||
| name: PropTypes.string.isRequired, | ||
| name: PropTypes.node.isRequired, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is a node?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything you can render straight up. Any n that is valid for |
||
| action: PropTypes.func, | ||
| })).isRequired, | ||
| }; | ||
This file contains hidden or 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,42 @@ | ||
| import { fetch } from '~/fetch'; | ||
| import { UPDATE_LINODE } from '~/actions/api/linodes'; | ||
|
|
||
| export const CHANGE_DETAIL_TAB = '@@linodes@@detail/CHANGE_DETAIL_TAB'; | ||
| export const TOGGLE_EDIT_MODE = '@@linodes@@detail/TOGGLE_EDIT_MODE'; | ||
| export const SET_LINODE_LABEL = '@@linodes@@detail/SET_LINODE_LABEL'; | ||
| export const SET_LINODE_GROUP = '@@linodes@@detail/SET_LINODE_GROUP'; | ||
| export const TOGGLE_LOADING = '@@linodes@@detail/TOGGLE_LOADING'; | ||
|
|
||
| export function changeDetailTab(index) { | ||
| return { type: CHANGE_DETAIL_TAB, index }; | ||
| } | ||
|
|
||
| export function toggleEditMode() { | ||
| return { type: TOGGLE_EDIT_MODE }; | ||
| } | ||
|
|
||
| export function setLinodeLabel(label) { | ||
| return { type: SET_LINODE_LABEL, label }; | ||
| } | ||
|
|
||
| export function setLinodeGroup(group) { | ||
| return { type: SET_LINODE_GROUP, group }; | ||
| } | ||
|
|
||
| export function commitChanges(id) { | ||
| return async (dispatch, getState) => { | ||
| const state = getState(); | ||
| const { label, group } = state.linodes.detail; | ||
| const { token } = state.authentication; | ||
| dispatch({ type: TOGGLE_LOADING }); | ||
| // TODO: Error handling | ||
| const resp = await fetch(token, `/linodes/${id}`, { | ||
| method: 'PUT', | ||
| body: JSON.stringify({ label, group }), | ||
| }); | ||
| const json = await resp.json(); | ||
| dispatch({ type: UPDATE_LINODE, linode: json }); | ||
| dispatch({ type: TOGGLE_LOADING }); | ||
| dispatch(toggleEditMode()); | ||
| }; | ||
| } |
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.
What was the reason for this change?
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.
@na3d pointed out that the width of the dropdown's contents don't match up with the width of the dropdown. This fixes that.
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.
(with the help of other changes)
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.
Ah. I wouldn't worry about this too much. It's too complex and arbitrary. I do not expect for much of the dropdown code to remain for long.
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.
Cool. I was thinking that an overhaul of the dropdowns was probably necessary. Want to backlog it?
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.
Sure