Skip to content

Commit

Permalink
Add javadoc installation option
Browse files Browse the repository at this point in the history
  • Loading branch information
fdaugan committed Feb 20, 2024
1 parent 50ab69e commit ee43a30
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ define({
'downloaded': 'Plug-in {{[0]}} téléchargé ({{[1]}}/{{[2]}}), un redémarrage est requis',
'subscriptions': 'Souscriptions',
'plugin-installing': 'Plug-in installé, mais non activé. Nécessite un redémarrage.',
'plugin-javadoc': 'Installer JavaDoc',
'plugin-javadoc-help': 'Les JavaDocs téléchargées contribuent à la documentation OpenAPI dans les formulaires Swagger',
'plugin-update': 'Mettre à jour ce plug-in',
'plugin-cancel-update': 'Anuler cette mise à jour',
'plugin-cancel-install': 'Anuler cette installation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ define({
'type': 'Type',
'downloaded-continue': 'Plug-in {{[0]}} downloaded ({{[1]}}/{{[2]}}),',
'downloaded': 'Plug-in {{[0]}} downloaded ({{[1]}}/{{[2]}}), a restart is required',
'plugin-javadoc-downloaded': 'Plug-in {{[0]}} downloaded, a restart is required',
'subscriptions': 'Subscriptions',
'restart': 'Restart',
'restart-requested': 'Restart has been requested',
'plugin-install': 'Install ...',
'plugin-install-from-repository': 'Install from repository',
'plugin-install-from-repository-help': 'Install plugins from defined repository',
'plugin-installing': 'Plug-in is installed but not yet available. Need a restart.',
'plugin-install-javadoc-all': 'Download all javadocs',
'plugin-install-javadoc-all-help': 'Download javadocs of all plugins and system resources',
'plugin-install-javadoc': 'Install javadoc',
'plugin-install-javadoc-help': 'Downloaded javadocs contribute to OpenAPI documentation in Swagger forms',
'plugin-update': 'Update this plug-in',
'plugin-cancel-update': 'Cancel this update',
'plugin-cancel-install': 'Cancel this install',
Expand All @@ -22,13 +30,13 @@ define({
'check-new-version': 'Check now',
'check-new-version-help': 'Check now the last available versions from the repository.<br/>24h cache is used.',
'check-new-version-requested': 'Check is requested, updating the list...',
'upload-plugin': 'Upload ...',
'file': 'File',
'upload-plugin': 'Install from file ...',
'upload-plugin-go': 'Upload',
'upload-plugin-title': 'Upload a plug-in',
'upload-plugin-progress': 'Uploading',
'upload-plugin-help': 'Upload a plug-in providing its version and id',
'upload-plugin-message': 'The below plug-in information is very important, it will determinate the plug-in to update or install.<br/>Currently only the latest version of each plug-in is considered, so your upload must either be a new plug-in, either a greater version. Otherwise your upload plug-in will be ignored at startup.',
'upload-plugin-message': 'The below plug-in information is critical, it will determinate the plug-in to update or install.<br/>Currently only the latest version of each plug-in is considered, so your upload must either be a new plug-in, either a greater version. Otherwise your upload plug-in will be ignored at startup.',
'artifact-id' : 'ArtifactID',
'upload-plugin-finished': 'Plug-in {{this}} has been uploaded, a restart is required'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ <h4 class="modal-title" id="modal-title">{{search}}</h4>
<input class="form-control" type="text" id="search" placeholder="{{plugin}}">
</div>
</div>

<div class="form-group">
<div class="col-sm-offset-4 col-sm-5">
<div class="checkbox" title="{{plugin-install-javadoc-help}}" data-toggle="tooltip" data-container="body">
<label for="plugin-install-javadoc">
<input type="checkbox" id="plugin-install-javadoc" checked>
<span>{{plugin-install-javadoc}}</span>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,30 @@ define(function () {
table: null,

initialize: function () {
function installJavadoc() {
$.ajax({
type: 'POST',
url: `${REST_PATH}system/plugin/javadoc/install?repository=${current.repository}`,
dataType: 'text',
contentType: 'application/json',
success: function (data) {
notifyManager.notify(Handlebars.compile(current.$messages['plugin-javadoc-downloaded'])([data]));
// Refresh after this batch update
current.clearAndReload();
}
});
}
current.table = _('table').on('click', '.update', function () {
// Update the plug-in
current.installNext(_('table').dataTable().fnGetData($(this).closest('tr')[0]).plugin.artifact, 0);
current.installNext(_('table').dataTable().fnGetData($(this).closest('tr')[0]).plugin.artifact, 0, true);
}).on('click', '.cancel-local', function () {
// Update the plug-in
var plugin = _('table').dataTable().fnGetData($(this).closest('tr')[0]);
current.delete(plugin.plugin.artifact, plugin.latestLocalVersion);
}).on('click', '.delete', function () {
current.delete(_('table').dataTable().fnGetData($(this).closest('tr')[0]).plugin.artifact);
}).dataTable({
ajax: function () {
return REST_PATH + 'system/plugin?repository=' + current.repository;
},
ajax: () => `${REST_PATH}system/plugin?repository=${current.repository}`,
dataSrc: '',
sAjaxDataProp: '',
dom: '<"row"<"col-sm-11"B><"col-sm-1"f>r>t',
Expand Down Expand Up @@ -119,12 +130,33 @@ define(function () {
}
}],
buttons: [{
extend: 'create',
text: 'install',
action: function () {
_('popup').modal('show');
}
}, {
extend: 'collection',
className: 'btn-success btn-raised plugin-install',
text: current.$messages['plugin-install'],
autoClose: true,
buttons: [{
text: current.$messages['plugin-install-from-repository'],
attr: {
'title': current.$messages['plugin-install-from-repository-help'],
'data-toggle': 'tooltip'
},
action: () => _('popup').modal('show')
}, {
text: current.$messages['upload-plugin'],
attr: {
'title': current.$messages['upload-plugin-help'],
'data-toggle': 'tooltip'
},
action: () => _('popup-plugin-upload').modal('show')
}, {
text: current.$messages['plugin-install-javadoc-all'],
attr: {
'title': current.$messages['plugin-install-javadoc-all-help'],
'data-toggle': 'tooltip'
},
action: () => installJavadoc()
}]
}, {
text: current.$messages.restart,
className: 'btn-danger',
action: current.restart
Expand All @@ -135,15 +167,6 @@ define(function () {
'title': current.$messages['check-new-version-help'],
'data-toggle': 'tooltip'
}
}, {
text: current.$messages['upload-plugin'],
attr: {
'title': current.$messages['upload-plugin-help'],
'data-toggle': 'tooltip'
},
action: function() {
_('popup-plugin-upload').modal('show');
}
}, {
extend: 'collection',
className: 'btn-default plugin-repository-selected',
Expand Down Expand Up @@ -203,7 +226,7 @@ define(function () {
});

_('save').click(function () {
current.install(_('search').select2('val'));
current.install(_('search').select2('val'), _('plugin-install-javadoc').is(':checked'));
_('popup').modal('hide');
});
_('popup').on('show.bs.modal', function () {
Expand Down Expand Up @@ -282,9 +305,9 @@ define(function () {
* Install the requested plug-ins.
* @param pluginsAsString The plug-in identifiers (comma separated) or null. When null, a prompt is displayed.
*/
install: function (plugins) {
install: function (plugins, javadoc) {
if (plugins) {
current.installNext(plugins, 0);
current.installNext(plugins, 0, javadoc);
}
},

Expand All @@ -293,8 +316,9 @@ define(function () {
* There is one AJAX call by plug-in, and stops at any error.
* @param {string[]|string} plugins The plug-in identifiers array to install. Accept a sole plugin string too.
* @param {number} index The starting plug-in index within the given array. When undefined, is 0.
* @param {javadoc} Option to install javadoc along the plugin.
*/
installNext: function (plugins, index) {
installNext: function (plugins, index, javadoc) {
plugins = Array.isArray(plugins) ? plugins : [plugins];
index = index || 0;
if (index >= plugins.length) {
Expand All @@ -308,7 +332,7 @@ define(function () {
if (plugin) {
$.ajax({
type: 'POST',
url: REST_PATH + 'system/plugin/' + encodeURIComponent(plugin) + '?repository=' + current.repository,
url: `${REST_PATH}system/plugin/${encodeURIComponent(plugin)}?repository=${current.repository}&javadoc=${javadoc}`,
dataType: 'text',
contentType: 'application/json',
success: function () {
Expand All @@ -317,7 +341,7 @@ define(function () {

// Install the next plug-in
if (next) {
current.installNext(plugins, index + 1);
current.installNext(plugins, index + 1, javadoc);
} else {
// Refresh after this batch update
current.clearAndReload();
Expand All @@ -326,7 +350,7 @@ define(function () {
});
} else {
// The token was empty, install the next real plug-in
current.installNext(plugins, index + 1);
current.installNext(plugins, index + 1, javadoc);
}
},

Expand Down

0 comments on commit ee43a30

Please sign in to comment.