Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
go
Commits
b67231a2
Commit
b67231a2
authored
Jan 09, 2019
by
David Haynes
🙆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
really bad first passing working DebugUpdate
parent
ec65da65
Pipeline
#3591
passed with stage
in 1 minute and 32 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
3 deletions
+96
-3
go/go_ahead/src/Components/Molecules/DebugUpdate.jsx
go/go_ahead/src/Components/Molecules/DebugUpdate.jsx
+77
-0
go/go_ahead/src/Components/Molecules/index.js
go/go_ahead/src/Components/Molecules/index.js
+2
-1
go/go_ahead/src/Components/Pages/DebugCRUD.jsx
go/go_ahead/src/Components/Pages/DebugCRUD.jsx
+9
-1
go/go_ahead/src/Components/index.js
go/go_ahead/src/Components/index.js
+8
-1
No files found.
go/go_ahead/src/Components/Molecules/DebugUpdate.jsx
0 → 100644
View file @
b67231a2
import
React
from
"
react
"
;
import
*
as
Yup
from
"
yup
"
;
import
{
Formik
,
Field
,
Form
,
ErrorMessage
}
from
"
formik
"
;
import
{
GetCSRFToken
}
from
"
../../Utils
"
;
const
DebugUpdateYup
=
Yup
.
object
().
shape
({
destination
:
Yup
.
string
()
.
url
()
.
max
(
1000
,
"
Too Long!
"
),
oldshort
:
Yup
.
string
()
.
required
(
"
Required
"
)
.
max
(
20
,
"
Too Long!
"
),
newshort
:
Yup
.
string
()
.
required
(
"
Required
"
)
.
max
(
20
,
"
Too Long!
"
)
// expires: Yup.date()
// .nullable()
// .min(new Date(new Date().getTime() + 24 * 60 * 60 * 1000))
});
const
DebugUpdate
=
()
=>
(
<
div
>
<
Formik
initialValues
=
{
{
oldshort
:
""
,
newshort
:
""
,
newdestination
:
""
,
expires
:
null
}
}
validationSchema
=
{
DebugUpdateYup
}
onSubmit
=
{
(
{
newshort
,
oldshort
,
expires
,
destination
},
{
setSubmitting
}
)
=>
{
const
updateURL
=
"
/api/golinks/
"
+
oldshort
+
"
/
"
;
const
payload
=
{
short
:
newshort
,
destination
:
destination
,
expires
:
expires
};
fetch
(
updateURL
,
{
method
:
"
put
"
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
"
X-CSRFToken
"
:
GetCSRFToken
()
},
body
:
JSON
.
stringify
(
payload
)
})
.
then
(
response
=>
console
.
log
(
response
))
.
then
(
setSubmitting
(
false
));
}
}
render
=
{
({
isSubmitting
})
=>
(
<
Form
>
{
"
Old Short:
"
}
<
Field
name
=
"oldshort"
/>
<
ErrorMessage
name
=
"oldshort"
/>
{
"
New Destination:
"
}
<
Field
name
=
"destination"
placeholder
=
"https://longwebsitelink.com"
/>
<
ErrorMessage
name
=
"destination"
component
=
"div"
/>
{
"
New Short:
"
}
<
Field
name
=
"newshort"
/>
<
ErrorMessage
name
=
"newshort"
/>
{
"
New Expires:
"
}
<
Field
type
=
"select"
name
=
"expires"
placeholder
=
"leave blank"
/>
<
ErrorMessage
name
=
"expires"
/>
<
button
type
=
"submit"
disabled
=
{
isSubmitting
}
>
Submit
</
button
>
</
Form
>
)
}
/>
</
div
>
);
export
default
DebugUpdate
;
go/go_ahead/src/Components/Molecules/index.js
View file @
b67231a2
...
...
@@ -2,5 +2,6 @@ import AuthButton from "./AuthButton";
import
DebugRead
from
"
./DebugRead
"
;
import
DebugCreate
from
"
./DebugCreate
"
;
import
DebugDelete
from
"
./DebugDelete
"
;
import
DebugUpdate
from
"
./DebugUpdate
"
;
export
{
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
};
export
{
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
,
DebugUpdate
};
go/go_ahead/src/Components/Pages/DebugCRUD.jsx
View file @
b67231a2
import
React
from
"
react
"
;
import
{
PageTemplate
,
DebugRead
,
DebugCreate
,
DebugDelete
}
from
"
Components
"
;
import
{
PageTemplate
,
DebugRead
,
DebugCreate
,
DebugDelete
,
DebugUpdate
}
from
"
Components
"
;
class
DebugCRUD
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -20,6 +26,8 @@ class DebugCRUD extends React.Component {
<
DebugRead
/>
<
h3
>
Update
</
h3
>
<
DebugUpdate
/>
<
h3
>
Delete
</
h3
>
<
DebugDelete
/>
</
div
>
...
...
go/go_ahead/src/Components/index.js
View file @
b67231a2
import
{
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
}
from
"
./Molecules
"
;
import
{
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
,
DebugUpdate
}
from
"
./Molecules
"
;
import
{
NavBar
}
from
"
./Organisms
"
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
,
DebugCRUD
}
from
"
./Pages
"
;
import
{
PageTemplate
}
from
"
./Templates
"
;
...
...
@@ -9,6 +15,7 @@ export {
DebugRead
,
DebugCreate
,
DebugDelete
,
DebugUpdate
,
//Organisms
NavBar
,
//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