SCADA-LTS / Scada-LTS

Scada-LTS is an Open Source, web-based, multi-platform solution for building your own SCADA (Supervisory Control and Data Acquisition) system.
GNU General Public License v2.0
744 stars 292 forks source link

Fix view import #1719

Open Limraj opened 3 years ago

Limraj commented 3 years ago

Describe the bug If the import process encounters an error, it should import the view. Currently, the object where the error occurred is not being imported.

To Reproduce

  1. Login as admin;

  2. Craete Virtual datasource nad datapoint dp_1;

  3. Craete graphical view gv_1, click on 'Graphical Views';

  4. Click on 'New View';

  5. Set view name;

  6. Click on 'Add Component to View' for 'Simple point'

  7. Set datapoint dp_1;

  8. Click save view;

  9. Click 'Import/Export' and click 'Export project', project should be exported to a * .zip file, inside this file there should be a json_project.txt file with the configuration;

  10. Delete dp_1 and gv_1;

  11. Click 'Import/Export'

  12. Copy "graphicalViews" array from json_project.txt file and past to "data" field;

  13. Click 'Import' and msg: "View 'GV_175911': Data point with XID 'DP_284435' not found", Similarly for the error: View 'GV_592706': Image set id '016-ISOMotorValveR' not found. Known image set ids are [BlinkingLights, Bomba-3D, Bomba-On-Off-gd, Bomba-On-Off-md, Bomba-On-Off-pq, Bullets, CarBattery, Drinks, Encanamento-A-3D, Encanamento-B-3D, Encanamento-C-3D, Fan, Fan2, Filtro-Manga-On-Off-Fail, Helice-3D, LavaLamp, Leds16, Leds24, Leds32, Leds48, Botao-3D, Sensor-on-off, Estrela-on-off, Anti-horario-on-off, Horario-on-off, Triangulo-on-off, LightBulb, LightBulb2, Misturador-3D, Motor-Horizontal-On-Off-Fail, Motor-Vertical-On-Off-Fail, Tanque-Nivel-gd, Tanque-Nivel-med, Tanque-Nivel-peq, Reservatorio-3D, Scada-LTS-Fan, Scada-LTS-Pump, Scada-LTS-Valve, SetPoint, Signal, Battery, Tank, Tanque-B-3D, Tanque-A-3D, GreenThermo, Valvula-3D, Valvula-on-off, Ventilador-Animado-gd, Ventilador-Animado-med, Ventilador-Animado-peq, Ventilador-On-Off-Fail, Weather, viconics.VAV, viconics.VT7200.BaseBoard, viconics.VT7200.ElectricalCoil, viconics.VT7200.HotWaterCoil, viconics.VT7300.BaseBoard, viconics.VT7300.ColdWaterCoil, viconics.VT7300.Fan, viconics.VT7300.Filter, viconics.VT7300.HotWaterCoil, viconics.VT7600.CoolingStage, viconics.VT7600.Damper, viconics.VT7600.Fan, viconics.VT7600.Filter, viconics.VT7600.HeatingStage]

  14. View not imported

arturro96 commented 3 years ago

If profile already exists in Scada with name same as profile from import file, it doesn't delete profiles and doesn't set proper permissions during import.