Skip to content

Instantly share code, notes, and snippets.

@alison985
Created June 27, 2017 20:07
Show Gist options
  • Save alison985/9fb118b812e7722f2e024a2edf00fda6 to your computer and use it in GitHub Desktop.
Save alison985/9fb118b812e7722f2e024a2edf00fda6 to your computer and use it in GitHub Desktop.
trying to troubleshoot the hard-coded bug in https://github.com/mozilla/redash/pull/94/files
function GetDataSourceVersionCtrl(Events, toastr, $scope, DataSource) {
// 'ngInject';
// this works but hard codes the data source id
this.getDataSourceVersion = DataSource.version({ id: 6 });
// this doesn't event lint (unexpected block) for some reason but also doesn't work
this.getDSV = (variable) => {
return DataSource.version({ id: variable});
};
// this doesn't work
function getSQLVersion(ida) {
return DataSource.version({ id: ida }).message;
}
// this doesn't work
this.thisOne = getSQLVersion(6);
// this doesn't work
this.showMeTheThing = document.getElementById('data-source-selection').value;
}
const GetDataSourceVersionInfo = {
bindings: {
schema: '<',
onRefresh: '&',
datasourceid: '=',
},
controller: GetDataSourceVersionCtrl,
template: '<span>{{ $ctrl.getDSV($ctrl.datasourceid).message }}</span>-{{ $ctrl.showMeTheThing }}-{{ $ctrl.datasourceid }}-<span ng-bind="$ctrl.getSQLVersion($ctrl.datasourceid)"></span>',
};
export default function (ngModule) {
ngModule.component('getDataSourceVersion', GetDataSourceVersionInfo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment