Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cms
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro-dev_2
cms
Commits
23ae754a
Commit
23ae754a
authored
Jul 04, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete asset UI
parent
8f7f09f7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
index.js
src/views/assets/projectassets/card/index.js
+6
-4
main.js
src/views/assets/projectassets/edit/main.js
+9
-2
assets.js
src/views/assets/store/actions/assets.js
+21
-0
No files found.
src/views/assets/projectassets/card/index.js
View file @
23ae754a
...
@@ -52,7 +52,7 @@ const SuccessProgressToast = () => (
...
@@ -52,7 +52,7 @@ const SuccessProgressToast = () => (
)
)
const
ElementCard
=
({
selectedElement
,
onSubmitHandler
})
=>
{
const
ElementCard
=
({
selectedElement
,
onSubmitHandler
,
handelDelete
})
=>
{
const
store
=
useSelector
(
state
=>
state
.
projectsettings
)
const
store
=
useSelector
(
state
=>
state
.
projectsettings
)
const
[
PlatformName
,
setPlatformName
]
=
useState
(
'Web'
)
const
[
PlatformName
,
setPlatformName
]
=
useState
(
'Web'
)
...
@@ -471,9 +471,11 @@ return (
...
@@ -471,9 +471,11 @@ return (
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'submit'
color
=
'primary'
>
<
Button
.
Ripple
className
=
'mb-1 mb-sm-0 mr-0 mr-sm-1'
type
=
'submit'
color
=
'primary'
>
Save
Changes
Save
Changes
<
/Button.Ripple
>
<
/Button.Ripple
>
{
/* <Button.Ripple color='secondary' outline onClick={() => dispatch(getPlatform(selectedElement.id))} >
{
!!
handelDelete
&&
Reset
<
Button
.
Ripple
style
=
{{
marginLeft
:
'auto'
}}
color
=
'danger'
outline
onClick
=
{()
=>
handelDelete
()}
>
</Button.Ripple> */
}
Delete
<
/Button.Ripple
>
}
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
<
/Form
>
<
/Form
>
...
...
src/views/assets/projectassets/edit/main.js
View file @
23ae754a
...
@@ -2,7 +2,7 @@ import { useState, useEffect, Fragment } from 'react'
...
@@ -2,7 +2,7 @@ import { useState, useEffect, Fragment } from 'react'
import
{
useParams
,
Link
}
from
'react-router-dom'
import
{
useParams
,
Link
}
from
'react-router-dom'
// ** Store & Actions
// ** Store & Actions
import
{
getasset
,
updateasset
}
from
'../../store/actions'
import
{
getasset
,
updateasset
,
deleteasset
}
from
'../../store/actions'
import
{
useSelector
,
useDispatch
}
from
'react-redux'
import
{
useSelector
,
useDispatch
}
from
'react-redux'
...
@@ -41,6 +41,12 @@ const ElementEdit = () => {
...
@@ -41,6 +41,12 @@ const ElementEdit = () => {
}
}
const
handelDelete
=
()
=>
{
if
(
!
confirm
(
'Delete'
))
return
dispatch
(
deleteasset
({
...
dataElement
})
)
}
// ** Function to get user on mount
// ** Function to get user on mount
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
getasset
(
id
))
dispatch
(
getasset
(
id
))
...
@@ -59,6 +65,7 @@ const ElementEdit = () => {
...
@@ -59,6 +65,7 @@ const ElementEdit = () => {
<
ElementCard
<
ElementCard
selectedElement
=
{
store
.
selectedAsset
}
selectedElement
=
{
store
.
selectedAsset
}
onSubmitHandler
=
{
onSubmitHandler
}
onSubmitHandler
=
{
onSubmitHandler
}
handelDelete
=
{
handelDelete
}
/>
/>
)
:
(
)
:
(
<
Alert
color
=
'info'
>
<
Alert
color
=
'info'
>
...
...
src/views/assets/store/actions/assets.js
View file @
23ae754a
...
@@ -82,6 +82,27 @@ export const getData_assets = params => {
...
@@ -82,6 +82,27 @@ export const getData_assets = params => {
}
}
}
}
export
const
deleteasset
=
params
=>
{
return
(
dispatch
,
getState
)
=>
{
axios
.
delete
(
`
${
process
.
env
.
REACT_APP_API
}${
moduleSettings
.
apiBaseURL
}
/
${
params
.
id
}
`
,
params
)
.
then
(
response
=>
{
dispatch
({
type
:
'GET_ASSET'
,
data
:
null
})
})
.
then
(()
=>
{
dispatch
(
setSaveSatus
(
true
))
})
.
catch
(
err
=>
{
const
errosMsg
=
!
err
.
response
?
'error'
:
err
.
response
.
data
.
message
console
.
log
(
errosMsg
)
dispatch
(
setErrorMsg
(
errosMsg
))
})
}
}
export
const
updateasset
=
params
=>
{
export
const
updateasset
=
params
=>
{
return
(
dispatch
,
getState
)
=>
{
return
(
dispatch
,
getState
)
=>
{
axios
axios
...
...
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