diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ffdb927526c..fba1e0d9269 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -427,6 +427,7 @@ def report_only # moved this method here so it can be accessed from pxe_server controller as well # this is a terrible name, it doesn't validate log_depots + # TODO: I think we can move this back to the pxe_server_controller and eliminate all non-pxe code paths def log_depot_validate @schedule = nil # setting to nil, since we are using same view for both db_back and log_depot edit # if zone is selected in tree replace tab#3 diff --git a/app/controllers/miq_ae_class_controller.rb b/app/controllers/miq_ae_class_controller.rb index 1bbbfcaa8da..de5a8769308 100644 --- a/app/controllers/miq_ae_class_controller.rb +++ b/app/controllers/miq_ae_class_controller.rb @@ -803,7 +803,6 @@ def set_method_form_vars else _("Editing Automate Method \"%{name}\"") % {:name => @ae_method.name} end - session[:log_depot_default_verify_status] = false session[:edit] = @edit session[:changed] = @changed = false end @@ -1024,14 +1023,11 @@ def form_method_field_changed end @edit[:new][:fields][f[1].to_i]['default_value'] = nil end - if @edit[:default_verify_status] != session[:log_depot_default_verify_status] - session[:log_depot_default_verify_status] = @edit[:default_verify_status] - page << if @edit[:default_verify_status] - "miqValidateButtons('show', 'default_');" - else - "miqValidateButtons('hide', 'default_');" - end - end + page << if @edit[:default_verify_status] + "miqValidateButtons('show', 'default_');" + else + "miqValidateButtons('hide', 'default_');" + end page << javascript_for_miq_button_visibility_changed(@changed) page << "miqSparkle(false)" end diff --git a/app/controllers/ops_controller.rb b/app/controllers/ops_controller.rb index 0008b705389..447d2feca4d 100644 --- a/app/controllers/ops_controller.rb +++ b/app/controllers/ops_controller.rb @@ -59,15 +59,12 @@ def display_ae_namespaces end OPS_X_BUTTON_ALLOWED_ACTIONS = { - 'collect_logs' => :logs_collect, - 'collect_current_logs' => :collect_current_logs, 'custom_button' => :custom_buttons, 'delete_server' => :delete_server, 'demote_server' => :demote_server, 'fetch_audit_log' => :fetch_audit_log, 'fetch_log' => :fetch_log, 'fetch_production_log' => :fetch_production_log, - 'log_depot_edit' => :log_depot_edit, 'promote_server' => :promote_server, 'rbac_group_add' => :rbac_group_add, 'rbac_group_edit' => :rbac_group_edit, @@ -104,11 +101,8 @@ def display_ae_namespaces 'ap_host_edit' => :ap_host_edit, 'ap_vm_edit' => :ap_vm_edit, 'ap_copy' => :ap_copy, - 'zone_collect_logs' => :logs_collect, - 'zone_collect_current_logs' => :collect_current_logs, 'zone_delete_server' => :delete_server, 'zone_demote_server' => :demote_server, - 'zone_log_depot_edit' => :log_depot_edit, 'zone_promote_server' => :promote_server, 'zone_role_start' => :role_start, 'zone_role_suspend' => :role_suspend, @@ -124,11 +118,6 @@ def display_ae_namespaces 'schedule_run_now' => :schedule_run_now }.freeze - def collect_current_logs - assert_privileges("#{x_node.split('-').first == "z" ? "zone_" : ""}collect_current_logs") - logs_collect(:only_current => true) - end - # handle buttons pressed on the center buttons toolbar def x_button generic_x_button(OPS_X_BUTTON_ALLOWED_ACTIONS) @@ -471,9 +460,6 @@ def set_form_locals locals[:submit_text] = _("Select Start date and End date to Collect C & U Data") locals[:no_reset] = true locals[:no_cancel] = true - elsif @sb[:active_tab] == "diagnostics_collect_logs" - action_url = "log_depot_edit" - record_id = @record && @record.id ? @record.id : "new" else action_url = "old_dialogs_update" record_id = my_server.id @@ -592,7 +578,6 @@ def replace_right_cell(options = {}) tree_selected_model if @tree_selected_model.nil? locals = set_form_locals if @in_a_form - build_supported_depots_for_select presenter = ExplorerPresenter.new(:active_tree => x_active_tree) @@ -626,9 +611,6 @@ def diagnostics_replace_right_cell(nodetype, presenter) if %w[accordion_select change_tab explorer tree_select].include?(params[:action]) || %w[diagnostics_roles_servers diagnostics_servers_roles].include?(@sb[:active_tab]) presenter.replace(:ops_tabs, r[:partial => "all_tabs"]) - elsif nodetype == "log_depot_edit" - @right_cell_text = _("Editing Log Depot settings") - presenter.update(:diagnostics_collect_logs, r[:partial => "ops/log_collection"]) else presenter.update(@sb[:active_tab], r[:partial => "#{@sb[:active_tab]}_tab"]) end @@ -791,7 +773,7 @@ def handle_bottom_cell(nodetype, presenter, locals) if @pages presenter.hide(:form_buttons_div) elsif @in_a_form - if ["log_depot_edit", "ze"].include?(nodetype) + if ["ze"].include?(nodetype) presenter.hide(:form_buttons_div) else presenter.update(:form_buttons_div, r[:partial => "layouts/x_edit_buttons", :locals => locals]) diff --git a/app/controllers/ops_controller/diagnostics.rb b/app/controllers/ops_controller/diagnostics.rb index ce17870e5c9..c26369c7da9 100644 --- a/app/controllers/ops_controller/diagnostics.rb +++ b/app/controllers/ops_controller/diagnostics.rb @@ -74,80 +74,6 @@ def pm_refresh_workers end alias refresh_workers pm_refresh_workers - def log_depot_edit - assert_privileges("#{@sb[:selected_typ] == "miq_server" ? "" : "zone_"}log_depot_edit") - @record = @sb[:selected_typ].classify.constantize.find(@sb[:selected_server_id]) - # @schedule = nil # setting to nil, since we are using same view for both db_back and log_depot edit - case params[:button] - when "cancel" - @in_a_form = false - @edit = session[:edit] = nil - add_flash(_("Edit Log Depot settings was cancelled by the user")) - diagnostics_set_form_vars - replace_right_cell(:nodetype => x_node) - when "save" - if @flash_array - javascript_flash(:spinner_off => true) - return - end - - begin - if params[:log_protocol].blank? - @record.log_file_depot.try(:destroy) - else - new_uri = "#{params[:uri_prefix]}://#{params[:uri]}" - raise _("Unsupported log depot protocol: %{protocol}") % {:protocol => params[:log_protocol]} unless FileDepot.supported_depots.key?(params[:log_protocol]) - - build_supported_depots_for_select - log_protocol = params[:log_protocol] - protocols = FileDepot.supported_depots.map { |k, _v| [k, k.constantize] }.to_h - raise _('Invalid or unsupported file depot type.') unless protocols.key?(log_protocol) - - depot = @record.log_file_depot.instance_of?(protocols[log_protocol]) ? @record.log_file_depot : @record.build_log_file_depot(:type => log_protocol) - depot.update(:uri => new_uri, :name => params[:depot_name]) - creds = set_credentials - depot.update_authentication(creds) if protocols[log_protocol].try(:requires_credentials?) - @record.save! - end - rescue => bang - add_flash(_("Error during 'Save': %{message}") % {:message => bang.message}, :error) - @changed = true - render :update do |page| - page << javascript_prologue - page.replace_html("diagnostics_collect_logs", :partial => "ops/log_collection") - end - else - add_flash(_("Log Depot Settings were saved")) - @edit = nil - diagnostics_set_form_vars - replace_right_cell(:nodetype => x_node) - end - when "validate" - creds = set_credentials - settings = { - :username => creds[:default][:userid], - :password => creds[:default][:password], - :uri => "#{params[:uri_prefix]}://#{params[:uri]}" - } - - begin - log_protocol = params[:log_protocol] - protocols = FileDepot.supported_depots.map { |k, _v| [k, k.constantize] }.to_h - raise _("Unsupported log depot protocol: %{protocol}") % {:protocol => log_protocol} unless protocols.key?(log_protocol) - - protocols[log_protocol].validate_settings(settings) - rescue => bang - add_flash(_("Error during 'Validate': %{message}") % {:message => bang.message}, :error) - else - add_flash(_("Log Depot Settings were validated")) - end - javascript_flash(:spinner_off => true) - when nil # Reset or first time in - @in_a_form = true - replace_right_cell(:nodetype => "log_depot_edit") - end - end - # Send the log in text format def fetch_log assert_privileges("fetch_log") @@ -257,36 +183,6 @@ def cu_repair end end - def log_collection_form_fields - assert_privileges("#{@sb[:selected_typ] == "miq_server" ? "" : "zone_"}log_depot_edit") - @record = @sb[:selected_typ].classify.constantize.find(@sb[:selected_server_id]) - log_depot = @record.log_file_depot - log_depot_json = log_depot ? build_log_depot_json(log_depot) : build_empty_log_depot_json - render :json => log_depot_json - end - - def build_log_depot_json(log_depot) - prefix, uri = log_depot[:uri].to_s.split('://') - klass = @record.log_file_depot.try(:class) - - log_depot_json = {:depot_name => log_depot[:name], - :uri => uri, - :uri_prefix => prefix, - :log_userid => log_depot.authentication_userid, - :log_protocol => klass.to_s} - log_depot_json - end - - def build_empty_log_depot_json - log_depot_json = {:depot_name => '', - :uri => '', - :uri_prefix => '', - :log_userid => '', - :log_password => '', - :log_protocol => ''} - log_depot_json - end - def diagnostics_server_list assert_privileges("ops_diagnostics_server_view") @@ -376,31 +272,6 @@ def cu_repair_get_form_vars end end - # Collect the current logs from the selected zone or server - def logs_collect(options = {}) - options[:support_case] = params[:support_case] if params[:support_case] - obj, id = x_node.split("-") - assert_privileges("#{obj == "z" ? "zone_" : ""}collect_logs") - klass = obj == "svr" ? MiqServer : Zone - instance = @selected_server = klass.find(id.to_i) - if !instance.active? - add_flash(_("Cannot start log collection, requires a started server"), :error) - elsif instance.log_collection_active_recently? - add_flash(_("Cannot start log collection, a log collection is already in progress within this scope"), :error) - else - begin - options[:context] = klass.name - instance.synchronize_logs(session[:userid], options) - rescue => bang - add_flash(_("Log collection error returned: %{error_message}") % {:error_message => bang.message}, :error) - else - add_flash(_("Log collection for %{product} %{object_type} %{name} has been initiated") % {:product => Vmdb::Appliance.PRODUCT_NAME, :object_type => klass.name, :name => instance.display_name}) - end - end - get_node_info(x_node) - replace_right_cell(:nodetype => x_node) - end - # Reload the selected node and redraw the screen via ajax def refresh_server_summary assert_privileges("refresh_server_summary") @@ -677,7 +548,7 @@ def diagnostics_set_form_vars @sb[:selected_typ] = "miq_server" end else - @sb[:active_tab] = "diagnostics_collect_logs" # setting it to show collect logs tab as first tab for the servers that are not started + @sb[:active_tab] = "diagnostics_summary" # setting it to summary tab as first tab for the servers that are not started @record = @selected_server = MiqServer.find(x_node.split("-").last.to_i) @sb[:selected_server_id] = @selected_server.id @sb[:selected_typ] = "miq_server" @@ -726,20 +597,4 @@ def diagnostics_get_info diagnostics_set_form_vars end end - - def build_supported_depots_for_select - not_supported_depots = %w[FileDepotS3 FileDepotSwift] - supported_depots = FileDepot.supported_depots.reject { |model, _desc| not_supported_depots.include?(model) } - @uri_prefixes = supported_depots.keys.map { |model| [model, model.constantize.uri_prefix] }.to_h - @supported_depots_for_select = {'' => _('')}.merge(supported_depots) - end - - def set_credentials - creds = {} - if params[:log_userid] - log_password = params[:log_password] || @record.log_file_depot.authentication_password - creds[:default] = {:userid => params[:log_userid], :password => log_password} - end - creds - end end diff --git a/app/controllers/ops_controller/settings/schedules.rb b/app/controllers/ops_controller/settings/schedules.rb index 2855d6d694a..bec4c631bd1 100644 --- a/app/controllers/ops_controller/settings/schedules.rb +++ b/app/controllers/ops_controller/settings/schedules.rb @@ -267,6 +267,9 @@ def schedule_disable schedule_toggle(false) end + # TODO: I think we can drop this now that log collection is dropped, however, PXE needs FileDepot validation, and + # I'm not sure if this method is also used by PXE validation. Note that application_controller has a log_depot_validate + # as well, which might be the one used for PXE. By extension, build_uri_settings can probably also be dropped. def log_depot_validate assert_privileges("schedule_admin") diff --git a/app/helpers/application_helper/button/collect_logs.rb b/app/helpers/application_helper/button/collect_logs.rb deleted file mode 100644 index 01046bab417..00000000000 --- a/app/helpers/application_helper/button/collect_logs.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ApplicationHelper::Button::CollectLogs < ApplicationHelper::Button::LogDepotEdit - include ApplicationHelper::Button::Mixins::ButtonPromptMixin - needs :@record - - def disabled? - @error_message = if !@record.started? - _('Cannot collect current logs unless the Server is started') - elsif @record.log_collection_active_recently? - _('Log collection is already in progress for this Server') - elsif !@record.log_file_depot - _('Log collection requires the Log Depot settings to be configured') - end - @error_message.present? - end -end diff --git a/app/helpers/application_helper/button/log_depot_edit.rb b/app/helpers/application_helper/button/log_depot_edit.rb deleted file mode 100644 index 98c4ee63431..00000000000 --- a/app/helpers/application_helper/button/log_depot_edit.rb +++ /dev/null @@ -1,7 +0,0 @@ -class ApplicationHelper::Button::LogDepotEdit < ApplicationHelper::Button::Basic - include ApplicationHelper::Button::Mixins::ActiveContextMixin - - def visible? - active_tree?(:diagnostics_tree) && active_tab?('diagnostics_collect_logs') - end -end diff --git a/app/helpers/application_helper/button/mixins/button_prompt_mixin.rb b/app/helpers/application_helper/button/mixins/button_prompt_mixin.rb deleted file mode 100644 index 6ecf06fe6d4..00000000000 --- a/app/helpers/application_helper/button/mixins/button_prompt_mixin.rb +++ /dev/null @@ -1,6 +0,0 @@ -module ApplicationHelper::Button::Mixins::ButtonPromptMixin - def calculate_properties - super - self[:prompt] = @record.try(:log_file_depot).try(:requires_support_case?) - end -end diff --git a/app/helpers/application_helper/button/zone_collect_logs.rb b/app/helpers/application_helper/button/zone_collect_logs.rb deleted file mode 100644 index 1ddafad7ecd..00000000000 --- a/app/helpers/application_helper/button/zone_collect_logs.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ApplicationHelper::Button::ZoneCollectLogs < ApplicationHelper::Button::LogDepotEdit - include ApplicationHelper::Button::Mixins::ButtonPromptMixin - needs :@record - - def disabled? - @error_message = if !@record.any_started_miq_servers? - _('Cannot collect current logs unless there are started Servers in the Zone') - elsif !@record.log_file_depot - _('This Zone do not have Log Depot settings configured, collection not allowed') - elsif @record.log_collection_active_recently? - _('Log collection is already in progress for one or more Servers in this Zone') - end - @error_message.present? - end -end diff --git a/app/helpers/application_helper/toolbar/diagnostics_server_center.rb b/app/helpers/application_helper/toolbar/diagnostics_server_center.rb index 904ef93246b..d3e0de64250 100644 --- a/app/helpers/application_helper/toolbar/diagnostics_server_center.rb +++ b/app/helpers/application_helper/toolbar/diagnostics_server_center.rb @@ -57,34 +57,6 @@ class ApplicationHelper::Toolbar::DiagnosticsServerCenter < ApplicationHelper::T :klass => ApplicationHelper::Button::DiagnosticsProductionLogs), ]) button_group('ldap_domain_vmdb', [ - select( - :server_collect_logs_choice, - nil, - N_('Collect Logs'), - N_('Collect'), - :items => [ - button( - :collect_current_logs, - 'fa fa-filter fa-lg', - N_('Collect the current logs from the selected Server'), - N_('Collect current logs'), - :klass => ApplicationHelper::Button::CollectLogs - ), - button( - :collect_logs, - 'fa fa-filter fa-lg', - N_('Collect all logs from the selected Server'), - N_('Collect all logs'), - :klass => ApplicationHelper::Button::CollectLogs - ), - ] - ), - button( - :log_depot_edit, - 'pficon pficon-edit fa-lg', - N_('Edit the Log Depot settings for the selected Server'), - N_('Edit'), - :klass => ApplicationHelper::Button::LogDepotEdit), select( :restart_vmdb_choice, nil, diff --git a/app/helpers/application_helper/toolbar/diagnostics_zone_center.rb b/app/helpers/application_helper/toolbar/diagnostics_zone_center.rb index 9135def2bde..aa233e7db23 100644 --- a/app/helpers/application_helper/toolbar/diagnostics_zone_center.rb +++ b/app/helpers/application_helper/toolbar/diagnostics_zone_center.rb @@ -80,34 +80,6 @@ class ApplicationHelper::Toolbar::DiagnosticsZoneCenter < ApplicationHelper::Too :klass => ApplicationHelper::Button::ServerLevelOptions ), ] - ), - select( - :zone_collect_logs_choice, - 'fa fa-filter fa-lg', - N_('Collect Logs'), - N_('Collect'), - :items => [ - button( - :zone_collect_current_logs, - 'fa fa-filter fa-lg', - N_('Collect the current logs from the selected Zone'), - N_('Collect current logs'), - :klass => ApplicationHelper::Button::ZoneCollectLogs - ), - button( - :zone_collect_logs, - 'fa fa-filter fa-lg', - N_('Collect all logs from the selected Zone'), - N_('Collect all logs'), - :klass => ApplicationHelper::Button::ZoneCollectLogs - ), - ] - ), - button( - :zone_log_depot_edit, - 'pficon pficon-edit fa-lg', - N_('Edit the Log Depot settings for the selected Zone'), - N_('Edit'), - :klass => ApplicationHelper::Button::LogDepotEdit), + ) ]) end diff --git a/app/helpers/ops_helper.rb b/app/helpers/ops_helper.rb index 5609a72ab15..093a421ecd8 100644 --- a/app/helpers/ops_helper.rb +++ b/app/helpers/ops_helper.rb @@ -42,26 +42,6 @@ def database_tab_summary miq_structured_list(@data) end - def collect_logs_tab - record = @selected_server - log_depot_uri = (record.log_file_depot.try(:uri) || "N/A").to_s - last_time = record.last_log_sync_on - last_collection_time = last_time.blank? ? _("Never") : format_timezone(last_time.to_time, Time.zone, "gtl") - data = {:title => _('Basic Information'), :mode => "miq_summary"} - data[:rows] = [ - row_data(_('Log Depot URI'), log_depot_uri), - row_data(_('Last Log Collection'), last_collection_time) - ] - if record.respond_to?(:last_log_sync_message) - data[:rows] = [ - row_data(_('Log Depot URI'), log_depot_uri), - row_data(_('Last Log Collection'), last_collection_time), - row_data(_('Last Message'), record.last_log_sync_message) - ] - end - miq_structured_list(data) - end - def hide_button(button, opt) if opt == "on" button ? '' : 'display:none' diff --git a/app/javascript/components/diagnostics-collect-log-form/index.jsx b/app/javascript/components/diagnostics-collect-log-form/index.jsx deleted file mode 100644 index 36d89962875..00000000000 --- a/app/javascript/components/diagnostics-collect-log-form/index.jsx +++ /dev/null @@ -1,70 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import MiqFormRenderer from '@@ddf'; -import PropTypes from 'prop-types'; -import createSchema from './schema'; -import { http } from '../../http_api'; - -const DiagnosticsCollectLogForm = ({ initialData }) => { - const url = `/ops/log_depot_edit/${initialData.recordId}}`; - // option item like does not contain a value which is not required to passed into API. - const BLANK = 'BLANK_VALUE'; - const newPageData = { - depot_name: '', - uri: '', - uri_prefix: '', - log_protocol: '', - log_userid: '', - log_password: '', - }; - const [data, setData] = useState({ isLoading: initialData.recordId !== 'new', pageData: newPageData }); - const options = Object.entries(initialData.options).map((item) => ({ label: item[1], value: item[0] || BLANK })); - - useEffect(() => { - if (initialData.recordId !== 'new') { - http.get(`/${initialData.controller}/log_collection_form_fields/${initialData.recordId}`) - .then((response) => { - let responseData = { ...response }; - if (response.log_userid !== '') { - responseData = { ...responseData, log_password: '●●●●●●●●' }; - } - setData({ - isLoading: false, - pageData: responseData, - }); - }); - } - }, [initialData.recordId]); - - const onSubmit = (values) => { - const changedValues = { ...values, uri_prefix: initialData.prefixes[values.log_protocol] || null }; - const formData = { ...data.pageData, ...changedValues }; - // removes the null value attributes from the formData - Object.keys(formData).forEach((key) => (formData[key] == null || formData[key] === BLANK) && delete formData[key]); - miqAjaxButton(`${url}?button=save`, formData); - }; - - const onCancel = () => miqAjaxButton(`${url}?button=cancel`); - - return !data.isLoading && ( - - ); -}; - -DiagnosticsCollectLogForm.propTypes = { - initialData: PropTypes.shape({ - controller: PropTypes.string.isRequired, - recordId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - options: PropTypes.shape({}), - prefixes: PropTypes.shape({}), - logType: PropTypes.string.isRequired || undefined, - displayName: PropTypes.string.isRequired, - }).isRequired, -}; - -export default DiagnosticsCollectLogForm; diff --git a/app/javascript/components/diagnostics-collect-log-form/schema.js b/app/javascript/components/diagnostics-collect-log-form/schema.js deleted file mode 100644 index 7ceaa1c4b4c..00000000000 --- a/app/javascript/components/diagnostics-collect-log-form/schema.js +++ /dev/null @@ -1,23 +0,0 @@ -import { componentTypes } from '@@ddf'; - -const createSchema = (initialData, options) => { - const fields = [{ - component: componentTypes.SUB_FORM, - title: sprintf(__(`Editing Log Depot Settings for %s: %s`), initialData.logType, initialData.displayName), - id: 'log-depot-settings', - name: 'log-depot-settings', - fields: [{ - component: componentTypes.SELECT, - id: 'log_protocol', - name: 'log_protocol', - label: __('Type'), - placeholder: `<${__('Choose')}>`, - validateOnMount: true, - options, - }], - }, - ]; - return { fields }; -}; - -export default createSchema; diff --git a/app/javascript/components/miq-toolbar.jsx b/app/javascript/components/miq-toolbar.jsx index b0e04d1afe1..d6989bff12a 100644 --- a/app/javascript/components/miq-toolbar.jsx +++ b/app/javascript/components/miq-toolbar.jsx @@ -11,21 +11,6 @@ import { sendDataWithRx } from '../miq_observable'; /* global miqJqueryRequest, miqSerializeForm */ /* eslint no-restricted-globals: ["off", "miqJqueryRequest", "miqSerializeForm"] */ -/* eslint no-alert: "off" */ -const miqSupportCasePrompt = (tbUrl) => { - const supportCase = prompt(__('Enter Support Case:'), ''); - if (supportCase === null) { - return false; - } - - if (supportCase.trim() === '') { - alert(__('Support Case must be provided to collect logs')); - return false; - } - - return `${tbUrl}&support_case=${encodeURIComponent(supportCase)}`; -}; - const getParams = (urlParms, sendChecked) => { const params = []; @@ -104,13 +89,6 @@ const onClick = (button) => { `?pressed=${button.id.split('__').pop()}`].join(''); } - if (button.prompt) { - buttonUrl = miqSupportCasePrompt(buttonUrl); - if (!buttonUrl) { - return; - } - } - // put url_parms into params var, if defined let paramstring = getParams(button.url_parms, !!button.send_checked); paramstring = convertMultParamsToRailsMultParams(paramstring); diff --git a/app/javascript/packs/component-definitions-common.js b/app/javascript/packs/component-definitions-common.js index 164edaa3905..1b3406d55f9 100644 --- a/app/javascript/packs/component-definitions-common.js +++ b/app/javascript/packs/component-definitions-common.js @@ -45,7 +45,6 @@ import DashboardWidget from '../components/dashboard-widgets/dashboard-charts'; import Datastore from '../components/data-tables/datastore'; import DatastoreForm from '../components/data-store-form'; import DbList from '../components/data-tables/db-list'; -import DiagnosticsCollectLogForm from '../components/diagnostics-collect-log-form'; import DiagnosticsCURepairForm from '../components/c-and-u-collections-form'; import EditServiceForm from '../components/edit-service-form'; import EmbeddedTerraformCredentialMappingForm from '../components/embedded-terraform-credential-mapping-form'; @@ -225,7 +224,6 @@ ManageIQ.component.addReact('DashboardWidget', DashboardWidget); ManageIQ.component.addReact('Datastore', Datastore); ManageIQ.component.addReact('DatastoreForm', DatastoreForm); ManageIQ.component.addReact('DbList', DbList); -ManageIQ.component.addReact('DiagnosticsCollectLogForm', DiagnosticsCollectLogForm); ManageIQ.component.addReact('DiagnosticsCURepairForm', DiagnosticsCURepairForm); ManageIQ.component.addReact('EditServiceForm', EditServiceForm); ManageIQ.component.addReact('EmbeddedTerraformCredentialMappingForm', EmbeddedTerraformCredentialMappingForm); diff --git a/app/javascript/spec/diagnostics-collect-log-form/__snapshots__/diagnostics-collect-log-form.spec.js.snap b/app/javascript/spec/diagnostics-collect-log-form/__snapshots__/diagnostics-collect-log-form.spec.js.snap deleted file mode 100644 index 9d8a90c83e7..00000000000 --- a/app/javascript/spec/diagnostics-collect-log-form/__snapshots__/diagnostics-collect-log-form.spec.js.snap +++ /dev/null @@ -1,4678 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Diagnostics Collect Log form component should render edit DiagnosticsCollectLogForm for Server for ftp 1`] = ` - - ", - "FileDepotFtp": "FTP", - "FileDepotFtpAnonymous": "Anonymous FTP", - "FileDepotNfs": "NFS", - "FileDepotSmb": "Samba", - }, - "prefixes": Object { - "FileDepotFtp": "ftp", - "FileDepotFtpAnonymous": "ftp", - "FileDepotNfs": "nfs", - "FileDepotSmb": "smb", - }, - "recordId": 10, - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - ], - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - ], - } - } - showFormControls={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formWrapperProps={ - Object { - "className": "form-react", - } - } - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - showFormControls={true} - submitLabel="Save" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formWrapperProps={ - Object { - "className": "form-react", - } - } - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - showFormControls={true} - submitLabel="Save" - > -
- - - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - key="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - > -
-
-

- Editing Log Depot Settings for Server: EVM [17] -

-
- ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - validateOnMount={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - validateOnMount={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - simpleValue={false} - value="" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - value="" - > - - - - - - - - - - - - - - -
- - - - - - - -
-
-
- - - - - - - - - - - - - - - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formSpyProps={ - Object { - "active": undefined, - "dirty": false, - "dirtyFields": Object {}, - "dirtyFieldsSinceLastSubmit": Object {}, - "dirtySinceLastSubmit": false, - "error": undefined, - "errors": Object {}, - "form": Object { - "batch": [Function], - "blur": [Function], - "change": [Function], - "destroyOnUnregister": false, - "focus": [Function], - "getFieldState": [Function], - "getRegisteredFields": [Function], - "getState": [Function], - "initialize": [Function], - "isValidationPaused": [Function], - "mutators": Object { - "concat": [Function], - "insert": [Function], - "move": [Function], - "pop": [Function], - "push": [Function], - "remove": [Function], - "removeBatch": [Function], - "shift": [Function], - "swap": [Function], - "unshift": [Function], - "update": [Function], - }, - "pauseValidation": [Function], - "registerField": [Function], - "reset": [Function], - "resetFieldState": [Function], - "restart": [Function], - "resumeValidation": [Function], - "setConfig": [Function], - "submit": [Function], - "subscribe": [Function], - }, - "hasSubmitErrors": false, - "hasValidationErrors": false, - "initialValues": Object { - "log_password": "●●●●●●●●", - }, - "invalid": false, - "modified": Object {}, - "modifiedSinceLastSubmit": false, - "pristine": true, - "submitError": undefined, - "submitErrors": undefined, - "submitFailed": false, - "submitSucceeded": false, - "submitting": false, - "touched": Object {}, - "valid": true, - "validating": false, - "values": Object { - "log_password": "●●●●●●●●", - }, - "visited": Object {}, - } - } - onCancel={[Function]} - onReset={[Function]} - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - submitLabel="Save" - > - - -
- - - - - - - - - -
-
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-`; - -exports[`Diagnostics Collect Log form component should render edit DiagnosticsCollectLogForm for Server for no depot 1`] = ` - - ", - "FileDepotFtp": "FTP", - "FileDepotFtpAnonymous": "Anonymous FTP", - "FileDepotNfs": "NFS", - "FileDepotSmb": "Samba", - }, - "prefixes": Object { - "FileDepotFtp": "ftp", - "FileDepotFtpAnonymous": "ftp", - "FileDepotNfs": "nfs", - "FileDepotSmb": "smb", - }, - "recordId": 11, - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - ], - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - ], - } - } - showFormControls={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formWrapperProps={ - Object { - "className": "form-react", - } - } - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - showFormControls={true} - submitLabel="Save" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formWrapperProps={ - Object { - "className": "form-react", - } - } - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - showFormControls={true} - submitLabel="Save" - > -
- - - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - key="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - > -
-
-

- Editing Log Depot Settings for Server: EVM [17] -

-
- ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - validateOnMount={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - validateOnMount={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - simpleValue={false} - value="" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - value="" - > - - - - - - - - - - - - - - -
- - - - - - - -
-
-
- - - - - - - - - - - - - - - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formSpyProps={ - Object { - "active": undefined, - "dirty": false, - "dirtyFields": Object {}, - "dirtyFieldsSinceLastSubmit": Object {}, - "dirtySinceLastSubmit": false, - "error": undefined, - "errors": Object {}, - "form": Object { - "batch": [Function], - "blur": [Function], - "change": [Function], - "destroyOnUnregister": false, - "focus": [Function], - "getFieldState": [Function], - "getRegisteredFields": [Function], - "getState": [Function], - "initialize": [Function], - "isValidationPaused": [Function], - "mutators": Object { - "concat": [Function], - "insert": [Function], - "move": [Function], - "pop": [Function], - "push": [Function], - "remove": [Function], - "removeBatch": [Function], - "shift": [Function], - "swap": [Function], - "unshift": [Function], - "update": [Function], - }, - "pauseValidation": [Function], - "registerField": [Function], - "reset": [Function], - "resetFieldState": [Function], - "restart": [Function], - "resumeValidation": [Function], - "setConfig": [Function], - "submit": [Function], - "subscribe": [Function], - }, - "hasSubmitErrors": false, - "hasValidationErrors": false, - "initialValues": Object { - "log_password": "●●●●●●●●", - }, - "invalid": false, - "modified": Object {}, - "modifiedSinceLastSubmit": false, - "pristine": true, - "submitError": undefined, - "submitErrors": undefined, - "submitFailed": false, - "submitSucceeded": false, - "submitting": false, - "touched": Object {}, - "valid": true, - "validating": false, - "values": Object { - "log_password": "●●●●●●●●", - }, - "visited": Object {}, - } - } - onCancel={[Function]} - onReset={[Function]} - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - submitLabel="Save" - > - - -
- - - - - - - - - -
-
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-`; - -exports[`Diagnostics Collect Log form component should render new DiagnosticsCollectLogForm for Server 1`] = ` - - ", - "FileDepotFtp": "FTP", - "FileDepotFtpAnonymous": "Anonymous FTP", - "FileDepotNfs": "NFS", - "FileDepotSmb": "Samba", - }, - "prefixes": Object { - "FileDepotFtp": "ftp", - "FileDepotFtpAnonymous": "ftp", - "FileDepotNfs": "nfs", - "FileDepotSmb": "smb", - }, - "recordId": "new", - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - ], - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - ], - } - } - showFormControls={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formWrapperProps={ - Object { - "className": "form-react", - } - } - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - showFormControls={true} - submitLabel="Save" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formWrapperProps={ - Object { - "className": "form-react", - } - } - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - showFormControls={true} - submitLabel="Save" - > -
- - - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - key="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - > -
-
-

- Editing Log Depot Settings for Server: EVM [17] -

-
- ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - validateOnMount={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - } - } - > - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - validateOnMount={true} - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - simpleValue={false} - value="" - > - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ] - } - placeholder="" - value="" - > - - - - - - - - - - - - - - -
- - - - - - - -
-
-
- - - - - - - - - - - - - - - - ", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ] - } - id="log-depot-settings" - name="log-depot-settings" - title="Editing Log Depot Settings for Server: EVM [17]" - />, - , - ] - } - formSpyProps={ - Object { - "active": undefined, - "dirty": false, - "dirtyFields": Object {}, - "dirtyFieldsSinceLastSubmit": Object {}, - "dirtySinceLastSubmit": false, - "error": undefined, - "errors": Object {}, - "form": Object { - "batch": [Function], - "blur": [Function], - "change": [Function], - "destroyOnUnregister": false, - "focus": [Function], - "getFieldState": [Function], - "getRegisteredFields": [Function], - "getState": [Function], - "initialize": [Function], - "isValidationPaused": [Function], - "mutators": Object { - "concat": [Function], - "insert": [Function], - "move": [Function], - "pop": [Function], - "push": [Function], - "remove": [Function], - "removeBatch": [Function], - "shift": [Function], - "swap": [Function], - "unshift": [Function], - "update": [Function], - }, - "pauseValidation": [Function], - "registerField": [Function], - "reset": [Function], - "resetFieldState": [Function], - "restart": [Function], - "resumeValidation": [Function], - "setConfig": [Function], - "submit": [Function], - "subscribe": [Function], - }, - "hasSubmitErrors": false, - "hasValidationErrors": false, - "initialValues": Object { - "depot_name": "", - "log_password": "", - "log_protocol": "", - "log_userid": "", - "uri": "", - "uri_prefix": "", - }, - "invalid": false, - "modified": Object {}, - "modifiedSinceLastSubmit": false, - "pristine": true, - "submitError": undefined, - "submitErrors": undefined, - "submitFailed": false, - "submitSucceeded": false, - "submitting": false, - "touched": Object {}, - "valid": true, - "validating": false, - "values": Object { - "depot_name": "", - "log_password": "", - "log_protocol": "", - "log_userid": "", - "uri": "", - "uri_prefix": "", - }, - "visited": Object {}, - } - } - onCancel={[Function]} - onReset={[Function]} - resetLabel="Reset" - schema={ - Object { - "fields": Array [ - Object { - "component": "sub-form", - "fields": Array [ - Object { - "component": "select", - "id": "log_protocol", - "label": "Type", - "name": "log_protocol", - "options": Array [ - Object { - "label": "", - "value": "BLANK_VALUE", - }, - Object { - "label": "FTP", - "value": "FileDepotFtp", - }, - Object { - "label": "Anonymous FTP", - "value": "FileDepotFtpAnonymous", - }, - Object { - "label": "NFS", - "value": "FileDepotNfs", - }, - Object { - "label": "Samba", - "value": "FileDepotSmb", - }, - ], - "placeholder": "", - "validateOnMount": true, - }, - ], - "id": "log-depot-settings", - "name": "log-depot-settings", - "title": "Editing Log Depot Settings for Server: EVM [17]", - }, - Object { - "component": "spy-field", - "initialize": undefined, - "name": "spy-field", - }, - ], - } - } - submitLabel="Save" - > - - -
- - - - - - - - - -
-
-
-
-
- -
- - -
-
-
-
-
-
-
-
-
-`; diff --git a/app/javascript/spec/diagnostics-collect-log-form/diagnostics-collect-log-form.spec.js b/app/javascript/spec/diagnostics-collect-log-form/diagnostics-collect-log-form.spec.js deleted file mode 100644 index e1400096714..00000000000 --- a/app/javascript/spec/diagnostics-collect-log-form/diagnostics-collect-log-form.spec.js +++ /dev/null @@ -1,83 +0,0 @@ -import React from 'react'; -import { act } from 'react-dom/test-utils'; -import toJson from 'enzyme-to-json'; -import fetchMock from 'fetch-mock'; -import DiagnosticsCollectLogForm from '../../components/diagnostics-collect-log-form'; -import { mount } from '../helpers/mountForm'; - -describe('Diagnostics Collect Log form component', () => { - const options = { - '': '', - FileDepotFtp: 'FTP', - FileDepotFtpAnonymous: 'Anonymous FTP', - FileDepotNfs: 'NFS', - FileDepotSmb: 'Samba', - }; - const prefixes = { - FileDepotFtp: 'ftp', - FileDepotFtpAnonymous: 'ftp', - FileDepotNfs: 'nfs', - FileDepotSmb: 'smb', - }; - it('should render new DiagnosticsCollectLogForm for Server', () => { - const initialData = { - recordId: 'new', - name: '', - options, - prefixes, - controller: 'ops', - logType: 'Server', - displayName: 'EVM [17]', - }; - fetchMock.postOnce(`/ops/log_depot_edit/${initialData.recordId}`, {}); - const wrapper = mount(); - expect(wrapper.find('select[name="log_protocol"]')).toHaveLength(1); - expect(toJson(wrapper)).toMatchSnapshot(); - }); - - it('should render edit DiagnosticsCollectLogForm for Server for ftp', async(done) => { - const initialData = { - recordId: 10, - name: 'EVM', - options, - prefixes, - controller: 'ops', - logType: 'Server', - displayName: 'EVM [17]', - }; - fetchMock.getOnce(`/${initialData.controller}/log_collection_form_fields/${initialData.recordId}`, {}); - const paramData = { uri_prefix: 'ftp', log_protocol: 'FileDepotFtp', log_password: '123456' }; - fetchMock.postOnce(`/ops/log_depot_edit/${initialData.recordId}`, paramData); - let wrapper; - await act(async() => { - wrapper = mount(); - }); - wrapper.update(); - expect(wrapper.find('select[name="log_protocol"]')).toHaveLength(1); - expect(toJson(wrapper)).toMatchSnapshot(); - done(); - }); - - it('should render edit DiagnosticsCollectLogForm for Server for no depot', async(done) => { - const initialData = { - recordId: 11, - name: 'EVM', - options, - prefixes, - controller: 'ops', - logType: 'Server', - displayName: 'EVM [17]', - }; - fetchMock.getOnce(`/${initialData.controller}/log_collection_form_fields/${initialData.recordId}`, {}); - const paramData = { log_password: '123456' }; - fetchMock.postOnce(`/ops/log_depot_edit/${initialData.recordId}`, paramData); - let wrapper; - await act(async() => { - wrapper = mount(); - }); - wrapper.update(); - expect(wrapper.find('select[name="log_protocol"]')).toHaveLength(1); - expect(toJson(wrapper)).toMatchSnapshot(); - done(); - }); -}); diff --git a/app/views/ops/_all_tabs.html.haml b/app/views/ops/_all_tabs.html.haml index 8f757c241dd..31a1c6e45ef 100644 --- a/app/views/ops/_all_tabs.html.haml +++ b/app/views/ops/_all_tabs.html.haml @@ -101,8 +101,6 @@ = _("Servers by Roles") = miq_tab_header("diagnostics_server_list", @sb[:active_tab]) do = _("Servers") - = miq_tab_header("diagnostics_collect_logs", @sb[:active_tab]) do - = _("Collect Logs") = miq_tab_header("diagnostics_cu_repair", @sb[:active_tab]) do = _("C & U Gap Collection") .tab-content @@ -112,8 +110,6 @@ = render :partial => "diagnostics_servers_roles_tab" = miq_tab_content("diagnostics_server_list", @sb[:active_tab]) do = render :partial => "diagnostics_server_list_tab" - = miq_tab_content("diagnostics_collect_logs", @sb[:active_tab]) do - = render :partial => "diagnostics_collect_logs_tab" = miq_tab_content("diagnostics_cu_repair", @sb[:active_tab]) do = render :partial => "diagnostics_cu_repair_tab" - elsif x_node.split("-")[0] == "svr" @@ -123,33 +119,27 @@ = _("Summary") = miq_tab_header("diagnostics_workers", @sb[:active_tab]) do = _("Workers") - - if !MiqEnvironment::Command.is_podified? - = miq_tab_header("diagnostics_collect_logs", @sb[:active_tab]) do - = _("Collect Logs") - - if @sb[:selected_server_id] == my_server.id - = miq_tab_header("diagnostics_evm_log", @sb[:active_tab]) do - = _("%{product} Log") % {:product => Vmdb::Appliance.PRODUCT_NAME} - = miq_tab_header("diagnostics_audit_log", @sb[:active_tab]) do - = _("Audit Log") - = miq_tab_header("diagnostics_production_log", @sb[:active_tab]) do - = _(@sb[:rails_log]) - = _("Log") + - if @sb[:selected_server_id] == my_server.id && !MiqEnvironment::Command.is_podified? + = miq_tab_header("diagnostics_evm_log", @sb[:active_tab]) do + = _("%{product} Log") % {:product => Vmdb::Appliance.PRODUCT_NAME} + = miq_tab_header("diagnostics_audit_log", @sb[:active_tab]) do + = _("Audit Log") + = miq_tab_header("diagnostics_production_log", @sb[:active_tab]) do + = _(@sb[:rails_log]) + = _("Log") .tab-content - if @sb[:selected_server_id] == my_server.id || @selected_server.started? = miq_tab_content("diagnostics_summary", @sb[:active_tab]) do = render :partial => "diagnostics_summary_tab" = miq_tab_content("diagnostics_workers", @sb[:active_tab]) do = render :partial => "diagnostics_workers_tab" - - if !MiqEnvironment::Command.is_podified? - = miq_tab_content("diagnostics_collect_logs", @sb[:active_tab]) do - = render :partial => "diagnostics_collect_logs_tab" - - if @sb[:selected_server_id] == my_server.id - = miq_tab_content("diagnostics_evm_log", @sb[:active_tab]) do - = render :partial => "diagnostics_evm_log_tab" - = miq_tab_content("diagnostics_audit_log", @sb[:active_tab]) do - = render :partial => "diagnostics_audit_log_tab" - = miq_tab_content("diagnostics_production_log", @sb[:active_tab]) do - = render :partial => "diagnostics_production_log_tab" + - if @sb[:selected_server_id] == my_server.id && !MiqEnvironment::Command.is_podified? + = miq_tab_content("diagnostics_evm_log", @sb[:active_tab]) do + = render :partial => "diagnostics_evm_log_tab" + = miq_tab_content("diagnostics_audit_log", @sb[:active_tab]) do + = render :partial => "diagnostics_audit_log_tab" + = miq_tab_content("diagnostics_production_log", @sb[:active_tab]) do + = render :partial => "diagnostics_production_log_tab" - else %ul.nav.nav-tabs{'role' => 'tablist'} = miq_tab_header("diagnostics_zones", @sb[:active_tab]) do diff --git a/app/views/ops/_diagnostics_collect_logs_tab.html.haml b/app/views/ops/_diagnostics_collect_logs_tab.html.haml deleted file mode 100644 index 40aa9523334..00000000000 --- a/app/views/ops/_diagnostics_collect_logs_tab.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- if @sb[:active_tab] == "diagnostics_collect_logs" - - if x_node.split('-').first != "root" - = render :partial => "layouts/flash_msg" - = render :partial => "logs_selected" - %div{:style => "padding-bottom: 20px"} diff --git a/app/views/ops/_log_collection.html.haml b/app/views/ops/_log_collection.html.haml deleted file mode 100644 index 3043c7561b5..00000000000 --- a/app/views/ops/_log_collection.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- record, options, prefixes = @record, @supported_depots_for_select, @uri_prefixes -- log_type = Dictionary.gettext(record.class.name, :type => :model, :notfound => :titleize) - -= react('DiagnosticsCollectLogForm', {:initialData => {:recordId => record.id || "new", - :options => options, - :prefixes => prefixes, - :controller => controller_name, - :logType => log_type, - :displayName => record.display_name}}) diff --git a/app/views/ops/_logs_selected.html.haml b/app/views/ops/_logs_selected.html.haml deleted file mode 100644 index 1e02a122f0f..00000000000 --- a/app/views/ops/_logs_selected.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -#selected_div - - if @sb[:selected_server_id] != my_server.id && !@selected_server.try(:started?) - %h2= _("Collect Logs") - = collect_logs_tab diff --git a/config/routes.rb b/config/routes.rb index ce1fd14bf9a..c8cf5559f20 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2415,7 +2415,6 @@ fetch_audit_log fetch_log fetch_production_log - log_collection_form_fields pglogical_subscriptions_form_fields schedule_form_fields ], @@ -2455,8 +2454,6 @@ label_tag_mapping_edit label_tag_mapping_update label_tag_mapping_field_changed - log_depot_edit - log_depot_validate perf_chart_chooser pglogical_save_subscriptions pglogical_validate_subscription diff --git a/cypress/e2e/ui/Settings/Application-Settings/edit_collect_logs.cy.js b/cypress/e2e/ui/Settings/Application-Settings/edit_collect_logs.cy.js deleted file mode 100644 index e5bdb5f3a24..00000000000 --- a/cypress/e2e/ui/Settings/Application-Settings/edit_collect_logs.cy.js +++ /dev/null @@ -1,262 +0,0 @@ -/* eslint-disable no-undef */ -import { flashClassMap } from '../../../../support/assertions/assertion_constants'; - -// Component route url -const COMPONENT_ROUTE_URL = '/ops/explorer'; - -// Menu options -const SETTINGS_MENU_OPTION = 'Settings'; -const APP_SETTINGS_MENU_OPTION = 'Application Settings'; - -// List items -const DIAGNOSTICS_ACCORDION_ITEM = 'Diagnostics'; -const MANAGEIQ_REGION_ACCORDION_ITEM = /^ManageIQ Region:/; -const ZONE_ACCORDION_ITEM = /^Zone:/; -const SERVER_ACCORDION_ITEM = /^Server:/; - -// Field values -const FORM_HEADER = 'Editing Log Depot settings'; -const FORM_SUBHEADER_SNIPPET = 'Editing Log Depot Settings'; - -// Config options -const EDIT_TOOLBAR_BUTTON = 'Edit'; - -// Buttons -const SAVE_BUTTON_TEXT = 'Save'; -const CANCEL_BUTTON_TEXT = 'Cancel'; -const RESET_BUTTON_TEXT = 'Reset'; - -// Dropdown values -const DROPDOWN_BLANK_VALUE = 'BLANK_VALUE'; -const SAMBA_DROPDOWN_VALUE = 'FileDepotSmb'; - -// Flash message text snippets -const FLASH_MESSAGE_SETTINGS_SAVED = 'saved'; -const FLASH_MESSAGE_OPERATION_CANCELLED = 'cancel'; - -function goToCollectLogsTab() { - cy.interceptApi({ - alias: 'getCollectLogsTabInfo', - urlPattern: '/ops/change_tab?tab_id=diagnostics_collect_logs', - triggerFn: () => cy.tabs({ tabLabel: 'Collect Logs' }), - }); -} - -function selectToolbarEditButton() { - cy.interceptApi({ - alias: 'editEventForServer', - // This pattern matches both /ops/x_button/1?pressed=log_depot_edit & /ops/x_button/2?pressed=zone_log_depot_edit endpoints - urlPattern: /\/ops\/x_button\/[^/]+\?pressed=.*log_depot_edit/, - triggerFn: () => cy.toolbar(EDIT_TOOLBAR_BUTTON), - }); -} - -function resetProtocolDropdown({ selectServerListItem = true } = {}) { - // Select Diagnostics - cy.accordion(DIAGNOSTICS_ACCORDION_ITEM); - // Select "Zone:" or "Server:" accordion item - cy.selectAccordionItem([ - MANAGEIQ_REGION_ACCORDION_ITEM, - ZONE_ACCORDION_ITEM, - ...(selectServerListItem ? [SERVER_ACCORDION_ITEM] : []), - ]); - - // Clicking Edit button - selectToolbarEditButton(); - - // Resetting Protocol dropdown value - cy.getFormSelectFieldById({ selectId: 'log_protocol' }).then( - (selectField) => { - const currentValue = selectField.val(); - // If the value is not default one(BLANK_VALUE), then setting it to blank - if (currentValue !== DROPDOWN_BLANK_VALUE) { - cy.wrap(selectField).select(DROPDOWN_BLANK_VALUE); - cy.getFormButtonByTypeWithText({ - buttonText: SAVE_BUTTON_TEXT, - buttonType: 'submit', - }).click(); - // Validating confirmation flash message - cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SETTINGS_SAVED); - } - } - ); -} - -function goToCollectLogsTabAndOpenEditForm() { - // Selecting Collect Logs tab - goToCollectLogsTab(); - // Clicking Edit button - selectToolbarEditButton(); -} - -function validateFormElements() { - // Assert form header is visible - cy.expect_explorer_title(FORM_HEADER).should('be.visible'); - // Assert form sub-header is visible - cy.contains('#main-content .bx--form h3', FORM_SUBHEADER_SNIPPET).should( - 'be.visible' - ); - // Assert protocol field label is visible - cy.getFormLabelByForAttribute({ forValue: 'log_protocol' }).should( - 'be.visible' - ); - // Assert protocol field is visible and enabled - cy.getFormSelectFieldById({ selectId: 'log_protocol' }) - .should('be.visible') - .and('be.enabled'); - // Assert cancel button is visible and enabled - cy.getFormButtonByTypeWithText({ - buttonText: CANCEL_BUTTON_TEXT, - }) - .should('be.visible') - .and('be.enabled'); - // Assert save button is visible and disabled - cy.getFormButtonByTypeWithText({ - buttonText: SAVE_BUTTON_TEXT, - buttonType: 'submit', - }) - .should('be.visible') - .and('be.disabled'); - // Assert reset button is visible and disabled - cy.getFormButtonByTypeWithText({ - buttonText: RESET_BUTTON_TEXT, - }) - .should('be.visible') - .and('be.disabled'); -} - -function cancelButtonValidation() { - // Click cancel button in the form - cy.getFormButtonByTypeWithText({ - buttonText: CANCEL_BUTTON_TEXT, - }).click(); - // Validating confirmation flash message - cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_OPERATION_CANCELLED); -} - -function resetButtonValidation() { - // Selecting Samba option from dropdown - cy.getFormSelectFieldById({ selectId: 'log_protocol' }).select( - SAMBA_DROPDOWN_VALUE - ); - // Confirm Reset button is enabled once dropdown value is changed and then click on Reset - cy.getFormButtonByTypeWithText({ - buttonText: RESET_BUTTON_TEXT, - }) - .should('be.enabled') - .click(); - // Confirm dropdown has the old value - cy.getFormSelectFieldById({ selectId: 'log_protocol' }).should( - 'have.value', - DROPDOWN_BLANK_VALUE - ); -} - -function saveButtonValidation() { - // Selecting Samba option from dropdown - cy.getFormSelectFieldById({ selectId: 'log_protocol' }).select( - SAMBA_DROPDOWN_VALUE - ); - // Confirm Save button is enabled once dropdown value is changed and then click on Save - cy.getFormButtonByTypeWithText({ - buttonText: SAVE_BUTTON_TEXT, - buttonType: 'submit', - }) - .should('be.enabled') - .click(); - // Validating confirmation flash message - cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SETTINGS_SAVED); -} - -describe('Automate Collect logs Edit form operations', () => { - beforeEach(() => { - cy.login(); - // Navigate to Application settings and expand Diagnostics accordion - cy.menu(SETTINGS_MENU_OPTION, APP_SETTINGS_MENU_OPTION); - // Expand Diagnostics accordion - cy.accordion(DIAGNOSTICS_ACCORDION_ITEM); - }); - - describe('Settings > Application Settings > Diagnostics > Manage IQ Region > Zone > Server > Collect logs > Edit', () => { - beforeEach(() => { - // Select "Server:" accordion item - cy.selectAccordionItem([ - MANAGEIQ_REGION_ACCORDION_ITEM, - ZONE_ACCORDION_ITEM, - SERVER_ACCORDION_ITEM, - ]); - // Select collect logs navbar and open edit form - goToCollectLogsTabAndOpenEditForm(); - }); - - it('Validate form elements', () => { - validateFormElements(); - }); - - it('Validate Reset & Cancel buttons', () => { - // Reset button validation - resetButtonValidation(); - // Cancel button validation - cancelButtonValidation(); - }); - - it('Validate Save button', () => { - saveButtonValidation(); - }); - - after(() => { - cy.url() - ?.then((url) => { - // Ensures navigation to Settings -> Application-Settings in the UI - if (!url?.includes(COMPONENT_ROUTE_URL)) { - // Navigate to Settings -> Application-Settings before cleanup - cy.menu(SETTINGS_MENU_OPTION, APP_SETTINGS_MENU_OPTION); - } - }) - .then(() => { - resetProtocolDropdown(); - }); - }); - }); - - describe('Settings > Application Settings > Diagnostics > Manage IQ Region > Zone > Collect logs > Edit', () => { - beforeEach(() => { - // Select "Zone:" accordion item - cy.selectAccordionItem([ - MANAGEIQ_REGION_ACCORDION_ITEM, - ZONE_ACCORDION_ITEM, - ]); - // Select collect logs tab and open edit form - goToCollectLogsTabAndOpenEditForm(); - }); - - it('Validate form elements', () => { - validateFormElements(); - }); - - it('Validate Reset & Cancel buttons', () => { - // Reset button validation - resetButtonValidation(); - // Cancel button validation - cancelButtonValidation(); - }); - - it('Validate Save button', () => { - saveButtonValidation(); - }); - - after(() => { - cy.url() - ?.then((url) => { - // Ensures navigation to Settings -> Application-Settings in the UI - if (!url?.includes(COMPONENT_ROUTE_URL)) { - // Navigate to Settings -> Application-Settings before cleanup - cy.menu(SETTINGS_MENU_OPTION, APP_SETTINGS_MENU_OPTION); - } - }) - .then(() => { - resetProtocolDropdown({ selectServerListItem: false }); - }); - }); - }); -}); diff --git a/spec/config/routes.pending.yml b/spec/config/routes.pending.yml index df312c6e461..16d1e03134d 100644 --- a/spec/config/routes.pending.yml +++ b/spec/config/routes.pending.yml @@ -903,8 +903,6 @@ OpsController: - dynamic_text_box_refresh - index - label_tag_mapping_update -- log_collection_form_fields -- log_depot_edit - open_url_after_dialog - report_data - show diff --git a/spec/controllers/ops_controller/diagnostics_spec.rb b/spec/controllers/ops_controller/diagnostics_spec.rb index bc72151e27c..24bb9a78cb0 100644 --- a/spec/controllers/ops_controller/diagnostics_spec.rb +++ b/spec/controllers/ops_controller/diagnostics_spec.rb @@ -1,58 +1,3 @@ -shared_examples "logs_collect" do |type| - let(:klass) { type.classify.constantize } - before do - sb_hash = { - :trees => {:diagnostics_tree => {:active_node => active_node}}, - :active_tree => :diagnostics_tree, - :diag_selected_id => instance_variable_get("@#{type}").id, - :active_tab => "diagnostics_roles_servers" - } - controller.instance_variable_set(:@sb, sb_hash) - EvmSpecHelper.local_miq_server - end - - it "not running" do - allow_any_instance_of(MiqServer).to receive(:status).and_return("stopped") - - expect(controller).to receive(:replace_right_cell).with(:nodetype => active_node) - - controller.send(:logs_collect) - - expect(assigns(:flash_array).first[:message]).to include("requires a started server") - end - - it "collection already in progress" do - expect_any_instance_of(klass).to receive(:log_collection_active_recently?).and_return(true) - expect(controller).to receive(:replace_right_cell).with(:nodetype => active_node) - - controller.send(:logs_collect) - - expect(assigns(:flash_array).first[:message]).to include("already in progress") - end - - context "nothing preventing collection" do - it "succeeds" do - expect_any_instance_of(klass).to receive(:log_collection_active_recently?).and_return(false) - expect_any_instance_of(klass).to receive(:synchronize_logs).with(user.userid, :context => klass.name) - expect(controller).to receive(:replace_right_cell).with(:nodetype => active_node) - - controller.send(:logs_collect) - - expect(assigns(:flash_array).first[:message]).to include("has been initiated") - end - - it "collection raises and error" do - expect_any_instance_of(klass).to receive(:log_collection_active_recently?).and_return(false) - expect_any_instance_of(klass).to receive(:synchronize_logs).and_raise(StandardError) - expect(controller).to receive(:replace_right_cell).with(:nodetype => active_node) - - controller.send(:logs_collect) - - expect(assigns(:flash_array).first[:message]).to include("Log collection error returned") - end - end -end - describe OpsController do render_views @@ -94,55 +39,6 @@ end end - context "#log_collection_form_fields" do - it "renders log_collection_form_fields" do - stub_user(:features => :all) - EvmSpecHelper.create_guid_miq_server_zone - MiqRegion.seed - - _guid, @miq_server, @zone = EvmSpecHelper.remote_guid_miq_server_zone - file_depot = FileDepotNfs.create(:name => "abc", :uri => "nfs://abc") - @miq_server.update(:log_file_depot_id => file_depot.id) - - session[:sandboxes] = {"ops" => {:active_tree => :diagnostics_tree, - :selected_typ => "miq_server", - :selected_server_id => @miq_server.id}} - post :tree_select, :params => { :id => 'root', :format => :js } - get :log_collection_form_fields, :params => { :id => @miq_server.id } - expect(response.status).to eq(200) - end - end - - context "#set_credentials" do - it "uses params[:log_password] to set the creds hash if it exists" do - stub_user(:features => :all) - EvmSpecHelper.create_guid_miq_server_zone - MiqRegion.seed - - _guid, @miq_server, @zone = EvmSpecHelper.remote_guid_miq_server_zone - controller.instance_variable_set(:@record, @miq_server) - controller.params = {:log_userid => "default_userid", - :log_password => "default_password2"} - default_creds = {:userid => "default_userid", :password => "default_password2"} - expect(controller.send(:set_credentials)).to include(:default => default_creds) - end - - it "uses stored password to set the creds hash" do - stub_user(:features => :all) - EvmSpecHelper.create_guid_miq_server_zone - MiqRegion.seed - - _guid, @miq_server, @zone = EvmSpecHelper.remote_guid_miq_server_zone - file_depot = FileDepotSmb.create(:name => "abc", :uri => "smb://abc") - expect(@miq_server).to receive(:log_file_depot).and_return(file_depot) - expect(file_depot).to receive(:authentication_password).and_return('default_password') - controller.instance_variable_set(:@record, @miq_server) - controller.params = {:log_userid => "default_userid"} - default_creds = {:userid => "default_userid", :password => "default_password"} - expect(controller.send(:set_credentials)).to include(:default => default_creds) - end - end - context "::Diagnostics" do let!(:user) { stub_user(:features => :all) } before do @@ -307,40 +203,5 @@ end end end - - context "#logs_collect" do - context "Server" do - let(:active_node) { "svr-#{@miq_server.id}" } - include_examples "logs_collect", "miq_server" - end - context "Zone" do - let(:active_node) { "z-#{@zone.id}" } - include_examples "logs_collect", "zone" - end - end - - context "#log_depot_edit" do - it "renders validate button" do - server_id = @miq_server.id - sb_hash = { - :selected_server_id => server_id, - :selected_typ => "miq_server" - } - edit = { - :new => {}, - :key => "logdepot_edit__#{server_id}" - } - session[:edit] = edit - controller.instance_variable_set(:@sb, sb_hash) - allow(controller).to receive(:set_credentials) - .and_return(:default => {:userid => "testuser", :password => 'password'}) - controller.params = {:log_userid => "default_user", - :button => "validate", - :id => server_id} - expect(controller).to receive(:render) - expect(response.status).to eq(200) - controller.send(:log_depot_edit) - end - end end end diff --git a/spec/controllers/ops_controller/settings/schedules_spec.rb b/spec/controllers/ops_controller/settings/schedules_spec.rb index 1a8a17066d7..8efb335d50e 100644 --- a/spec/controllers/ops_controller/settings/schedules_spec.rb +++ b/spec/controllers/ops_controller/settings/schedules_spec.rb @@ -81,6 +81,7 @@ end end end + context "#build_uri_settings" do let(:mocked_filedepot) { double(FileDepotSmb) } it "uses params[:log_password] for validation if one exists" do diff --git a/spec/controllers/ops_controller_spec.rb b/spec/controllers/ops_controller_spec.rb index 3d6fc9a77d1..e2e709e1501 100644 --- a/spec/controllers/ops_controller_spec.rb +++ b/spec/controllers/ops_controller_spec.rb @@ -281,36 +281,6 @@ end end - context "Toolbar buttons render" do - before do - _guid, @miq_server, @zone = EvmSpecHelper.remote_guid_miq_server_zone - allow(controller).to receive(:check_privileges).and_return(true) - allow(controller).to receive(:assert_privileges).and_return(true) - seed_session_trees('ops', :diagnostics_tree, "z-#{@zone.id}") - post :change_tab, :params => {:tab_id => "diagnostics_collect_logs"} - end - - it "does not render toolbar buttons when edit is clicked" do - post :x_button, :params => {:id => @miq_server.id, :pressed => 'log_depot_edit', :format => :js} - expect(response.status).to eq(200) - expect(JSON.parse(response.body)['reloadToolbars']).to match([nil, nil]) - end - - it "renders toolbar buttons when cancel is clicked" do - allow(controller).to receive(:diagnostics_set_form_vars) - post :x_button, :params => {:id => @miq_server.id, :pressed => 'log_depot_edit', :button => "cancel", :format => :js} - expect(response.status).to eq(200) - expect(JSON.parse(response.body)['reloadToolbars'].length).to eq(2) - end - - it "renders toolbar buttons when save is clicked" do - allow(controller).to receive(:diagnostics_set_form_vars) - post :x_button, :params => {:id => @miq_server.id, :pressed => 'log_depot_edit', :button => "save", :format => :js} - expect(response.status).to eq(200) - expect(JSON.parse(response.body)['reloadToolbars'].length).to eq(2) - end - end - context "Import Tags and Import forms" do %w(settings_import settings_import_tags).each do |tab| render_views diff --git a/spec/helpers/application_helper/buttons/collect_logs_spec.rb b/spec/helpers/application_helper/buttons/collect_logs_spec.rb deleted file mode 100644 index c1d1764d9ac..00000000000 --- a/spec/helpers/application_helper/buttons/collect_logs_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -describe ApplicationHelper::Button::CollectLogs do - let(:view_context) { setup_view_context_with_sandbox({}) } - let(:file_depot) { FactoryBot.create(:file_depot) } - let(:record) { FactoryBot.create(:miq_server, :status => server_status, :log_file_depot => file_depot) } - let(:button) { described_class.new(view_context, {}, {'record' => record}, {}) } - - def tear_down - LogFile.delete_all - MiqTask.delete_all - end - - describe '#disabled?' do - let(:setup_log_files) {} - let(:setup_tasks) {} - before do - setup_log_files - setup_tasks - end - after(:each) { tear_down } - - context 'when server is started' do - let(:server_status) { 'started' } - let(:setup_log_files) do - log_file = FactoryBot.create(:log_file, :resource => record, :state => log_state) - log_file.save - record.log_files << log_file - end - - context 'and log collection is not yet in progress' do - let(:log_state) { 'not_collecting' } - context 'and Log Depot settings is configured' do - it_behaves_like 'an enabled button' - end - context 'and Log Depot settings is not configured' do - let(:file_depot) { nil } - it_behaves_like 'a disabled button', 'Log collection requires the Log Depot settings to be configured' - end - end - context 'and log collection is currently in progress' do - let(:log_state) { 'collecting' } - it_behaves_like 'a disabled button', 'Log collection is already in progress for this Server' - - context 'and has an unfinished task' do - let(:setup_tasks) do - task = FactoryBot.create(:miq_task, :name => 'Zipped log retrieval for XXX', :miq_server_id => record.id) - task.save - end - it_behaves_like 'a disabled button', 'Log collection is already in progress for this Server' - end - end - end - context 'when server is not started' do - let(:server_status) { 'not_responding' } - it_behaves_like 'a disabled button', 'Cannot collect current logs unless the Server is started' - end - end -end diff --git a/spec/helpers/application_helper/buttons/log_depot_edit_spec.rb b/spec/helpers/application_helper/buttons/log_depot_edit_spec.rb deleted file mode 100644 index d6708f7139f..00000000000 --- a/spec/helpers/application_helper/buttons/log_depot_edit_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -describe ApplicationHelper::Button::LogDepotEdit do - let(:view_context) { setup_view_context_with_sandbox(:active_tree => tree, :active_tab => tab) } - let(:button) { described_class.new(view_context, {}, {}, {}) } - - it_behaves_like 'a button with correct active context', :diagnostics_tree, 'diagnostics_collect_logs' - it_behaves_like 'a button with incorrect active context', :not_diagnostics_tree, 'diagnostics_collect_logs' - it_behaves_like 'a button with incorrect active context', :diagnostics_tree, 'not_diagnostics_collect_logs' -end diff --git a/spec/helpers/application_helper/buttons/zone_collect_logs_spec.rb b/spec/helpers/application_helper/buttons/zone_collect_logs_spec.rb deleted file mode 100644 index 36dcb9a7464..00000000000 --- a/spec/helpers/application_helper/buttons/zone_collect_logs_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -describe ApplicationHelper::Button::ZoneCollectLogs do - let(:view_context) { setup_view_context_with_sandbox({}) } - let(:file_depot) { FactoryBot.create(:file_depot) } - let(:record) { FactoryBot.create(:zone, :log_file_depot => file_depot) } - let(:miq_server) { FactoryBot.create(:miq_server, :status => server_status) } - let(:button) { described_class.new(view_context, {}, {'record' => record}, {}) } - - def tear_down - LogFile.delete_all - MiqTask.delete_all - MiqServer.delete_all - end - - describe '#calculate_properties' do - let(:setup_log_files) {} - let(:setup_tasks) {} - let(:log_state) { 'not_collecting' } - before do - setup_log_files - setup_tasks - record.miq_servers << miq_server - button.calculate_properties - end - after(:each) { tear_down } - - context 'when some miq_servers are started' do - let(:server_status) { 'started' } - let(:setup_log_files) do - log_file = FactoryBot.create(:log_file, :resource => record, :state => log_state) - log_file.save - miq_server.log_files << log_file - end - - context 'and Log Depot settings is configured' do - context 'and log collection is not yet in progress' do - it_behaves_like 'an enabled button' - end - context 'and log collection is currently in progress' do - let(:log_state) { 'collecting' } - it_behaves_like 'a disabled button', - 'Log collection is already in progress for one or more Servers in this Zone' - - context 'and has an unfinished task' do - let(:setup_tasks) do - task = FactoryBot.create(:miq_task, :name => 'Zipped log retrieval for XXX', :miq_server_id => record.id) - task.save - end - it_behaves_like 'a disabled button', - 'Log collection is already in progress for one or more Servers in this Zone' - end - end - end - context 'and Log Depot settings is not configured' do - let(:file_depot) { nil } - it_behaves_like 'a disabled button', - 'This Zone do not have Log Depot settings configured, collection not allowed' - end - end - context 'when there is no miq_server started' do - let(:server_status) { 'not_responding' } - it_behaves_like 'a disabled button', 'Cannot collect current logs unless there are started Servers in the Zone' - end - end -end diff --git a/spec/routing/ops_routing_spec.rb b/spec/routing/ops_routing_spec.rb index dca02dba90f..00ef106fc24 100644 --- a/spec/routing/ops_routing_spec.rb +++ b/spec/routing/ops_routing_spec.rb @@ -8,7 +8,6 @@ fetch_audit_log fetch_log fetch_production_log - log_collection_form_fields schedule_form_fields ).each do |task| describe "##{task}" do @@ -50,8 +49,6 @@ label_tag_mapping_edit label_tag_mapping_update label_tag_mapping_field_changed - log_depot_edit - log_depot_validate perf_chart_chooser rbac_group_edit rbac_group_field_changed