mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: folder picker did not notify parent that the initial folder had been changed, fixes #12543 (#12554)
This commit is contained in:
@@ -104,10 +104,7 @@ export class FolderPickerCtrl {
|
||||
appEvents.emit('alert-success', ['Folder Created', 'OK']);
|
||||
|
||||
this.closeCreateFolder();
|
||||
this.folder = {
|
||||
text: result.title,
|
||||
value: result.id,
|
||||
};
|
||||
this.folder = { text: result.title, value: result.id };
|
||||
this.onFolderChange(this.folder);
|
||||
});
|
||||
}
|
||||
@@ -149,17 +146,14 @@ export class FolderPickerCtrl {
|
||||
folder = result.length > 0 ? result[0] : resetFolder;
|
||||
}
|
||||
}
|
||||
this.folder = folder;
|
||||
this.onFolderLoad();
|
||||
});
|
||||
}
|
||||
|
||||
private onFolderLoad() {
|
||||
if (this.onLoad) {
|
||||
this.onLoad({
|
||||
$folder: { id: this.folder.value, title: this.folder.text },
|
||||
});
|
||||
this.folder = folder;
|
||||
|
||||
// if this is not the same as our initial value notify parent
|
||||
if (this.folder.id !== this.initialFolderId) {
|
||||
this.onChange({ $folder: { id: this.folder.value, title: this.folder.text } });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +170,6 @@ export function folderPicker() {
|
||||
labelClass: '@',
|
||||
rootName: '@',
|
||||
onChange: '&',
|
||||
onLoad: '&',
|
||||
onCreateFolder: '&',
|
||||
enterFolderCreation: '&',
|
||||
exitFolderCreation: '&',
|
||||
|
||||
Reference in New Issue
Block a user