Skip to content
schemaSelection.xhtml 6.39 KiB
Newer Older
<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition template="/WEB-INF/templates/master.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets" 
                xmlns:tsm_components="http://xmlns.jcp.org/jsf/composite/tsm_components">
    <ui:define name="title">TASMAN - Schemata selection page</ui:define>
    <ui:define name="scripts">
        <h:outputScript library="js" name="keepalive.js"></h:outputScript>
        <h:outputScript library="js" name="ucd-editor.js"></h:outputScript>
        <script>startKeepAlive('${config.restPath}', '${keepalive.windowId}');</script>
    </ui:define>
    <ui:define name="content">

        <f:event listener="#{loggedInChecker.checkFromNonIndex()}" type="preRenderView" />
        <f:event listener="#{schemaSelection.onPageLoad()}" type="preRenderView" />

        <h:form id="main">

            <tsm_components:user_navbar />

            <div class="container">
                <h1 class="text-center">Schemata selection page</h1>
                <br/>

                <f:passThroughAttribute name="autocomplete" value="off" />
                <div class="panel panel-default col-sm-10 col-sm-offset-1">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-2 text-right">
                                <strong>Action:</strong>
                            </div>
                            <div class="form-inline col-sm-10">
                                <h:selectOneRadio value="#{schemaSelection.selectedRadioOption}">
                                    <f:selectItem itemValue="edit" itemLabel="Edit existing" />
                                    <f:selectItem itemValue="create" itemLabel="Create new" />
                                    <f:ajax event="click" render="main:radioPanels"></f:ajax>
                                </h:selectOneRadio>
                            </div>
                        </div>
                        <br/>

                        <h:panelGroup id="radioPanels">
                            <!-- Edit -->
                            <h:panelGroup rendered="#{schemaSelection.selectedRadioOption eq 'edit'}">
                                <div id="editContainer">
                                    <div class="form-group">
                                        <h:outputLabel for="selectedTAPSchema">Tap Schema:</h:outputLabel>
                                        <h:selectOneMenu value="#{schemaSelection.selectedTAPSchema}" id="selectedTAPSchema" class="form-control">
                                            <f:selectItems value="#{schemaSelection.allTAPSchemas}"></f:selectItems>
                                            <f:ajax event="change" render="main:exposedSchemas"></f:ajax>
                                        </h:selectOneMenu>
                                    </div>
                                    <div class="form-group" id="exposedDatabasesWrapper">
                                        <label class="control-label">Exposed databases:</label>

                                        <p class="form-control-static" id="exposed-schemas">
                                            <h:panelGroup id="exposedSchemas">#{schemaSelection.exposedSchemas}</h:panelGroup>
                                        </p>
                                    </div>
                                    <div class="form-group">
Sonia Zorba's avatar
Sonia Zorba committed
                                        <h:commandButton value="Edit Tapschema" class="btn btn-primary" action="#{schemaSelection.edit()}" onclick="showWaiting()"></h:commandButton>
                                    </div>
                                </div>
                            </h:panelGroup>

                            <!-- Create -->
                            <h:panelGroup rendered="#{schemaSelection.selectedRadioOption eq 'create'}">
                                <div id="createContainer">
                                    <div class="form-group">
                                        <h:outputLabel for="tapschemaName">Name:</h:outputLabel>
Sonia Zorba's avatar
Sonia Zorba committed
                                        <h:inputText id="tapschemaName" value="#{schemaSelection.tapSchemaName}" class="form-control" validator="#{schemaSelection.validateTapSchemaName}" />
                                        <h:message for="tapschemaName" class="text-danger"></h:message>
                                    </div>

                                    <div class="form-group">
                                        <h:outputLabel for="selectedSchemas">Databases to expose:</h:outputLabel>
                                        <h:selectManyListbox value="#{schemaSelection.selectedSchemas}" id="selectedSchemas" class="form-control" size="7" validatorMessage="Select at least one schema">
                                            <f:selectItems value="#{schemaSelection.allSchemas}"></f:selectItems>
                                            <f:validateRequired></f:validateRequired>
                                        </h:selectManyListbox>
                                        <h:message for="selectedSchemas" class="text-danger"></h:message>
                                    </div>

                                    <div class="form-group">
Sonia Zorba's avatar
Sonia Zorba committed
                                        <h:commandButton value="Create TAP_SCHEMA" class="btn btn-primary" action="#{schemaSelection.create()}" onclick="showWaiting()"></h:commandButton>
                                    </div>
                                </div>
                            </h:panelGroup>
                        </h:panelGroup>
                    </div>
                </div>

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

            <tsm_components:ucd_editor id="ucd-editor" />
        </h:form>
    </ui:define>
</ui:composition>