mirror of
https://github.com/minio/minio.git
synced 2025-02-28 05:49:16 -05:00
UI: Handle policies listed in mc as 'none' by not showing them (#6353)
This commit is contained in:
parent
72fa2b4537
commit
5e7ccc983d
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { READ_ONLY, WRITE_ONLY, READ_WRITE } from '../constants'
|
import { READ_ONLY, WRITE_ONLY, READ_WRITE, NONE } from '../constants'
|
||||||
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
@ -42,10 +42,12 @@ export class Policy extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const {policy, prefix} = this.props
|
const {policy, prefix} = this.props
|
||||||
let newPrefix = prefix
|
let newPrefix = prefix
|
||||||
|
|
||||||
if (newPrefix === '')
|
if (newPrefix === '')
|
||||||
newPrefix = '*'
|
newPrefix = '*'
|
||||||
|
|
||||||
|
if (policy === NONE) {
|
||||||
|
return <noscript />
|
||||||
|
} else {
|
||||||
return (
|
return (
|
||||||
<div className="pmb-list">
|
<div className="pmb-list">
|
||||||
<div className="pmbl-item">
|
<div className="pmbl-item">
|
||||||
@ -75,6 +77,7 @@ export class Policy extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { shallow, mount } from "enzyme"
|
import { shallow, mount } from "enzyme"
|
||||||
import { Policy } from "../Policy"
|
import { Policy } from "../Policy"
|
||||||
import { READ_ONLY, WRITE_ONLY, READ_WRITE } from "../../constants"
|
import { READ_ONLY, WRITE_ONLY, READ_WRITE, NONE } from "../../constants"
|
||||||
import web from "../../web"
|
import web from "../../web"
|
||||||
|
|
||||||
jest.mock("../../web", () => ({
|
jest.mock("../../web", () => ({
|
||||||
@ -31,6 +31,11 @@ describe("Policy", () => {
|
|||||||
shallow(<Policy currentBucket={"bucket"} prefix={"foo"} policy={READ_ONLY} />)
|
shallow(<Policy currentBucket={"bucket"} prefix={"foo"} policy={READ_ONLY} />)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should not render when policy is listed as 'none'", () => {
|
||||||
|
const wrapper = shallow(<Policy currentBucket={"bucket"} prefix={"foo"} policy={NONE} />)
|
||||||
|
expect(wrapper.find(".pmb-list").length).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
it("should call web.setBucketPolicy and fetchPolicies on submit", () => {
|
it("should call web.setBucketPolicy and fetchPolicies on submit", () => {
|
||||||
const fetchPolicies = jest.fn()
|
const fetchPolicies = jest.fn()
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
|
@ -23,6 +23,7 @@ export const minioBrowserPrefix = p.slice(0, p.indexOf("/", 1))
|
|||||||
export const READ_ONLY = "readonly"
|
export const READ_ONLY = "readonly"
|
||||||
export const WRITE_ONLY = "writeonly"
|
export const WRITE_ONLY = "writeonly"
|
||||||
export const READ_WRITE = "readwrite"
|
export const READ_WRITE = "readwrite"
|
||||||
|
export const NONE = "none"
|
||||||
|
|
||||||
export const SHARE_OBJECT_EXPIRY_DAYS = 5
|
export const SHARE_OBJECT_EXPIRY_DAYS = 5
|
||||||
export const SHARE_OBJECT_EXPIRY_HOURS = 0
|
export const SHARE_OBJECT_EXPIRY_HOURS = 0
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user