Skip to content

Commit

Permalink
UX: Show notification upon page load if currently a deployment import…
Browse files Browse the repository at this point in the history
… is active
  • Loading branch information
vigorouscoding committed Feb 28, 2024
1 parent f282c45 commit d17e66b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.structr.core.property.StringProperty;
import org.structr.core.script.polyglot.context.ContextFactory;
import org.structr.schema.action.ActionContext;
import org.structr.web.maintenance.DeployCommand;

public class StructrEnvFunction extends AdvancedScriptingFunction {

Expand Down Expand Up @@ -95,6 +96,7 @@ public static GraphObjectMap getStructrEnv() throws FrameworkException {
info.setProperty(new StringProperty("maintenanceModeActive"), Settings.MaintenanceModeEnabled.getValue());
info.setProperty(new StringProperty("validUUIDv4Regex"), Settings.getValidUUIDRegexString());
info.setProperty(new StringProperty("legacyRequestParameters"), Settings.RequestParameterLegacyMode.getValue());
info.setProperty(new StringProperty("isDeploymentActive"), DeployCommand.isDeploymentActive());

info.setProperty(new StringProperty("debuggerActive"), Settings.ScriptingDebugger.getValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void execute(final Map<String, Object> parameters) throws FrameworkExcept

final String mode = (String) parameters.get("mode");

if (Boolean.FALSE.equals(deploymentActive.get())) {
if (Boolean.FALSE.equals(isDeploymentActive())) {

try {

Expand Down
16 changes: 16 additions & 0 deletions structr-base/src/main/resources/structr/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,14 @@ let Structr = {
}
}

let deploymentActive = (envInfo.isDeploymentActive ?? false);
if (deploymentActive === true) {
Structr.handleGenericMessage({
type: 'DEPLOYMENT_IMPORT_STATUS',
subtype: 'ALREADY_RUNNING'
});
}

$('#header .structr-instance-name').text(envInfo.instanceName);
$('#header .structr-instance-stage').text(envInfo.instanceStage);

Expand Down Expand Up @@ -1401,6 +1409,14 @@ let Structr = {

new InfoMessage().title(`${type} Progress`).uniqueClass(messageCssClass).text(text).requiresConfirmation().updatesText().show();

} else if (data.subtype === 'ALREADY_RUNNING') {

let text = `${type} was already running before page was loaded<br><br>
Please wait until the import process is finished. Any changes made during a deployment might get lost or conflict with the deployment! This message will be updated during the deployment process.<br><ol class="message-steps"></ol>
`;

new InfoMessage().title(`${type} Progress`).uniqueClass(messageCssClass).text(text).requiresConfirmation().updatesText().show();

} else if (data.subtype === 'PROGRESS') {

new InfoMessage().title(`${type} Progress`).uniqueClass(messageCssClass).text(`<li>${data.message}</li>`).requiresConfirmation().appendsText('.message-steps').show();
Expand Down

0 comments on commit d17e66b

Please sign in to comment.