Skip to content

Commit

Permalink
Show the loading UX immediately when the graph is being imported arch…
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGriniezakis committed Dec 6, 2024
1 parent 02f2d8c commit dded6f3
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions arches/app/media/js/views/graph.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require([
define([
'jquery',
'underscore',
'knockout',
Expand All @@ -11,7 +11,7 @@ require([
'bindings/hover',
'bindings/chosen',
'utils/set-csrf-token',
], function($, _, ko, arches, graphManagerData, BaseManager, AlertViewModel, JsonErrorAlertViewModel) {
], function($, _, ko, arches, graphManagerData, BaseManager, AlertViewModel, JsonErrorAlertViewModel) {
var GraphView = BaseManager.extend({
/**
* Initializes an instance of BaseManager, optionally using a passed in view
Expand Down Expand Up @@ -74,9 +74,9 @@ require([
};
graph.deleteGraph = function() {
self.viewModel.alert(new AlertViewModel(
'ep-alert-red',
arches.translations.confirmGraphDelete.title,
arches.translations.confirmGraphDelete.text,
'ep-alert-red',
arches.translations.confirmGraphDelete.title,
arches.translations.confirmGraphDelete.text,
function() {
return;
}, function(){
Expand All @@ -98,9 +98,9 @@ require([
};
graph.deleteInstances = function() {
self.viewModel.alert(new AlertViewModel(
'ep-alert-red',
arches.translations.confirmAllResourceDelete.title,
arches.translations.confirmAllResourceDelete.text,
'ep-alert-red',
arches.translations.confirmAllResourceDelete.title,
arches.translations.confirmAllResourceDelete.text,
function() {
return;
}, function(){
Expand Down Expand Up @@ -143,14 +143,14 @@ require([
resources = self.viewModel.graphs();
}

return resources.reduce((acc, resource) => {
return resources.reduce((acc, resource) => {
if (!resource.source_identifier_id) {
const editableFutureGraph = resources.find(graph => graph.source_identifier_id === resource.graphid);

if (editableFutureGraph) {
resource['has_unpublished_changes'] = editableFutureGraph['has_unpublished_changes'];
}

acc.push(resource);
}
return acc;
Expand All @@ -166,6 +166,7 @@ require([
var formData = new FormData();
formData.append("importedGraph", e.target.files[0]);

self.viewModel.loading(true);
$.ajax({
type: "POST",
url: 'import/',
Expand Down

0 comments on commit dded6f3

Please sign in to comment.