mirror of
https://github.com/getredash/redash.git
synced 2026-05-11 18:01:55 -04:00
40 lines
839 B
JavaScript
40 lines
839 B
JavaScript
import template from './edit-group-dialog.html';
|
|
|
|
const EditGroupDialogComponent = {
|
|
template,
|
|
bindings: {
|
|
resolve: '<',
|
|
close: '&',
|
|
dismiss: '&',
|
|
},
|
|
controller($location) {
|
|
'ngInject';
|
|
|
|
this.group = this.resolve.group;
|
|
const newGroup = this.group.id === undefined;
|
|
|
|
if (newGroup) {
|
|
this.saveButtonText = 'Create';
|
|
this.title = 'Create a New Group';
|
|
} else {
|
|
this.saveButtonText = 'Save';
|
|
this.title = 'Edit Group';
|
|
}
|
|
|
|
this.ok = () => {
|
|
this.group.$save((group) => {
|
|
if (newGroup) {
|
|
$location.path(`/groups/${group.id}`).replace();
|
|
this.close();
|
|
} else {
|
|
this.close();
|
|
}
|
|
});
|
|
};
|
|
},
|
|
};
|
|
|
|
export default function init(ngModule) {
|
|
ngModule.component('editGroupDialog', EditGroupDialogComponent);
|
|
}
|