mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-20 09:52:19 +01:00
set openlab-projects id & secret from the UI
This commit is contained in:
parent
6af3f12917
commit
db8de18bd4
@ -628,7 +628,8 @@ angular.module('application.router', ['ui.router'])
|
||||
licencesPromise: ['Licence', function (Licence) { return Licence.query().$promise; }],
|
||||
themesPromise: ['Theme', function (Theme) { return Theme.query().$promise; }],
|
||||
settingsPromise: ['Setting', function (Setting) {
|
||||
return Setting.query({ names: "['feature_tour_display', 'disqus_shortname', 'allowed_cad_extensions', 'allowed_cad_mime_types']" }).$promise;
|
||||
return Setting.query({ names: "['feature_tour_display', 'disqus_shortname', 'allowed_cad_extensions', \
|
||||
'allowed_cad_mime_types', 'open_lab_app_id', 'open_lab_app_secret']" }).$promise;
|
||||
}]
|
||||
}
|
||||
})
|
||||
|
@ -61,3 +61,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default m-t-lg">
|
||||
<div class="panel-heading">
|
||||
<span class="font-sbold" translate>{{ 'app.admin.projects.settings.projects_sharing' }}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<h3 class="m-l" translate>{{ 'app.admin.projects.settings.open_lab_projects' }}</h3>
|
||||
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.projects.settings.open_lab_info_html' | translate"></p>
|
||||
<div class="col-md-4">
|
||||
<text-setting name="openlab_app_id"
|
||||
settings="allSettings"
|
||||
label="app.admin.projects.settings.open_lab_app_id"
|
||||
fa-icon="fa-id-badge">
|
||||
</text-setting>
|
||||
</div>
|
||||
<div class="col-md-4 col-md-offset-2">
|
||||
<text-setting name="openlab_app_secret"
|
||||
settings="allSettings"
|
||||
label="app.admin.projects.settings.open_lab_app_secret"
|
||||
fa-icon="fa-key">
|
||||
</text-setting>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,7 +92,9 @@ class Setting < ApplicationRecord
|
||||
email_from
|
||||
disqus_shortname
|
||||
allowed_cad_extensions
|
||||
allowed_cad_mime_types] }
|
||||
allowed_cad_mime_types
|
||||
openlab_app_id
|
||||
openlab_app_secret] }
|
||||
def value
|
||||
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
|
||||
last_value&.value
|
||||
|
@ -1,12 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Asynchronously synchronize the projects with OpenLab-Projects
|
||||
class OpenlabWorker
|
||||
include Sidekiq::Worker
|
||||
sidekiq_options queue: 'default', retry: true
|
||||
|
||||
Logger = Sidekiq.logger.level == Logger::DEBUG ? Sidekiq.logger : nil
|
||||
LOGGER = Sidekiq.logger.level == Logger::DEBUG ? Sidekiq.logger : nil
|
||||
OPENLAB_CLIENT = Openlab::Projects.new
|
||||
|
||||
def perform(action, project_id)
|
||||
logger.debug ["Openlab sync", action, "project ID: #{project_id}"]
|
||||
LOGGER&.debug ['Openlab sync', action, "project ID: #{project_id}"]
|
||||
|
||||
case action.to_s
|
||||
when /create/
|
||||
@ -17,8 +20,10 @@ class OpenlabWorker
|
||||
response = OPENLAB_CLIENT.update(project_id, project.openlab_attributes)
|
||||
when /destroy/
|
||||
response = OPENLAB_CLIENT.destroy(project_id)
|
||||
else
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
logger.debug ["Openlab sync", "RESPONSE ERROR", response.inspect] unless response.success?
|
||||
LOGGER&.debug ['Openlab sync', 'RESPONSE ERROR', response.inspect] unless response.success?
|
||||
end
|
||||
end
|
||||
|
@ -156,6 +156,11 @@ en:
|
||||
test_file: "Test a file"
|
||||
set_a_file: "Select a file"
|
||||
file_is_TYPE: "MIME type of this file is {TYPE}"
|
||||
projects_sharing: "Projects sharing"
|
||||
open_lab_projects: "OpenLab Projects"
|
||||
open_lab_info_html: "Share your projects with other Fab Labs and display a gallery of shared projects. Please send an email to <a href='mailto:contact@fab-manager.com'>contact@fab-manager.com</a> to get your access credentials for free."
|
||||
open_lab_app_id: "ID"
|
||||
open_lab_app_secret: "Secret"
|
||||
#track and monitor the trainings
|
||||
trainings:
|
||||
trainings_monitoring: "Trainings monitoring"
|
||||
@ -1072,6 +1077,8 @@ en:
|
||||
disqus_shortname: "Disqus shortname"
|
||||
COUNT_items_removed: "{COUNT, plural, =1{One item} other{{COUNT} items}} removed"
|
||||
item_added: "One item added"
|
||||
openlab_app_id: "OpenLab-Projects ID"
|
||||
openlab_app_secret: "OpenLab-Projects secret"
|
||||
general:
|
||||
general: "General"
|
||||
title: "Title"
|
||||
|
@ -156,6 +156,11 @@ fr:
|
||||
test_file: "Tester un fichier"
|
||||
set_a_file: "Sélectionner un fichier"
|
||||
file_is_TYPE: "Le type MIME de ce fichier est {TYPE}"
|
||||
projects_sharing: "Partage de projets"
|
||||
open_lab_projects: "OpenLab Projects"
|
||||
open_lab_info_html: "Partagez vos projets avec d'autres Fab Labs et affichez une galerie de projets partagés. Veuillez envoyer un courriel à <a href='mailto:contact@fab-manager.com'>contact@fab-manager.com</a> pour obtenir gratuitement vos identifiants d'accès."
|
||||
open_lab_app_id: "ID"
|
||||
open_lab_app_secret: "Secret"
|
||||
#track and monitor the trainings
|
||||
trainings:
|
||||
trainings_monitoring: "Suivi formations"
|
||||
@ -1072,6 +1077,8 @@ fr:
|
||||
disqus_shortname: "nom court Disqus"
|
||||
COUNT_items_removed: "{COUNT, plural, =1{Un élément retiré} other{{COUNT} éléments retirés}}"
|
||||
item_added: "Un élément ajouté"
|
||||
openlab_app_id: "l'ID OpenLab-Projects"
|
||||
openlab_app_secret: "secret OpenLab-Projects"
|
||||
general:
|
||||
general: "Général"
|
||||
title: "Titre"
|
||||
|
@ -122,7 +122,9 @@ namespace :fablab do
|
||||
%w[_ DEFAULT_MAIL_FROM email_from],
|
||||
%w[_ DISQUS_SHORTNAME disqus_shortname],
|
||||
%w[_ ALLOWED_EXTENSIONS allowed_cad_extensions],
|
||||
%w[_ ALLOWED_MIME_TYPES allowed_cad_mime_types]
|
||||
%w[_ ALLOWED_MIME_TYPES allowed_cad_mime_types],
|
||||
%w[_ OPENLAB_APP_ID openlab_app_id],
|
||||
%w[_ OPENLAB_APP_SECRET openlab_app_secret]
|
||||
]
|
||||
|
||||
mapping.each do |m|
|
||||
|
Loading…
x
Reference in New Issue
Block a user