-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[qa] Switched to prettier for CSS/JS formatting
- Loading branch information
1 parent
f20f6a2
commit af5effb
Showing
9 changed files
with
64 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
openwisp_firmware_upgrader/static/firmware-upgrader/css/upgrade-options.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
openwisp_firmware_upgrader/static/firmware-upgrader/js/build.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
django.jQuery(function ($) { | ||
function initSelect2() { | ||
$('select[id^="id_firmwareimage_set"][id$="type"]') | ||
.not('select[name*="__prefix__"]') | ||
.select2(); | ||
} | ||
$('.add-row > a').click(initSelect2); | ||
initSelect2(); | ||
function initSelect2() { | ||
$('select[id^="id_firmwareimage_set"][id$="type"]') | ||
.not('select[name*="__prefix__"]') | ||
.select2(); | ||
} | ||
$(".add-row > a").click(initSelect2); | ||
initSelect2(); | ||
}); |
69 changes: 37 additions & 32 deletions
69
openwisp_firmware_upgrader/static/firmware-upgrader/js/device-firmware.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,42 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
django.jQuery(function ($) { | ||
if(firmwareUpgraderSchema === null) { | ||
if (firmwareUpgraderSchema === null) { | ||
return; | ||
} | ||
var firmwareImageChanged = false; | ||
// Do not render JSONSchema form if the image field is not changed. | ||
// The "change" event is also emitted when the form is rendered. | ||
// The "firmwareImageChanged" variable is used as flag to prevent this | ||
// behavior. | ||
if ( | ||
$("#id_devicefirmware-0-upgrade_options").val() && | ||
$("#id_devicefirmware-0-upgrade_options").val() !== "null" | ||
) { | ||
firmwareImageChanged = true; | ||
} | ||
$("#devicefirmware-group").on( | ||
"change", | ||
"#id_devicefirmware-0-image", | ||
function (event) { | ||
if (!$(event.target).val()) { | ||
$("#id_devicefirmware-0-upgrade_options_jsoneditor").hide(); | ||
return; | ||
} | ||
var firmwareImageChanged = false; | ||
// Do not render JSONSchema form if the image field is not changed. | ||
// The "change" event is also emitted when the form is rendered. | ||
// The "firmwareImageChanged" variable is used as flag to prevent this | ||
// behavior. | ||
if ( | ||
$('#id_devicefirmware-0-upgrade_options').val() && $('#id_devicefirmware-0-upgrade_options').val() !== 'null' | ||
) { | ||
} | ||
$("#id_devicefirmware-0-upgrade_options_jsoneditor").show(); | ||
if (firmwareImageChanged) { | ||
django._loadJsonSchemaUi( | ||
$("#id_devicefirmware-0-upgrade_options").get(0), | ||
false, | ||
firmwareUpgraderSchema, | ||
true, | ||
); | ||
} else { | ||
firmwareImageChanged = true; | ||
} | ||
$('#devicefirmware-group').on('change', '#id_devicefirmware-0-image', function (event) { | ||
if (!$(event.target).val()) { | ||
$('#id_devicefirmware-0-upgrade_options_jsoneditor').hide(); | ||
return; | ||
} | ||
$('#id_devicefirmware-0-upgrade_options_jsoneditor').show(); | ||
if (firmwareImageChanged) { | ||
django._loadJsonSchemaUi( | ||
$('#id_devicefirmware-0-upgrade_options').get(0), | ||
false, | ||
firmwareUpgraderSchema, | ||
true | ||
); | ||
} else { | ||
firmwareImageChanged = true; | ||
} | ||
}); | ||
$('#devicefirmware-group .add-row a').click(function() { | ||
firmwareImageChanged = true; | ||
}); | ||
} | ||
}, | ||
); | ||
$("#devicefirmware-group .add-row a").click(function () { | ||
firmwareImageChanged = true; | ||
}); | ||
}); |
25 changes: 12 additions & 13 deletions
25
openwisp_firmware_upgrader/static/firmware-upgrader/js/upgrade-selected-confirmation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
django.jQuery(function ($) { | ||
if(firmwareUpgraderSchema === null) { | ||
$('.form-row').hide(); | ||
|
||
} else { | ||
django._loadJsonSchemaUi( | ||
$('textarea[name="upgrade_options"]').get(0), | ||
false, | ||
firmwareUpgraderSchema, | ||
true | ||
); | ||
} | ||
$('#ow-loading').hide(); | ||
if (firmwareUpgraderSchema === null) { | ||
$(".form-row").hide(); | ||
} else { | ||
django._loadJsonSchemaUi( | ||
$('textarea[name="upgrade_options"]').get(0), | ||
false, | ||
firmwareUpgraderSchema, | ||
true, | ||
); | ||
} | ||
$("#ow-loading").hide(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters