Commit 380cfb92 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Small improvements

parent a7f9e1f3
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -11,7 +11,10 @@ import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
import javax.inject.Inject;
import javax.inject.Named;

@@ -192,4 +195,21 @@ public class SchemaSelectionBean implements Serializable {
        conversation.end();
        return "index.xhtml?faces-redirect=true";
    }

    public void validateTapSchemaName(FacesContext context, UIComponent inputComponent, Object value) {
        String textValue = (String) value;

        String validatorMessage = null;
        if (textValue == null || textValue.isEmpty()) {
            validatorMessage = "TAP_SCHEMA name is required";
        } else if (!textValue.matches("^[a-zA-Z0-9_[-]]*$")) {
            validatorMessage = "TAP_SCHEMA name has to be a valid table name";
        } else if (allSchemas.contains(textValue)) {
            validatorMessage = "Database already contains a schema with this name. Please choose another name";
        }

        if (validatorMessage != null) {
            throw new ValidatorException(new FacesMessage(validatorMessage));
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -210,6 +210,6 @@ public class TapSchemaEditingBean implements Serializable {

    @PreDestroy
    public void onDestroy() {
        tapSchema.getTapSchemaHandler().onDestroy();
        tapSchema.getTapSchemaHandler().close();
    }
}
+24 −1
Original line number Diff line number Diff line
@@ -162,3 +162,26 @@ input[type="checkbox"].changed {
#columnUcd {
    cursor:pointer;
}

.loading {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.33);
    z-index: 10000;
    text-align: center;
}

.loading .icon-wrapper {
    display: table;
    width: 100%;
    height: 100%;
}

.loading .glyphicon {
    display: table-cell;
    vertical-align: middle;
    font-size: 45px;
}
+11 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@
        },
        openSearchUCDModal: function (event) {
            if (event.status === 'success') {
                $('.loading').addClass('hide');
                $('#searchUCDModal').modal('show');
            }
        },
@@ -118,6 +119,16 @@
            if (event.status === 'success' && $(event.responseXML).find('error').length === 0) {
                $('#updateSuccessModal').modal('show');
            }
        },
        // Show loading div
        showLoading: function () {
            $('.loading').removeClass('hide');
        },
        // Hide loading div
        hideLoading: function (event) {
            if (event.status === 'success') {
                $('.loading').addClass('hide');
            }
        }
    };

+2 −4
Original line number Diff line number Diff line
@@ -60,9 +60,7 @@
                                <div id="createContainer">
                                    <div class="form-group">
                                        <h:outputLabel for="tapschemaName">Name:</h:outputLabel>
                                        <h:inputText id="tapschemaName" value="#{schemaSelection.tapSchemaName}" class="form-control" validatorMessage="TAP_SCHEMA name is required">
                                            <f:validateRequired></f:validateRequired>
                                        </h:inputText>
                                        <h:inputText id="tapschemaName" value="#{schemaSelection.tapSchemaName}" class="form-control" validator="#{schemaSelection.validateTapSchemaName}" />
                                        <h:message for="tapschemaName" class="text-danger"></h:message>
                                    </div>

@@ -86,7 +84,7 @@

                <div class="row">
                    <div class="col-sm-10 col-sm-offset-1">
                        <h:commandLink action="#{schemaSelection.logout()}" class="btn btn-danger pull-right">
                        <h:commandLink action="#{schemaSelection.logout()}" class="btn btn-danger pull-right" immediate="true">
                            <span class="glyphicon glyphicon-log-out"></span>
                            Close session
                        </h:commandLink>
Loading