Admin area gets a spinner when a device is deleted

Ólavur9 years ago

Hello,

The admin area gets a spinner in the device section when a device is deleted.:
Admin area

How can this be fixed?

I have checked the user_device table and it seems to have the correct values

Ólavur9 years ago

This error is shown in the browser:

ext-all.js:22 Uncaught TypeError: Cannot read property 'isModel' of null
    at F.extractData (ext-all.js:22)
    at F.extractData (ext-all.js:22)
    at F.readRecords (ext-all.js:22)
    at F.read (ext-all.js:22)
    at F.processResponse (ext-all.js:22)
    at F.<anonymous> (ext-all.js:22)
    at Object.callback (ext-all.js:22)
    at F.onComplete (ext-all.js:22)
    at F.onStateChange (ext-all.js:22)
    at XMLHttpRequest.<anonymous> (ext-all.js:22)
Anton Tananaev9 years ago

Usually it means that you have a problem with foreign keys in the database. You have some links to removed devices.

Ólavur9 years ago

Would that be in the user_device table?

Anton Tananaev9 years ago

Yes, most likely.

Ólavur9 years ago

Ok, I cleared all devices from user:
delete from user_device where userid = 1

And added one device again.

Problem solved :)

Anton Tananaev9 years ago

What database are you using?

Ólavur9 years ago

MySql

Anton Tananaev9 years ago

I suspect that you are using MyISAM engine which doesn't support foreign keys. You need to use InnoDB engine with Traccar.

Ólavur9 years ago

Show table status say MyISAM for all tables.

Is it easy to change it? Would it give any other problems?

Anton Tananaev9 years ago

It's not easy to change. As far as I know, you would have to re-create the database.

If you don't do it, you would always have problems with removing things from the database.

Ólavur9 years ago

This seemed to work:

ALTER TABLE DATABASECHANGELOG ENGINE=InnoDB;
ALTER TABLE DATABASECHANGELOGLOCK ENGINE=InnoDB;
ALTER TABLE attribute_aliases ENGINE=InnoDB;
ALTER TABLE device_geofence ENGINE=InnoDB;
ALTER TABLE devices ENGINE=InnoDB;
ALTER TABLE events ENGINE=InnoDB;
ALTER TABLE geofences ENGINE=InnoDB;
ALTER TABLE group_geofence ENGINE=InnoDB;
ALTER TABLE groups ENGINE=InnoDB;
ALTER TABLE notifications ENGINE=InnoDB;
ALTER TABLE positions ENGINE=InnoDB;
ALTER TABLE server ENGINE=InnoDB;
ALTER TABLE statistics ENGINE=InnoDB;
ALTER TABLE user_device ENGINE=InnoDB;
ALTER TABLE user_geofence ENGINE=InnoDB;
ALTER TABLE user_group ENGINE=InnoDB;
ALTER TABLE users ENGINE=InnoDB;

Anton Tananaev9 years ago

Yes, but the problem is that you don't have foreign keys.