From 7ecd4c70e7823485e88324868182ba9446649997 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 5 Oct 2021 11:02:57 +1100 Subject: [PATCH] JS linting --- InvenTree/templates/js/translated/build.js | 29 ++++++++-------------- InvenTree/templates/js/translated/forms.js | 6 ++--- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js index 4e385d9f9a..90690cf728 100644 --- a/InvenTree/templates/js/translated/build.js +++ b/InvenTree/templates/js/translated/build.js @@ -4,7 +4,6 @@ /* globals buildStatusDisplay, constructForm, - getFieldByName, global_settings, imageHoverIcon, inventreeGet, @@ -397,7 +396,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { var row = $(table).bootstrapTable('getRowByUniqueId', pk); if (!row) { - console.log("WARNING: getRowByUniqueId returned null"); + console.log('WARNING: getRowByUniqueId returned null'); return; } @@ -834,12 +833,6 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { // ID of the associated "build output" (or null) var output_id = options.output || null; - var query_params = { - part: part_id, - sub_part_detail: true, - sub_part_trackable: output_id != null - }; - var source_location = options.source_location; function renderBomItemRow(bom_item, quantity) { @@ -915,7 +908,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { return html; } - var table_entries = ""; + var table_entries = ''; for (var idx = 0; idx < bom_items.length; idx++) { var bom_item = bom_items[idx]; @@ -1045,7 +1038,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { // Add callback to "clear" button for take_from field addClearCallback( - "take_from", + 'take_from', take_from_field, options, ); @@ -1098,7 +1091,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { // Provide nested values opts.nested = { - "items": item_pk_values + 'items': item_pk_values }; inventreePut( @@ -1116,13 +1109,13 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { }, error: function(xhr) { switch (xhr.status) { - case 400: - handleFormErrors(xhr.responseJSON, fields, opts); - break; - default: - $(opts.modal).modal('hide'); - showApiError(xhr); - break; + case 400: + handleFormErrors(xhr.responseJSON, fields, opts); + break; + default: + $(opts.modal).modal('hide'); + showApiError(xhr); + break; } } } diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index 2d8a563550..bffb42403b 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -905,7 +905,7 @@ function handleNestedErrors(errors, field_name, options) { return; } - var nest_list = nest_list = options["nested"][field_name]; + var nest_list = nest_list = options['nested'][field_name]; // Nest list must be provided! if (!nest_list) { @@ -996,7 +996,7 @@ function handleFormErrors(errors, fields, options) { var field = fields[field_name]; - if ((field.type == "field") && ("child" in field)) { + if ((field.type == 'field') && ('child' in field)) { // This is a "nested" field handleNestedErrors(errors, field_name, options); } else { @@ -1348,7 +1348,7 @@ function initializeRelatedField(field, fields, options) { query.limit = pageSize; // Allow custom run-time filter augmentation - if ("adjustFilters" in field) { + if ('adjustFilters' in field) { query = field.adjustFilters(query); }