foreman_resource_quota 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6916afed10f56a6e68d6dab6bc68441f75996422a6776927e7ef41abd35464
|
4
|
+
data.tar.gz: 4f8b5a6fb679a1ca0e1cfa4eced475b434ed59ca23d89aaa73c67002d6f9c0f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb2239f5e28ff78afcfd9cbf7e2a1808cb3b28fd97a1ce52ccf98cebb8e6ada88b5a814ca115b8844d8e526c97f68d6922849eea51efa6485c20ec92d1ea96c
|
7
|
+
data.tar.gz: 956efef81ed4f030dbdddef3abce948eefcb2502ab9e6e7cf4a27b518049ffd4afff3dc89330b2cd6adb6e69b6547ef0e3a4602cbb9527b4cf1d29c375c63f8e
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module ForemanResourceQuota
|
4
4
|
module UserExtensions
|
5
5
|
extend ActiveSupport::Concern
|
6
|
-
included do
|
6
|
+
included do # rubocop:disable Metrics/BlockLength
|
7
7
|
after_create :set_unassigned_quota
|
8
8
|
|
9
9
|
has_many :resource_quotas_users, class_name: 'ForemanResourceQuota::ResourceQuotaUser', dependent: :destroy,
|
@@ -13,6 +13,15 @@ module ForemanResourceQuota
|
|
13
13
|
|
14
14
|
scoped_search relation: :resource_quotas, on: :name, complete_value: true, rename: :resource_quota
|
15
15
|
|
16
|
+
def quotas_with_usergroups
|
17
|
+
quotas = []
|
18
|
+
usergroups.each do |group|
|
19
|
+
quotas << group.resource_quotas
|
20
|
+
end
|
21
|
+
quotas << resource_quotas
|
22
|
+
ForemanResourceQuota::ResourceQuota.where(id: quotas.flatten.map(&:id))
|
23
|
+
end
|
24
|
+
|
16
25
|
def assignable_resource_quotas
|
17
26
|
resource_quotas.assignable
|
18
27
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
user_quotas = User.current&.admin? ? ForemanResourceQuota::ResourceQuota.all : User.current.
|
2
|
+
user_quotas = User.current&.admin? ? ForemanResourceQuota::ResourceQuota.all : User.current.quotas_with_usergroups
|
3
3
|
user_quotas = user_quotas.assignable if !User.current.quota_assignment_optional?
|
4
4
|
user_quotas = user_quotas.order(:name)
|
5
5
|
selected = @host.resource_quota_id
|
@@ -107,10 +107,10 @@ Foreman::Plugin.register :foreman_resource_quota do
|
|
107
107
|
end
|
108
108
|
extend_page 'hosts/_list' do |context|
|
109
109
|
context.with_profile :resource_quota, _('Resource Quota'), default: true do
|
110
|
-
add_pagelet :hosts_table_column_header, key: :
|
110
|
+
add_pagelet :hosts_table_column_header, key: :resource_quota, label: s_('Resource Quota'),
|
111
111
|
sortable: true, width: '10%', class: 'hidden-xs'
|
112
|
-
add_pagelet :hosts_table_column_content, key: :
|
113
|
-
callback: ->(host) { host.resource_quota
|
112
|
+
add_pagelet :hosts_table_column_content, key: :resource_quota,
|
113
|
+
callback: ->(host) { host.resource_quota&.name || _('Not available') }, class: 'hidden-xs ellipsis'
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_resource_quota
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bastian Schmidt
|
@@ -321,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
321
|
- !ruby/object:Gem::Version
|
322
322
|
version: '0'
|
323
323
|
requirements: []
|
324
|
-
rubygems_version: 3.6.
|
324
|
+
rubygems_version: 3.6.9
|
325
325
|
specification_version: 4
|
326
326
|
summary: Foreman Plug-in for resource quota
|
327
327
|
test_files: []
|