Add repository snapshot error modal [SCI-6613] (#3993)

This commit is contained in:
artoscinote 2022-04-12 13:29:11 +02:00 committed by GitHub
parent 2d811cdc4c
commit 83ac50c57d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 5 deletions

View file

@ -399,9 +399,10 @@ var MyModuleRepositories = (function() {
function checkSnapshotStatus(snapshotItem) {
$.getJSON(snapshotItem.data('status-url'), (statusData) => {
if (statusData.status === 'ready') {
if (statusData.status !== 'provisioning') {
$.getJSON(snapshotItem.data('version-item-url'), (itemData) => {
snapshotItem.replaceWith(itemData.html);
$('#snapshot-error-' + itemData.repository_id).modal('show');
});
} else {
setTimeout(function() {

View file

@ -52,6 +52,7 @@ class MyModuleRepositorySnapshotsController < ApplicationController
def show
render json: {
repository_id: @repository_snapshot.parent_id,
html: render_to_string(partial: 'my_modules/repositories/full_view_version',
locals: { repository_snapshot: @repository_snapshot,
can_delete_snapshot: can_manage_my_module_repository_snapshots?(@my_module) })

View file

@ -3,10 +3,10 @@
id: "snapshot-error",
type: "error",
shown: true,
title: t("my_modules.modals.snapshot_error.title"),
body:
title: t("my_modules.modals.transition_snapshot_error.title"),
body:
t(
"my_modules.modals.snapshot_error.body_html",
"my_modules.modals.transition_snapshot_error.body_html",
repository: Repository.find(flash["repository_snapshot_error"]["repository_id"]).name
)
%>

View file

@ -42,5 +42,16 @@
<tbody></tbody>
</table>
</div>
<%= render 'shared/dialog',
id: "snapshot-error-#{repository.id}",
type: "error",
shown: false,
title: t("my_modules.modals.snapshot_error.title"),
body:
t(
"my_modules.modals.snapshot_error.body_html",
repository: repository.name
)
%>
</div>
<% end %>

View file

@ -1046,9 +1046,12 @@ en:
hidden_tasks: "No permission: There are %{size} tasks you cant assign to."
task: 'Assign to task'
task_and_downstream: 'Assign to task & downstream'
snapshot_error:
transition_snapshot_error:
title: "Cannot change status"
body_html: "The task cannot be moved to the next status because the <strong>%{repository}</strong> inventory snapshot failed to generate. Please contact support if this problem persists."
snapshot_error:
title: "Snapshot error"
body_html: "<strong>%{repository}</strong> inventory snapshot failed to generate. Please contact support if this problem persists."
modules_list_partial:
private_tasks_html: 'Assigned to <strong>%{nr}</strong> private task(s)'
no_results: