Merge branch 'develop' of git.znuny.com:zammad/zammad into develop
This commit is contained in:
commit
5980b7ab59
6 changed files with 125 additions and 20 deletions
|
@ -114,12 +114,13 @@ class SessionsController < ApplicationController
|
||||||
# "Delete" a login, aka "log the user out"
|
# "Delete" a login, aka "log the user out"
|
||||||
def destroy
|
def destroy
|
||||||
|
|
||||||
|
reset_session
|
||||||
|
|
||||||
# Remove the user id from the session
|
# Remove the user id from the session
|
||||||
@_current_user = nil
|
@_current_user = nil
|
||||||
|
|
||||||
# reset session
|
# reset session
|
||||||
request.env['rack.session.options'][:expire_after] = nil
|
request.env['rack.session.options'][:expire_after] = nil
|
||||||
session.clear
|
|
||||||
|
|
||||||
render json: {}
|
render json: {}
|
||||||
end
|
end
|
||||||
|
|
42
db/migrate/20180622140531_sequencer_log_level_setting.rb
Normal file
42
db/migrate/20180622140531_sequencer_log_level_setting.rb
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
class SequencerLogLevelSetting < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
|
||||||
|
# return if it's a new setup
|
||||||
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
|
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Sequencer log level',
|
||||||
|
name: 'sequencer_log_level',
|
||||||
|
area: 'Core',
|
||||||
|
description: 'Defines the log levels for various logging actions of the Sequencer.',
|
||||||
|
options: {},
|
||||||
|
state: {
|
||||||
|
sequence: {
|
||||||
|
start_finish: :debug,
|
||||||
|
unit: :debug,
|
||||||
|
result: :debug,
|
||||||
|
},
|
||||||
|
state: {
|
||||||
|
optional: :debug,
|
||||||
|
set: :debug,
|
||||||
|
get: :debug,
|
||||||
|
attribute_initialization: {
|
||||||
|
start_finish: :debug,
|
||||||
|
attributes: :debug,
|
||||||
|
},
|
||||||
|
parameter_initialization: {
|
||||||
|
parameters: :debug,
|
||||||
|
start_finish: :debug,
|
||||||
|
unused: :debug,
|
||||||
|
},
|
||||||
|
expectations_initialization: :debug,
|
||||||
|
cleanup: {
|
||||||
|
start_finish: :debug,
|
||||||
|
remove: :debug,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
frontend: false,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -2938,6 +2938,41 @@ Setting.create_if_not_exists(
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Setting.create_if_not_exists(
|
||||||
|
title: 'Sequencer log level',
|
||||||
|
name: 'sequencer_log_level',
|
||||||
|
area: 'Core',
|
||||||
|
description: 'Defines the log levels for various logging actions of the Sequencer.',
|
||||||
|
options: {},
|
||||||
|
state: {
|
||||||
|
sequence: {
|
||||||
|
start_finish: :debug,
|
||||||
|
unit: :debug,
|
||||||
|
result: :debug,
|
||||||
|
},
|
||||||
|
state: {
|
||||||
|
optional: :debug,
|
||||||
|
set: :debug,
|
||||||
|
get: :debug,
|
||||||
|
attribute_initialization: {
|
||||||
|
start_finish: :debug,
|
||||||
|
attributes: :debug,
|
||||||
|
},
|
||||||
|
parameter_initialization: {
|
||||||
|
parameters: :debug,
|
||||||
|
start_finish: :debug,
|
||||||
|
unused: :debug,
|
||||||
|
},
|
||||||
|
expectations_initialization: :debug,
|
||||||
|
cleanup: {
|
||||||
|
start_finish: :debug,
|
||||||
|
remove: :debug,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
frontend: false,
|
||||||
|
)
|
||||||
|
|
||||||
Setting.create_if_not_exists(
|
Setting.create_if_not_exists(
|
||||||
title: 'Time Accounting',
|
title: 'Time Accounting',
|
||||||
name: 'time_accounting',
|
name: 'time_accounting',
|
||||||
|
|
|
@ -25,6 +25,17 @@ class Sequencer
|
||||||
new(sequence, *args).process
|
new(sequence, *args).process
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Provides the log level definition for the requested Sequencer component.
|
||||||
|
#
|
||||||
|
# @example
|
||||||
|
# Sequencer.log_level_for(:state)
|
||||||
|
# #=> { get: :debug, set: :debug, ... }
|
||||||
|
#
|
||||||
|
# @return [ActiveSupport::HashWithIndifferentAcces] the log level definition
|
||||||
|
def self.log_level_for(component)
|
||||||
|
Setting.get('sequencer_log_level').with_indifferent_access[component]
|
||||||
|
end
|
||||||
|
|
||||||
# Initializes a new Sequencer instance for the given Sequence with parameters and expecting result.
|
# Initializes a new Sequencer instance for the given Sequence with parameters and expecting result.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
|
@ -55,13 +66,13 @@ class Sequencer
|
||||||
#
|
#
|
||||||
# @return [Hash{Symbol => Object}] the final result state attributes and values
|
# @return [Hash{Symbol => Object}] the final result state attributes and values
|
||||||
def process
|
def process
|
||||||
log_start_finish(:info, "Sequence '#{sequence.name}'") do
|
log_start_finish(log_level[:start_finish], "Sequence '#{sequence.name}'") do
|
||||||
|
|
||||||
sequence.units.each_with_index do |unit, index|
|
sequence.units.each_with_index do |unit, index|
|
||||||
|
|
||||||
state.process do
|
state.process do
|
||||||
|
|
||||||
log_start_finish(:info, "Sequence '#{sequence.name}' Unit '#{unit.name}' (index: #{index})") do
|
log_start_finish(log_level[:unit], "Sequence '#{sequence.name}' Unit '#{unit.name}' (index: #{index})") do
|
||||||
unit.process(state)
|
unit.process(state)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -69,7 +80,7 @@ class Sequencer
|
||||||
end
|
end
|
||||||
|
|
||||||
state.to_h.tap do |result|
|
state.to_h.tap do |result|
|
||||||
logger.debug { "Returning Sequence '#{sequence.name}' result: #{result.inspect}" }
|
logger.public_send(log_level[:result]) { "Returning Sequence '#{sequence.name}' result: #{result.inspect}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,4 +91,8 @@ class Sequencer
|
||||||
parameters: @parameters,
|
parameters: @parameters,
|
||||||
expecting: @expecting)
|
expecting: @expecting)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_level
|
||||||
|
@log_level ||= self.class.log_level_for(:sequence)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Sequencer
|
||||||
# @return [Object, nil]
|
# @return [Object, nil]
|
||||||
def optional(attribute)
|
def optional(attribute)
|
||||||
return get(attribute) if @attributes.known?(attribute)
|
return get(attribute) if @attributes.known?(attribute)
|
||||||
logger.debug { "Access to unknown optional attribute '#{attribute}'." }
|
logger.public_send(log_level[:optional]) { "Access to unknown optional attribute '#{attribute}'." }
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -184,13 +184,13 @@ class Sequencer
|
||||||
end
|
end
|
||||||
|
|
||||||
def set(attribute, value)
|
def set(attribute, value)
|
||||||
logger.debug { "Setting '#{attribute}' value (#{value.class.name}): #{value.inspect}" }
|
logger.public_send(log_level[:set]) { "Setting '#{attribute}' value (#{value.class.name}): #{value.inspect}" }
|
||||||
@values[attribute] = value
|
@values[attribute] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(attribute)
|
def get(attribute)
|
||||||
value = @values[attribute]
|
value = @values[attribute]
|
||||||
logger.debug { "Getting '#{attribute}' value (#{value.class.name}): #{value.inspect}" }
|
logger.public_send(log_level[:get]) { "Getting '#{attribute}' value (#{value.class.name}): #{value.inspect}" }
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -207,21 +207,21 @@ class Sequencer
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize_attributes(units)
|
def initialize_attributes(units)
|
||||||
log_start_finish(:debug, 'Attributes lifespan initialization') do
|
log_start_finish(log_level[:attribute_initialization][:start_finish], 'Attributes lifespan initialization') do
|
||||||
@attributes = Sequencer::Units::Attributes.new(units.declarations)
|
@attributes = Sequencer::Units::Attributes.new(units.declarations)
|
||||||
logger.debug { "Attributes lifespan: #{@attributes.inspect}" }
|
logger.public_send(log_level[:attribute_initialization][:attributes]) { "Attributes lifespan: #{@attributes.inspect}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize_parameters(parameters)
|
def initialize_parameters(parameters)
|
||||||
logger.debug { "Initializing Sequencer::State with initial parameters: #{parameters.inspect}" }
|
logger.public_send(log_level[:parameter_initialization][:parameters]) { "Initializing Sequencer::State with initial parameters: #{parameters.inspect}" }
|
||||||
|
|
||||||
log_start_finish(:debug, 'Attribute value provisioning check and initialization') do
|
log_start_finish(log_level[:parameter_initialization][:start_finish], 'Attribute value provisioning check and initialization') do
|
||||||
|
|
||||||
@attributes.each do |identifier, attribute|
|
@attributes.each do |identifier, attribute|
|
||||||
|
|
||||||
if !attribute.will_be_used?
|
if !attribute.will_be_used?
|
||||||
logger.debug { "Attribute '#{identifier}' is provided by Unit(s) but never used." }
|
logger.public_send(log_level[:parameter_initialization][:unused]) { "Attribute '#{identifier}' is provided by Unit(s) but never used." }
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -250,23 +250,27 @@ class Sequencer
|
||||||
|
|
||||||
def initialize_expectations(expected_attributes)
|
def initialize_expectations(expected_attributes)
|
||||||
expected_attributes.each do |identifier|
|
expected_attributes.each do |identifier|
|
||||||
logger.debug { "Adding attribute '#{identifier}' to the list of expected result attributes." }
|
logger.public_send(log_level[:expectations_initialization]) { "Adding attribute '#{identifier}' to the list of expected result attributes." }
|
||||||
@attributes[identifier].to = @result_index
|
@attributes[identifier].to = @result_index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup
|
def cleanup
|
||||||
log_start_finish(:info, "State cleanup of Unit #{unit.name} (index: #{@index})") do
|
log_start_finish(log_level[:cleanup][:start_finish], "State cleanup of Unit #{unit.name} (index: #{@index})") do
|
||||||
|
|
||||||
@attributes.delete_if do |identifier, attribute|
|
@attributes.delete_if do |identifier, attribute|
|
||||||
remove = !attribute.will_be_used?
|
remove = !attribute.will_be_used?
|
||||||
remove ||= attribute.to <= @index
|
remove ||= attribute.to <= @index
|
||||||
if remove && attribute.will_be_used?
|
if remove && attribute.will_be_used?
|
||||||
logger.debug { "Removing unneeded attribute '#{identifier}': #{@values[identifier].inspect}" }
|
logger.public_send(log_level[:cleanup][:remove]) { "Removing unneeded attribute '#{identifier}': #{@values[identifier].inspect}" }
|
||||||
end
|
end
|
||||||
remove
|
remove
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_level
|
||||||
|
@log_level ||= Sequencer.log_level_for(:state)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2748,12 +2748,20 @@ wait untill text in selector disabppears
|
||||||
element = instance.find_elements(css: '.modal input.searchableSelect-main')[0]
|
element = instance.find_elements(css: '.modal input.searchableSelect-main')[0]
|
||||||
element.clear
|
element.clear
|
||||||
element.send_keys(data[:organization])
|
element.send_keys(data[:organization])
|
||||||
|
|
||||||
|
begin
|
||||||
|
retries ||= 0
|
||||||
target = nil
|
target = nil
|
||||||
until target
|
until target
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0]
|
target = instance.find_elements(css: ".modal li[title='#{data[:organization]}']")[0]
|
||||||
end
|
end
|
||||||
target.click()
|
target.click()
|
||||||
|
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
||||||
|
sleep retries
|
||||||
|
retries += 1
|
||||||
|
retry if retries < 3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
check(
|
check(
|
||||||
browser: instance,
|
browser: instance,
|
||||||
|
|
Loading…
Reference in a new issue