mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 18:03:54 +00:00
22 lines
498 B
JavaScript
22 lines
498 B
JavaScript
function QuerySnippet($resource) {
|
|
const resource = $resource('api/query_snippets/:id', { id: '@id' });
|
|
resource.prototype.getSnippet = function getSnippet() {
|
|
let name = this.trigger;
|
|
if (this.description !== '') {
|
|
name = `${this.trigger}: ${this.description}`;
|
|
}
|
|
|
|
return {
|
|
name,
|
|
content: this.snippet,
|
|
tabTrigger: this.trigger,
|
|
};
|
|
};
|
|
|
|
return resource;
|
|
}
|
|
|
|
export default function (ngModule) {
|
|
ngModule.factory('QuerySnippet', QuerySnippet);
|
|
}
|