Initial implementation of mixpanel instead of GA

This commit is contained in:
Jeff Morgan 2014-12-06 14:41:59 -05:00
Родитель fd1f51ff79
Коммит 0bb1153103
27 изменённых файлов: 123 добавлений и 149 удалений

9
.gitignore поставляемый
Просмотреть файл

@ -1,6 +1,4 @@
.DS_Store
bundle
bundle.tar.gz
.demeteorized
dist
node_modules
@ -9,14 +7,15 @@ cache
bin
# Resources
resources/cache
resources/base-images-*.tar.gz
resources/virtualbox-*.pkg
resources/boot2docker*
resources/node-webkit
resources/mongod
resources/MONGOD_LICENSE.txt
resources/node
resources/NODE_LICENSE.txt
resources/settings.json
# Cache
cache
script/sign.sh

Просмотреть файл

@ -166,6 +166,7 @@
"VirtualBox": true,
"ImageUtil": true,
"AppUtil": true,
"Metrics": true
// Forms
"showFormErrors": true,
@ -173,8 +174,7 @@
"formValidate": true,
"FormSchema": true,
"showFormSuccess": true,
"resetForm": true,
"trackLink": true,
"resetForm": true
// Testing
"require": false,

Просмотреть файл

@ -9,5 +9,4 @@ raix:handlebar-helpers
mrt:underscore-string-latest
dburles:collection-helpers
iron:router
reywood:iron-router-ga
simison:bootstrap3-less

Просмотреть файл

@ -49,7 +49,6 @@ reactive-dict@1.0.4
reactive-var@1.0.3
reload@1.1.1
retry@1.0.1
reywood:iron-router-ga@0.4.1
routepolicy@1.0.2
session@1.0.4
simison:bootstrap3-less@0.3.0

Просмотреть файл

@ -269,7 +269,7 @@ ImageUtil.sync = function (callback) {
return _.contains(kitematicIds, image.Id);
});
_.each(diffDockerImages, function (image) {
if (!image.RepoTags || _.isEmpty(image.Config.ExposedPorts)) {
if (!image.RepoTags || !image.Config || _.isEmpty(image.Config.ExposedPorts)) {
return;
}

Просмотреть файл

@ -0,0 +1,37 @@
var remote = require('remote');
var app = remote.require('app');
var crypto = require('crypto');
var getmac = require('getmac');
var uuid = require('node-uuid');
var Mixpanel = require('mixpanel');
var mixpanel = Mixpanel.init(Meteor.settings.public.mixpanel.token);
Metrics = {};
Metrics.trackEvent = function (name) {
if (!name) {
return;
}
var uuid = localStorage.getItem('metrics.userId');
if (localStorage.getItem('metrics.enabled') && uuid) {
mixpanel.track('docker_gui ' + name, {
distinct_id: uuid,
version: app.getVersion()
});
}
};
Metrics.prepareTracking = function () {
if (localStorage.getItem('metrics.enabled') === null) {
var settings = Settings.findOne();
if (settings && settings.tracking) {
localStorage.setItem('metrics.enabled', !!settings.tracking);
} else {
localStorage.setItem('metrics.enabled', true);
}
}
if (!localStorage.getItem('metrics.uuid')) {
localStorage.setItem('metrics.uuid', uuid.v4());
}
};

Просмотреть файл

@ -1,13 +1,5 @@
Router.configure({
layoutTemplate: 'layout',
onBeforeAction: function () {
var setting = Settings.findOne({});
if (setting && setting.tracking) {
var currentPath = Router.current().path;
ga('send', 'pageview', currentPath);
}
this.next();
}
layoutTemplate: 'layout'
});
DashboardController = RouteController.extend({
@ -44,11 +36,8 @@ Router.map(function () {
if (err) {
console.log('Setup failed.');
console.log(err);
Metrics.trackEvent('app setup failed');
} else {
var settings = Settings.findOne();
if (!settings) {
Settings.insert({tracking: true});
}
startUpdatingBoot2DockerUtilization();
startSyncingAppState();
if (Apps.findOne()) {

Просмотреть файл

@ -18,6 +18,13 @@ Meteor.startup(function () {
fs.mkdirSync(Util.getResourceDir());
}
Metrics.prepareTracking();
Metrics.trackEvent('app started');
Metrics.trackEvent('app heartbeat');
Meteor.setInterval(function () {
Metrics.trackEvent('app heartbeat');
}, 14400000);
Boot2Docker.ip(function (err, ip) {
if (!err) {
console.log('Setting host IP to: ' + ip);

Просмотреть файл

@ -186,12 +186,3 @@ Util.compareVersions = function (v1, v2, options) {
return 0;
};
trackLink = function (trackLabel) {
var setting = Settings.findOne({});
if (setting && setting.tracking) {
if (trackLabel) {
ga('send', 'event', 'link', 'click', trackLabel);
}
}
};

Просмотреть файл

@ -29,7 +29,7 @@
<div class="env-var-key" data-key="{{name}}" title="{{name}}">{{name}}</div>
<div class="env-var-value" data-value="{{value}}" title="{{value}}">{{value}}</div>
<div class="options">
<a href="#" onclick="trackLink('delete environment variable')" class="btn btn-negative btn-xs btn-delete-var" data-app-id="{{../_id}}" data-key="{{name}}"><i class="fa fa-times"></i></a>
<a href="#" onclick="Metrics.trackEvent('container remove environment variable')" class="btn btn-negative btn-xs btn-delete-var" data-app-id="{{../_id}}" data-key="{{name}}"><i class="fa fa-times"></i></a>
</div>
</div>
{{/each}}
@ -41,7 +41,7 @@
<input type="text" name="env-var-value" class="form-control" placeholder="New Value">
</div>
</div>
<button onclick="trackLink('add environment variable')" type="submit" class="btn btn-action btn-sm">Save Variable</button>
<button onclick="Metrics.trackEvent('container add environment variable')" type="submit" class="btn btn-action btn-sm">Save Variable</button>
</form>
</div>
</div>
@ -52,9 +52,9 @@
</div>
<div class="right-section">
{{#if volumesEnabled}}
<a onclick="trackLink('enable container volumes')" class="btn btn-negative btn-disable-volumes btn-sm">Disable Volumes</a>
<a onclick="Metrics.trackEvent('container enable volumes')" class="btn btn-negative btn-disable-volumes btn-sm">Disable Volumes</a>
{{else}}
<a onclick="trackLink('disable container volumes')" class="btn btn-positive btn-enable-volumes btn-sm">Enable Volumes</a>
<a onclick="Metrics.trackEvent('container disable volumes')" class="btn btn-positive btn-enable-volumes btn-sm">Enable Volumes</a>
{{/if}}
</div>
</div>
@ -64,7 +64,7 @@
<p class="help-block">Delete this container permanently.</p>
</div>
<div class="right-section">
<a onclick="trackLink('delete container')" class="btn btn-negative btn-delete-app btn-sm">Delete Container</a>
<a onclick="Metrics.trackEvent('container delete')" class="btn btn-negative btn-delete-app btn-sm">Delete Container</a>
</div>
</div>
</template>

Просмотреть файл

@ -5,7 +5,7 @@
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<a href="#" data-toggle="modal" data-target="#modal-create-app" class="btn btn-action" disabled="disabled"><span class="typcn typcn-plus-outline"></span> Create Container</a>
{{else}}
<a href="#" onclick="trackLink('create container')" data-toggle="modal" data-target="#modal-create-app" class="btn btn-action"><span class="typcn typcn-plus-outline"></span> Create Container</a>
<a href="#" onclick="Metrics.trackEvent('container create modal')" data-toggle="modal" data-target="#modal-create-app" class="btn btn-action"><span class="typcn typcn-plus-outline"></span> Create Container</a>
{{/if}}
</div>
</div>
@ -24,7 +24,7 @@
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<a href="#" data-toggle="modal" data-target="#modal-create-app" class="btn btn-action" disabled="disabled"><span class="typcn typcn-plus-outline"></span> Create Container</a>
{{else}}
<a href="#" onclick="trackLink('create container')" data-toggle="modal" data-target="#modal-create-app" class="btn btn-action"><span class="typcn typcn-plus-outline"></span> Create Container</a>
<a href="#" onclick="Metrics.trackEvent('container create modal')" data-toggle="modal" data-target="#modal-create-app" class="btn btn-action"><span class="typcn typcn-plus-outline"></span> Create Container</a>
{{/if}}
</div>
{{/if}}

Просмотреть файл

@ -18,18 +18,18 @@
{{/if}}
{{/if}}
{{/if}}
<a onclick="trackLink('container detail')" href="/apps/{{name}}" class="name">{{name}}</a>
<small><a onclick="trackLink('container image detail')" href="/images/{{image._id}}">{{displayTags image.tags}}</a></small>
<a onclick="Metrics.trackEvent('container details')" href="/apps/{{name}}" class="name">{{name}}</a>
<small><a onclick="Metrics.trackEvent('container view image details')" href="/images/{{image._id}}">{{displayTags image.tags}}</a></small>
</h5>
<div class="options">
{{#if $eq status 'READY'}}
{{#if ports}}
{{#if viewPort}}
<div class="ports btn-group btn-icon" title="View" data-placement="bottom">
<a href="{{viewPort.url}}" onclick="trackLink('view container')" class="btn btn-action btn-xs btn-view btn-globe">
<a href="{{viewPort.url}}" onclick="Metrics.trackEvent('container open browser')" class="btn btn-action btn-xs btn-view btn-globe">
<span class="typcn typcn-world-outline"></span>
</a>
<a href="#" class="btn btn-action btn-xs btn-caret dropdown-toggle" id="dashboardAppsPorts" data-toggle="dropdown">
<a href="#" class="btn btn-action btn-xs btn-caret dropdown-toggle" onclick="Metrics.trackEvent('container view ports')" id="dashboardAppsPorts" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</a>
@ -40,7 +40,7 @@
{{else}}
<span class="ports dropdown">
<div class="dropdown btn-group btn-icon dropdown-toggle" id="dashboardAppsPorts" data-toggle="dropdown" data-placement="bottom" title="View">
<a href="#" onclick="trackLink('view container')" class="btn btn-action btn-xs btn-globe btn-ports">
<a href="#" onclick="Metrics.trackEvent('container view ports')" class="btn btn-action btn-xs btn-globe btn-ports">
<span class="typcn typcn-world-outline"></span>
<span class="caret"></span>
</a>
@ -52,19 +52,19 @@
{{/if}}
{{/if}}
{{/if}}
<a href="#" onclick="trackLink('open container folder')" class="btn-icon btn-folder" data-toggle="tooltip" data-placement="bottom" title="Volumes"><span class="typcn typcn-folder"></span></a>
<a href="#" onclick="Metrics.trackEvent('container open volume directory')" class="btn-icon btn-folder" data-toggle="tooltip" data-placement="bottom" title="Volumes"><span class="typcn typcn-folder"></span></a>
{{#if $eq status 'READY'}}
<a href="#" onclick="trackLink('terminal into container')" class="btn-icon btn-terminal" data-toggle="tooltip" data-placement="bottom" title="Terminal"><span class="typcn typcn-device-laptop"></span></a>
<a href="#" onclick="trackLink('stop container')" class="btn-icon btn-stop" data-toggle="tooltip" data-placement="bottom" title="Stop"><span class="typcn typcn-media-stop-outline"></span></a>
<a href="#" onclick="Metrics.trackEvent('container open terminal')" class="btn-icon btn-terminal" data-toggle="tooltip" data-placement="bottom" title="Terminal"><span class="typcn typcn-device-laptop"></span></a>
<a href="#" onclick="Metrics.trackEvent('container stop')" class="btn-icon btn-stop" data-toggle="tooltip" data-placement="bottom" title="Stop"><span class="typcn typcn-media-stop-outline"></span></a>
{{/if}}
{{#if $eq status 'STOPPED'}}
<a href="#" onclick="trackLink('start container')" class="btn-icon btn-start" data-toggle="tooltip" data-placement="bottom" title="Start"><span class="typcn typcn-media-play-outline"></span></a>
<a href="#" onclick="Metrics.trackEvent('container start')" class="btn-icon btn-start" data-toggle="tooltip" data-placement="bottom" title="Start"><span class="typcn typcn-media-play-outline"></span></a>
{{/if}}
{{#unless changingState}}
<a href="#" onclick="trackLink('restart container')" class="btn-icon btn-restart" data-toggle="tooltip" data-placement="bottom" title="Restart"><span class="typcn typcn-refresh-outline"></span></a>
<a href="#" onclick="Metrics.trackEvent('container restart')" class="btn-icon btn-restart" data-toggle="tooltip" data-placement="bottom" title="Restart"><span class="typcn typcn-refresh-outline"></span></a>
{{/unless}}
<a href="/apps/{{name}}/logs" onclick="trackLink('container logs')" class="btn-icon btn-logs" data-toggle="tooltip" data-placement="bottom" title="Logs"><span class="typcn typcn-document-text"></span></a>
<a href="/apps/{{name}}/settings" onclick="trackLink('container settings')" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Settings"><span class="typcn typcn-cog-outline"></span></a>
<a href="/apps/{{name}}/logs" onclick="Metrics.trackEvent('container open logs')" class="btn-icon btn-logs" data-toggle="tooltip" data-placement="bottom" title="Logs"><span class="typcn typcn-document-text"></span></a>
<a href="/apps/{{name}}/settings" onclick="Metrics.trackEvent('container open settings')" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Settings"><span class="typcn typcn-cog-outline"></span></a>
</div>
</div>
</template>

Просмотреть файл

@ -6,10 +6,10 @@
<div class="mac-maximize"><i class="fa fa-plus no-display"></i></div>
</div>
<ul class="nav nav-pills nav-stacked">
<li class="{{activeDashboardMenuItem 'apps'}}"><a onclick="trackLink('menu containers')" href="/apps" data-toggle="tooltip" data-placement="right" title="Containers"><i class="fa fa-cube"></i></a></li>
<li class="{{activeDashboardMenuItem 'images'}}"><a onclick="trackLink('menu images')" href="/images" data-toggle="tooltip" data-placement="right" title="Images" style="margin-left: -2px;"><i class="fa fa-camera"></i></a></li>
<li class="{{activeDashboardMenuItem 'apps'}}"><a onclick="Metrics.trackEvent('container menu')" href="/apps" data-toggle="tooltip" data-placement="right" title="Containers"><i class="fa fa-cube"></i></a></li>
<li class="{{activeDashboardMenuItem 'images'}}"><a onclick="Metrics.trackEvent('image menu')" href="/images" data-toggle="tooltip" data-placement="right" title="Images" style="margin-left: -2px;"><i class="fa fa-camera"></i></a></li>
<li class="{{activeDashboardMenuItem 'settings'}}">
<a onclick="trackLink('menu settings')" href="/settings" data-toggle="tooltip" data-placement="right" title="Settings" style="margin-left: 1px;"><i class="fa fa-gear"></i></a>
<a onclick="Metrics.trackEvent('settings menu')" href="/settings" data-toggle="tooltip" data-placement="right" title="Settings" style="margin-left: 1px;"><i class="fa fa-gear"></i></a>
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<span class="warning-badge"><i class="fa fa-exclamation"></i></span>
{{/if}}

Просмотреть файл

@ -47,7 +47,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Close</button>
{{#if hasItem images}}
<button onclick="trackLink('confirm create app')" type="submit" class="btn btn-sm btn-action">Create Container</button>
<button onclick="Metrics.trackEvent('container create')" type="submit" class="btn btn-sm btn-action">Create Container</button>
{{else}}
<button type="submit" class="btn btn-sm btn-action" disabled="disabled">Create Container</button>
{{/if}}

Просмотреть файл

@ -11,12 +11,12 @@
<p>Select a folder with Dockerfile to build your image.</p>
<h5 id="picked-directory"></h5>
<h6 id="picked-directory-error" class="error"></h6>
<a onclick="trackLink('pick image folder')" href="#" id="btn-pick-directory" class="btn btn-positive btn-sm"><span class="typcn typcn-folder-open"></span> Select Folder</a>
<a onclick="Metrics.trackEvent('image choose directory')" href="#" id="btn-pick-directory" class="btn btn-positive btn-sm"><span class="typcn typcn-folder-open"></span> Select Folder</a>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Close</button>
<button onclick="trackLink('confirm create image')" id="btn-create-image" type="button" class="btn btn-sm btn-action" disabled="disabled">Create Image</button>
<button onclick="Metrics.trackEvent('image create')" id="btn-create-image" type="button" class="btn btn-sm btn-action" disabled="disabled">Create Image</button>
</div>
</div>
</div>

Просмотреть файл

@ -61,7 +61,7 @@
<div class="right-section">
<h5><strong>{{this.path}}</strong></h5>
<h6 id="picked-directory-error" class="error"></h6>
<a onclick="trackLink('change build directory')" href="#" id="btn-pick-directory" class="btn btn-positive btn-sm"><span class="typcn typcn-folder-open"></span> Change Directory</a>
<a onclick="Metrics.trackEvent('image change directory')" href="#" id="btn-pick-directory" class="btn btn-positive btn-sm"><span class="typcn typcn-folder-open"></span> Change Directory</a>
</div>
</div>
<div class="section">
@ -70,7 +70,7 @@
<p class="help-block">Delete this image permanently.</p>
</div>
<div class="right-section">
<a onclick="trackLink('delete image')" class="btn btn-negative btn-delete-image btn-sm">Delete Image</a>
<a onclick="Metrics.trackEvent('image delete')" class="btn btn-negative btn-delete-image btn-sm">Delete Image</a>
<div id="error-delete-image" class="error no-display"></div>
</div>
</div>

Просмотреть файл

@ -5,7 +5,7 @@
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<a href="#" data-toggle="modal" data-target="#modal-create-image" class="btn btn-action" disabled="disabled"><span class="typcn typcn-plus-outline"></span> Create Image</a>
{{else}}
<a href="#" onclick="trackLink('create image')" data-toggle="modal" data-target="#modal-create-image" class="btn btn-action"><span class="typcn typcn-plus-outline"></span> Create Image</a>
<a href="#" onclick="Metrics.trackEvent('image create modal')" data-toggle="modal" data-target="#modal-create-image" class="btn btn-action"><span class="typcn typcn-plus-outline"></span> Create Image</a>
{{/if}}
</div>
</div>
@ -26,7 +26,7 @@
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<a href="#" data-toggle="modal" data-target="#modal-create-image" class="btn btn-action" disabled="disabled"><span class="typcn typcn-plus-outline"></span> Create Image</a>
{{else}}
<a href="#" onclick="trackLink('create image')" data-toggle="modal" data-target="#modal-create-image" class="btn btn-action"><span class="typcn typcn-plus-outline"></span>Create Image</a>
<a href="#" onclick="Metrics.trackEvent('image create modal')" data-toggle="modal" data-target="#modal-create-image" class="btn btn-action"><span class="typcn typcn-plus-outline"></span>Create Image</a>
{{/if}}
</div>
{{/if}}

Просмотреть файл

@ -18,7 +18,7 @@
{{/if}}
{{/if}}
{{/if}}
<a onclick="trackLink('image detail')" href="/images/{{_id}}" class="name">{{displayTags tags ', '}}</a>
<a onclick="Metrics.trackEvent('image details')" href="/images/{{_id}}" class="name">{{displayTags tags ', '}}</a>
{{#if $eq status 'BUILDING'}}
<small>Creating image. This may take a couple minutes...</small>
{{else}}
@ -28,19 +28,19 @@
<div class="options">
{{#if $eq status 'READY'}}
{{#if hasExposedPort}}
<a onclick="trackLink('create container from image')" href="#" class="btn-icon btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container"><span class="typcn typcn-plus-outline"></span></a>
<a onclick="Metrics.trackEvent('image create container')" href="#" class="btn-icon btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container"><span class="typcn typcn-plus-outline"></span></a>
{{/if}}
{{/if}}
{{#if path}}
<a onclick="trackLink('open image folder')" href="#" class="btn-icon btn-folder" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Folder"><span class="typcn typcn-folder-open"></span></a>
<a onclick="Metrics.trackEvent('image open directory')" href="#" class="btn-icon btn-folder" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Folder"><span class="typcn typcn-folder-open"></span></a>
{{/if}}
{{#if $neq status 'BUILDING'}}
{{#if path}}
<a onclick="trackLink('rebuild image')" href="#" class="btn-icon btn-rebuild" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Rebuild"><span class="typcn typcn-refresh-outline"></span></a>
<a onclick="Metrics.trackEvent('image rebuild')" href="#" class="btn-icon btn-rebuild" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Rebuild"><span class="typcn typcn-refresh-outline"></span></a>
{{/if}}
{{/if}}
<a onclick="trackLink('image logs')" href="/images/{{_id}}/logs" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Logs"><span class="typcn typcn-document-text"></span></a>
<a onclick="trackLink('image settings')" href="/images/{{_id}}/settings" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Settings"><span class="typcn typcn-cog-outline"></span></a>
<a onclick="Metrics.trackEvent('image logs')" href="/images/{{_id}}/logs" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Logs"><span class="typcn typcn-document-text"></span></a>
<a onclick="Metrics.trackEvent('image settings')" href="/images/{{_id}}/settings" class="btn-icon" data-toggle="tooltip" data-placement="bottom" title="Settings"><span class="typcn typcn-cog-outline"></span></a>
</div>
</div>
</template>

Просмотреть файл

@ -9,30 +9,27 @@
{{> menuHeader}}
<div class="header">
<h3>
<a href="/apps" onclick="trackLink('back to containers')">Containers</a> &raquo; {{this.name}}
<a href="/apps" onclick="Metrics.trackEvent('container back to list')">Containers</a> &raquo; {{this.name}}
<span class="icons">
{{#if $eq status 'READY'}}
{{#if url}}
<a onclick="trackLink('view container')" href="{{url}}" class="btn-view" target="_blank" data-toggle="tooltip" data-placement="bottom" title="View" data-container="body"><span class="typcn typcn-eye-outline"></span></a>
{{/if}}
<a onclick="trackLink('terminal into container')" href="#" class="btn-terminal" data-toggle="tooltip" data-placement="bottom" title="Terminal" data-container="body"><span class="typcn typcn-device-laptop"></span></a>
<a onclick="Metrics.trackEvent('container details terminal')" href="#" class="btn-terminal" data-toggle="tooltip" data-placement="bottom" title="Terminal" data-container="body"><span class="typcn typcn-device-laptop"></span></a>
{{#if image}}
<a onclick="trackLink('go to container image')" href="/images/{{image._id}}" class="btn-image" data-toggle="tooltip" data-placement="bottom" title="Image" data-container="body"><span class="typcn typcn-camera-outline"></span></a>
<a onclick="Metrics.trackEvent('container details view image details')" href="/images/{{image._id}}" class="btn-image" data-toggle="tooltip" data-placement="bottom" title="Image" data-container="body"><span class="typcn typcn-camera-outline"></span></a>
{{/if}}
{{/if}}
<a onclick="trackLink('open container folder')" href="#" class="btn-folder" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Folder" data-container="body"><span class="typcn typcn-folder-open"></span></a>
<a onclick="Metrics.trackEvent('container details open volume directory')" href="#" class="btn-folder" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Folder" data-container="body"><span class="typcn typcn-folder-open"></span></a>
{{#if $eq status 'READY'}}
<a href="#" onclick="trackLink('stop container')" class="btn-icon btn-stop" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Stop"><span class="typcn typcn-media-stop-outline"></span></a>
<a href="#" onclick="Metrics.trackEvent('container details stop')" class="btn-icon btn-stop" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Stop"><span class="typcn typcn-media-stop-outline"></span></a>
{{/if}}
{{#if $eq status 'STOPPED'}}
<a href="#" onclick="trackLink('start container')" class="btn-icon btn-start" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Start"><span class="typcn typcn-media-play-outline"></span></a>
<a href="#" onclick="Metrics.trackEvent('container details start')" class="btn-icon btn-start" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Start"><span class="typcn typcn-media-play-outline"></span></a>
{{/if}}
<a onclick="trackLink('restart container')" href="#" class="btn-restart" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Restart" data-container="body"><span class="typcn typcn-refresh-outline"></span></a>
<a onclick="Metrics.trackEvent('container details restart')" href="#" class="btn-restart" target="_blank" data-toggle="tooltip" data-placement="bottom" title="Restart" data-container="body"><span class="typcn typcn-refresh-outline"></span></a>
</span>
</h3>
<div class="options">
<a onclick="trackLink('container logs')" href="/apps/{{this.name}}/logs" class=" btn btn-action {{activeDashboardSubMenuItem 'logs'}} btn-logs"><span class="typcn typcn-document-text"></span> Logs</a>
<a onclick="trackLink('container settings')" href="/apps/{{this.name}}/settings" class="btn btn-action {{activeDashboardSubMenuItem 'settings'}}"><span class="typcn typcn-cog-outline"></span> Settings</a>
<a onclick="Metrics.trackEvent('container details logs')" href="/apps/{{this.name}}/logs" class=" btn btn-action {{activeDashboardSubMenuItem 'logs'}} btn-logs"><span class="typcn typcn-document-text"></span> Logs</a>
<a onclick="Metrics.trackEvent('container details settings')" href="/apps/{{this.name}}/settings" class="btn btn-action {{activeDashboardSubMenuItem 'settings'}}"><span class="typcn typcn-cog-outline"></span> Settings</a>
</div>
</div>
<div class="content">

Просмотреть файл

@ -9,26 +9,26 @@
{{> menuHeader}}
<div class="header">
<h3>
<a href="/images" onclick="trackLink('back to images')">Images</a> &raquo; {{this.meta.name}}
<a href="/images" onclick="Metrics.trackEvent('image back to list')">Images</a> &raquo; {{this.meta.name}}
<span class="icons">
{{#if $eq status 'READY'}}
{{#if hasExposedPort}}
<a onclick="trackLink('create container from image')" href="#" class="btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container" data-container="body"><span class="typcn typcn-plus-outline"></span></a>
<a onclick="Metrics.trackEvent('image details create container')" href="#" class="btn-create-app" data-toggle="tooltip" data-placement="bottom" title="Create Container" data-container="body"><span class="typcn typcn-plus-outline"></span></a>
{{/if}}
{{/if}}
{{#if path}}
<a onclick="trackLink('open image folder')" href="#" class="btn-folder" data-toggle="tooltip" data-placement="bottom" title="Folder" data-container="body"><span class="typcn typcn-folder-open"></span></a>
<a onclick="Metrics.trackEvent('image details open directory')" href="#" class="btn-folder" data-toggle="tooltip" data-placement="bottom" title="Folder" data-container="body"><span class="typcn typcn-folder-open"></span></a>
{{/if}}
{{#if $neq status 'BUILDING'}}
{{#if path}}
<a onclick="trackLink('rebuild image')" href="#" class="btn-rebuild" data-toggle="tooltip" data-placement="bottom" title="Rebuild" data-container="body"><span class="typcn typcn-refresh-outline"></span></a>
<a onclick="Metrics.trackEvent('image details rebuild')" href="#" class="btn-rebuild" data-toggle="tooltip" data-placement="bottom" title="Rebuild" data-container="body"><span class="typcn typcn-refresh-outline"></span></a>
{{/if}}
{{/if}}
</span>
</h3>
<div class="options">
<a onclick="trackLink('image logs')" href="/images/{{this._id}}/logs" class="btn btn-action {{activeDashboardSubMenuItem 'logs'}}"><span class="typcn typcn-document-text"></span> Logs</a>
<a onclick="trackLink('image settings')" href="/images/{{this._id}}/settings" class="btn btn-action {{activeDashboardSubMenuItem 'settings'}}"><span class="typcn typcn-cog-outline"></span> Settings</a>
<a onclick="Metrics.trackEvent('image details logs')" href="/images/{{this._id}}/logs" class="btn btn-action {{activeDashboardSubMenuItem 'logs'}}"><span class="typcn typcn-document-text"></span> Logs</a>
<a onclick="Metrics.trackEvent('image details settings')" href="/images/{{this._id}}/settings" class="btn btn-action {{activeDashboardSubMenuItem 'settings'}}"><span class="typcn typcn-cog-outline"></span> Settings</a>
</div>
</div>
<div class="content">

Просмотреть файл

@ -6,11 +6,6 @@
<div class="section dashboard-settings">
<div class="left-section">
<h4>Boot2Docker VM</h4>
{{#if $.Session.equals 'boot2dockerState' 'poweroff'}}
<p class="help-block error">Please start Boot2Docker for Kitematic to work properly!</p>
{{else}}
<p class="help-block">All containers run in a Linux VM included with Kitematic. It needs to be turned on to run containers.</p>
{{/if}}
</div>
<div class="right-section">
{{#if disk}}
@ -41,10 +36,10 @@
<p class="help-block">Send anonymized usage diagnostics to help us improve Kitematic.</p>
</div>
<div class="right-section">
{{#if settings.tracking}}
<a onclick="trackLink('turn off usage analytics')" class="btn btn-negative btn-usage-analytics-off">Turn Off Usage Diagnostics</a>
{{#if metricsEnabled}}
<a onclick="Metrics.trackEvent('settings disable metrics')" class="btn btn-negative btn-usage-analytics-off">Turn Off Usage Diagnostics</a>
{{else}}
<a onclick="trackLink('turn on usage analytics')" class="btn btn-positive btn-usage-analytics-on">Turn On Usage Diagnostics</a>
<a onclick="Metrics.trackEvent('settings enable metrics')" class="btn btn-positive btn-usage-analytics-on">Turn On Usage Diagnostics</a>
{{/if}}
</div>
</div>

Просмотреть файл

@ -2,60 +2,22 @@ var remote = require('remote');
var dialog = remote.require('dialog');
Template.dashboardSettings.events({
'click .btn-start-boot2docker': function (e) {
var $btn = $(e.currentTarget);
$btn.html('Starting Boot2Docker...');
$btn.attr("disabled", "disabled");
Session.set('boot2dockerOff', false);
Boot2Docker.start(function (err) {
if (err) {
console.log(err);
}
});
},
'click .btn-stop-boot2docker': function (e) {
var $btn = $(e.currentTarget);
$btn.html('Stopping Boot2Docker...');
$btn.attr("disabled", "disabled");
Session.set('boot2dockerOff', true);
Boot2Docker.stop(function (err) {
if (err) {
console.log(err);
}
});
},
'click .btn-usage-analytics-on': function () {
var settings = Settings.findOne();
Settings.update(settings._id, {
$set: {
tracking: true
}
});
localStorage.setItem('metrics.enabled', true);
Session.set('metrics.enabled', true);
},
'click .btn-usage-analytics-off': function () {
var settings = Settings.findOne();
Settings.update(settings._id, {
$set: {
tracking: false
}
});
},
'click .btn-repair': function () {
dialog.showMessageBox({
message: 'Repairing Kitematic will clear your current Docker VM and the state of the app. Please make sure your work is backed up. Do you wish to continue?',
buttons: ['Repair', 'Cancel']
}, function (index) {
if (index !== 0) {
return;
}
Router.go('setup_intro');
});
localStorage.setItem('metrics.enabled', false);
Session.set('metrics.enabled', false);
}
});
Template.dashboardSettings.helpers({
settings: function () {
return Settings.findOne({});
metricsEnabled: function () {
if (Session.get('metrics.enabled') === undefined) {
Session.set('metrics.enabled', localStorage.getItem('metrics.enabled'));
}
return Session.get('metrics.enabled');
},
memory: function () {
return Session.get('boot2dockerMemoryUsage');

Просмотреть файл

@ -1,5 +1,5 @@
<template name="updateNotification">
{{#if updateAvailable}}
<div class="update-alert" role="alert"><span class="update-text">A new version of Kitematic is available.</span> <a href="#" class="btn btn-action-inverse btn-inverse btn-xs btn-update">Update Now</a></div>
<div class="update-alert" role="alert"><span class="update-text">A new version of Kitematic is available.</span> <a href="#" onclick="Metrics.trackEvent('app update')" class="btn btn-action-inverse btn-inverse btn-xs btn-update">Update Now</a></div>
{{/if}}
</template>

Просмотреть файл

@ -1,10 +1,7 @@
{
"public": {
"ga": {
"id": "UA-54515442-1",
"create": {
"cookieDomain": "none"
}
"mixpanel": {
"token": "812536ceb71a26ccf29e861a78bdd6ff"
}
}
}

Просмотреть файл

@ -25,6 +25,9 @@
"open": "0.0.5",
"request": "2.42.0",
"request-progress": "0.3.1",
"tar": "0.1.20"
"tar": "0.1.20",
"mixpanel": "0.0.20",
"node-uuid": "1.4.1",
"getmac": "1.0.6"
}
}

Просмотреть файл

@ -12,4 +12,3 @@ sed '/App running at/q' <&3 ; cat <&3 &
NODE_ENV=development $BASE/cache/atom-shell/Atom.app/Contents/MacOS/Atom $BASE
kill $(ps aux | grep '.*node.*kitematic' | awk '{print $2}')
kill $(ps aux | grep '.*mongod.*kitematic' | awk '{print $2}')

Просмотреть файл

@ -39,7 +39,7 @@ fi
cd $BASE
NODE="$BASE/cache/node/bin/node"
BOOT2DOCKER_CLI_VERSION=$($NODE -pe "JSON.parse(process.argv[1])['boot2dockerversion']" "$(cat package.json)")
BOOT2DOCKER_CLI_VERSION=$($NODE -pe "JSON.parse(process.argv[1])['boot2docker-version']" "$(cat package.json)")
BOOT2DOCKER_CLI_VERSION_FILE=boot2docker-$BOOT2DOCKER_CLI_VERSION
cd resources