Newer
Older
Sonia Zorba
committed
<?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"
xmlns:ia2="http://ia2.inaf.it/component">
Sonia Zorba
committed
<ui:define name="title">TASMAN - Credentials insertion page</ui:define>
<ui:define name="scripts">
<h:outputScript library="js" name="credentials.js"></h:outputScript>
<h:outputScript library="js" name="ucd-editor.js"></h:outputScript>
<h:outputScript library="js" name="async-loader.js"></h:outputScript>
<script>TSM.asyncLoader.init(#{tapSchemaLoader.loading});</script>
Sonia Zorba
committed
</ui:define>
<ui:define name="content">
<f:event listener="#{loggedInChecker.checkFromNonIndex()}" type="preRenderView" />
<h:form id="main">
<tsm_components:user_navbar />
<div class="container">
Sonia Zorba
committed
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h1 class="text-center">Credentials insertion page</h1>
<br/>
</div>
Sonia Zorba
committed
</div>
<h:panelGroup id="saved-credentials">
<h:panelGroup rendered="#{credentialsInsertion.savedCredentials.size() gt 0}">
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>Credentials</th>
<th>TAP_SCHEMA name</th>
<th>Version</th>
<th>Obscore</th>
<th>IVOA schema name</th>
<th>Login</th>
</tr>
</thead>
<tbody>
<ui:repeat value="#{credentialsInsertion.savedCredentials}" var="c" varStatus="loop">
<tr>
<td>
<h:commandLink action="#{credentialsInsertion.openDeleteCredentialsConfirmation(loop.index)}" title="Delete" class="text-danger">
<span class="glyphicon glyphicon-trash"></span>
<f:ajax execute="@this" render="@form" onevent="credentials.openConfirmDeleteModal" />
</h:commandLink>
<h:commandLink action="#{credentialsInsertion.editCredentials(loop.index)}" title="Edit">
<span class="glyphicon glyphicon-pencil"></span>
<f:ajax execute="@this" render=":main:credentials-modal-body" onevent="credentials.editClicked" />
</h:commandLink>
</td>
<td>
<h:panelGroup rendered="#{c.label ne null and c.label ne ''}">
#{c.label}
<h:panelGroup rendered="#{c.label eq null or c.label eq ''}">
<h:panelGroup rendered="#{c.class.simpleName eq 'JoinedCredentials'}">
<tsm_components:print_credentials credentials="#{c.credentials}" />
</h:panelGroup>
<h:panelGroup rendered="#{c.class.simpleName eq 'SeparatedCredentials'}">
<tsm_components:print_credentials credentials="#{c.sourceCredentials}" />
<span class="glyphicon glyphicon-arrow-right"></span>
<tsm_components:print_credentials credentials="#{c.tapSchemaCredentials}" />
</h:panelGroup>
</h:panelGroup>
</td>
<td>#{c.tapSchemaName}</td>
<td>#{c.tapSchemaVersion}</td>
<td><span class="glyphicon glyphicon-#{c.hasObscore ? 'ok':'remove'}"></span></td>
<td><h:panelGroup rendered="#{c.hasObscore}">#{c.obscoreVersion}</h:panelGroup></td>
<td><h:panelGroup rendered="#{c.hasObscore}">#{c.ivoaSchemaName}</h:panelGroup></td>
<td>
<h:commandLink action="#{credentialsInsertion.loadTapSchema(c)}" title="Login" immediate="true">
<span class="glyphicon glyphicon-log-in"></span>
<f:ajax execute="@form" render="@form" onevent="TSM.asyncLoader.openTapSchemaClicked" />
</h:commandLink>
</td>
</tr>
</ui:repeat>
</tbody>
</table>
</h:panelGroup>
Sonia Zorba
committed
<p class="text-danger text-center"><strong><h:message for="main" /></strong></p>
Sonia Zorba
committed
<div class="text-center">
Sonia Zorba
committed
<br/><br/>
<h:commandLink class="btn btn-success" action="#{credentialsInsertion.addNewCredentialsInEditing()}">
Sonia Zorba
committed
<span class="glyphicon glyphicon-plus"></span>
Add new database credentials
<f:ajax execute="@this" render=":main:credentials-modal-body" onevent="credentials.editClicked" />
Sonia Zorba
committed
</h:commandLink>
</div>
</h:panelGroup>
<div class="modal fade" tabindex="-1" role="dialog" id="credentials-modal">
Sonia Zorba
committed
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Credentials editing</h4>
</div>
<h:panelGroup id="credentials-modal-body" layout="block" class="modal-body">
<h:panelGroup class="row" layout="block" id="credentials_panels_wrapper">
<div class="col-xs-12">
<div class="form-horizontal">
<div class="form-group">
<h:outputLabel for="credentials_label" class="control-label col-xs-4">Credentials label</h:outputLabel>
<div class="col-xs-7">
<h:inputText value="#{credentialsInsertion.label}" id="credentials_label" class="form-control" />
<h:message for="credentials_label" class="text-danger" />
</div>
</div>
</div>
</div>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-6':'col-xs-12'}">
<div class="panel panel-primary">
<div class="panel-heading#{credentialsInsertion.separateCredentials ? '' : ' hide'}">
<h3 class="panel-title">Source credentials</h3>
Sonia Zorba
committed
</div>
<div class="panel-body">
<h:panelGroup layout="block" class="form-horizontal" id="source_credentials" rendered="#{credentialsInsertion.sourceCredentials ne null}">
<div class="form-group">
<h:outputLabel for="source_dbtype" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Database type</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:selectOneMenu id="source_dbtype" value="#{credentialsInsertion.sourceCredentials.databaseType}" class="form-control">
<f:selectItem itemValue="MYSQL" itemLabel="MySQL" />
<f:selectItem itemValue="POSTGRES" itemLabel="Postgres" />
<f:ajax execute="@this" render=":main:source_credentials" listener="#{credentialsInsertion.sourceCredentials.setDefaults()}" />
</h:selectOneMenu>
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_hostname" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Hostname</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="source_hostname" value="#{credentialsInsertion.sourceCredentials.hostname}" class="form-control" />
<h:message for="source_hostname" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_port" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Port</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="source_port" value="#{credentialsInsertion.sourceCredentials.port}" class="form-control" />
<h:message for="source_port" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_username" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Username</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="source_username" value="#{credentialsInsertion.sourceCredentials.username}" class="form-control" />
<h:message for="source_username" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_password" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Password</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputSecret id="source_password" value="#{credentialsInsertion.sourceCredentials.password}" class="form-control" redisplay="true" />
<h:message for="source_password" class="text-danger" />
</div>
</div>
<h:panelGroup class="form-group" layout="block" rendered="#{credentialsInsertion.sourceCredentials.databaseType eq 'POSTGRES'}">
<h:outputLabel for="source_database" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Database</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="source_database" value="#{credentialsInsertion.sourceCredentials.database}" class="form-control" />
<h:message for="source_database" class="text-danger" />
</div>
</h:panelGroup>
</h:panelGroup>
Sonia Zorba
committed
</div>
Sonia Zorba
committed
</div>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-6':'col-xs-12'}">
<h:panelGroup layout="block" class="panel panel-primary" rendered="#{credentialsInsertion.separateCredentials and credentialsInsertion.tapSchemaCredentials ne null}">
<h:panelGroup layout="block" class="panel-heading" rendered="#{credentialsInsertion.separateCredentials}">
<h3 class="panel-title">TAP_SCHEMA credentials</h3>
</h:panelGroup>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<h:outputLabel for="tap_schema_dbtype" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Database type</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:selectOneMenu id="tap_schema_dbtype" value="#{credentialsInsertion.tapSchemaCredentials.databaseType}" class="form-control">
<f:selectItem itemValue="MYSQL" itemLabel="MySQL" />
<f:selectItem itemValue="POSTGRES" itemLabel="Postgres" />
<f:ajax execute="@this" render=":main:credentials_panels_wrapper" listener="#{credentialsInsertion.tapSchemaCredentials.setDefaults()}" />
</h:selectOneMenu>
</div>
Sonia Zorba
committed
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_hostname" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Hostname</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="tap_schema_hostname" value="#{credentialsInsertion.tapSchemaCredentials.hostname}" class="form-control" />
<h:message for="tap_schema_hostname" class="text-danger" />
</div>
Sonia Zorba
committed
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_port" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Port</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="tap_schema_port" value="#{credentialsInsertion.tapSchemaCredentials.port}" class="form-control" />
<h:message for="tap_schema_port" class="text-danger" />
</div>
Sonia Zorba
committed
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_username" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Username</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="tap_schema_username" value="#{credentialsInsertion.tapSchemaCredentials.username}" class="form-control" />
<h:message for="tap_schema_username" class="text-danger" />
</div>
Sonia Zorba
committed
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_password" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Password</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputSecret id="tap_schema_password" value="#{credentialsInsertion.tapSchemaCredentials.password}" class="form-control" redisplay="true" />
<h:message for="tap_schema_password" class="text-danger" />
</div>
Sonia Zorba
committed
</div>
<h:panelGroup class="form-group" layout="block" rendered="#{credentialsInsertion.tapSchemaCredentials.databaseType eq 'POSTGRES'}">
<h:outputLabel for="tap_schema_database" class="#{credentialsInsertion.separateCredentials ? 'col-xs-4': 'col-xs-3'} control-label">Database</h:outputLabel>
<div class="#{credentialsInsertion.separateCredentials ? 'col-xs-8': 'col-xs-9'}">
<h:inputText id="tap_schema_database" value="#{credentialsInsertion.tapSchemaCredentials.database}" class="form-control" />
<h:message for="tap_schema_database" class="text-danger" />
</div>
</h:panelGroup>
Sonia Zorba
committed
</div>
</div>
</h:panelGroup>
</div>
Sonia Zorba
committed
</h:panelGroup>
<div class="form-horizontal">
<div class="form-group">
<label class="col-xs-6 col-xs-offset-4">
<h:selectBooleanCheckbox value="#{credentialsInsertion.separateCredentials}" id="separate-credentials">
<f:ajax render="credentials_panels_wrapper" execute="@form" onevent="credentials.separateCredentialsChanged" />
</h:selectBooleanCheckbox>
Separate credentials
</label>
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_name" class="control-label col-xs-4">TAP_SCHEMA name</h:outputLabel>
<div class="col-xs-6">
<h:inputText value="#{credentialsInsertion.tapSchemaName}" id="tap_schema_name" class="form-control" />
<h:message for="tap_schema_name" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_version" class="control-label col-xs-4">TAP_SCHEMA version</h:outputLabel>
<div class="col-xs-6">
<h:selectOneMenu value="#{credentialsInsertion.tapSchemaVersion}" class="form-control">
<f:selectItems value="#{credentialsInsertion.tapSchemaVersions}" var="version" itemLabel="#{version}" itemDescription="#{version}" id="tap_schema_version" />
</h:selectOneMenu>
</div>
</div>
<div class="form-group">
<label class="col-xs-6 col-xs-offset-4">
<h:selectBooleanCheckbox value="#{credentialsInsertion.hasObscore}" id="has-obscore">
<f:ajax execute="@this" render="obscore_settings" />
Has obscore
</label>
</div>
<h:panelGroup id="obscore_settings">
<h:panelGroup class="form-group" rendered="#{credentialsInsertion.hasObscore}" layout="block">
<h:outputLabel for="obscore_version" class="control-label col-xs-4">ObsCore version</h:outputLabel>
<div class="col-xs-6">
<h:selectOneMenu value="#{credentialsInsertion.obscoreVersion}" class="form-control" id="obscore_version">
<f:selectItems value="#{credentialsInsertion.obscoreVersions}" var="version" itemLabel="#{version}" itemDescription="#{version}" />
</h:selectOneMenu>
</div>
</h:panelGroup>
<h:panelGroup class="form-group" rendered="#{credentialsInsertion.hasObscore}" layout="block">
<h:outputLabel for="ivoa_schema_name" class="control-label col-xs-4">IVOA schema name</h:outputLabel>
<div class="col-xs-6">
<h:inputText value="#{credentialsInsertion.ivoaSchemaName}" id="ivoa_schema_name" class="form-control" />
<h:message for="ivoa_schema_name" class="text-danger" />
</div>
</h:panelGroup>
Sonia Zorba
committed
</h:panelGroup>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<h:commandLink action="#{credentialsInsertion.saveCredentialsEdited()}" class="btn btn-primary" id="save-credentials">
Save changes
<f:ajax execute="@form" render=":main:credentials-modal-body :main:saved-credentials" onevent="credentials.credentialsSaved" />
</h:commandLink>
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="modal-confirm-credentials-deletion">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Confirm deletion</h4>
</div>
<div class="modal-body">
<p>Do you really want to delete this credentials?</p>
</div>
<div class="modal-footer">
<h:commandButton class="btn btn-danger" value="Confirm" action="#{credentialsInsertion.confirmCredentialsDeletion()}">
<f:ajax execute="@form" render=":main:saved-credentials" onevent="credentials.closeConfirmDeleteModal" />
</h:commandButton>
</div>
</div>
</div>
</div>
Sonia Zorba
committed
<tsm_components:ucd_editor id="ucd-editor" />
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="modal-confirm-ts-creation">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Create TAP_SCHEMA</h4>
</div>
<div class="modal-body">
<p>The TAP_SCHEMA <strong>#{tapSchemaLoader.tapCredentials.tapSchemaName}</strong> doesn't exists. Do you want to create it?</p>
<p class="ivoa-schema-warning text-warning hide">
<span class="glyphicon glyphicon-alert"></span>
<strong>WARNING</strong>: existing ivoa schema detected. Next changes could alter an existing ObsCore table.
</p>
</div>
<div class="modal-footer">
<h:commandButton class="btn btn-success" value="Yes" action="#{tapSchemaLoader.create()}">
<f:ajax execute="@this" render="@none" onevent="TSM.asyncLoader.tapSchemaCreationConfirmed" />
</h:commandButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</h:form>
<h:form id="async-loader" class="hide">
<h:commandButton action="#{tapSchemaLoader.openLoaded()}" id="open-loaded" />
Sonia Zorba
committed
</h:form>
</ui:define>
</ui:composition>