diff --git a/packages/local-sync/src/local-sync-dashboard/public/images/close.png b/packages/local-sync/images/close.png similarity index 100% rename from packages/local-sync/src/local-sync-dashboard/public/images/close.png rename to packages/local-sync/images/close.png diff --git a/packages/local-sync/src/local-sync-dashboard/public/images/dropdown.png b/packages/local-sync/images/dropdown.png similarity index 100% rename from packages/local-sync/src/local-sync-dashboard/public/images/dropdown.png rename to packages/local-sync/images/dropdown.png diff --git a/packages/local-sync/main.es6 b/packages/local-sync/main.es6 index bd555b299..14da6c9e0 100644 --- a/packages/local-sync/main.es6 +++ b/packages/local-sync/main.es6 @@ -1,9 +1,14 @@ +/* eslint global-require: 0 */ +import {ComponentRegistry} from 'nylas-exports' import {createLogger} from './src/shared/logger' export function activate() { global.Logger = createLogger('local-sync') - require('./src/local-api/app.js'); - require('./src/local-sync-worker/app.js'); + require('./src/local-api/app'); + require('./src/local-sync-worker/app'); + + const Root = require('./src/local-sync-dashboard/root').default; + ComponentRegistry.register(Root, {role: 'Developer:LocalSyncUI'}); } export function deactivate() { diff --git a/packages/local-sync/src/local-sync-dashboard/app.js b/packages/local-sync/src/local-sync-dashboard/app.js deleted file mode 100644 index d9719213d..000000000 --- a/packages/local-sync/src/local-sync-dashboard/app.js +++ /dev/null @@ -1,49 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const Inert = require('inert'); -const Hapi = require('hapi'); -const HapiWebSocket = require('hapi-plugin-websocket'); - -const server = new Hapi.Server(); -server.connection({ port: process.env.PORT }); - -const attach = (directory) => { - const routesDir = path.join(__dirname, directory) - fs.readdirSync(routesDir).forEach((filename) => { - if (filename.endsWith('.js')) { - const routeFactory = require(path.join(routesDir, filename)); - routeFactory(server); - } - }); -} - -server.register([HapiWebSocket, Inert], () => { - attach('./routes/') - - server.route({ - method: 'GET', - path: '/ping', - config: { - auth: false, - }, - handler: (request, reply) => { - global.Logger.info("---> Ping!") - reply("pong") - }, - }); - - server.route({ - method: 'GET', - path: '/{param*}', - handler: { - directory: { - path: require('path').join(__dirname, 'public'), - }, - }, - }); - - server.start((startErr) => { - if (startErr) { throw startErr; } - global.Logger.info({uri: server.info.uri}, 'Dashboard running'); - }); -}); diff --git a/packages/local-sync/src/local-sync-dashboard/public/js/dropdown.jsx b/packages/local-sync/src/local-sync-dashboard/dropdown.jsx similarity index 94% rename from packages/local-sync/src/local-sync-dashboard/public/js/dropdown.jsx rename to packages/local-sync/src/local-sync-dashboard/dropdown.jsx index c09f78d64..31a8f7a19 100644 --- a/packages/local-sync/src/local-sync-dashboard/public/js/dropdown.jsx +++ b/packages/local-sync/src/local-sync-dashboard/dropdown.jsx @@ -1,6 +1,6 @@ -const React = window.React; +import {React} from 'nylas-exports'; -class Dropdown extends React.Component { +export default class Dropdown extends React.Component { constructor(props) { super(props); this.state = { @@ -67,5 +67,3 @@ Dropdown.propTypes = { defaultOption: React.PropTypes.string, onSelect: React.PropTypes.func, } - -window.Dropdown = Dropdown; diff --git a/packages/local-sync/src/local-sync-dashboard/public/js/elapsed-time.jsx b/packages/local-sync/src/local-sync-dashboard/elapsed-time.jsx similarity index 83% rename from packages/local-sync/src/local-sync-dashboard/public/js/elapsed-time.jsx rename to packages/local-sync/src/local-sync-dashboard/elapsed-time.jsx index ecad76b01..c8b2b2a4d 100644 --- a/packages/local-sync/src/local-sync-dashboard/public/js/elapsed-time.jsx +++ b/packages/local-sync/src/local-sync-dashboard/elapsed-time.jsx @@ -1,12 +1,11 @@ -const React = window.React; -const ReactDOM = window.ReactDOM; +import {React, ReactDOM} from 'nylas-exports'; setInterval(() => { const event = new Event('tick'); window.dispatchEvent(event); }, 1000); -class ElapsedTime extends React.Component { +export default class ElapsedTime extends React.Component { constructor(props) { super(props); this.state = { @@ -36,5 +35,3 @@ ElapsedTime.propTypes = { refTimestamp: React.PropTypes.number, // milliseconds formatTime: React.PropTypes.func, } - -window.ElapsedTime = ElapsedTime; diff --git a/packages/local-sync/src/local-sync-dashboard/public/js/modal.jsx b/packages/local-sync/src/local-sync-dashboard/modal.jsx similarity index 96% rename from packages/local-sync/src/local-sync-dashboard/public/js/modal.jsx rename to packages/local-sync/src/local-sync-dashboard/modal.jsx index bcc8587f2..b8c350454 100644 --- a/packages/local-sync/src/local-sync-dashboard/public/js/modal.jsx +++ b/packages/local-sync/src/local-sync-dashboard/modal.jsx @@ -1,6 +1,6 @@ -const React = window.React; +import {React} from 'nylas-exports'; -class Modal extends React.Component { +export default class Modal extends React.Component { constructor(props) { super(props); this.state = { @@ -101,5 +101,3 @@ Modal.propTypes = { onClose: React.PropTypes.func, actionElems: React.PropTypes.arrayOf(React.PropTypes.object), } - -window.Modal = Modal; diff --git a/packages/local-sync/src/local-sync-dashboard/newrelic.js b/packages/local-sync/src/local-sync-dashboard/newrelic.js deleted file mode 100644 index 97cd18e90..000000000 --- a/packages/local-sync/src/local-sync-dashboard/newrelic.js +++ /dev/null @@ -1,21 +0,0 @@ -const {NODE_ENV} = process.env -/** - * New Relic agent configuration. - * - * See lib/config.defaults.js in the agent distribution for a more complete - * description of configuration variables and their potential values. - */ -exports.config = { - /** - * Array of application names. - */ - app_name: [`k2-dash-${NODE_ENV}`], - logging: { - /** - * Level at which to log. 'trace' is most useful to New Relic when diagnosing - * issues with the agent, 'info' and higher will impose the least overhead on - * production applications. - */ - level: 'info', - }, -} diff --git a/packages/local-sync/src/local-sync-dashboard/public/css/app.css b/packages/local-sync/src/local-sync-dashboard/public/css/app.css deleted file mode 100644 index c77a55c1c..000000000 --- a/packages/local-sync/src/local-sync-dashboard/public/css/app.css +++ /dev/null @@ -1,261 +0,0 @@ -body { - background-image: url(http://news.nationalgeographic.com/content/dam/news/2015/12/13/BookTalk%20K2/01BookTalkK2.jpg); - background-image: -moz-linear-gradient(top, rgba(232, 244, 250, 0.2), rgba(231, 231, 233, 1)), url(http://news.nationalgeographic.com/content/dam/news/2015/12/13/BookTalk%20K2/01BookTalkK2.jpg); - background-image: -webkit-linear-gradient(top, rgba(232, 244, 250, 0.2), rgba(231, 231, 233, 1)), url(http://news.nationalgeographic.com/content/dam/news/2015/12/13/BookTalk%20K2/01BookTalkK2.jpg); - background-size: 100vw auto; - background-attachment: fixed; - font-family: Roboto, sans-serif; - font-size: 11px; -} - -h2 { - padding-top: 10px; - text-align: center; -} - -pre { - margin: 0; -} - -#accounts-wrapper { - position: relative; -} - -.account { - position: absolute; - border-radius: 5px; - width: 240px; - height: 450px; - background-color: rgb(255, 255, 255); - padding: 15px; - margin: 5px; - overflow: hidden; -} - -.account h3 { - font-size: 13px; - margin: 0; - padding: 0; -} - -.account .section { - font-size: 12px; - padding: 10px 0; - text-align: center; -} - -.account.errored { - color: #a94442; - border-radius: 4px; - background-color: rgb(231, 195, 195); -} - -.error-link { - font-weight: bold; -} - -.error-link:hover { - cursor: pointer; - color: #702726; -} - -#open-all-sync { - color: #ffffff; - padding-left: 5px; -} - -.right-action { - float: right; - margin-top: 10px; -} - -.action-link { - color: rgba(16, 83, 161, 0.88); - text-decoration: underline; - cursor: pointer; - margin: 5px 0; -} - -.action-link.cancel { - margin-top: 10px; -} - -.sync-policy textarea { - width: 100%; - height: 200px; - white-space: pre; -} - -.modal { - background-color: white; - width: 50%; - margin: 10vh auto; - padding: 20px; - max-height: calc(80vh - 40px); /* minus padding */ - overflow: auto; -} - -.modal-bg { - position: fixed; - width: 100%; - height: 100%; - left: 0; - top: 0; - background-color: rgba(0, 0, 0, 0.3); - z-index: 10; -} - -.modal-close-wrapper { - position: relative; - height: 0; - width: 0; - float: right; - top: -10px; -} - -.modal-close { - position: absolute; - cursor: pointer; - font-size: 14px; - font-weight: bold; - background: url('../images/close.png') center center no-repeat; - background-size: 12px auto; - height: 12px; - width: 12px; - top: 12px; - right: 12px; -} - -.sync-graph { - margin-top: 3px; -} - -.stats b { - display: inline-block; - margin-top: 5px; - margin-bottom: 1px; -} - -#syncback-request-details { - font-size: 15px; - color: black; -} - -#syncback-request-details .counts { - margin: 10px; -} - -#syncback-request-details span { - margin: 10px; -} - -#syncback-request-details table { - width: 100%; - border: solid black 1px; - box-shadow: 1px 1px #333333; - margin: 10px 0; - border-collapse: collapse; -} - -#syncback-request-details tr:nth-child(even) { - background-color: #F1F1F1; -} - -#syncback-request-details tr:not(:first-child):hover { - background-color: #C9C9C9; -} - -#syncback-request-details td, #syncback-request-details th { - text-align: center; - padding: 10px 5px; - border: solid black 1px; -} - -.dropdown-arrow { - margin: 0 5px; - height: 7px; - vertical-align: middle; -} - -.dropdown-options { - border: solid black 1px; - position: absolute; - background-color: white; - text-align: left; - display: inline; -} - -.dropdown-option { - position: relative; - padding: 0px 2px; -} - -.dropdown-option:hover { - background-color: rgb(114, 163, 255); -} - -.dropdown-selected { - display: inline; -} - -.dropdown-wrapper { - display: inline; - cursor: pointer; - font-weight: normal; -} - -.mini-account::after { - display: inline-block; - position: relative; - height: 100%; - width: 100%; - background-color: #666666; - content: ""; - z-index: -1; -} - -.mini-account { - background-color: rgb(0, 255, 157); - display: inline-block; - width: 10px; - height: 10px; -} - -.mini-account.errored { - background-color: rgb(255, 38, 0); -} - -.process-loads { - display: inline-block; - padding: 15px; - width: 250px; - margin: 15px 0; - background-color: white; -} - -.process-loads .section { - text-decoration: underline; - margin-bottom: 10px; - font-size: 12px; -} - -.sum-accounts { - border-top: solid black 1px; - margin-top: 5px; - padding-top: 5px; -} - -.account-filter { - padding-left: 5px; -} - -.process-group { - display: inline-block; - margin: 10px; - max-width: 250px; - vertical-align: top; -} - -#group-by-process { - vertical-align: middle; -} diff --git a/packages/local-sync/src/local-sync-dashboard/public/favicon.png b/packages/local-sync/src/local-sync-dashboard/public/favicon.png deleted file mode 100644 index d595d6d01..000000000 Binary files a/packages/local-sync/src/local-sync-dashboard/public/favicon.png and /dev/null differ diff --git a/packages/local-sync/src/local-sync-dashboard/public/index.html b/packages/local-sync/src/local-sync-dashboard/public/index.html deleted file mode 100644 index 888e40cfb..000000000 --- a/packages/local-sync/src/local-sync-dashboard/public/index.html +++ /dev/null @@ -1,27 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - -{JSON.stringify(stack, null, 2)}-
{firstSyncDuration}- Average Time Between Syncs (sec): -
{avgBetweenSyncs}- Time Since Last Sync (sec): -
-- Recent Syncs: --