mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-02-12 23:28:13 -05:00
Handle removal of temp rule result profiles.
This commit is contained in:
parent
ee144e20a7
commit
21f0eedf83
@ -23,6 +23,7 @@ class Options
|
|||||||
_watchingProfiles: {}
|
_watchingProfiles: {}
|
||||||
_tempProfile: null
|
_tempProfile: null
|
||||||
_tempProfileRules: {}
|
_tempProfileRules: {}
|
||||||
|
_tempProfileRulesByProfile: {}
|
||||||
fallbackProfileName: 'system'
|
fallbackProfileName: 'system'
|
||||||
_isSystem: false
|
_isSystem: false
|
||||||
debugStr: 'Options'
|
debugStr: 'Options'
|
||||||
@ -331,6 +332,21 @@ class Options
|
|||||||
@_tempProfile.defaultProfileName = profile.name
|
@_tempProfile.defaultProfileName = profile.name
|
||||||
@_tempProfile.color = profile.color
|
@_tempProfile.color = profile.color
|
||||||
OmegaPac.Profiles.updateRevision(@_tempProfile)
|
OmegaPac.Profiles.updateRevision(@_tempProfile)
|
||||||
|
|
||||||
|
removedKeys = []
|
||||||
|
for own key, list of @_tempProfileRulesByProfile
|
||||||
|
if not OmegaPac.Profiles.byKey(key, @_options)
|
||||||
|
removedKeys.push(key)
|
||||||
|
for rule in list
|
||||||
|
rule.profileName = null
|
||||||
|
@_tempProfile.rules.splice(@_tempProfile.rules.indexOf(rule), 1)
|
||||||
|
if removedKeys.length > 0
|
||||||
|
for key in removedKeys
|
||||||
|
delete @_tempProfileRulesByProfile[key]
|
||||||
|
OmegaPac.Profiles.updateRevision(@_tempProfile)
|
||||||
|
|
||||||
|
@_watchingProfiles = OmegaPac.Profiles.allReferenceSet(@_tempProfile,
|
||||||
|
@_options)
|
||||||
@applyProfileProxy(@_tempProfile)
|
@applyProfileProxy(@_tempProfile)
|
||||||
else
|
else
|
||||||
@applyProfileProxy(profile)
|
@applyProfileProxy(profile)
|
||||||
@ -501,8 +517,12 @@ class Options
|
|||||||
|
|
||||||
changed = false
|
changed = false
|
||||||
rule = @_tempProfileRules[domain]
|
rule = @_tempProfileRules[domain]
|
||||||
if rule
|
if rule and rule.profileName
|
||||||
if rule.profileName != profileName
|
if rule.profileName != profileName
|
||||||
|
key = OmegaPac.Profiles.nameAsKey(rule.profileName)
|
||||||
|
list = @_tempProfileRulesByProfile[key]
|
||||||
|
list.splice(list.indexOf(rule), 1)
|
||||||
|
|
||||||
rule.profileName = profileName
|
rule.profileName = profileName
|
||||||
changed = true
|
changed = true
|
||||||
else
|
else
|
||||||
@ -515,6 +535,13 @@ class Options
|
|||||||
@_tempProfile.rules.push(rule)
|
@_tempProfile.rules.push(rule)
|
||||||
@_tempProfileRules[domain] = rule
|
@_tempProfileRules[domain] = rule
|
||||||
changed = true
|
changed = true
|
||||||
|
|
||||||
|
key = OmegaPac.Profiles.nameAsKey(profileName)
|
||||||
|
rulesByProfile = @_tempProfileRulesByProfile[key]
|
||||||
|
if not rulesByProfile?
|
||||||
|
rulesByProfile = @_tempProfileRulesByProfile[key] = []
|
||||||
|
rulesByProfile.push(rule)
|
||||||
|
|
||||||
if changed
|
if changed
|
||||||
OmegaPac.Profiles.updateRevision(@_tempProfile)
|
OmegaPac.Profiles.updateRevision(@_tempProfile)
|
||||||
@applyProfile(@_currentProfileName)
|
@applyProfile(@_currentProfileName)
|
||||||
@ -530,9 +557,11 @@ class Options
|
|||||||
queryTempRule: (domain) ->
|
queryTempRule: (domain) ->
|
||||||
rule = @_tempProfileRules[domain]
|
rule = @_tempProfileRules[domain]
|
||||||
if rule
|
if rule
|
||||||
rule.profileName
|
if rule.profileName
|
||||||
|
return rule.profileName
|
||||||
else
|
else
|
||||||
null
|
delete @_tempProfileRules[domain]
|
||||||
|
return null
|
||||||
|
|
||||||
###*
|
###*
|
||||||
# Add a condition to the current active switch profile.
|
# Add a condition to the current active switch profile.
|
||||||
|
Loading…
Reference in New Issue
Block a user