Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var project_data = null;
try
{
project_data = JSON.parse (value.target.result);
}
catch (e)
{
debug ('Project format error '+e);
}
if (project_data && _.isArray (project_data))
{
for (var projectIndex in project_data)
{
library.add (project_data[projectIndex]);
}
mixpanel.track ('Projects Import', {
// language: projectimport.language
});
$wyapp.emit ('library');
}
};
fileReader.onerror = function (err)
$mdDialog.show(message).then(function() {
var pos = _.indexOf($scope.project.dashboard, signal);
mixpanel.track ('Dashboard Erase',
{
language: $scope.project.language,
type: $scope.project.dashboard[pos].style
});
if (pos >= 0) $scope.project.dashboard.splice (pos, 1);
$timeout (function ()
{
$(window).trigger ('resize');
}, 500);
}, function() {
//
$mdDialog.show(message).then(function() {
$scope.project.schematics = '';
mixpanel.track ('Schematics Erase', {
language: $scope.project.language
});
library.storeSchematics ($scope.project.id, $scope.project.schematics);
}, function() {
this.rename = function (project)
{
mixpanel.track ('Project Rename', {
language: project.language
});
$mdDialog.hide ();
var renameProjDialog = $mdDialog.show({
controller: function ($scope)
{
$scope.title = project.title;
this.rename = function ()
{
debug ('Rename project '+project.title+' language '+project.language);
if ($scope.title.trim().length > 3)
{
$scope.showPopupRename = 0;
$scope.showPopupNewFolder = 0;
$scope.showPopupError = 0;
$scope.showPopupUpload = 0;
$scope.showPopupDownload = 0;
$scope.contentPopupRename = "";
$scope.contentPopupNewFolder = "";
$scope.contentPopupError = "";
$scope.MAXPACKET = 32*1024;
$scope.uploadvars={};
$scope.downloadvars={};
mixpanel.track ('File Explorer', {
category: $wydevice.device.category
});
var that = this;
var message = function (t, p)
{
//change dir
if (t === 'fe1')
{
$timeout (function ()
{
$scope.selectedRight = {}; //force deselectation
if (p[0] == "ERROR")
this.install = function (p, l)
{
p.loading = true;
$scope.runmanager = true;
$scope.runoutput = '';
$wydevice.send ('pm', {a:'i', p:p.n, l:l});
$scope.runpackage = p.n;
$scope.runlanguage = l;
mixpanel.track ('Package Install',
{
category: $wydevice.device.category,
package: p.n,
langauge: l
});
};
else
{
for(var index1=$scope.project.tree[0].children[index].children.length-1;index1>=0;index1--)
{
$scope.project.tree[0].children[index].children.splice(index1,1);
}
i=0;
_.each(firmware,function(firmwareData, firmwareFilename){
that.newFile(firmwareFilename);
$scope.project.tree[0].children[index].children[i].content=firmwareData;
i++;
});
}
});
mixpanel.track ('Project Load Firmware',
{
langauge: $scope.project.language
});
});
fileReader.onload = function (value)
{
$scope.project.schematics = value.target.result;
mixpanel.track ('Schematics Load', {
language: $scope.project.language
});
library.storeSchematics ($scope.project.id, $scope.project.schematics);
};
fileReader.readAsText (file);
app.controller('TaskManagerController', function($scope, $timeout, $mdDialog, $wydevice){
debug ('Registering');
$scope.tasks = [];
mixpanel.track ('Task Manager', {
category: $wydevice.device.category
});
var that = this;
var message = function (t, p)
{
if (t === 'tm')
{
$timeout (function ()
{
$scope.tasks = p;
});
}
};
$wydevice.on ('message', function (t, p)
{
if (t==='i')
{
if ($scope.device.category !== p.c || $scope.device.network !== p.i)
{
mixpanel.track ('Device Data',
{
category: p.c
});
}
$timeout (function ()
{
if (p.tr) $scope.running = p.tr;
else $scope.running = false;
if (settings.LABEL[p.c])
{
$scope.device.category = p.c;
$scope.device.network = p.i;
}
else
{
$scope.device.category = 'board';