strapi-plugin-content-manager
Advanced tools
Comparing version 3.0.0-alpha.7.1 to 3.0.0-alpha.7.2
@@ -67,4 +67,2 @@ /* | ||
this.source = getQueryParameters(this.props.location.search, 'source'); | ||
this.state = { | ||
@@ -88,3 +86,3 @@ showWarning: false, | ||
if (!isEmpty(nextProps.location.search) && this.props.location.search !== nextProps.location.search) { | ||
this.props.loadRecords(this.source); | ||
this.props.loadRecords(getQueryParameters(nextProps.location.search, 'source')); | ||
} | ||
@@ -94,2 +92,3 @@ } | ||
init(props) { | ||
const source = getQueryParameters(props.location.search, 'source'); | ||
const slug = props.match.params.slug; | ||
@@ -100,17 +99,17 @@ // Set current model name | ||
const sort = (isEmpty(props.location.search) ? | ||
get(this.props.models, ['models', slug.toLowerCase(), 'primaryKey']) || get(this.props.models.plugins, [this.source, 'models', slug.toLowerCase(), 'primaryKey']) : | ||
get(this.props.models, ['models', slug.toLowerCase(), 'primaryKey']) || get(this.props.models.plugins, [source, 'models', slug.toLowerCase(), 'primaryKey']) : | ||
getQueryParameters('sort')) || 'id'; | ||
if (!isEmpty(props.location.search)) { | ||
this.props.changePage(toInteger(getQueryParameters('page')), this.source); | ||
this.props.changeLimit(toInteger(getQueryParameters('limit')), this.source); | ||
this.props.changePage(toInteger(getQueryParameters('page')), source); | ||
this.props.changeLimit(toInteger(getQueryParameters('limit')), source); | ||
} | ||
this.props.changeSort(sort, this.source); | ||
this.props.changeSort(sort, source); | ||
// Load records | ||
this.props.loadRecords(this.source); | ||
this.props.loadRecords(source); | ||
// Get the records count | ||
this.props.loadCount(this.source); | ||
this.props.loadCount(source); | ||
@@ -122,6 +121,7 @@ // Define the `create` route url | ||
handleChangeLimit = ({ target }) => { | ||
this.props.changeLimit(toInteger(target.value), this.source); | ||
const source = getQueryParameters(this.props.location.search, 'source'); | ||
this.props.changeLimit(toInteger(target.value), source); | ||
router.push({ | ||
pathname: this.props.location.pathname, | ||
search: `?page=${this.props.currentPage}&limit=${target.value}&sort=${this.props.sort}&source=${this.source}`, | ||
search: `?page=${this.props.currentPage}&limit=${target.value}&sort=${this.props.sort}&source=${source}`, | ||
}); | ||
@@ -131,22 +131,25 @@ } | ||
handleChangePage = (page) => { | ||
const source = getQueryParameters(this.props.location.search, 'source'); | ||
router.push({ | ||
pathname: this.props.location.pathname, | ||
search: `?page=${page}&limit=${this.props.limit}&sort=${this.props.sort}&source=${this.source}`, | ||
search: `?page=${page}&limit=${this.props.limit}&sort=${this.props.sort}&source=${source}`, | ||
}); | ||
this.props.changePage(page, this.source); | ||
this.props.changePage(page, source); | ||
} | ||
handleChangeSort = (sort) => { | ||
const source = getQueryParameters(this.props.location.search, 'source'); | ||
router.push({ | ||
pathname: this.props.location.pathname, | ||
search: `?page=${this.props.currentPage}&limit=${this.props.limit}&sort=${sort}&source=${this.source}`, | ||
search: `?page=${this.props.currentPage}&limit=${this.props.limit}&sort=${sort}&source=${source}`, | ||
}); | ||
this.props.changeSort(sort, this.source); | ||
this.props.changeSort(sort, source); | ||
} | ||
handleDelete = (e) => { | ||
const source = getQueryParameters(this.props.location.search, 'source'); | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
this.props.deleteRecord(this.state.target, this.props.currentModelName, this.source); | ||
this.props.deleteRecord(this.state.target, this.props.currentModelName, source); | ||
this.setState({ showWarning: false }); | ||
@@ -168,5 +171,6 @@ } | ||
render() { | ||
const source = getQueryParameters(this.props.location.search, 'source'); | ||
// Detect current model structure from models list | ||
const currentModel = get(this.props.models, ['models', this.props.currentModelName]) || get(this.props.models, ['plugins', this.source, 'models', this.props.currentModelName]); | ||
const currentSchema = get(this.props.schema, [this.props.currentModelName]) || get(this.props.schema, ['plugins', this.source, this.props.currentModelName]); | ||
const currentModel = get(this.props.models, ['models', this.props.currentModelName]) || get(this.props.models, ['plugins', source, 'models', this.props.currentModelName]); | ||
const currentSchema = get(this.props.schema, [this.props.currentModelName]) || get(this.props.schema, ['plugins', source, this.props.currentModelName]); | ||
@@ -197,3 +201,3 @@ if (!this.props.currentModelName || !currentSchema) { | ||
handleDelete={this.toggleModalWarning} | ||
redirectUrl={`?redirectUrl=/plugins/content-manager/${this.props.currentModelName.toLowerCase()}/?page=${this.props.currentPage}&limit=${this.props.limit}&sort=${this.props.sort}&source=${this.source}`} | ||
redirectUrl={`?redirectUrl=/plugins/content-manager/${this.props.currentModelName.toLowerCase()}/?page=${this.props.currentPage}&limit=${this.props.limit}&sort=${this.props.sort}&source=${source}`} | ||
/> | ||
@@ -215,3 +219,3 @@ ); | ||
pathname: this.addRoute, | ||
search: `?source=${this.source}`, | ||
search: `?source=${source}`, | ||
}), | ||
@@ -218,0 +222,0 @@ }, |
{ | ||
"name": "strapi-plugin-content-manager", | ||
"version": "3.0.0-alpha.7.1", | ||
"version": "3.0.0-alpha.7.2", | ||
"description": "A powerful UI to easily manage your data.", | ||
@@ -49,4 +49,4 @@ "engines": { | ||
"react-select": "^1.0.0-rc.5", | ||
"strapi-helper-plugin": "3.0.0-alpha.7.1" | ||
"strapi-helper-plugin": "3.0.0-alpha.7.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1181661
7411