Newer
Older
Sonia Zorba
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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
<?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 - 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>
<script>credentials.init('#{config.restPath}');</script>
</ui:define>
<ui:define name="content">
<f:event listener="#{loggedInChecker.checkFromNonIndex()}" type="preRenderView" />
<h:form id="main">
<tsm_components:user_navbar />
<div class="container">
<div class="col-sm-10 col-sm-offset-1">
<h1 class="text-center">TASMAN - Credentials insertion page</h1>
</div>
<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>
</div>
</div>
</ui:repeat>
<div class="text-center">
<br/><br/><br/><br/>
<h:commandLink class="btn btn-success" action="#{credentialsInsertion.addNewCredentials()}">
<span class="glyphicon glyphicon-plus"></span>
Add new database credentials
<f:ajax execute="@this" render="credentials-modal-body" onevent="credentials.editClicked" />
</h:commandLink>
</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>
</div>
<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" required="#{credentialsInsertion.credentialsDialogOpened}" requiredMessage="Hostname is required"/>
<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" required="#{credentialsInsertion.credentialsDialogOpened}" requiredMessage="Port is required"/>
<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}" required="#{credentialsInsertion.credentialsDialogOpened}" class="form-control" requiredMessage="Username is required"/>
<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>
<div>
<label>
<h:selectBooleanCheckbox value="#{credentialsInsertion.separateCredentials}">
<f:ajax render="tap_schema_credentials source_credentials_title" execute="@this" />
</h:selectBooleanCheckbox>
Separate credentials
</label>
</div>
<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}" required="#{credentialsInsertion.credentialsDialogOpened}" class="form-control" requiredMessage="Hostname is required"/>
<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}" required="#{credentialsInsertion.credentialsDialogOpened}" class="form-control" requiredMessage="Port is required"/>
<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}" required="#{credentialsInsertion.credentialsDialogOpened}" class="form-control" requiredMessage="Username is required"/>
<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" 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>
<tsm_components:ucd_editor id="ucd-editor" />
</div>
</h:form>
</ui:define>
</ui:composition>