dashfolders: autosave permissions on change (remove update button)

This commit is contained in:
Daniel Lee
2018-01-26 14:02:22 +01:00
parent 08c78ab8b7
commit ccd86873e7
5 changed files with 126 additions and 59 deletions

View File

@@ -34,14 +34,17 @@ export interface IProps {
class Permissions extends Component<IProps, any> {
constructor(props) {
super(props);
const { dashboardId, permissions, isFolder } = this.props;
const { dashboardId, isFolder } = this.props;
this.permissionChanged = this.permissionChanged.bind(this);
this.typeChanged = this.typeChanged.bind(this);
this.removeItem = this.removeItem.bind(this);
this.update = this.update.bind(this);
this.userPicked = this.userPicked.bind(this);
this.teamPicked = this.teamPicked.bind(this);
permissions.load(dashboardId, isFolder);
this.loadStore(dashboardId, isFolder);
}
loadStore(dashboardId, isFolder) {
return this.props.permissions.load(dashboardId, isFolder);
}
permissionChanged(index: number, permission: number, permissionName: string) {
@@ -54,11 +57,6 @@ class Permissions extends Component<IProps, any> {
permissions.removeStoreItem(index);
}
update() {
const { permissions, dashboardId } = this.props;
permissions.update(dashboardId);
}
resetNewType() {
const { permissions } = this.props;
permissions.resetNewType();
@@ -142,11 +140,6 @@ class Permissions extends Component<IProps, any> {
</div>
) : null}
</div>
<div className="gf-form-button-row">
<button type="button" className="btn btn-danger" onClick={this.update} disabled={!permissions.canUpdate}>
Update Permissions
</button>
</div>
<div className="empty-list-cta m-t-3">
<div className="grafana-info-box">
<h5>What are Permissions?</h5>