Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
b74653e6
Commit
b74653e6
authored
Dec 31, 2018
by
David Haynes
🙆
Browse files
Abstracted DebugRead into it's own component
- added refresh button to allow for.. just that
parent
45271a66
Pipeline
#3569
passed with stage
in 1 minute and 2 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
go/go_ahead/src/Components/Molecules/DebugRead.jsx
0 → 100644
View file @
b74653e6
import
React
from
"
react
"
;
import
{
GetAllGoLinks
}
from
"
../../Utils
"
;
import
{
Button
}
from
"
reactstrap
"
;
class
DebugRead
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
GoLinks
:
[],
error
:
null
};
// This binding is necessary to make `this` work in the callback
this
.
refreshGoLinks
=
this
.
refreshGoLinks
.
bind
(
this
);
}
async
refreshGoLinks
()
{
GetAllGoLinks
()
.
then
(
data
=>
this
.
setState
({
GoLinks
:
data
})
)
.
catch
(
reason
=>
this
.
setState
({
error
:
reason
}));
}
async
componentDidMount
()
{
this
.
refreshGoLinks
();
}
render
()
{
return
(
<
div
>
<
Button
onClick
=
{
this
.
refreshGoLinks
}
color
=
"primary"
>
Refresh
</
Button
>
{
"
"
}
{
this
.
state
.
GoLinks
.
map
(
golink
=>
(
<
li
key
=
{
golink
.
short
}
>
<
a
href
=
{
`/
${
golink
.
short
}
`
}
>
/
{
golink
.
short
}
</
a
>
|
{
"
"
}
{
golink
.
destination
}
</
li
>
))
}
</
div
>
);
}
}
export
default
DebugRead
;
go/go_ahead/src/Components/Molecules/index.js
View file @
b74653e6
import
AuthButton
from
"
./AuthButton
"
;
import
AuthButton
from
"
./AuthButton
"
;
import
DebugRead
from
"
./DebugRead
"
;
export
{
AuthButton
};
export
{
AuthButton
,
DebugRead
};
go/go_ahead/src/Components/Pages/DebugCRUD.jsx
View file @
b74653e6
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
Formik
,
Field
,
Form
,
ErrorMessage
}
from
"
formik
"
;
import
{
Formik
,
Field
,
Form
,
ErrorMessage
}
from
"
formik
"
;
import
*
as
Yup
from
"
yup
"
;
import
*
as
Yup
from
"
yup
"
;
import
{
PageTemplate
}
from
"
Components
"
;
import
{
PageTemplate
,
DebugRead
}
from
"
Components
"
;
import
{
GetAllGoLinks
}
from
"
../../Utils
"
;
const
SignupSchema
=
Yup
.
object
().
shape
({
const
SignupSchema
=
Yup
.
object
().
shape
({
password
:
Yup
.
string
()
password
:
Yup
.
string
()
...
@@ -16,17 +15,7 @@ const SignupSchema = Yup.object().shape({
...
@@ -16,17 +15,7 @@ const SignupSchema = Yup.object().shape({
class
DebugCRUD
extends
React
.
Component
{
class
DebugCRUD
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
AllGoLinks
:
[],
error
:
null
};
this
.
state
=
{};
}
async
componentDidMount
()
{
GetAllGoLinks
()
.
then
(
data
=>
this
.
setState
({
AllGoLinks
:
data
})
)
.
catch
(
reason
=>
this
.
setState
({
error
:
reason
}));
}
}
render
()
{
render
()
{
...
@@ -59,13 +48,7 @@ class DebugCRUD extends React.Component {
...
@@ -59,13 +48,7 @@ class DebugCRUD extends React.Component {
/>
/>
<
h3
>
Read
</
h3
>
<
h3
>
Read
</
h3
>
<
DebugRead
/>
{
this
.
state
.
AllGoLinks
.
map
(
golink
=>
(
<
li
key
=
{
golink
.
short
}
>
<
a
href
=
{
`/
${
golink
.
short
}
`
}
>
/
{
golink
.
short
}
</
a
>
|
{
"
"
}
{
golink
.
destination
}
</
li
>
))
}
<
h3
>
Update
</
h3
>
<
h3
>
Update
</
h3
>
<
Formik
<
Formik
...
...
go/go_ahead/src/Components/index.js
View file @
b74653e6
import
{
AuthButton
}
from
"
./Molecules
"
;
import
{
AuthButton
,
DebugRead
}
from
"
./Molecules
"
;
import
{
NavBar
}
from
"
./Organisms
"
;
import
{
NavBar
}
from
"
./Organisms
"
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
,
DebugCRUD
}
from
"
./Pages
"
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
,
DebugCRUD
}
from
"
./Pages
"
;
import
{
PageTemplate
}
from
"
./Templates
"
;
import
{
PageTemplate
}
from
"
./Templates
"
;
...
@@ -6,6 +6,7 @@ import { PageTemplate } from "./Templates";
...
@@ -6,6 +6,7 @@ import { PageTemplate } from "./Templates";
export
{
export
{
//Molecules
//Molecules
AuthButton
,
AuthButton
,
DebugRead
,
//Organisms
//Organisms
NavBar
,
NavBar
,
//Pages
//Pages
...
...
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