Sha256: b5a8dbce81889c2afa113190d7e1066d56bb26eed4fb8dea06ab9ee83e8b15f7

Contents?: true

Size: 1.03 KB

Versions: 24

Compression:

Stored size: 1.03 KB

Contents

module Types
  class OverridenAnsibleVariable < ::Types::AnsibleVariable
    description 'Ansible Variable with an override value for a host'
    model_class ::AnsibleVariable

    field :current_value, ::Types::AnsibleVariableOverride, :null => true
    field :lookup_values, ::Types::LookupValue.connection_type do
      argument :match, String, required: false
    end

    field :meta, ::Types::Meta, resolve: (proc do |object|
      {
        :can_edit => ::User.current.can?(object.ansible_variable.permission_name(:edit), object.ansible_variable),
        :can_destroy => ::User.current.can?(object.ansible_variable.permission_name(:destroy), object.ansible_variable)
      }
    end)

    def lookup_values(match: nil)
      return CollectionLoader.for(object.ansible_variable.class, :lookup_values).load(object.ansible_variable) unless match

      scope = lambda do |sc|
        sc.where(:match => match)
      end
      CollectionLoader.for(object.ansible_variable.class, :lookup_values, scope).load(object.ansible_variable)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
foreman_ansible-7.1.8 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.7 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.6 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.5 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-10.3.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-11.0.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-10.2.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-10.1.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-10.0.1 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-10.0.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.4 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-9.0.1 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.3 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-9.0.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.2 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.1 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-8.0.1 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-8.0.0 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.0.4 app/graphql/types/overriden_ansible_variable.rb
foreman_ansible-7.1.0 app/graphql/types/overriden_ansible_variable.rb