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">TAP_SCHEMA Manager - Credentials insertion page</ui:define>
<ui:define name="scripts">
<h:outputScript library="js" name="credentials.js"></h:outputScript>
</ui:define>
<ui:define name="content">
<div class="container">
<div class="col-sm-10 col-sm-offset-1">
<h1 class="text-center">TAP_SCHEMA Manager - Credentials insertion page</h1>
<h:form id="main">
<h:panelGroup rendered="#{!credentialsInsertion.loggedIn}">
<div class="row">
<div class="col-xs-8 col-xs-offset-2">
<div class="panel panel-primary">
<div class="panel-heading">Login</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group">
<h:outputLabel for="password" class="col-sm-3 control-label">Password</h:outputLabel>
<div class="col-sm-9">
<h:inputSecret class="form-control" id="password" value="#{credentialsInsertion.adminPassword}" onkeypress="credentials.adminLoginClicked(event)" />
<p class="text-danger"><h:message for="password"/></p>
</div>
</div>
<div class="text-center">
<h:commandLink id="admin-login-btn" action="#{credentialsInsertion.login()}" class="btn btn-primary">
Login
<f:ajax execute="@form" render="@form" />
</h:commandLink>
</div>
</div>
</div>
</div>
</h:panelGroup>
<h:panelGroup rendered="#{credentialsInsertion.loggedIn}">
<h:panelGroup id="saved-credentials">
<ui:repeat value="#{credentialsInsertion.savedCredentials}" var="c" varStatus="loop">
<div class="panel panel-default">
<div class="panel-body">
<h:panelGroup rendered="#{c.class.simpleName eq 'Credentials'}">
<div class="col-xs-10">
<h:commandLink action="#{credentialsInsertion.removeCredentials(loop.index)}" title="Delete">
<span class="glyphicon glyphicon-trash"></span>
<f:ajax execute="@this" render="@form" />
</h:commandLink>
<h:commandLink action="#{credentialsInsertion.editCredentials(c, loop.index)}" title="Edit">
<span class="glyphicon glyphicon-pencil"></span>
<f:ajax execute="@this" render=":main:credentials-modal-body" onevent="credentials.editClicked" />
</h:commandLink>
(${c.databaseType eq 'MYSQL' ? 'MySQL' : 'Postgres'}) ${c.hostname}:${c.port} ${c.username}
</div>
<div class="col-xs-2 text-right">
<h:commandLink action="#{credentialsInsertion.loginWithSingleCredentials(c)}" title="Login" immediate="true">
<span class="glyphicon glyphicon-log-in"></span>
</h:commandLink>
</div>
</h:panelGroup>
<h:panelGroup rendered="#{c.class.simpleName eq 'SeparateCredentials'}">
<div class="col-xs-10">
<h:commandLink action="#{credentialsInsertion.removeCredentials(loop.index)}" title="Delete">
<span class="glyphicon glyphicon-trash"></span>
<f:ajax execute="@this" render="@form" />
</h:commandLink>
<h:commandLink action="#{credentialsInsertion.editSeparateCredentials(c, loop.index)}" title="Edit">
<span class="glyphicon glyphicon-pencil"></span>
<f:ajax execute="@this" render=":main:credentials-modal-body" onevent="credentials.editClicked" />
</h:commandLink>
<strong>Source</strong>
(${c.sourceCredentials.databaseType eq 'MYSQL' ? 'MySQL' : 'Postgres'}) ${c.sourceCredentials.hostname}:${c.sourceCredentials.port} ${c.sourceCredentials.username}
<strong>TAP_SCHEMA</strong>
(${c.tapSchemaCredentials.databaseType eq 'MYSQL' ? 'MySQL' : 'Postgres'}) ${c.tapSchemaCredentials.hostname}:${c.tapSchemaCredentials.port} ${c.tapSchemaCredentials.username}
</div>
<div class="col-xs-2 text-right">
<h:commandLink action="#{credentialsInsertion.loginWithSeparatedCredentials(c.sourceCredentials, c.tapSchemaCredentials)}" title="Login" immediate="true">
<span class="glyphicon glyphicon-log-in"></span>
</h:commandLink>
</div>
</h:panelGroup>
</ui:repeat>
<div class="text-center">
<h:commandLink class="btn btn-success" action="#{credentialsInsertion.addNewCredentials()}">
<span class="glyphicon glyphicon-plus"></span>
Add new
<f:ajax execute="@this" render=":main:credentials-modal-body" onevent="credentials.editClicked" />
</h:commandLink>
<h:panelGroup rendered="#{credentialsInsertion.loginError != null}">
<div class="alert alert-danger">
#{credentialsInsertion.loginError}
</div>
</h:panelGroup>
<div class="modal fade" tabindex="-1" role="dialog" id="credentials-modal">
<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>
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<h:panelGroup id="credentials-modal-body" layout="block" class="modal-body">
<div class="panel panel-primary">
<h:panelGroup id="source_credentials_title" layout="block" class="panel-heading#{credentialsInsertion.separateCredentials ? '' : ' hide'}">
<h3 class="panel-title">Source credentials</h3>
</h:panelGroup>
<div class="panel-body">
<h:panelGroup layout="block" class="form-horizontal" id="source_credentials">
<div class="form-group">
<h:outputLabel for="source_dbtype" class="col-sm-2 control-label">Database type</h:outputLabel>
<div class="col-sm-10">
<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="col-sm-2 control-label">Hostname</h:outputLabel>
<div class="col-sm-10">
<h:inputText id="source_hostname" value="#{credentialsInsertion.sourceCredentials.hostname}" class="form-control" validatorMessage="Hostname is required">
<f:validateRequired />
</h:inputText>
<h:message for="source_hostname" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_port" class="col-sm-2 control-label">Port</h:outputLabel>
<div class="col-sm-10">
<h:inputText id="source_port" value="#{credentialsInsertion.sourceCredentials.port}" class="form-control" validatorMessage="Port is required">
<f:validateRequired />
</h:inputText>
<h:message for="source_port" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_username" class="col-sm-2 control-label">Username</h:outputLabel>
<div class="col-sm-10">
<h:inputText id="source_username" value="#{credentialsInsertion.sourceCredentials.username}" class="form-control" validatorMessage="Username is required">
<f:validateRequired />
</h:inputText>
<h:message for="source_username" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="source_password" class="col-sm-2 control-label">Password</h:outputLabel>
<div class="col-sm-10">
<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="col-sm-2 control-label">Database</h:outputLabel>
<div class="col-sm-10">
<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>
</div>
<div>
<label>
<h:selectBooleanCheckbox value="#{credentialsInsertion.separateCredentials}">
<f:ajax render="tap_schema_credentials source_credentials_title" execute="@this" />
</h:selectBooleanCheckbox>
Separate credentials
</label>
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<h:panelGroup id="tap_schema_credentials">
<h:panelGroup layout="block" class="panel panel-primary" rendered="#{credentialsInsertion.separateCredentials}">
<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="col-sm-2 control-label">Database type</h:outputLabel>
<div class="col-sm-10">
<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:tap_schema_credentials" listener="#{credentialsInsertion.tapSchemaCredentials.setDefaults()}" />
</h:selectOneMenu>
</div>
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_hostname" class="col-sm-2 control-label">Hostname</h:outputLabel>
<div class="col-sm-10">
<h:inputText id="tap_schema_hostname" value="#{credentialsInsertion.tapSchemaCredentials.hostname}" class="form-control" validatorMessage="Hostname is required">
<f:validateRequired />
</h:inputText>
<h:message for="tap_schema_hostname" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_port" class="col-sm-2 control-label">Port</h:outputLabel>
<div class="col-sm-10">
<h:inputText id="tap_schema_port" value="#{credentialsInsertion.tapSchemaCredentials.port}" class="form-control" validatorMessage="Port is required">
<f:validateRequired />
</h:inputText>
<h:message for="tap_schema_port" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_username" class="col-sm-2 control-label">Username</h:outputLabel>
<div class="col-sm-10">
<h:inputText id="tap_schema_username" value="#{credentialsInsertion.tapSchemaCredentials.username}" class="form-control" validatorMessage="Username is required">
<f:validateRequired />
</h:inputText>
<h:message for="tap_schema_username" class="text-danger" />
</div>
</div>
<div class="form-group">
<h:outputLabel for="tap_schema_password" class="col-sm-2 control-label">Password</h:outputLabel>
<div class="col-sm-10">
<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>
</div>
<h:panelGroup class="form-group" layout="block" rendered="#{credentialsInsertion.tapSchemaCredentials.databaseType eq 'POSTGRES'}">
<h:outputLabel for="tap_schema_database" class="col-sm-2 control-label">Database</h:outputLabel>
<div class="col-sm-10">
<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>
</div>
</div>
</h:panelGroup>
</h:panelGroup>
</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">
Save changes
<f:ajax execute="@form" render=":main:credentials-modal-body :main:saved-credentials" onevent="credentials.credentialsSaved" />
</h:commandLink>
</div>
</div>
</div>
<h:commandButton value="Logout" action="#{credentialsInsertion.logout()}" class="btn btn-primary pull-right" immediate="true"></h:commandButton>
</h:form>
</div>
</div>
</ui:define>
</ui:composition>