Skip to content
schemaSelection.xhtml 5.96 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" >
    <ui:define name="title">TapSchema Manager - Schemata selection page</ui:define>
    <ui:define name="scripts">
        <h:outputScript library="js" name="keepalive.js"></h:outputScript>
        <script>startKeepAlive('${keepalive.restPath}', '${keepalive.conversationId}');</script>
    </ui:define>
    <ui:define name="content">

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

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

            <h:form id="selectionForm">
                <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="selectionForm: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="selectionForm: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">
                                        <h:commandButton value="Edit Tapschema" class="btn btn-primary" action="#{schemaSelection.edit()}"></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">
                                        <h:commandButton value="Create TAP_SCHEMA" class="btn btn-primary" action="#{schemaSelection.create()}"></h:commandButton>
                                    </div>
                                </div>
                            </h:panelGroup>
                        </h:panelGroup>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-10 col-sm-offset-1">
Sonia Zorba's avatar
Sonia Zorba committed
                        <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>
                </div>
            </h:form>
        </div>
    </ui:define>
</ui:composition>