Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 57366958 authored by Alexandre MERLIN's avatar Alexandre MERLIN
Browse files

[gen/wiki] add a licenses group generator

parent fac91297
Branches
No related tags found
No related merge requests found
Pipeline #826640 failed
......@@ -9,6 +9,7 @@ require 'refrepo/gen/wiki/generators/site_network'
require 'refrepo/gen/wiki/generators/status'
require 'refrepo/gen/wiki/generators/group_storage'
require 'refrepo/gen/wiki/generators/environments'
require 'refrepo/gen/wiki/generators/licenses'
require 'refrepo/gen/wiki/generators/kwollect_metrics'
require 'refrepo/gen/wiki/generators/oarsub_simplifier_aliases'
......@@ -43,6 +44,10 @@ module RefRepo::Gen::Wiki
:gen => EnvironmentsGenerator,
:page => 'Generated/Environments'
},
'licenses' => {
:gen => LicensesGenerator,
:page => 'Generated/Licenses'
},
'kwollect_metrics' => {
:gen => KwollectMetricsGenerator,
:page => 'Generated/KwollectMetrics'
......
# coding: utf-8
class LicensesGenerator < WikiGenerator
def generate_content(_options)
table_columns = ["Group", "Software", "Server", "Usage", "Allowed users"]
table_data = []
envs = []
grps = RefRepo::Utils::get_api("users/groups")['items']
grps.select!{|g| g['is_license'] }.select!{|g| g['enabled']}
grps.each do |grp|
table_data << [grp['name'], grp['payload']['software'], grp['payload']['server'], grp['payload']['usage'] || "-", grp['description'] || "-"]
end
# Table construction
table_options = 'class="wikitable sortable" style="text-align: center;"'
@generated_content = MW.generate_table(table_options, table_columns, table_data)
@generated_content += MW.italic(MW.small("Last generated from the Grid'5000 API on #{Time.now.strftime("%Y-%m-%d")}"))
@generated_content += MW::LINE_FEED
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment