ssh-keys.xhtml 5.22 KB
Newer Older
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
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 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:bw="http://www.scc.kit.edu/bwfacelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:of="http://omnifaces.org/functions">
<head>
<title></title>
</head>
<body>

<f:view>
<f:metadata>
	<f:event type="javax.faces.event.PreRenderViewEvent"
           listener="#{userSshKeyManagementBean.preRenderView}" />
</f:metadata>

<ui:composition template="/template/default.xhtml">
	<ui:param name="title" value="#{messages.title}"/>

	<ui:define name="content">
michael.simon's avatar
michael.simon committed
26
	<h:form id="form">
ls1947's avatar
ls1947 committed
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
		<div><p:messages showDetail="true" /></div>

		<p:dataGrid var="key" value="#{userSshKeyManagementBean.keyList.toArray()}" styleClass="whitefoot"
				columns="2" layout="grid" style="margin-bottom: 16px;">
	        <f:facet name="header">#{messages.ssh_pub_key_list}</f:facet>
	        <p:panel styleClass="grayback" style="margin-bottom: 0px;">
	        	<f:facet name="header">
	        		<i class="fa fa-fw fa-key"></i>
	        		<b><h:outputText value="#{key.pubKeyEntity.name}"/></b>
				</f:facet>
				
	        	<h:panelGrid columns="2">

	        		<h:outputText for="@next" value="#{messages.expires}:" style="font-weight: bold;"/>
	        		<p:outputPanel>
		        		<h:outputText value="#{of:formatDate(key.pubKeyEntity.expiresAt, 'dd.MM.yyyy HH:mm')}"
		        			rendered="#{not empty key.pubKeyEntity.expiresAt}" style="font-weight: bold;"/>
		        		<h:outputText value="#{messages.never}"
		        			rendered="#{empty key.pubKeyEntity.expiresAt}" style="font-weight: bold;"/>
	        		</p:outputPanel>

	        		<p:outputLabel for="@next" value="#{messages.ssh_key_type}:"/>
	        		<h:outputText value="#{key.pubKeyEntity.keyType}"/>
	        		
	        		<p:outputLabel for="@next" value="#{messages.fingerprint} (SHA256):"/>
	        		<h:panelGroup>
		        		<h:outputText value="#{key.fingerprint}" rendered="#{not empty key.fingerprint}"/>
		        		<h:outputText value="#{messages.unknown}" rendered="#{empty key.fingerprint}"/>
	        		</h:panelGroup>
	        		
	        		<h:outputText for="@next" value="#{messages.services}:"/>
					<p:repeat var="reg" value="#{key.pubKeyEntity.sshPubKeyRegistries}">
	        			<div>
		        			<h:outputText value="#{reg.registry.service.name}"/> 
		        			<h:panelGroup id="interactiveId" rendered="#{reg.usageType == 'INTERACTIVE'}"><i class="fa fa-fw fa-user"></i></h:panelGroup>
		        			<p:tooltip for="interactiveId" value="#{messages.ssh_pub_key_interactiv}" position="top"/>
		        			<h:panelGroup id="commandId" rendered="#{reg.usageType == 'COMMAND'}"><i class="fa fa-fw fa-database"></i></h:panelGroup>
		        			<p:tooltip for="commandId" value="#{messages.ssh_pub_key_command}" position="top"/>
	        			</div>
					</p:repeat>
	        		
	        	</h:panelGrid>

				<p:commandButton action="#{userSshKeyManagementBean.deleteKey(key.pubKeyEntity.name)}" value="#{messages.delete}" 
71
					update="@form" immediate="true">
ls1947's avatar
ls1947 committed
72
					<p:confirm header="#{messages.confirm_header}" message="#{messages.ssh_key_confirm}" />
ls1947's avatar
ls1947 committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
				</p:commandButton>

			</p:panel>		
		</p:dataGrid>

		<p:panel>
			<p:commandButton id="openAddSshKeyDlg" oncomplete="PF('addSshKeyDlg').show();" value="#{messages.add_ssh_pub_key}"></p:commandButton>
		</p:panel>

		<p:dialog header="#{messages.add_ssh_pub_key}" 
					widgetVar="addSshKeyDlg" id="addSshKeyDlgId" modal="true" closable="true" closeOnEscape="true"
					showEffect="fade" hideEffect="fade">
			<p:ajax event="close" update="@form" />

			<div class="panel" style="width:360px;">
			    <h:outputText value="#{messages.add_ssh_pub_key_desc}" escape="false" />
		    </div>

michael.simon's avatar
michael.simon committed
91
			<p:panelGrid id="baseData" columns="2">
michael.simon's avatar
michael.simon committed
92
		        <bw:inputText id="sshKeyName" label="#{messages.ssh_key_name}:" 
93
94
			        	value="#{userSshKeyManagementBean.newName}" required="true"/>			

ls1947's avatar
ls1947 committed
95
96
97
		        <h:outputText for="@next" value="#{messages.ssh_key}:"/>
		        <p:outputPanel>
			        <p:inputTextarea id="keyInputArea" value="#{userSshKeyManagementBean.newKey}" 
ls1947's avatar
ls1947 committed
98
			        	style="width: 400px; height: 100px;" autoResize="false" maxlength="8128">
ls1947's avatar
ls1947 committed
99
100
101
102
103
			        	<f:validator validatorId="edu.kit.SshKeyValidator"/>
			        	<p:ajax update="keyInputMessage" event="keyup" />
			        </p:inputTextarea>
			        <p:message id="keyInputMessage" for="keyInputArea" />
		        </p:outputPanel>
104
			</p:panelGrid>
ls1947's avatar
ls1947 committed
105

106
			<p:commandButton id="add" action="#{userSshKeyManagementBean.deployKey()}" value="#{messages.add}" update="@form" />
ls1947's avatar
ls1947 committed
107
108

		</p:dialog>
michael.simon's avatar
michael.simon committed
109

110
	    <p:confirmDialog global="true" showEffect="fade" hideEffect="fade" closable="false" closeOnEscape="true">
michael.simon's avatar
michael.simon committed
111
112
113
	        <p:commandButton value="#{messages.yes}" type="button" styleClass="ui-confirmdialog-yes" />
	        <p:commandButton value="#{messages.no}" type="button" styleClass="ui-confirmdialog-no" />
	    </p:confirmDialog>    
114
115
116
117
118
119
	</h:form>
	</ui:define>
</ui:composition>
</f:view>
</body>
</html>