mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
fix success alert not shown after object is uploaded (#6500)
This commit is contained in:
parent
b62ed5dc90
commit
7c339e248a
@ -22,7 +22,7 @@ export let alertId = 0
|
|||||||
export const set = alert => {
|
export const set = alert => {
|
||||||
const id = alertId++
|
const id = alertId++
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
if (alert.type !== "danger") {
|
if (alert.type !== "danger" || alert.autoClear) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: CLEAR,
|
type: CLEAR,
|
||||||
|
@ -123,9 +123,6 @@ describe("Objects actions", () => {
|
|||||||
objects: { currentPrefix: "" }
|
objects: { currentPrefix: "" }
|
||||||
})
|
})
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{
|
|
||||||
type: "alert/CLEAR"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: "objects/SET_LIST",
|
type: "objects/SET_LIST",
|
||||||
objects: [{ name: "test1" }, { name: "test2" }],
|
objects: [{ name: "test1" }, { name: "test2" }],
|
||||||
@ -157,9 +154,6 @@ describe("Objects actions", () => {
|
|||||||
objects: { currentPrefix: "" }
|
objects: { currentPrefix: "" }
|
||||||
})
|
})
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{
|
|
||||||
type: "alert/CLEAR"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: "objects/APPEND_LIST",
|
type: "objects/APPEND_LIST",
|
||||||
objects: [{ name: "test1" }, { name: "test2" }],
|
objects: [{ name: "test1" }, { name: "test2" }],
|
||||||
@ -183,15 +177,13 @@ describe("Objects actions", () => {
|
|||||||
objects: { currentPrefix: "" }
|
objects: { currentPrefix: "" }
|
||||||
})
|
})
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{
|
|
||||||
type: "alert/CLEAR"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: "alert/SET",
|
type: "alert/SET",
|
||||||
alert: {
|
alert: {
|
||||||
type: "danger",
|
type: "danger",
|
||||||
message: "listobjects is denied",
|
message: "listobjects is denied",
|
||||||
id: alertActions.alertId
|
id: alertActions.alertId,
|
||||||
|
autoClear: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -252,7 +244,6 @@ describe("Objects actions", () => {
|
|||||||
})
|
})
|
||||||
const expectedActions = [
|
const expectedActions = [
|
||||||
{ type: "objects/SET_CURRENT_PREFIX", prefix: "abc/" },
|
{ type: "objects/SET_CURRENT_PREFIX", prefix: "abc/" },
|
||||||
{ type: "alert/CLEAR" },
|
|
||||||
{ type: "objects/CHECKED_LIST_RESET" }
|
{ type: "objects/CHECKED_LIST_RESET" }
|
||||||
]
|
]
|
||||||
store.dispatch(actionsObjects.selectPrefix("abc/"))
|
store.dispatch(actionsObjects.selectPrefix("abc/"))
|
||||||
|
@ -64,7 +64,6 @@ export const fetchObjects = append => {
|
|||||||
buckets: { currentBucket },
|
buckets: { currentBucket },
|
||||||
objects: { currentPrefix, marker }
|
objects: { currentPrefix, marker }
|
||||||
} = getState()
|
} = getState()
|
||||||
dispatch(alertActions.clear())
|
|
||||||
if (currentBucket) {
|
if (currentBucket) {
|
||||||
return web
|
return web
|
||||||
.ListObjects({
|
.ListObjects({
|
||||||
@ -93,10 +92,15 @@ export const fetchObjects = append => {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (web.LoggedIn()) {
|
if (web.LoggedIn()) {
|
||||||
dispatch(alertActions.set({ type: "danger", message: err.message }))
|
dispatch(
|
||||||
|
alertActions.set({
|
||||||
|
type: "danger",
|
||||||
|
message: err.message,
|
||||||
|
autoClear: true
|
||||||
|
})
|
||||||
|
)
|
||||||
dispatch(resetList())
|
dispatch(resetList())
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
history.push("/login")
|
history.push("/login")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user