Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ChatOps Package to JavaScript #6425

Merged
merged 2 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/rocketchat-chatops/client/startup.coffee

This file was deleted.

5 changes: 5 additions & 0 deletions packages/rocketchat-chatops/client/startup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* globals GoogleMaps */
Meteor.startup(function() {
console.log('startup hooked');
return GoogleMaps.load();
});
24 changes: 0 additions & 24 deletions packages/rocketchat-chatops/client/tabBar.coffee

This file was deleted.

31 changes: 31 additions & 0 deletions packages/rocketchat-chatops/client/tabBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Meteor.startup(() =>
Tracker.autorun(function() {
if (RocketChat.TabBar) {
if (RocketChat.settings && RocketChat.settings.get('Chatops_Enabled')) {
console.log('Adding chatops to tabbar');
RocketChat.TabBar.addButton({
groups: ['channel', 'group', 'direct'],
id: 'chatops-button2',
i18nTitle: 'rocketchat-chatops:Chatops_Title',
icon: 'icon-hubot',
template: 'chatops-dynamicUI',
order: 4
});

console.log('Adding chatops to tabbar');
return RocketChat.TabBar.addButton({
groups: ['channel', 'group', 'direct'],
id: 'chatops-button3',
i18nTitle: 'rocketchat-chatops:Chatops_Title',
icon: 'icon-inbox',
template: 'chatops_droneflight',
width: 675,
order: 5
});
} else {
RocketChat.TabBar.removeButton('chatops-button2');
return RocketChat.TabBar.removeButton('chatops-button3');
}
}
})
);
1 change: 0 additions & 1 deletion packages/rocketchat-chatops/client/views/chatops.coffee

This file was deleted.

1 change: 1 addition & 0 deletions packages/rocketchat-chatops/client/views/chatops.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Template.chatops.helpers;
7 changes: 0 additions & 7 deletions packages/rocketchat-chatops/client/views/codemirror.coffee

This file was deleted.

9 changes: 9 additions & 0 deletions packages/rocketchat-chatops/client/views/codemirror.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Template.chatops_codemirror.helpers({
editorOptions() {
return {lineNumbers: true, mode:'javascript'};
},

editorCode() {
return '# This is a full featured, syntax highlighted editor\n# BOTs can fetch, edit, commit, and save source code\n#\n\nvar express = require("express");\nvar app = express();\n// respond with \"hello world\" when a GET request is made to the homepage \ +\napp.get("/", function(req, res) {\nres.send("hello world");\n});';
}
});
18 changes: 0 additions & 18 deletions packages/rocketchat-chatops/client/views/droneflight.coffee

This file was deleted.

23 changes: 23 additions & 0 deletions packages/rocketchat-chatops/client/views/droneflight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* globals GoogleMaps google*/
Template.chatops_droneflight.helpers({
flightMapOptions() {
if (GoogleMaps.loaded()) {
console.log('helper run');
return {center: new google.maps.LatLng(35.6609285, -78.8456125), zoom: 17};
}
}
});


Template.chatops_droneflight.onCreated(() =>
GoogleMaps.ready('flightMap', function(map) {
console.log('ready');
const redicon = { path: google.maps.SymbolPath.CIRCLE, fillColor: 'red', fillOpacity: 0.8, strokeColor: 'gold', strokeWeight: 2, scale: 10};
const greenicon = {path: google.maps.SymbolPath.CIRCLE, fillColor: 'green', fillOpacity: 0.8, strokeColor: 'gold', strokeWeight: 2, scale: 10};

const marker = new google.maps.Marker({position: new google.maps.LatLng(35.661848, -78.843165), icon: redicon, map: map.instance});
marker.setLabel('1');
const marker2 = new google.maps.Marker({position: new google.maps.LatLng(35.660537, -78.846959), icon: greenicon, map: map.instance});
return marker2.setLabel('2');
})
);
13 changes: 6 additions & 7 deletions packages/rocketchat-chatops/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Package.describe({

Package.onUse(function(api) {
api.use([
'coffeescript',
'ecmascript',
'rocketchat:lib',
'dburles:google-maps@1.1.5'
Expand All @@ -16,19 +15,19 @@ Package.onUse(function(api) {
api.use('templating', 'client');

api.addFiles([
'client/startup.coffee',
'client/tabBar.coffee',
'client/startup.js',
'client/tabBar.js',
'client/views/chatops.html',
'client/views/chatops.coffee',
'client/views/chatops.js',
'client/views/codemirror.html',
'client/views/codemirror.coffee',
'client/views/codemirror.js',
'client/views/droneflight.html',
'client/views/droneflight.coffee',
'client/views/droneflight.js',
'client/views/dynamicUI.html',
'client/views/stylesheets/chatops.css'
], 'client');

api.addFiles([
'server/settings.coffee'
'server/settings.js'
], 'server');
});
4 changes: 0 additions & 4 deletions packages/rocketchat-chatops/server/settings.coffee

This file was deleted.

5 changes: 5 additions & 0 deletions packages/rocketchat-chatops/server/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Meteor.startup(function() {
RocketChat.settings.addGroup('Chatops');
RocketChat.settings.add('Chatops_Enabled', false, { type: 'boolean', group: 'Chatops', public: true });
return RocketChat.settings.add('Chatops_Username', false, { type: 'string', group: 'Chatops', public: true });
});