-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DrushSqlDump and DrushCacheClear Tasks
- Loading branch information
Showing
10 changed files
with
294 additions
and
21 deletions.
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
96 changes: 96 additions & 0 deletions
96
services/ui/src/components/AddTask/components/DrushCacheClear.js
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,96 @@ | ||
import React from 'react'; | ||
import { Mutation } from 'react-apollo'; | ||
import gql from 'graphql-tag'; | ||
import ReactSelect from 'react-select'; | ||
import { bp, color, fontSize } from '../../../variables'; | ||
|
||
const taskDrushCacheClear = gql` | ||
mutation taskDrushCacheClear( | ||
$environment: Int! | ||
) { | ||
taskDrushCacheClear( | ||
environment: $environment | ||
) { | ||
id | ||
name | ||
status | ||
created | ||
started | ||
completed | ||
remoteId | ||
command | ||
service | ||
} | ||
} | ||
`; | ||
|
||
const DrushCacheClear = ({ | ||
pageEnvironment, | ||
onCompleted, | ||
onError, | ||
}) => ( | ||
<Mutation | ||
mutation={taskDrushCacheClear} | ||
onCompleted={onCompleted} | ||
onError={onError} | ||
> | ||
{(taskDrushCacheClear, { loading, called, error, data }) => { | ||
return ( | ||
<React.Fragment> | ||
<div className="envSelect"> | ||
<label id="dest-env">Environment:</label> | ||
<ReactSelect | ||
aria-labelledby="dest-env" | ||
name="dest-environment" | ||
value={{ | ||
label: pageEnvironment.name, | ||
value: pageEnvironment.id, | ||
}} | ||
options={[ | ||
{ | ||
label: pageEnvironment.name, | ||
value: pageEnvironment.id, | ||
} | ||
]} | ||
isDisabled | ||
required | ||
/> | ||
</div> | ||
<button | ||
onClick={() => | ||
taskDrushCacheClear({ | ||
variables: { | ||
environment: pageEnvironment.id | ||
} | ||
}) | ||
} | ||
> | ||
Add task | ||
</button> | ||
<style jsx>{` | ||
.envSelect { | ||
margin-top: 10px; | ||
} | ||
button { | ||
align-self: flex-end; | ||
background-color: ${color.lightestGrey}; | ||
border: none; | ||
border-radius: 20px; | ||
color: ${color.darkGrey}; | ||
font-family: 'source-code-pro', sans-serif; | ||
${fontSize(13)}; | ||
margin-top: 10px; | ||
padding: 3px 20px 2px; | ||
text-transform: uppercase; | ||
@media ${bp.tinyUp} { | ||
align-self: auto; | ||
} | ||
} | ||
`}</style> | ||
</React.Fragment> | ||
); | ||
}} | ||
</Mutation> | ||
); | ||
|
||
export default DrushCacheClear; |
96 changes: 96 additions & 0 deletions
96
services/ui/src/components/AddTask/components/DrushSqlDump.js
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,96 @@ | ||
import React from 'react'; | ||
import { Mutation } from 'react-apollo'; | ||
import gql from 'graphql-tag'; | ||
import ReactSelect from 'react-select'; | ||
import { bp, color, fontSize } from '../../../variables'; | ||
|
||
const taskDrushSqlDump = gql` | ||
mutation taskDrushSqlDump( | ||
$environment: Int! | ||
) { | ||
taskDrushSqlDump( | ||
environment: $environment | ||
) { | ||
id | ||
name | ||
status | ||
created | ||
started | ||
completed | ||
remoteId | ||
command | ||
service | ||
} | ||
} | ||
`; | ||
|
||
const DrushSqlDump = ({ | ||
pageEnvironment, | ||
onCompleted, | ||
onError, | ||
}) => ( | ||
<Mutation | ||
mutation={taskDrushSqlDump} | ||
onCompleted={onCompleted} | ||
onError={onError} | ||
> | ||
{(taskDrushSqlDump, { loading, called, error, data }) => { | ||
return ( | ||
<React.Fragment> | ||
<div className="envSelect"> | ||
<label id="dest-env">Environment:</label> | ||
<ReactSelect | ||
aria-labelledby="dest-env" | ||
name="dest-environment" | ||
value={{ | ||
label: pageEnvironment.name, | ||
value: pageEnvironment.id, | ||
}} | ||
options={[ | ||
{ | ||
label: pageEnvironment.name, | ||
value: pageEnvironment.id, | ||
} | ||
]} | ||
isDisabled | ||
required | ||
/> | ||
</div> | ||
<button | ||
onClick={() => | ||
taskDrushSqlDump({ | ||
variables: { | ||
environment: pageEnvironment.id | ||
} | ||
}) | ||
} | ||
> | ||
Add task | ||
</button> | ||
<style jsx>{` | ||
.envSelect { | ||
margin-top: 10px; | ||
} | ||
button { | ||
align-self: flex-end; | ||
background-color: ${color.lightestGrey}; | ||
border: none; | ||
border-radius: 20px; | ||
color: ${color.darkGrey}; | ||
font-family: 'source-code-pro', sans-serif; | ||
${fontSize(13)}; | ||
margin-top: 10px; | ||
padding: 3px 20px 2px; | ||
text-transform: uppercase; | ||
@media ${bp.tinyUp} { | ||
align-self: auto; | ||
} | ||
} | ||
`}</style> | ||
</React.Fragment> | ||
); | ||
}} | ||
</Mutation> | ||
); | ||
|
||
export default DrushSqlDump; |
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.