Added auto restart of zammad after changing object attributes.
This commit is contained in:
parent
eae8ead41c
commit
39feeccc88
8 changed files with 126 additions and 26 deletions
|
@ -334,6 +334,7 @@ test:browser:twitter_ff:
|
||||||
- twitter
|
- twitter
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- RAILS_ENV=test rake db:create
|
- RAILS_ENV=test rake db:create
|
||||||
- cp contrib/auto_wizard_test.json auto_wizard.json
|
- cp contrib/auto_wizard_test.json auto_wizard.json
|
||||||
- script/bootstrap.sh
|
- script/bootstrap.sh
|
||||||
|
@ -350,6 +351,7 @@ test:browser:facebook_ff:
|
||||||
- facebook
|
- facebook
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- RAILS_ENV=test rake db:create
|
- RAILS_ENV=test rake db:create
|
||||||
- cp contrib/auto_wizard_test.json auto_wizard.json
|
- cp contrib/auto_wizard_test.json auto_wizard.json
|
||||||
- script/bootstrap.sh
|
- script/bootstrap.sh
|
||||||
|
@ -365,6 +367,7 @@ test:browser:autowizard_ff:
|
||||||
- browser-ff
|
- browser-ff
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- RAILS_ENV=test rake db:create
|
- RAILS_ENV=test rake db:create
|
||||||
- cp contrib/auto_wizard_example.json auto_wizard.json
|
- cp contrib/auto_wizard_example.json auto_wizard.json
|
||||||
- script/bootstrap.sh
|
- script/bootstrap.sh
|
||||||
|
@ -381,6 +384,7 @@ test:browser:core:ff_1_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -401,6 +405,7 @@ test:browser:core:ff_2_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -421,6 +426,7 @@ test:browser:core:ff_3_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- script/build/test_slice_tests.sh 3
|
- script/build/test_slice_tests.sh 3
|
||||||
- RAILS_ENV=test rake db:create
|
- RAILS_ENV=test rake db:create
|
||||||
- script/bootstrap.sh
|
- script/bootstrap.sh
|
||||||
|
@ -437,6 +443,7 @@ test:browser:core:ff_4_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -457,6 +464,7 @@ test:browser:core:ff_5_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -477,6 +485,7 @@ test:browser:core:ff_1_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -497,6 +506,7 @@ test:browser:core:ff_2_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -517,6 +527,7 @@ test:browser:core:ff_3_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- script/build/test_slice_tests.sh 3
|
- script/build/test_slice_tests.sh 3
|
||||||
- RAILS_ENV=test rake db:create
|
- RAILS_ENV=test rake db:create
|
||||||
- script/bootstrap.sh
|
- script/bootstrap.sh
|
||||||
|
@ -533,6 +544,7 @@ test:browser:core:ff_4_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -553,6 +565,7 @@ test:browser:core:ff_5_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -573,6 +586,7 @@ test:browser:core:chrome_1_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -593,6 +607,7 @@ test:browser:core:chrome_2_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -613,6 +628,7 @@ test:browser:core:chrome_3_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -633,6 +649,7 @@ test:browser:core:chrome_4_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -653,6 +670,7 @@ test:browser:core:chrome_5_mysql:
|
||||||
- mysql
|
- mysql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -673,6 +691,7 @@ test:browser:core:chrome_1_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -693,6 +712,7 @@ test:browser:core:chrome_2_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -713,6 +733,7 @@ test:browser:core:chrome_3_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -733,6 +754,7 @@ test:browser:core:chrome_4_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
@ -753,6 +775,7 @@ test:browser:core:chrome_5_postgresql:
|
||||||
- postgresql
|
- postgresql
|
||||||
script:
|
script:
|
||||||
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
- export BROWSER_URL=http://$IP:$BROWSER_PORT
|
||||||
|
- export APP_RESTART_CMD="script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT && script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT"
|
||||||
- unset MAILBOX_AUTO1
|
- unset MAILBOX_AUTO1
|
||||||
- unset MAILBOX_AUTO2
|
- unset MAILBOX_AUTO2
|
||||||
- unset MAILBOX_MANUAL1
|
- unset MAILBOX_MANUAL1
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
class Widget extends App.Controller
|
class Widget extends App.Controller
|
||||||
|
errorCount: 0
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
|
||||||
|
@ -13,8 +14,10 @@ class Widget extends App.Controller
|
||||||
@maintanaceAppVersion(data)
|
@maintanaceAppVersion(data)
|
||||||
if data.type is 'config_changed'
|
if data.type is 'config_changed'
|
||||||
@maintanaceConfigChanged(data)
|
@maintanaceConfigChanged(data)
|
||||||
if data.type is 'restart'
|
if data.type is 'restart_auto'
|
||||||
@maintanaceRestart(data)
|
@maintanaceRestartAuto(data)
|
||||||
|
if data.type is 'restart_manual'
|
||||||
|
@maintanaceRestartManual(data)
|
||||||
'maintenance'
|
'maintenance'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,12 +44,12 @@ class Widget extends App.Controller
|
||||||
return if !@authenticate(true)
|
return if !@authenticate(true)
|
||||||
@navigate '#logout'
|
@navigate '#logout'
|
||||||
|
|
||||||
#App.Event.trigger('maintenance', {type:'restart'})
|
#App.Event.trigger('maintenance', {type:'restart_auto'})
|
||||||
maintanaceRestart: (data) =>
|
maintanaceRestartAuto: (data) =>
|
||||||
return if @messageRestart
|
return if @messageRestartAuto
|
||||||
@messageRestart = new App.SessionMessage(
|
@messageRestartAuto = new App.SessionMessage(
|
||||||
head: 'Restarting...'
|
head: 'Zammad is restarting...'
|
||||||
message: 'Zammad is restarting... waiting...'
|
message: 'Some system settings have changed, Zammad is restarting. Please wait until Zammad is back again.'
|
||||||
keyboard: false
|
keyboard: false
|
||||||
backdrop: false
|
backdrop: false
|
||||||
buttonClose: false
|
buttonClose: false
|
||||||
|
@ -54,12 +57,24 @@ class Widget extends App.Controller
|
||||||
small: true
|
small: true
|
||||||
forceReload: true
|
forceReload: true
|
||||||
)
|
)
|
||||||
|
@disconnectClient()
|
||||||
|
@checkAvailability()
|
||||||
|
|
||||||
# disconnect
|
#App.Event.trigger('maintenance', {type:'restart_manual'})
|
||||||
|
maintanaceRestartManual: (data) =>
|
||||||
# try if backend is reachable again
|
return if @messageRestartManual
|
||||||
|
@messageRestartManual = new App.SessionMessage(
|
||||||
# reload app
|
head: 'Zammad need a restart!'
|
||||||
|
message: 'Some system settings have changed, please restart all Zammad processes! If you want to do this automatically, set environment variable APP___RESTART___CMD="/path/to/your___app___script.sh restart".'
|
||||||
|
keyboard: false
|
||||||
|
backdrop: false
|
||||||
|
buttonClose: false
|
||||||
|
buttonSubmit: false
|
||||||
|
small: true
|
||||||
|
forceReload: true
|
||||||
|
)
|
||||||
|
@disconnectClient()
|
||||||
|
@checkAvailability()
|
||||||
|
|
||||||
maintanaceConfigChanged: (data) =>
|
maintanaceConfigChanged: (data) =>
|
||||||
return if @messageConfigChanged
|
return if @messageConfigChanged
|
||||||
|
@ -94,4 +109,21 @@ class Widget extends App.Controller
|
||||||
)
|
)
|
||||||
@delay(message, 2000)
|
@delay(message, 2000)
|
||||||
|
|
||||||
|
checkAvailability: (delay) =>
|
||||||
|
delay = =>
|
||||||
|
@ajax(
|
||||||
|
id: 'check_availability'
|
||||||
|
type: 'get'
|
||||||
|
url: "#{@apiPath}/available"
|
||||||
|
success: (data) =>
|
||||||
|
if @errorCount is 0
|
||||||
|
@checkAvailability()
|
||||||
|
return
|
||||||
|
@windowReload()
|
||||||
|
error: =>
|
||||||
|
@errorCount += 1
|
||||||
|
@checkAvailability()
|
||||||
|
)
|
||||||
|
@delay(delay, 2000)
|
||||||
|
|
||||||
App.Config.set('maintenance', Widget, 'Widgets')
|
App.Config.set('maintenance', Widget, 'Widgets')
|
||||||
|
|
|
@ -273,6 +273,12 @@ class SessionsController < ApplicationController
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def available
|
||||||
|
render json: {
|
||||||
|
app_version: AppVersion.get
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def list
|
def list
|
||||||
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
return if deny_if_not_role(Z_ROLENAME_ADMIN)
|
||||||
assets = {}
|
assets = {}
|
||||||
|
|
|
@ -591,9 +591,18 @@ returns
|
||||||
execute_count += 1
|
execute_count += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# sent reload to clients
|
# sent maintenance message to clients
|
||||||
if execute_count != 0
|
if execute_count != 0
|
||||||
AppVersion.set(true)
|
if ENV['APP_RESTART_CMD']
|
||||||
|
AppVersion.set(true, 'restart_auto')
|
||||||
|
pid = fork do
|
||||||
|
sleep 5
|
||||||
|
system(ENV['APP_RESTART_CMD'])
|
||||||
|
Process.exit!(true)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
AppVersion.set(true, 'restart_manual')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -611,6 +620,10 @@ returns
|
||||||
raise 'Spaces in name are not allowed'
|
raise 'Spaces in name are not allowed'
|
||||||
elsif name !~ /^[a-z0-9_]+$/
|
elsif name !~ /^[a-z0-9_]+$/
|
||||||
raise 'Only letters from a-z, numbers from 0-9, and _ are allowed'
|
raise 'Only letters from a-z, numbers from 0-9, and _ are allowed'
|
||||||
|
elsif name !~ /[a-z]/
|
||||||
|
raise 'At least one letters is needed'
|
||||||
|
elsif name =~ /^(destroy|true|false|integer|select|drop|create|alter|index|table)$/i
|
||||||
|
raise "#{name} is a reserved word, please choose a different one"
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,8 @@ Zammad::Application.routes.draw do
|
||||||
match api_path + '/signshow', to: 'sessions#show', via: [:get, :post]
|
match api_path + '/signshow', to: 'sessions#show', via: [:get, :post]
|
||||||
match api_path + '/signout', to: 'sessions#destroy', via: [:get, :delete]
|
match api_path + '/signout', to: 'sessions#destroy', via: [:get, :delete]
|
||||||
|
|
||||||
|
match api_path + '/available', to: 'sessions#available', via: :get
|
||||||
|
|
||||||
match api_path + '/sessions/switch/:id', to: 'sessions#switch_to_user', via: :get
|
match api_path + '/sessions/switch/:id', to: 'sessions#switch_to_user', via: :get
|
||||||
match api_path + '/sessions/switch_back', to: 'sessions#switch_back_to_user', via: :get
|
match api_path + '/sessions/switch_back', to: 'sessions#switch_back_to_user', via: :get
|
||||||
match api_path + '/sessions', to: 'sessions#list', via: :get
|
match api_path + '/sessions', to: 'sessions#list', via: :get
|
||||||
|
|
|
@ -24,22 +24,33 @@ set new app version and if browser reload is required
|
||||||
|
|
||||||
AppVersion.set(true) # true == reload is required / false == no reload is required
|
AppVersion.set(true) # true == reload is required / false == no reload is required
|
||||||
|
|
||||||
|
send also reload type to clients
|
||||||
|
|
||||||
|
AppVersion.set(true, 'restart_auto')
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.set(reload_required = false)
|
def self.set(reload_required = false, type = false)
|
||||||
return false if !Setting.find_by(name: 'app_version')
|
return false if !Setting.find_by(name: 'app_version')
|
||||||
version = "#{Time.zone.now.strftime('%Y%m%d%H%M%S')}:#{reload_required}"
|
version = "#{Time.zone.now.strftime('%Y%m%d%H%M%S')}:#{reload_required}"
|
||||||
Setting.set('app_version', version)
|
Setting.set('app_version', version)
|
||||||
|
|
||||||
# broadcast to clients
|
# broadcast to clients
|
||||||
Sessions.broadcast(event_data)
|
Sessions.broadcast(event_data(type), 'public')
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
get event data
|
get event data
|
||||||
|
|
||||||
AppVersion.event_data
|
AppVersion.event_data(type)
|
||||||
|
|
||||||
|
types:
|
||||||
|
|
||||||
|
app_version -> new app version
|
||||||
|
restart_manual -> app needs restart
|
||||||
|
restart_auto -> app is restarting
|
||||||
|
config_changed -> config has changed
|
||||||
|
|
||||||
returnes
|
returnes
|
||||||
|
|
||||||
|
@ -53,11 +64,11 @@ returnes
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.event_data
|
def self.event_data(type = 'app_version')
|
||||||
{
|
{
|
||||||
event: 'maintenance',
|
event: 'maintenance',
|
||||||
data: {
|
data: {
|
||||||
type: 'app_version',
|
type: type,
|
||||||
app_version: get,
|
app_version: get,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,7 @@ returns
|
||||||
|
|
||||||
broadcase also to not authenticated client
|
broadcase also to not authenticated client
|
||||||
|
|
||||||
Sessions.broadcast(data, 'public')
|
Sessions.broadcast(data, 'public') # public|authenticated
|
||||||
|
|
||||||
broadcase also not to sender
|
broadcase also not to sender
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ broadcase also not to sender
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.broadcast(data, recipient = 'autenticated', sender_user_id = nil)
|
def self.broadcast(data, recipient = 'authenticated', sender_user_id = nil)
|
||||||
|
|
||||||
# list all current clients
|
# list all current clients
|
||||||
recipients = []
|
recipients = []
|
||||||
|
|
|
@ -68,9 +68,16 @@ class AdminObjectManagerTest < TestCase
|
||||||
click(css: '#content .tab-pane.active div.js-execute')
|
click(css: '#content .tab-pane.active div.js-execute')
|
||||||
watch_for(
|
watch_for(
|
||||||
css: '.modal',
|
css: '.modal',
|
||||||
value: 'New Version',
|
value: 'restart',
|
||||||
|
)
|
||||||
|
watch_for_disappear(
|
||||||
|
css: '.modal',
|
||||||
|
timeout: 26,
|
||||||
|
)
|
||||||
|
sleep 5
|
||||||
|
watch_for(
|
||||||
|
css: '#content',
|
||||||
)
|
)
|
||||||
click(css: '.modal button.js-submit')
|
|
||||||
|
|
||||||
# create new ticket
|
# create new ticket
|
||||||
ticket = ticket_create(
|
ticket = ticket_create(
|
||||||
|
@ -126,10 +133,16 @@ class AdminObjectManagerTest < TestCase
|
||||||
click(css: '#content .tab-pane.active div.js-execute')
|
click(css: '#content .tab-pane.active div.js-execute')
|
||||||
watch_for(
|
watch_for(
|
||||||
css: '.modal',
|
css: '.modal',
|
||||||
value: 'New Version',
|
value: 'restart',
|
||||||
|
)
|
||||||
|
watch_for_disappear(
|
||||||
|
css: '.modal',
|
||||||
|
timeout: 26,
|
||||||
)
|
)
|
||||||
click(css: '.modal button.js-submit')
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
watch_for(
|
||||||
|
css: '#content',
|
||||||
|
)
|
||||||
match_not(
|
match_not(
|
||||||
css: '#content',
|
css: '#content',
|
||||||
value: 'Database Update required',
|
value: 'Database Update required',
|
||||||
|
|
Loading…
Reference in a new issue