mirror of
https://github.com/valitydev/redash.git
synced 2024-11-09 02:06:49 +00:00
22 lines
482 B
JavaScript
22 lines
482 B
JavaScript
function QuerySnippet($resource) {
|
|
const resource = $resource('api/query_snippets/:id', { id: '@id' });
|
|
resource.prototype.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);
|
|
}
|