You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2015/06/18 18:13:09 UTC
[1/4] syncope git commit: [SYNCOPE-156] provided modal content panel
+ features to add, edit and remove resource/conectors - still missing: 1. the
possibility to edit new topology element as soon as created;
2. to show the spinner during ajax calls.
Repository: syncope
Updated Branches:
refs/heads/master b33f9ef16 -> 63b9416bc
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.html
deleted file mode 100644
index d5fe13b..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!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:wicket="http://xmlns.jcp.org/jsf/composite">
- <body>
- <wicket:panel>
-
- <div>
- <div id="users-contain" class="ui-widget" style="width:inherit">
- <span wicket:id="connectorContainer">
- <span wicket:id="connectorDatatable">[connectors]</span>
- </span>
-
- <span style="float:right">
- <form wicket:id="connectorPaginatorForm" style="display:inline">
- <label><wicket:message key="displayRows"/></label>
- <select class="text ui-widget-content ui-corner-all" wicket:id="rowsChooser"/>
- </form>
- </span>
- </div>
-
- <div wicket:id="createConnectorWin">[Show modal window for creating connector]</div>
- <div wicket:id="editConnectorWin">[Show modal window for editing connector]</div>
-
- <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" wicket:id="createConnectorLink">
- <wicket:message key="create-connector"/>
- </a>
- </div>
-
- <div>
- <a href="#" style="position: absolute; top: 4px; right:20px;" wicket:id="reloadLink">
- <img src="img/reload_30.png" width="25" height="25"
- alt="Reload connectors" title="title" wicket:message="title:reloadConnectors"/>
- </a>
- </div>
-
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.properties
deleted file mode 100644
index fb6b8a1..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tab1=Resources
-edit=Edit
-delete=Delete
-create-resource=Create
-propagationPriority=Propagation priority
-propagationPrimary=Propagation primary
-
-tab2=Connectors
-displayName=Display name
-version=Version
-bundleName=Bundle name
-edit=Edit
-delete=Delete
-create-connector=Create
-delete_error=Operation forbidden:the connector you're trying to delete is connected to a Resource
-connector=Connector
-reloadConnectors=Reload connectors
-confirmReloadConnectors=This request is potentially dangerous for running operations, continue?
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_it.properties
deleted file mode 100644
index 80a5185..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_it.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tab1=Risorse
-edit=Modifica
-delete=Rimuovi
-create-resource=Crea
-propagationPriority=Priorit\u00e0 in propagazione
-propagationPrimary=Primaria in propagazione
-
-tab2=Connettori
-create-connector=Crea
-version=Versione
-bundleName=Bundle name
-edit=Modifica
-delete=Elimina
-delete_error=Operazione vietata: il connettore che si desidera rimuovere \u00e8 correlato ad una risorsa
-displayName=Nome visualizzato
-connector=Connettore
-reloadConnectors=Ricarica connettori
-confirmReloadConnectors=Questa richiesta \u00e8 potenzialmente dannosa per le operazioni in corso, proseguire?
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_pt_BR.properties
deleted file mode 100644
index a631352..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/Connectors_pt_BR.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tab1=Recursos
-edit=Alterar
-delete=Excluir
-create-resource=Criar
-propagationPriority=Prioridade de propaga\u00e7\u00e3o
-propagationPrimary=Propaga\u00e7\u00e3o prim\u00e1ria
-
-tab2=Conectores
-displayName=Mostar
-version=Vers\u00e3o
-bundleName=Nome do Pacote
-create-connector=Criar
-delete_error=Opera\u00e7\u00e3o n\u00e3o permitida\: o conector que voc\u00ea est\u00e1 tentando excluir est\u00e1 conectado a um recurso
-connector=Conector
-reloadConnectors=Carregar Conector
-confirmReloadConnectors=Esta requis\u00e7\u00e3o \u00e9 potencialmente perigosa para opera\u00e7\u00f5es em execu\u00e7\u00e3o, prosseguir?
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.html
new file mode 100644
index 0000000..471a985
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.html
@@ -0,0 +1,45 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+
+ <wicket:head>
+ <script type="text/javascript">
+ var notificationShownTimes = 0;
+
+ function showNotification(componentId, messagecount) {
+ notificationShownTimes++;
+ timeout = 1700 + (messagecount * 500) + notificationShownTimes * 200;
+ $('div#' + componentId).fadeTo('normal', 1.0);
+ setTimeout("$('div#" + componentId + "').fadeOut('normal')", timeout);
+ }
+ </script>
+
+ <style type="text/css">
+ table.palette td.header {
+ background:url("images/ui-bg_glass_75_e6e6e6_1x400.png")
+ repeat-x scroll 50% 50% #E6E6E6 !important;
+ }
+ </style>
+ </wicket:head>
+
+ <wicket:panel>
+ <div wicket:id="feedback"/>
+ <wicket:child />
+ </wicket:panel>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.properties
new file mode 100644
index 0000000..e696256
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+submit=Save
+add=Add
+remove=Delete
+cancel=Cancel
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_it.properties
new file mode 100644
index 0000000..58e0aa0
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_it.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+submit=Salva
+add=Aggiungi
+remove=Elimina
+cancel=Annulla
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_pt_BR.properties
new file mode 100644
index 0000000..490fe30
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ModalContent_pt_BR.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+submit=Salvar
+add=Adicionar
+remove=Remover
+cancel=Cancelar
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.html
new file mode 100644
index 0000000..8cb22f0
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.html
@@ -0,0 +1,56 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <wicket:extend>
+ <form wicket:id="form">
+ <div class="tabbable tabs-left">
+ <ul class="nav nav-tabs">
+ <li class="active"><a data-toggle="tab" href="#resource"><span><wicket:message key="resource"/></span></a></li>
+ <li><a data-toggle="tab" href="#umapping"><span><wicket:message key="umapping"/></span></a></li>
+ <li><a data-toggle="tab" href="#gmapping"><span><wicket:message key="gmapping"/></span></a></li>
+ <li><a data-toggle="tab" href="#connectorProperties"><span><wicket:message key="connectorProperties"/></span></a></li>
+ <li><a data-toggle="tab" href="#security"><span><wicket:message key="security"/></span></a></li>
+ </ul>
+ <div class="tab-content">
+ <div id="resource" class="tab-pane active">
+ <span wicket:id="details">[details]</span>
+ <span wicket:id="systeminformation">[System Information]</span>
+ </div>
+ <div id="umapping" class="tab-pane">
+ <span wicket:id="umapping">[umapping]</span>
+ </div>
+ <div id="gmapping" class="tab-pane">
+ <span wicket:id="gmapping">[gmapping]</span>
+ </div>
+ <div id="connectorProperties" class="tab-pane">
+ <span wicket:id="connconf">[connconf]</span>
+ </div>
+ <div id="security" class="tab-pane">
+ <span wicket:id="security">[security]</span>
+ </div>
+ </div>
+ </div>
+
+ <div class="modal-footer">
+ <input type="submit" class="btn btn-primary" wicket:id="apply"/>
+ <input type="button" class="btn btn-default" wicket:id="cancel"/>
+ </div>
+ </form>
+ </wicket:extend>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
new file mode 100644
index 0000000..789919b
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+resource=Resource details
+umapping=User mapping
+connectorProperties=Connector properties
+security=Security
+required_alert=All form fields are required
+connector=Connector
+existing_resources=Existing resources
+action=Action
+edit_attribute=Edit resource
+title=Resource
+extAttrNames=External attributes
+intMappingTypes=Internal mapping types
+entity=Entity
+groupSchema=Group Schema
+connObjectKey=ConnObjectKey
+mandatoryCondition=Mandatory
+password=Password
+purpose=Purpose
+mappingUserSchema=Mapping User Schema
+mappingGroupSchema=Mapping Group Schema
+delete=Delete
+intAttrNames=Internal attributes
+enforceMandatoryCondition=Enforce mandatory condition
+fieldName=Field name
+
+connObjectKeyValidation=There must be exactly one ConnObjectKey
+propagationMode=Propagation mode
+connObjectLink=ConnObjectLink
+enable=Enable
+
+createTraceLevel=Create trace level
+updateTraceLevel=Update trace level
+deleteTraceLevel=Delete trace level
+syncTraceLevel=Synchronization trace level
+propagationPriority=Propagation priority
+propagationPrimary=Propagation primary
+
+success_connection=Successful connection
+error_connection=Connection failure
+check=Check connection
+actionsClasses=Actions classes
+gmapping=Group mapping
+new=New resource
+randomPwdIfNotProvided=Generate random passwords when missing
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
new file mode 100644
index 0000000..54179a5
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+resource=Dettagli Risorsa
+umapping=Mapping utenti
+connectorProperties=Propriet\u00e0\u00a0 Connettore
+security=Sicurezza
+required_alert=Tutti i campi sono richiesti
+connector=Connettore
+existing_resources=Risorse esistenti
+action=Azione
+edit_attribute=Modifica risorsa
+title=Risorsa
+extAttrNames=Attributi esterni
+intMappingTypes=Tipo mapping interno
+entity=Entità
+groupSchema=Schema Gruppo
+connObjectKey=ConnObjectKey
+mandatoryCondition=Obbligatorio
+password=Password
+purpose=Scopo
+mappingUserSchema=Mapping User Schema
+mappingGroupSchema=Mapping Group Schema
+delete=Rimuovi
+intAttrNames=Attributi interni
+enforceMandatoryCondition=Abilita mandatory condition
+fieldName=Nome campo
+
+connObjectKeyValidation=Deve essere definito esattamente un ConnObjectKey
+propagationMode=Modalit\u00e0 di propagazione
+connObjectLink=ConnObjectLink
+enable=Abilita
+
+createTraceLevel=Livello di tracciamento delle creazioni
+updateTraceLevel=Livello di tracciamento degli aggiornamenti
+deleteTraceLevel=Livello di tracciamento delle cancellazioni
+syncTraceLevel=Livello di tracciamento delle sincronizzazioni
+propagationPriority=Priorit\u00e0 in propagazione
+propagationPrimary=Primaria in propagazione
+
+success_connection=Connessione avvenuta con successo
+error_connection=Connessione non riuscita
+check=Verifica connessione
+actionsClasses=Classi azioni
+gmapping=Mapping gruppi
+new=Nuova risorsa
+randomPwdIfNotProvided=Genera password casuali se mancanti
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
new file mode 100644
index 0000000..45c3616
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+resource=Detalhes de Recursos
+umapping=Mapeamento de usu\u00e1rios
+connectorProperties=Propriedades de Conectores
+security=Seguran\u00e7a
+required_alert=Todos os campos deste formul\u00e1rio s\u00e3o obrigat\u00f3rios
+connector=Conector
+existing_resources=Recursos Existentes
+action=A\u00e7\u00e3o
+edit_attribute=Alterar Recurso
+title=Recurso
+extAttrNames=Atributos Externos
+intMappingTypes=Tipos internos de mapeamentos
+entity=Entidade
+groupSchema=Esquema de Grupo
+connObjectKey=ConnObjectKey
+mandatoryCondition=Obrigat\u00f3rio
+password=Senha
+purpose=Prop\u00f3sito
+mappingUserSchema=Esquema de mapeamento de usu\u00e1rio
+mappingGroupSchema=Esquema de mapeamento de grupo
+delete=Excluir
+intAttrNames=Atributos internos
+enforceMandatoryCondition=Aplicar condi\u00e7\u00e3o obrigat\u00f3ria
+fieldName=Nome do Campo
+
+connObjectKeyValidation=Precisa ser exatamente um ConnObjectKey
+propagationMode=Modo de propaga\u00e7\u00e3o
+connObjectLink=ConnObjectLink
+enable=Habilitado
+
+createTraceLevel=Criar n\u00edvel de trace
+updateTraceLevel=Atualizar n\u00edvel de trace
+deleteTraceLevel=Excluir n\u00edvel de trace
+syncTraceLevel=N\u00edvel de trace de sincroniza\u00e7\u00e3o
+propagationPriority=Prioridade de propaga\u00e7\u00e3o
+propagationPrimary=Propaga\u00e7\u00e3o prim\u00e1ria
+
+success_connection=Conex\u00e3o com sucesso
+error_connection=Conex\u00e3o sem sucesso
+check=Verificar a conex\u00e3o
+actionsClasses=Classes de a\u00e7\u00f5es
+gmapping=Mapeamento de grupos
+new=Novo recurso
+randomPwdIfNotProvided=Gerar senhas aleat\u00f3rias quando n\u00e3o houver
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html b/client/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html
index bc68d99..8df7df7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html
@@ -1,4 +1,4 @@
- <!DOCTYPE html>
+<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -23,6 +23,20 @@ under the License.
<script type="text/javascript" src="webjars/jquery-cookie/${jquery-cookie.version}/jquery.cookie.js"></script>
<script type="text/javascript" src="js/topology.js"></script>
<link href="css/topology.css" rel="stylesheet"/>
+
+ <style type="text/css">
+ legend {
+ font-weight: bold;
+ }
+ #sentMessages {
+ display: none;
+ }
+ #messages {
+ margin: 5px;
+ padding: 5px;
+ border: 2px groove #f5f5f5;
+ }
+ </style>
</wicket:head>
<wicket:extend>
<div id="zoom" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
@@ -45,8 +59,9 @@ under the License.
<div class="window topology_res" wicket:id="res" onmouseup="refreshPosition(this)">[resource]</div>
</span>
</span>
- <span wicket:id="jsPlace"></span>
</div>
+ <span wicket:id="jsPlace"></span>
</div>
+ <div wicket:id="modal">[modal]</div>
</wicket:extend>
</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyNodePanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyNodePanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyNodePanel.html
index 6b23d8f..ed238c7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyNodePanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/topology/TopologyNodePanel.html
@@ -28,11 +28,7 @@ under the License.
<p class="text-center text-primary" wicket:id="label"/>
- <span wicket:id="timer" />
-
<wicket:fragment wicket:id="connectorWithResourceActions">
- <div wicket:id="createWin">[createWin]</div>
- <div wicket:id="editWin">[editWin]</div>
<ul role="menu" class="dropdown-menu">
<li><a href="#"><i class="fa fa-plus"></i></a></li>
<li><a href="#"><i class="fa fa-pencil"></i></a></li>
@@ -40,17 +36,14 @@ under the License.
</wicket:fragment>
<wicket:fragment wicket:id="connectorWithNoResourceActions">
- <div wicket:id="createWin">[createWin]</div>
- <div wicket:id="editWin">[editWin]</div>
<ul role="menu" class="dropdown-menu">
- <li><a href="#"><i class="fa fa-plus"></i></a></li>
- <li><a href="#"><i class="fa fa-minus"></i></a></li>
- <li><a href="#"><i class="fa fa-pencil"></i></a></li>
+ <li><a href="#" wicket:id="create"><i class="fa fa-plus"></i></a></li>
+ <li><a href="#" wicket:id="delete"><i class="fa fa-minus"></i></a></li>
+ <li><a href="#" wicket:id="edit"><i class="fa fa-pencil"></i></a></li>
</ul>
</wicket:fragment>
<wicket:fragment wicket:id="resourceActions">
- <div wicket:id="editWin">[editWin]</div>
<ul role="menu" class="dropdown-menu">
<li><a href="#" wicket:id="delete"><i class="fa fa-minus"></i></a></li>
<li><a href="#" wicket:id="edit"><i class="fa fa-pencil"></i></a></li>
@@ -58,7 +51,6 @@ under the License.
</wicket:fragment>
<wicket:fragment wicket:id="syncopeActions">
- <div wicket:id="createWin">[createWin]</div>
<ul role="menu" class="dropdown-menu">
<li><a href="#"><i class="fa fa-plus"></i></a></li>
</ul>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8ea19f7..8543381 100644
--- a/pom.xml
+++ b/pom.xml
@@ -875,6 +875,11 @@ under the License.
<artifactId>wicket-jquery-ui</artifactId>
<version>${wicket-jqueryui.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-native-websocket-javax</artifactId>
+ <version>${wicket.version}</version>
+ </dependency>
<!-- /Wicket -->
<dependency>
[2/4] syncope git commit: [SYNCOPE-156] provided modal content panel
+ features to add, edit and remove resource/conectors - still missing: 1. the
possibility to edit new topology element as soon as created;
2. to show the spinner during ajax calls.
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java
new file mode 100644
index 0000000..8627998
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import static org.apache.wicket.Component.ENABLE;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.pages.AbstractBasePage;
+import org.apache.syncope.common.lib.to.MappingItemTO;
+import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.ResourceModel;
+
+/**
+ * Modal window with Resource form.
+ */
+public class ResourceModal extends ModalContent {
+
+ private static final long serialVersionUID = 1734415311027284221L;
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public ResourceModal(
+ final ModalWindow window,
+ final PageReference pageRef,
+ final ResourceTO resourceTO,
+ final boolean createFlag) {
+
+ super(window, pageRef);
+
+ final Form<ResourceTO> form = new Form<>(FORM);
+ form.setModel(new CompoundPropertyModel<>(resourceTO));
+
+ //--------------------------------
+ // Resource details panel
+ //--------------------------------
+ form.add(new ResourceDetailsPanel("details", resourceTO,
+ resourceRestClient.getPropagationActionsClasses(), createFlag));
+
+ form.add(new AnnotatedBeanPanel("systeminformation", resourceTO));
+ //--------------------------------
+
+ //--------------------------------
+ // Resource mapping panels
+ //--------------------------------
+ form.add(new ResourceMappingPanel("umapping", resourceTO, AnyTypeKind.USER));
+ form.add(new ResourceMappingPanel("gmapping", resourceTO, AnyTypeKind.GROUP));
+ //--------------------------------
+
+ //--------------------------------
+ // Resource connector configuration panel
+ //--------------------------------
+ ResourceConnConfPanel resourceConnConfPanel = new ResourceConnConfPanel("connconf", resourceTO, createFlag);
+ MetaDataRoleAuthorizationStrategy.authorize(resourceConnConfPanel, ENABLE, Entitlement.CONNECTOR_READ);
+ form.add(resourceConnConfPanel);
+ //--------------------------------
+
+ //--------------------------------
+ // Resource security panel
+ //--------------------------------
+ form.add(new ResourceSecurityPanel("security", resourceTO));
+ //--------------------------------
+
+ AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(SUBMIT, SUBMIT)) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ final ResourceTO resourceTO = (ResourceTO) form.getDefaultModelObject();
+
+ boolean connObjectKeyError = false;
+
+ final Collection<ProvisionTO> provisions = new ArrayList<>(resourceTO.getProvisions());
+
+ for (ProvisionTO provision : provisions) {
+ if (provision != null) {
+ if (provision.getMapping() == null || provision.getMapping().getItems().isEmpty()) {
+ resourceTO.getProvisions().remove(provision);
+ } else {
+ int uConnObjectKeyCount = CollectionUtils.countMatches(
+ provision.getMapping().getItems(), new Predicate<MappingItemTO>() {
+
+ @Override
+ public boolean evaluate(final MappingItemTO item) {
+ return item.isConnObjectKey();
+ }
+ });
+
+ connObjectKeyError = uConnObjectKeyCount != 1;
+ }
+ }
+ }
+
+ if (connObjectKeyError) {
+ error(getString("connObjectKeyValidation"));
+ feedbackPanel.refresh(target);
+ } else {
+ try {
+ if (createFlag) {
+ resourceRestClient.create(resourceTO);
+ send(pageRef.getPage(), Broadcast.BREADTH, new ResourceCreateEvent(target, resourceTO));
+ } else {
+ resourceRestClient.update(resourceTO);
+ }
+
+ if (pageRef.getPage() instanceof AbstractBasePage) {
+ ((AbstractBasePage) pageRef.getPage()).setModalResult(true);
+ }
+ window.close(target);
+ } catch (Exception e) {
+ LOG.error("Failure managing resource {}", resourceTO, e);
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ feedbackPanel.refresh(target);
+ }
+ }
+ }
+
+ @Override
+
+ protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ feedbackPanel.refresh(target);
+ }
+ };
+
+ form.add(submit);
+ form.setDefaultButton(submit);
+
+ final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ window.close(target);
+ }
+
+ @Override
+ protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ }
+ };
+
+ cancel.setDefaultFormProcessing(false);
+ form.add(cancel);
+
+ add(form);
+
+ MetaDataRoleAuthorizationStrategy.authorize(
+ submit, ENABLE, createFlag ? Entitlement.RESOURCE_CREATE : Entitlement.RESOURCE_UPDATE);
+ }
+
+ public NotificationPanel getFeedbackPanel() {
+ return feedbackPanel;
+ }
+
+ public static class ResourceCreateEvent extends ModalEvent {
+
+ private final ResourceTO resourceTO;
+
+ public ResourceCreateEvent(final AjaxRequestTarget target, final ResourceTO resourceTO) {
+ super(target);
+ this.resourceTO = resourceTO;
+ }
+
+ /**
+ * Create resource getter.
+ *
+ * @return created resource.
+ */
+ public ResourceTO getResourceTO() {
+ return resourceTO;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
index 0b49f12..5723859 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
@@ -20,25 +20,26 @@ package org.apache.syncope.client.console.topology;
import static org.apache.syncope.client.console.topology.TopologyNode.Status.FAILURE;
import static org.apache.syncope.client.console.topology.TopologyNode.Status.REACHABLE;
-import static org.apache.syncope.client.console.topology.TopologyNode.Status.UNKNOWN;
import static org.apache.syncope.client.console.topology.TopologyNode.Status.UNREACHABLE;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.pages.BasePage;
+import org.apache.syncope.client.console.panels.ResourceModal.ResourceCreateEvent;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -49,6 +50,8 @@ import org.apache.wicket.Component;
import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.Behavior;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -57,6 +60,9 @@ import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
+import org.apache.wicket.protocol.ws.api.WebSocketBehavior;
+import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler;
+import org.apache.wicket.protocol.ws.api.message.TextMessage;
import org.apache.wicket.util.time.Duration;
public class Topology extends BasePage {
@@ -69,6 +75,12 @@ public class Topology extends BasePage {
private final int origY = 2800;
+ private static final int RESOURCE_MODAL_WIN_HEIGHT = 700;
+
+ private static final int RESOURCE_MODAL_WIN_WIDTH = 1000;
+
+ final ModalWindow modal;
+
private final LoadableDetachableModel<List<ResourceTO>> resModel
= new LoadableDetachableModel<List<ResourceTO>>() {
@@ -121,7 +133,74 @@ public class Topology extends BasePage {
}
};
+ private enum SupportedOperation {
+
+ CHECK_RESOURCE,
+ CHECK_CONNECTOR,
+ ADD_ENDPOINT;
+
+ }
+
public Topology() {
+ modal = new ModalWindow("modal");
+ add(modal);
+
+ modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ modal.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
+ modal.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
+ modal.setCookieName("resource-modal");
+
+ add(new WebSocketBehavior() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onMessage(final WebSocketRequestHandler handler, final TextMessage message) {
+ try {
+ final ObjectMapper mapper = new ObjectMapper();
+ final JsonNode obj = mapper.readTree(message.getText());
+
+ switch (SupportedOperation.valueOf(obj.get("kind").asText())) {
+ case CHECK_CONNECTOR:
+ try {
+ final ConnInstanceTO connector = connectorRestClient.read(obj.get("target").asLong());
+ handler.push(String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
+ connectorRestClient.check(connector) ? REACHABLE : UNREACHABLE,
+ obj.get("target").asLong()));
+ } catch (Exception e) {
+ handler.push(String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
+ FAILURE,
+ obj.get("target").asLong()));
+ }
+ break;
+ case CHECK_RESOURCE:
+ try {
+ final ResourceTO resource = resourceRestClient.read(obj.get("target").asText());
+ handler.push(String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
+ connectorRestClient.check(resource) ? REACHABLE : UNREACHABLE,
+ obj.get("target").asText()));
+ } catch (Exception e) {
+ handler.push(String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
+ FAILURE,
+ obj.get("target").asText()));
+ }
+ break;
+ case ADD_ENDPOINT:
+ handler.appendJavaScript(String.format("addEndpoint('%s', '%s', '%s');",
+ obj.get("source").asText(),
+ obj.get("target").asText(),
+ obj.get("scope").asText()));
+ break;
+ default:
+ }
+
+ } catch (IOException ex) {
+ Logger.getLogger(Topology.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+ }
+ });
+
// -----------------------------------------
// Add Zoom panel
// -----------------------------------------
@@ -148,8 +227,6 @@ public class Topology extends BasePage {
}, ActionLink.ActionType.ZOOM_OUT, Entitlement.RESOURCE_LIST);
// -----------------------------------------
- final WebMarkupContainer jsPlace = new WebMarkupContainer("jsPlace");
-
// -----------------------------------------
// Add Syncope (root topologynode)
// -----------------------------------------
@@ -161,16 +238,16 @@ public class Topology extends BasePage {
syncopeTopologyNode.setHost(uri.getHost());
syncopeTopologyNode.setPort(uri.getPort());
- add(topologyNodePanel("syncope", syncopeTopologyNode, null, false));
+ add(topologyNodePanel("syncope", syncopeTopologyNode));
- final Map<String, Map<String, TopologyNode>> connections = new HashMap<>();
- final Map<String, TopologyNode> syncopeConnections = new HashMap<>();
- connections.put(syncopeTopologyNode.getDisplayName(), syncopeConnections);
+ final Map<Serializable, Map<Serializable, TopologyNode>> connections = new HashMap<>();
+ final Map<Serializable, TopologyNode> syncopeConnections = new HashMap<>();
+ connections.put(syncopeTopologyNode.getKey(), syncopeConnections);
// required to retrieve parent positions
final Map<String, TopologyNode> servers = new HashMap<>();
- final Map<String, TopologyNode> connectors = new HashMap<>();
- // -----------------------------------------
+ final Map<Long, TopologyNode> connectors = new HashMap<>();
+ // -----------------------------------------
// -----------------------------------------
// Add Connector Servers
@@ -198,18 +275,18 @@ public class Topology extends BasePage {
topologynode.setX(x);
topologynode.setY(y);
- servers.put(topologynode.getDisplayName(), topologynode);
+ servers.put(String.class.cast(topologynode.getKey()), topologynode);
- item.add(topologyNodePanel("cs", topologynode, syncopeTopologyNode, false));
+ item.add(topologyNodePanel("cs", topologynode));
syncopeConnections.put(url, topologynode);
- connections.put(url, new HashMap<String, TopologyNode>());
+ connections.put(url, new HashMap<Serializable, TopologyNode>());
}
};
connectorServers.setOutputMarkupId(true);
add(connectorServers);
- // -----------------------------------------
+ // -----------------------------------------
// -----------------------------------------
// Add Connector Intances (first level)
@@ -235,12 +312,12 @@ public class Topology extends BasePage {
topologynode.setX(x);
topologynode.setY(y);
- connectors.put(topologynode.getDisplayName(), topologynode);
+ connectors.put(Long.class.cast(topologynode.getKey()), topologynode);
- item.add(topologyNodePanel("conn", topologynode, syncopeTopologyNode, true));
+ item.add(topologyNodePanel("conn", topologynode));
if (conn.getLocation().startsWith(CONNECTOR_SERVER_LOCATION_PREFIX)) {
- final Map<String, TopologyNode> remoteConnections;
+ final Map<Serializable, TopologyNode> remoteConnections;
if (connections.containsKey(conn.getLocation())) {
remoteConnections = connections.get(conn.getLocation());
@@ -248,9 +325,9 @@ public class Topology extends BasePage {
remoteConnections = new HashMap<>();
connections.put(conn.getLocation(), remoteConnections);
}
- remoteConnections.put(conn.getDisplayName(), topologynode);
+ remoteConnections.put(conn.getKey(), topologynode);
} else {
- syncopeConnections.put(conn.getDisplayName(), topologynode);
+ syncopeConnections.put(conn.getKey(), topologynode);
}
}
};
@@ -288,12 +365,12 @@ public class Topology extends BasePage {
topologynode.setX(x);
topologynode.setY(y);
- connectors.put(topologynode.getDisplayName(), topologynode);
+ connectors.put(Long.class.cast(topologynode.getKey()), topologynode);
- item.add(topologyNodePanel("conn", topologynode, parent, true));
+ item.add(topologyNodePanel("conn", topologynode));
if (conn.getLocation().startsWith(CONNECTOR_SERVER_LOCATION_PREFIX)) {
- final Map<String, TopologyNode> remoteConnections;
+ final Map<Serializable, TopologyNode> remoteConnections;
if (connections.containsKey(conn.getLocation())) {
remoteConnections = connections.get(conn.getLocation());
@@ -301,9 +378,9 @@ public class Topology extends BasePage {
remoteConnections = new HashMap<>();
connections.put(conn.getLocation(), remoteConnections);
}
- remoteConnections.put(conn.getDisplayName(), topologynode);
+ remoteConnections.put(conn.getKey(), topologynode);
} else {
- syncopeConnections.put(conn.getDisplayName(), topologynode);
+ syncopeConnections.put(conn.getKey(), topologynode);
}
}
};
@@ -315,39 +392,39 @@ public class Topology extends BasePage {
// -----------------------------------------
// Add Resources
// -----------------------------------------
- final List<String> connToBeProcessed = new ArrayList<>();
+ final List<Long> connToBeProcessed = new ArrayList<>();
for (ResourceTO resourceTO : resModel.getObject()) {
final TopologyNode topologynode = new TopologyNode(
resourceTO.getKey(), resourceTO.getKey(), TopologyNode.Kind.RESOURCE);
topologynode.setX(origX);
topologynode.setY(origY);
- final Map<String, TopologyNode> remoteConnections;
+ final Map<Serializable, TopologyNode> remoteConnections;
- if (connections.containsKey(resourceTO.getConnectorDisplayName())) {
- remoteConnections = connections.get(resourceTO.getConnectorDisplayName());
+ if (connections.containsKey(resourceTO.getConnector())) {
+ remoteConnections = connections.get(resourceTO.getConnector());
} else {
remoteConnections = new HashMap<>();
- connections.put(resourceTO.getConnectorDisplayName(), remoteConnections);
+ connections.put(resourceTO.getConnector(), remoteConnections);
}
- remoteConnections.put(topologynode.getDisplayName(), topologynode);
+ remoteConnections.put(topologynode.getKey(), topologynode);
- if (!connToBeProcessed.contains(resourceTO.getConnectorDisplayName())) {
- connToBeProcessed.add(resourceTO.getConnectorDisplayName());
+ if (!connToBeProcessed.contains(resourceTO.getConnector())) {
+ connToBeProcessed.add(resourceTO.getConnector());
}
}
- final ListView<String> resources = new ListView<String>("resources", connToBeProcessed) {
+ final ListView<Long> resources = new ListView<Long>("resources", connToBeProcessed) {
private static final long serialVersionUID = 697862187148836038L;
@Override
- protected void populateItem(final ListItem<String> item) {
- final String connectorDisplayName = item.getModelObject();
+ protected void populateItem(final ListItem<Long> item) {
+ final Long connectorId = item.getModelObject();
final ListView<TopologyNode> innerListView = new ListView<TopologyNode>("resources",
- new ArrayList<>(connections.get(connectorDisplayName).values())) {
+ new ArrayList<>(connections.get(connectorId).values())) {
private static final long serialVersionUID = 1L;
@@ -356,7 +433,7 @@ public class Topology extends BasePage {
@Override
protected void populateItem(final ListItem<TopologyNode> item) {
final TopologyNode topologynode = item.getModelObject();
- final TopologyNode parent = connectors.get(connectorDisplayName);
+ final TopologyNode parent = connectors.get(connectorId);
final double k;
@@ -377,11 +454,7 @@ public class Topology extends BasePage {
topologynode.setX(x);
topologynode.setY(y);
- final Panel panel = new TopologyNodePanel(
- "res", topologynode, getPageReference(), resourceRestClient);
- panel.setMarkupId(topologynode.getDisplayName());
- panel.setOutputMarkupId(true);
- item.add(topologyNodePanel("res", topologynode, parent, true));
+ item.add(topologyNodePanel("res", topologynode));
}
};
@@ -392,11 +465,15 @@ public class Topology extends BasePage {
resources.setOutputMarkupId(true);
add(resources);
- // -----------------------------------------
+ // -----------------------------------------
// -----------------------------------------
// Create connections
// -----------------------------------------
+ final WebMarkupContainer jsPlace = new WebMarkupContainer("jsPlace");
+ jsPlace.setOutputMarkupId(true);
+ add(jsPlace);
+
jsPlace.add(new Behavior() {
private static final long serialVersionUID = 2661717818979056044L;
@@ -414,33 +491,40 @@ public class Topology extends BasePage {
}
});
- jsPlace.setOutputMarkupId(true);
- add(jsPlace);
- // -----------------------------------------
- }
+ jsPlace.add(new AbstractAjaxTimerBehavior(Duration.seconds(2)) {
- @Override
- public String getAjaxIndicatorMarkupId() {
- return StringUtils.EMPTY;
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onTimer(final AjaxRequestTarget target) {
+ target.appendJavaScript("checkConnection()");
+
+ if (getUpdateInterval().seconds() < 60.0) {
+ setUpdateInterval(Duration.seconds(60));
+ }
+ }
+ });
+ // -----------------------------------------
}
- private List<String> createConnections(final Map<String, Map<String, TopologyNode>> targets) {
+ private List<String> createConnections(final Map<Serializable, Map<Serializable, TopologyNode>> targets) {
List<String> list = new ArrayList<>();
- for (Map.Entry<String, Map<String, TopologyNode>> source : targets.entrySet()) {
- for (Map.Entry<String, TopologyNode> target : source.getValue().entrySet()) {
- list.add(String.format("jsPlumb.connect({source:'%s',target:'%s'},def);",
+ for (Map.Entry<Serializable, Map<Serializable, TopologyNode>> source : targets.entrySet()) {
+ for (Map.Entry<Serializable, TopologyNode> target : source.getValue().entrySet()) {
+ list.add(String.format("connect('%s','%s','%s');",
source.getKey(),
- target.getKey()));
+ target.getKey(),
+ target.getValue().getKind()));
}
}
return list;
}
- private Panel topologyNodePanel(
- final String id, final TopologyNode node, final TopologyNode parent, final boolean active) {
- final Panel panel = new TopologyNodePanel(id, node, getPageReference(), resourceRestClient);
- panel.setMarkupId(node.getDisplayName());
+ private Panel topologyNodePanel(final String id, final TopologyNode node) {
+
+ final Panel panel = new TopologyNodePanel(id, node, getPageReference(), modal);
+ panel.setMarkupId(String.valueOf(node.getKey()));
panel.setOutputMarkupId(true);
panel.add(new Behavior() {
@@ -450,72 +534,32 @@ public class Topology extends BasePage {
@Override
public void renderHead(final Component component, final IHeaderResponse response) {
response.render(OnDomReadyHeaderItem.forScript(String.format("setPosition('%s', %d, %d)",
- node.getDisplayName(), node.getX(), node.getY())));
+ node.getKey(), node.getX(), node.getY())));
}
});
- final WebMarkupContainer timer = new WebMarkupContainer("timer");
- timer.setOutputMarkupId(true);
- panel.add(timer);
-
- if (active) {
- timer.add(new AbstractAjaxTimerBehavior(Duration.seconds(2)) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onTimer(final AjaxRequestTarget target) {
- final List<TopologyReloadBehavior> behaviors = panel.getBehaviors(TopologyReloadBehavior.class);
- for (TopologyReloadBehavior behavior : behaviors) {
- panel.remove(behavior);
- }
-
- TopologyNode.Status status;
-
- final FutureTask<TopologyNode.Status> future = new FutureTask<>(
- new Callable<TopologyNode.Status>() {
-
- @Override
- public TopologyNode.Status call() throws Exception {
- switch (node.getKind()) {
- case CONNECTOR:
- final ConnInstanceTO connector = connectorRestClient.
- read(Long.class.cast(node.getKey()));
- return connectorRestClient.check(connector) ? REACHABLE : UNREACHABLE;
- case RESOURCE:
- final ResourceTO resource = resourceRestClient.
- read(String.class.cast(node.getKey()));
- return connectorRestClient.check(resource) ? REACHABLE : UNREACHABLE;
- default:
- return UNKNOWN;
- }
- }
- });
-
- future.run();
-
- try {
- status = future.get(10, TimeUnit.SECONDS);
- } catch (TimeoutException te) {
- LOG.warn("Check connection timed out");
- status = UNKNOWN;
- } catch (InterruptedException | ExecutionException ie) {
- // ignore
- LOG.warn("Check connection failed", ie);
- status = FAILURE;
- }
-
- timer.add(new TopologyReloadBehavior(parent.getDisplayName(), node.getDisplayName(), status));
-
- if (getUpdateInterval().seconds() < 60.0) {
- setUpdateInterval(Duration.seconds(60));
- }
+ return panel;
+ }
- target.add(timer);
- }
- });
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof ResourceCreateEvent) {
+ final ResourceCreateEvent resourceCreateEvent = ResourceCreateEvent.class.cast(event.getPayload());
+ resourceCreateEvent.getTarget().appendJavaScript(String.format(
+ "window.Wicket.WebSocket.send('"
+ + "{\"kind\":\"%s\",\"target\":\"%s\",\"source\":\"%s\",\"scope\":\"%s\"}"
+ + "');",
+ SupportedOperation.ADD_ENDPOINT,
+ resourceCreateEvent.getResourceTO().getKey(),
+ resourceCreateEvent.getResourceTO().getConnector(),
+ TopologyNode.Kind.RESOURCE));
}
+ }
- return panel;
+ @Override
+ public String getAjaxIndicatorMarkupId() {
+ return StringUtils.EMPTY;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyNodePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyNodePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyNodePanel.java
index e0b9066..ab8ebc2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyNodePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyNodePanel.java
@@ -21,21 +21,22 @@ package org.apache.syncope.client.console.topology;
import java.text.MessageFormat;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.pages.ResourceModalPage;
-import org.apache.syncope.client.console.rest.BaseRestClient;
+import org.apache.syncope.client.console.panels.ConnectorModal;
+import org.apache.syncope.client.console.panels.ResourceModal;
+import org.apache.syncope.client.console.rest.ConnectorRestClient;
import org.apache.syncope.client.console.rest.ResourceRestClient;
+import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Page;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,12 +46,19 @@ public class TopologyNodePanel extends Panel {
protected static final Logger LOG = LoggerFactory.getLogger(TopologyNodePanel.class);
- private static final int RESOURCE_MODAL_WIN_HEIGHT = 600;
+ final ModalWindow modal;
- private static final int RESOURCE_MODAL_WIN_WIDTH = 800;
+ @SpringBean
+ private ResourceRestClient resourceRestClient;
+
+ @SpringBean
+ private ConnectorRestClient connectorRestClient;
public TopologyNodePanel(
- final String id, final TopologyNode node, final PageReference pageRef, final BaseRestClient restClient) {
+ final String id,
+ final TopologyNode node,
+ final PageReference pageRef,
+ final ModalWindow modal) {
super(id);
final String resourceName = node.getDisplayName().length() > 20
@@ -64,20 +72,20 @@ public class TopologyNodePanel extends Panel {
switch (node.getKind()) {
case SYNCOPE:
title = "";
- add(getSyncopeFragment(node, (ResourceRestClient) restClient, pageRef));
+ add(getSyncopeFragment(node, pageRef));
break;
case CONNECTOR_SERVER:
title = node.getDisplayName();
- add(getConnectorServerFragment(node, (ResourceRestClient) restClient, pageRef));
+ add(getConnectorServerFragment(node, pageRef));
break;
case CONNECTOR:
title = (StringUtils.isBlank(node.getConnectionDisplayName())
? "" : node.getConnectionDisplayName() + ":") + node.getDisplayName();
- add(getConnectorFragment(node, (ResourceRestClient) restClient, pageRef));
+ add(getConnectorFragment(node, pageRef));
break;
default:
title = node.getDisplayName().length() > 20 ? node.getDisplayName() : "";
- add(getResurceFragment(node, (ResourceRestClient) restClient, pageRef));
+ add(getResurceFragment(node, pageRef));
}
if (StringUtils.isNotEmpty(title)) {
@@ -85,87 +93,94 @@ public class TopologyNodePanel extends Panel {
}
this.setMarkupId(node.getDisplayName());
+
+ this.modal = modal;
}
- private Fragment getSyncopeFragment(
- final TopologyNode node, final ResourceRestClient restClient, final PageReference pageRef) {
+ private Fragment getSyncopeFragment(final TopologyNode node, final PageReference pageRef) {
final Fragment fragment = new Fragment("actions", "syncopeActions", this);
-
- final ModalWindow createWin = new ModalWindow("createWin");
- fragment.add(createWin);
-
- createWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- createWin.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
- createWin.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
- createWin.setTitle(new ResourceModel("connector.new"));
- createWin.setCookieName("connector-modal");
-
+ fragment.setOutputMarkupId(true);
return fragment;
}
- private Fragment getConnectorServerFragment(
- final TopologyNode node, final ResourceRestClient restClient, final PageReference pageRef) {
+ private Fragment getConnectorServerFragment(final TopologyNode node, final PageReference pageRef) {
final Fragment fragment = new Fragment("actions", "syncopeActions", this);
-
- final ModalWindow createWin = new ModalWindow("createWin");
- fragment.add(createWin);
-
- createWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- createWin.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
- createWin.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
- createWin.setCookieName("connector-modal");
- createWin.setTitle(new ResourceModel("connector.new"));
-
return fragment;
}
- private Fragment getConnectorFragment(
- final TopologyNode node, final ResourceRestClient restClient, final PageReference pageRef) {
+ private Fragment getConnectorFragment(final TopologyNode node, final PageReference pageRef) {
final Fragment fragment = new Fragment("actions", "connectorWithNoResourceActions", this);
+ fragment.setOutputMarkupId(true);
- final ModalWindow createWin = new ModalWindow("createWin");
- fragment.add(createWin);
+ final AjaxLink<String> delete = new ClearIndicatingAjaxLink<String>("delete", pageRef) {
- createWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- createWin.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
- createWin.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
- createWin.setCookieName("resource-modal");
- createWin.setTitle(new ResourceModel("resource.new"));
+ private static final long serialVersionUID = 3776750333491622263L;
- final ModalWindow editWin = new ModalWindow("editWin");
- fragment.add(editWin);
+ @Override
+ public void onClickInternal(final AjaxRequestTarget target) {
+ try {
+ connectorRestClient.delete(Long.class.cast(node.getKey()));
+ target.appendJavaScript(String.format("jsPlumb.remove('%s');", node.getKey()));
+ info(getString(Constants.OPERATION_SUCCEEDED));
+ } catch (SyncopeClientException e) {
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ LOG.error("While deleting resource {}", node.getKey(), e);
+ }
+ }
+ };
+ fragment.add(delete);
- editWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- editWin.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
- editWin.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
- editWin.setCookieName("connector-modal");
- editWin.setTitle(MessageFormat.format(getString("connector.edit"), node.getKey()));
+ final AjaxLink<String> create = new ClearIndicatingAjaxLink<String>("create", pageRef) {
+
+ private static final long serialVersionUID = 3776750333491622263L;
+
+ @Override
+ public void onClickInternal(final AjaxRequestTarget target) {
+ final ResourceTO resourceTO = new ResourceTO();
+ resourceTO.setConnector(Long.class.cast(node.getKey()));
+ resourceTO.setConnectorDisplayName(node.getDisplayName());
+
+ modal.setContent(new ResourceModal(modal, pageRef, resourceTO, true));
+
+ modal.setTitle(getString("resource.new"));
+ modal.show(target);
+ }
+ };
+ fragment.add(create);
+
+ final AjaxLink<String> edit = new ClearIndicatingAjaxLink<String>("edit", pageRef) {
+
+ private static final long serialVersionUID = 3776750333491622263L;
+
+ @Override
+ public void onClickInternal(final AjaxRequestTarget target) {
+
+ modal.setContent(new ConnectorModal(
+ modal,
+ pageRef,
+ connectorRestClient.read(Long.class.cast(node.getKey()))));
+
+ modal.setTitle(MessageFormat.format(getString("connector.edit"), node.getKey()));
+ modal.show(target);
+ }
+ };
+ fragment.add(edit);
return fragment;
}
- private Fragment getResurceFragment(
- final TopologyNode node, final ResourceRestClient restClient, final PageReference pageRef) {
+ private Fragment getResurceFragment(final TopologyNode node, final PageReference pageRef) {
final Fragment fragment = new Fragment("actions", "resourceActions", this);
- final ModalWindow editWin = new ModalWindow("editWin");
- fragment.add(editWin);
-
- editWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- editWin.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
- editWin.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
- editWin.setCookieName("resource-modal");
- editWin.setTitle(MessageFormat.format(getString("resource.edit"), node.getKey()));
-
- final AjaxLink<String> delete = new IndicatingAjaxLink<String>("delete") {
+ final AjaxLink<String> delete = new ClearIndicatingAjaxLink<String>("delete", pageRef) {
private static final long serialVersionUID = 3776750333491622263L;
@Override
- public void onClick(final AjaxRequestTarget target) {
+ public void onClickInternal(final AjaxRequestTarget target) {
try {
- restClient.delete(node.getKey().toString());
- target.appendJavaScript(String.format("jsPlumb.remove('%s');", node.getDisplayName()));
+ resourceRestClient.delete(node.getKey().toString());
+ target.appendJavaScript(String.format("jsPlumb.remove('%s');", node.getKey()));
info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientException e) {
error(getString(Constants.ERROR) + ": " + e.getMessage());
@@ -175,27 +190,21 @@ public class TopologyNodePanel extends Panel {
};
fragment.add(delete);
- final AjaxLink<String> edit = new IndicatingAjaxLink<String>("edit") {
+ final AjaxLink<String> edit = new ClearIndicatingAjaxLink<String>("edit", pageRef) {
private static final long serialVersionUID = 3776750333491622263L;
@Override
- public void onClick(final AjaxRequestTarget target) {
- editWin.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new ResourceModalPage(
- pageRef,
- editWin,
- restClient.read(node.getKey().toString()),
- false);
- }
- });
-
- editWin.show(target);
+ public void onClickInternal(final AjaxRequestTarget target) {
+
+ modal.setContent(new ResourceModal(
+ modal,
+ pageRef,
+ resourceRestClient.read(node.getKey().toString()),
+ false));
+
+ modal.setTitle(MessageFormat.format(getString("resource.edit"), node.getKey()));
+ modal.show(target);
}
};
fragment.add(edit);
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyReloadBehavior.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyReloadBehavior.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyReloadBehavior.java
deleted file mode 100644
index 434c7ea..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyReloadBehavior.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.topology;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnLoadHeaderItem;
-
-public class TopologyReloadBehavior extends Behavior {
-
- private static final long serialVersionUID = 1L;
-
- private final String source;
-
- private final String target;
-
- private final TopologyNode.Status status;
-
- public TopologyReloadBehavior(final String source, final String target, final TopologyNode.Status status) {
- this.source = source;
- this.target = target;
- this.status = status;
- }
-
- @Override
- public void renderHead(final Component component, final IHeaderResponse response) {
-
- switch (status) {
- case UNKNOWN:
- response.render(OnLoadHeaderItem.forScript(String.format("unknown('%s', '%s')", source, target)));
- break;
- case REACHABLE:
- response.render(OnLoadHeaderItem.forScript(String.format("enable('%s', '%s')", source, target)));
- break;
- case UNREACHABLE:
- response.render(OnLoadHeaderItem.forScript(String.format("disable('%s', '%s')", source, target)));
- break;
- default:
- response.render(OnLoadHeaderItem.forScript(String.format("failure('%s', '%s')", source, target)));
- // remove subtree
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/META-INF/resources/css/topology.css
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/css/topology.css b/client/console/src/main/resources/META-INF/resources/css/topology.css
index c5744cb..be3f04d 100644
--- a/client/console/src/main/resources/META-INF/resources/css/topology.css
+++ b/client/console/src/main/resources/META-INF/resources/css/topology.css
@@ -60,12 +60,6 @@
filter:alpha(opacity=60);
}
-.active {
- border:1px dotted green;
-}
-.hover {
- border:1px dotted red;
-}
._jsPlumb_dragging {
z-index:4000;
}
@@ -116,6 +110,7 @@ div#drawing {
div#zoom {
padding : 10px;
text-align: right;
+ width: 100%;
}
div#zoom .fa{
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/META-INF/resources/js/topology.js
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/js/topology.js b/client/console/src/main/resources/META-INF/resources/js/topology.js
index 5592b9c..f2a7ac3 100644
--- a/client/console/src/main/resources/META-INF/resources/js/topology.js
+++ b/client/console/src/main/resources/META-INF/resources/js/topology.js
@@ -47,15 +47,8 @@ var failedConnectorStyle = {
outlineWidth: 1
};
-var disabledConnectorStyle = {
- lineWidth: 2,
- strokeStyle: "rgba(255, 69, 0, 1)",
- outlineColor: "#666",
- outlineWidth: 1
-};
-
-var disabledConnectorHoverStyle = {
- strokeStyle: "#FF8C00"
+var failedConnectorHoverStyle = {
+ strokeStyle: "#FFFFFF"
};
var failedEndpointStyle = {
@@ -69,6 +62,17 @@ var failedEndpointStyle = {
radius: 3.5
};
+var disabledConnectorStyle = {
+ lineWidth: 2,
+ strokeStyle: "rgba(255, 69, 0, 1)",
+ outlineColor: "#666",
+ outlineWidth: 1
+};
+
+var disabledConnectorHoverStyle = {
+ strokeStyle: "#FF8C00"
+};
+
var disabledEndpointStyle = {
gradient: {
stops: [
@@ -102,22 +106,22 @@ var enabledEndpointStyle = {
radius: 3.5
};
-function disable(sourceName, targetName){
- jsPlumb.select({target:targetName}).setPaintStyle(disabledConnectorStyle).setHoverPaintStyle({strokeStyle: "#FF8C00" });
+window.disable = function(targetName){
+ jsPlumb.select({target:targetName}).setPaintStyle(disabledConnectorStyle).setHoverPaintStyle(disabledConnectorHoverStyle);
jsPlumb.selectEndpoints({element: [targetName]}).setPaintStyle(disabledEndpointStyle);
}
-function enable(sourceName, targetName){
- jsPlumb.select({target:targetName}).setPaintStyle(enabledConnectorStyle).setHoverPaintStyle({strokeStyle: "#00FF00" });
+window.enable = function(targetName){
+ jsPlumb.select({target:targetName}).setPaintStyle(enabledConnectorStyle).setHoverPaintStyle(enabledConnectorHoverStyle);
jsPlumb.selectEndpoints({element: [targetName]}).setPaintStyle(enabledEndpointStyle);
}
-function failure(sourceName, targetName){
- jsPlumb.select({target:targetName}).setPaintStyle(failedConnectorStyle).setHoverPaintStyle({strokeStyle: "#FFFFFF" });
+window.failure = function(targetName){
+ jsPlumb.select({target:targetName}).setPaintStyle(failedConnectorStyle).setHoverPaintStyle(failedConnectorHoverStyle);
jsPlumb.selectEndpoints({element: [targetName]}).setPaintStyle(failedEndpointStyle);
}
-function unknown(sourceName, targetName){
+window.unknown = function(targetName){
}
function getTopology(){
@@ -216,6 +220,12 @@ window.zoomOut = function(el, instance, transformOrigin) {
$.cookie("topology", JSON.stringify(val), { expires: 9999 });
};
+window.connect = function(source, target, scope){
+ if(jsPlumb.select({source:source, target:target, scope: scope}) !=null){
+ jsPlumb.connect({source:source, target:target, scope: scope}, def);
+ }
+}
+
window.activate = function(zoom){
jsPlumb.draggable(jsPlumb.getSelector(".window"));
jsPlumb.setContainer("drawing");
@@ -228,11 +238,46 @@ window.activate = function(zoom){
var val = getTopology();
if(val.__zoom__ == null){
setZoom($("#drawing")[0], zoom);
- }else{
+ } else {
setZoom($("#drawing")[0], val.__zoom__);
}
}
+window.checkConnection = function() {
+ jsPlumb.select({scope:"CONNECTOR"}).each(function(connection) {
+ Wicket.WebSocket.send("{ \"kind\":\"CHECK_CONNECTOR\", \"target\":\"" + connection.target.id + "\" }");
+ });
+ jsPlumb.select({scope:"RESOURCE"}).each(function(connection) {
+ Wicket.WebSocket.send("{ \"kind\":\"CHECK_RESOURCE\", \"target\":\"" + connection.target.id + "\" }");
+ });
+}
+
+window.addEndpoint = function(source, target, scope) {
+ var sourceElement = $('#' + source);
+ var element = sourceElement.clone();
+ element.attr('id', target);
+ element.removeAttr('data-original-title');
+
+ var top = parseFloat(sourceElement.css("top")) + 10;
+ var left = parseFloat(sourceElement.css("left")) - 150;
+
+ if(scope == 'RESOURCE'){
+ var style = 'topology_res';
+ }else{
+ var style = 'topology_conn';
+ }
+
+ element.attr('class', 'window jsplumb-draggable _jsPlumb_endpoint_anchor_ ' + style);
+
+ element.find('p').text(target);
+
+ $('#drawing').append(element);
+ setPosition(target, left, top);
+
+ jsPlumb.draggable(element);
+ jsPlumb.connect({ source:source, target:target, scope:scope }, def);
+}
+
jsPlumb.importDefaults({
Connector : [ "Straight" ],
DragOptions: {
@@ -242,3 +287,25 @@ jsPlumb.importDefaults({
HoverClass: "connector-hover"
});
+jQuery(function($) {
+ Wicket.Event.subscribe("/websocket/message", function(jqEvent, message) {
+ var val = JSON.parse(decodeURIComponent(message));
+ switch (val.status) {
+ case 'UNKNOWN':
+ unknown(val.target);
+ break;
+ case 'REACHABLE':
+ enable(val.target);
+ break;
+ case 'UNREACHABLE':
+ disable(val.target);
+ break;
+ case 'FAILURE':
+ failure(val.target);
+ break;
+ default:
+ break;
+ }
+ });
+});
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/META-INF/web-fragment.xml
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/web-fragment.xml b/client/console/src/main/resources/META-INF/web-fragment.xml
index f19df05..04cd14e 100644
--- a/client/console/src/main/resources/META-INF/web-fragment.xml
+++ b/client/console/src/main/resources/META-INF/web-fragment.xml
@@ -44,7 +44,7 @@ under the License.
<filter>
<filter-name>SyncopeConsole</filter-name>
- <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <filter-class>org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter</filter-class>
<init-param>
<param-name>filterMappingUrlPattern</param-name>
<param-value>/*</param-value>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
index 147f819..b01e9d9 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
@@ -39,7 +39,7 @@ under the License.
<script type="text/javascript" src="webjars/bootstrap/${bootstrap.version}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="webjars/bootstrap-select/${bootstrap-select.version}/dist/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="js/AdminLTE-app.min.js"></script>
-
+
<script type="text/javascript">
var notificationShownTimes = 0;
function showNotification(componentId, messagecount) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.html
deleted file mode 100644
index b85acb6..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:extend>
- <p class="ui-widget ui-corner-all ui-widget-header">
- <span wicket:id="new"/> <wicket:message key="title"/> <span wicket:id="key"/>
- </p>
- <div style="margin: 5px;">
- <form wicket:id="form">
- <div id="tabs">
- <ul>
- <li class="tabs-selected"><a href="#tabs-1"><span><wicket:message key="tab1"/></span></a></li>
- <li><a href="#tabs-2"><span><wicket:message key="tab2"/></span></a></li>
- <li><a href="#tabs-3"><span><wicket:message key="tab3"/></span></a></li>
- </ul>
- <div id="tabs-1">
- <div id="formtable">
- <div class="tablerow alt">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="displayName"><wicket:message key="displayName"/></label>
- </div>
- <div class="tablecolumn_field short_dynamicsize">
- <span wicket:id="displayName">[displayName]</span>
- </div>
- </div>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="location"><wicket:message key="location"/></label>
- </div>
- <div class="tablecolumn_field short_dynamicsize">
- <span wicket:id="location">[location]</span>
- </div>
- </div>
-
- <div class="tablerow alt">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="name"><wicket:message key="name"/></label>
- </div>
- <div class="tablecolumn_field medium_dynamicsize">
- <span wicket:id="connectorName">[connectorName]</span>
- </div>
- </div>
-
- <div class="tablerow">
- <div class="tablecolumn_label short_dynamicsize">
- <label for="version"><wicket:message key="version"/></label>
- </div>
- <div class="tablecolumn_field short_dynamicsize">
- <span wicket:id="version">[version]</span>
- </div>
- </div>
- </div>
- <div style="display: table; border: 1px solid #BBBBBB;">
- <div class="tablerow2 alt">
- <div class="tablecolumn2_label short_dynamicsize">
- <label for="connRequestTimeout"><wicket:message key="connRequestTimeout"/></label>
- </div>
- <div class="tablecolumn2_field short_dynamicsize">
- <span wicket:id="connRequestTimeout">[connRequestTimeout]</span>
- </div>
- <div class="tablecolumn2_label short_dynamicsize">
- <label for="poolMaxObjects"><wicket:message key="poolMaxObjects"/></label>
- </div>
- <div class="tablecolumn2_field short_dynamicsize">
- <span wicket:id="poolMaxObjects">[poolMaxObjects]</span>
- </div>
- </div>
- <div class="tablerow2">
- <div class="tablecolumn2_label short_dynamicsize">
- <label for="poolMinIdle"><wicket:message key="poolMinIdle"/></label>
- </div>
- <div class="tablecolumn2_field short_dynamicsize">
- <span wicket:id="poolMinIdle">[poolMinIdle]</span>
- </div>
- <div class="tablecolumn2_label short_dynamicsize">
- <label for="poolMaxIdle"><wicket:message key="poolMaxIdle"/></label>
- </div>
- <div class="tablecolumn2_field short_dynamicsize">
- <span wicket:id="poolMaxIdle">[poolMaxIdle]</span>
- </div>
- </div>
- <div class="tablerow2 alt">
- <div class="tablecolumn2_label short_dynamicsize">
- <label for="poolMaxWait"><wicket:message key="poolMaxWait"/></label>
- </div>
- <div class="tablecolumn2_field short_dynamicsize">
- <span wicket:id="poolMaxWait">[poolMaxWait]</span>
- </div>
- <div class="tablecolumn2_label short_dynamicsize">
- <label for="poolMinEvictableIdleTime"><wicket:message key="poolMinEvictableIdleTime"/></label>
- </div>
- <div class="tablecolumn2_field short_dynamicsize">
- <span wicket:id="poolMinEvictableIdleTime">[poolMinEvictableIdleTime]</span>
- </div>
- </div>
- </div>
- </div>
- <div id="tabs-2">
- <div id="formtable">
- <span wicket:id="container">
- <div style="border-bottom: 10px">
- <div style="width: 40px; text-align: center; font-size: 7px">
- <label for="version"><wicket:message key="overridable"/></label>
- </div>
- </div>
- <form wicket:id="connectorPropForm">
- <div class="tablerow connectorProp" wicket:id="connectorProperties">
- <div class="tablecolumn_check" style="width: 27px; text-align: center; margin-right: 10px">
- <span wicket:id="connPropAttrOverridable">[connPropAttrOverridable]</span>
- </div>
- <div class="tablecolumn_connPropAttr">
- <span wicket:id="connPropAttrSchema">[connPropAttrSchema]</span>
- </div>
- <div class="tablecolumn_field veryshort_fixedsize">
- <span wicket:id="panel">[panel]</span>
- </div>
- </div>
- <div>
- <a style="position: absolute; top: 2px; right:20px;" wicket:id="check">
- <img src="img/ping.png"width="30" height="30"
- alt="ping" title="title" wicket:message="title:check"/>
- </a>
- </div>
- </form>
- </span>
- </div>
- </div>
- <div id="tabs-3">
- <span wicket:id="capabilitiesPalette"/>
- </div>
- </div>
-
- <div style="margin: 20px 10px 0">
- <input type="submit"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="apply"/>
- <input type="button"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="cancel"/>
- </div>
- </form>
- </div>
- </wicket:extend>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.properties
deleted file mode 100644
index 8500f1a..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tab1=General
-tab2=Configuration
-tab3=Capabilities
-displayName=Display name
-bundleName=Bundle name
-version=Version
-connRequestTimeout=Request timeout (sec)
-action=Action
-edit=Edit
-edit_attribute=Edit attribute
-serviceName=Service name
-endpoint=Endpoint
-title=Connector
-overridable=Overridable
-property=Property
-value=Value
-
-success_connection=Successful connection
-error_connection=Connection failure
-check=Check connection
-location=Location
-poolMaxObjects=Max objects (idle+active)
-poolMinIdle=Min idle objects
-poolMaxIdle=Max idle objects
-poolMaxWait=Max waiting time (msec)
-poolMinEvictableIdleTime=Min eviction time (msec)
-new=New
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_it.properties
deleted file mode 100644
index 96080c3..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_it.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tab1=Generale
-tab2=Configurazione
-tab3=Capabilities
-bundleName=Bundle name
-version=Versione
-connRequestTimeout=Timeout richiesta (sec)
-action=Azione
-edit=Edit
-edit_attribute=Edit attribute
-serviceName=Nome servizio
-endpoint=Endpoint
-title=Connettore
-displayName=Nome visualizzato
-overridable=Sovrascrivibile
-property=Propriet\u00e0
-value=Valore
-
-success_connection=Connessione avvenuta con successo
-error_connection=Connessione non riuscita
-check=Verifica connessione
-location=Posizione
-poolMaxObjects=Max oggetti (attivi e non)
-poolMinIdle=Max oggetti attivi
-poolMaxIdle=Max oggetti inattivi
-poolMaxWait=Tempo max attesa
-poolMinEvictableIdleTime=Tempo min espulsione
-new=Nuovo
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_pt_BR.properties
deleted file mode 100644
index b688216..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ConnectorModalPage_pt_BR.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tab1=Geral
-tab2=Configura\u00e7\u00e3o
-tab3=Capacidades
-displayName=Mostrar Nome
-bundleName=Nome do Pacote
-version=Vers\u00e3o
-connRequestTimeout=Timeout da Requisi\u00e7\u00e3o (seg)
-action=A\u00e7\u00e3o
-edit=Alterar
-edit_attribute=Alterar Atributo
-serviceName=Nome de Servi\u00e7o
-endpoint=Endpoint
-title=Conector
-overridable=Alter\u00e1vel
-property=Propriedade
-value=Valor
-
-success_connection=Sucesso na Conex\u00e3o
-error_connection=Falha na Conex\u00e3o
-check=Verificar a Conex\u00e3o
-location=Localiza\u00e7\u00e3o
-poolMaxObjects=Max objects (idle+active)
-poolMinIdle=Min idle objects
-poolMaxIdle=Max idle objects
-poolMaxWait=Max waiting time (msec)
-poolMinEvictableIdleTime=Min eviction time (msec)
-new=Novo
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.html
new file mode 100644
index 0000000..b85acb6
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.html
@@ -0,0 +1,161 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <wicket:extend>
+ <p class="ui-widget ui-corner-all ui-widget-header">
+ <span wicket:id="new"/> <wicket:message key="title"/> <span wicket:id="key"/>
+ </p>
+ <div style="margin: 5px;">
+ <form wicket:id="form">
+ <div id="tabs">
+ <ul>
+ <li class="tabs-selected"><a href="#tabs-1"><span><wicket:message key="tab1"/></span></a></li>
+ <li><a href="#tabs-2"><span><wicket:message key="tab2"/></span></a></li>
+ <li><a href="#tabs-3"><span><wicket:message key="tab3"/></span></a></li>
+ </ul>
+ <div id="tabs-1">
+ <div id="formtable">
+ <div class="tablerow alt">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="displayName"><wicket:message key="displayName"/></label>
+ </div>
+ <div class="tablecolumn_field short_dynamicsize">
+ <span wicket:id="displayName">[displayName]</span>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="location"><wicket:message key="location"/></label>
+ </div>
+ <div class="tablecolumn_field short_dynamicsize">
+ <span wicket:id="location">[location]</span>
+ </div>
+ </div>
+
+ <div class="tablerow alt">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="name"><wicket:message key="name"/></label>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="connectorName">[connectorName]</span>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="version"><wicket:message key="version"/></label>
+ </div>
+ <div class="tablecolumn_field short_dynamicsize">
+ <span wicket:id="version">[version]</span>
+ </div>
+ </div>
+ </div>
+ <div style="display: table; border: 1px solid #BBBBBB;">
+ <div class="tablerow2 alt">
+ <div class="tablecolumn2_label short_dynamicsize">
+ <label for="connRequestTimeout"><wicket:message key="connRequestTimeout"/></label>
+ </div>
+ <div class="tablecolumn2_field short_dynamicsize">
+ <span wicket:id="connRequestTimeout">[connRequestTimeout]</span>
+ </div>
+ <div class="tablecolumn2_label short_dynamicsize">
+ <label for="poolMaxObjects"><wicket:message key="poolMaxObjects"/></label>
+ </div>
+ <div class="tablecolumn2_field short_dynamicsize">
+ <span wicket:id="poolMaxObjects">[poolMaxObjects]</span>
+ </div>
+ </div>
+ <div class="tablerow2">
+ <div class="tablecolumn2_label short_dynamicsize">
+ <label for="poolMinIdle"><wicket:message key="poolMinIdle"/></label>
+ </div>
+ <div class="tablecolumn2_field short_dynamicsize">
+ <span wicket:id="poolMinIdle">[poolMinIdle]</span>
+ </div>
+ <div class="tablecolumn2_label short_dynamicsize">
+ <label for="poolMaxIdle"><wicket:message key="poolMaxIdle"/></label>
+ </div>
+ <div class="tablecolumn2_field short_dynamicsize">
+ <span wicket:id="poolMaxIdle">[poolMaxIdle]</span>
+ </div>
+ </div>
+ <div class="tablerow2 alt">
+ <div class="tablecolumn2_label short_dynamicsize">
+ <label for="poolMaxWait"><wicket:message key="poolMaxWait"/></label>
+ </div>
+ <div class="tablecolumn2_field short_dynamicsize">
+ <span wicket:id="poolMaxWait">[poolMaxWait]</span>
+ </div>
+ <div class="tablecolumn2_label short_dynamicsize">
+ <label for="poolMinEvictableIdleTime"><wicket:message key="poolMinEvictableIdleTime"/></label>
+ </div>
+ <div class="tablecolumn2_field short_dynamicsize">
+ <span wicket:id="poolMinEvictableIdleTime">[poolMinEvictableIdleTime]</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="tabs-2">
+ <div id="formtable">
+ <span wicket:id="container">
+ <div style="border-bottom: 10px">
+ <div style="width: 40px; text-align: center; font-size: 7px">
+ <label for="version"><wicket:message key="overridable"/></label>
+ </div>
+ </div>
+ <form wicket:id="connectorPropForm">
+ <div class="tablerow connectorProp" wicket:id="connectorProperties">
+ <div class="tablecolumn_check" style="width: 27px; text-align: center; margin-right: 10px">
+ <span wicket:id="connPropAttrOverridable">[connPropAttrOverridable]</span>
+ </div>
+ <div class="tablecolumn_connPropAttr">
+ <span wicket:id="connPropAttrSchema">[connPropAttrSchema]</span>
+ </div>
+ <div class="tablecolumn_field veryshort_fixedsize">
+ <span wicket:id="panel">[panel]</span>
+ </div>
+ </div>
+ <div>
+ <a style="position: absolute; top: 2px; right:20px;" wicket:id="check">
+ <img src="img/ping.png"width="30" height="30"
+ alt="ping" title="title" wicket:message="title:check"/>
+ </a>
+ </div>
+ </form>
+ </span>
+ </div>
+ </div>
+ <div id="tabs-3">
+ <span wicket:id="capabilitiesPalette"/>
+ </div>
+ </div>
+
+ <div style="margin: 20px 10px 0">
+ <input type="submit"
+ class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+ wicket:id="apply"/>
+ <input type="button"
+ class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+ wicket:id="cancel"/>
+ </div>
+ </form>
+ </div>
+ </wicket:extend>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.properties
new file mode 100644
index 0000000..8500f1a
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal.properties
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+tab1=General
+tab2=Configuration
+tab3=Capabilities
+displayName=Display name
+bundleName=Bundle name
+version=Version
+connRequestTimeout=Request timeout (sec)
+action=Action
+edit=Edit
+edit_attribute=Edit attribute
+serviceName=Service name
+endpoint=Endpoint
+title=Connector
+overridable=Overridable
+property=Property
+value=Value
+
+success_connection=Successful connection
+error_connection=Connection failure
+check=Check connection
+location=Location
+poolMaxObjects=Max objects (idle+active)
+poolMinIdle=Min idle objects
+poolMaxIdle=Max idle objects
+poolMaxWait=Max waiting time (msec)
+poolMinEvictableIdleTime=Min eviction time (msec)
+new=New
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_it.properties
new file mode 100644
index 0000000..96080c3
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_it.properties
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+tab1=Generale
+tab2=Configurazione
+tab3=Capabilities
+bundleName=Bundle name
+version=Versione
+connRequestTimeout=Timeout richiesta (sec)
+action=Azione
+edit=Edit
+edit_attribute=Edit attribute
+serviceName=Nome servizio
+endpoint=Endpoint
+title=Connettore
+displayName=Nome visualizzato
+overridable=Sovrascrivibile
+property=Propriet\u00e0
+value=Valore
+
+success_connection=Connessione avvenuta con successo
+error_connection=Connessione non riuscita
+check=Verifica connessione
+location=Posizione
+poolMaxObjects=Max oggetti (attivi e non)
+poolMinIdle=Max oggetti attivi
+poolMaxIdle=Max oggetti inattivi
+poolMaxWait=Tempo max attesa
+poolMinEvictableIdleTime=Tempo min espulsione
+new=Nuovo
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_pt_BR.properties
new file mode 100644
index 0000000..b688216
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ConnectorModal_pt_BR.properties
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+tab1=Geral
+tab2=Configura\u00e7\u00e3o
+tab3=Capacidades
+displayName=Mostrar Nome
+bundleName=Nome do Pacote
+version=Vers\u00e3o
+connRequestTimeout=Timeout da Requisi\u00e7\u00e3o (seg)
+action=A\u00e7\u00e3o
+edit=Alterar
+edit_attribute=Alterar Atributo
+serviceName=Nome de Servi\u00e7o
+endpoint=Endpoint
+title=Conector
+overridable=Alter\u00e1vel
+property=Propriedade
+value=Valor
+
+success_connection=Sucesso na Conex\u00e3o
+error_connection=Falha na Conex\u00e3o
+check=Verificar a Conex\u00e3o
+location=Localiza\u00e7\u00e3o
+poolMaxObjects=Max objects (idle+active)
+poolMinIdle=Min idle objects
+poolMaxIdle=Max idle objects
+poolMaxWait=Max waiting time (msec)
+poolMinEvictableIdleTime=Min eviction time (msec)
+new=Novo
[4/4] syncope git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/syncope
Posted by fm...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/syncope
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/63b9416b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/63b9416b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/63b9416b
Branch: refs/heads/master
Commit: 63b9416bca6f4190f2b87791bb488ebc5c2dd4cd
Parents: a205101 b33f9ef
Author: fmartelli <fa...@gmail.com>
Authored: Thu Jun 18 18:12:50 2015 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Jun 18 18:12:50 2015 +0200
----------------------------------------------------------------------
pom.xml | 1 -
src/site/site.xml | 2 +-
src/site/xdoc/mailing-lists.xml | 172 +++++++++++++++++++++++++++++++++++
3 files changed, 173 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/63b9416b/pom.xml
----------------------------------------------------------------------
[3/4] syncope git commit: [SYNCOPE-156] provided modal content panel
+ features to add, edit and remove resource/conectors - still missing: 1. the
possibility to edit new topology element as soon as created;
2. to show the spinner during ajax calls.
Posted by fm...@apache.org.
[SYNCOPE-156] provided modal content panel + features to add, edit and remove resource/conectors - still missing: 1. the possibility to edit new topology element as soon as created; 2. to show the spinner during ajax calls.
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a2051012
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a2051012
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a2051012
Branch: refs/heads/master
Commit: a20510123b4300150d43ff334335e218a3572c33
Parents: 67c79ab
Author: fmartelli <fa...@gmail.com>
Authored: Thu Jun 18 18:12:25 2015 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Jun 18 18:12:25 2015 +0200
----------------------------------------------------------------------
client/console/pom.xml | 4 +
.../console/pages/ConnectorModalPage.java | 477 -------------------
.../client/console/pages/ResourceModalPage.java | 204 --------
.../client/console/panels/ConnectorModal.java | 476 ++++++++++++++++++
.../client/console/panels/Connectors.java | 385 ---------------
.../client/console/panels/ModalContent.java | 99 ++++
.../console/panels/ResourceConnConfPanel.java | 6 +-
.../console/panels/ResourceDetailsPanel.java | 16 +-
.../client/console/panels/ResourceModal.java | 204 ++++++++
.../client/console/topology/Topology.java | 292 +++++++-----
.../console/topology/TopologyNodePanel.java | 177 +++----
.../topology/TopologyReloadBehavior.java | 61 ---
.../META-INF/resources/css/topology.css | 7 +-
.../resources/META-INF/resources/js/topology.js | 101 +++-
.../main/resources/META-INF/web-fragment.xml | 2 +-
.../syncope/client/console/pages/BasePage.html | 2 +-
.../console/pages/ConnectorModalPage.html | 161 -------
.../console/pages/ConnectorModalPage.properties | 43 --
.../pages/ConnectorModalPage_it.properties | 43 --
.../pages/ConnectorModalPage_pt_BR.properties | 43 --
.../client/console/panels/ConnectorModal.html | 161 +++++++
.../console/panels/ConnectorModal.properties | 43 ++
.../console/panels/ConnectorModal_it.properties | 43 ++
.../panels/ConnectorModal_pt_BR.properties | 43 ++
.../client/console/panels/Connectors.html | 57 ---
.../client/console/panels/Connectors.properties | 34 --
.../console/panels/Connectors_it.properties | 34 --
.../console/panels/Connectors_pt_BR.properties | 32 --
.../client/console/panels/ModalContent.html | 45 ++
.../console/panels/ModalContent.properties | 20 +
.../console/panels/ModalContent_it.properties | 20 +
.../panels/ModalContent_pt_BR.properties | 20 +
.../client/console/panels/ResourceModal.html | 56 +++
.../console/panels/ResourceModal.properties | 60 +++
.../console/panels/ResourceModal_it.properties | 60 +++
.../panels/ResourceModal_pt_BR.properties | 60 +++
.../client/console/topology/Topology.html | 19 +-
.../console/topology/TopologyNodePanel.html | 14 +-
pom.xml | 5 +
39 files changed, 1798 insertions(+), 1831 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/pom.xml
----------------------------------------------------------------------
diff --git a/client/console/pom.xml b/client/console/pom.xml
index 4ef7c9c..2a0f283 100644
--- a/client/console/pom.xml
+++ b/client/console/pom.xml
@@ -74,6 +74,10 @@ under the License.
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-native-websocket-javax</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/pages/ConnectorModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ConnectorModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ConnectorModalPage.java
deleted file mode 100644
index f35da6a..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ConnectorModalPage.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.pages;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.rest.ConnectorRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.client.console.wicket.markup.html.form.SpinnerFieldPanel;
-import org.apache.syncope.client.console.wicket.markup.html.list.ConnConfPropertyListView;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.ConnBundleTO;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.ConnPoolConfTO;
-import org.apache.syncope.common.lib.types.ConnConfPropSchema;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.common.lib.types.Entitlement;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.CheckBoxMultipleChoice;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.wicket.validation.validator.RangeValidator;
-
-/**
- * Modal window with Connector form.
- */
-public class ConnectorModalPage extends BaseModalPage {
-
- private static final long serialVersionUID = -2025535531121434050L;
-
- @SpringBean
- private ConnectorRestClient restClient;
-
- private final Map<String, Map<String, Map<String, ConnBundleTO>>> mapConnBundleTOs;
-
- private final List<ConnectorCapability> selectedCapabilities;
-
- private ConnBundleTO bundleTO;
-
- private List<ConnConfProperty> properties;
-
- private final WebMarkupContainer propertiesContainer;
-
- public ConnectorModalPage(final PageReference pageRef, final ModalWindow window,
- final ConnInstanceTO connInstanceTO) {
-
- super();
-
- this.add(new Label("new", connInstanceTO.getKey() == 0
- ? new ResourceModel("new")
- : new Model<>(StringUtils.EMPTY)));
- this.add(new Label("key", connInstanceTO.getKey() == 0
- ? StringUtils.EMPTY
- : connInstanceTO.getKey()));
-
- // general data setup
- selectedCapabilities = new ArrayList<>(connInstanceTO.getKey() == 0
- ? EnumSet.noneOf(ConnectorCapability.class)
- : connInstanceTO.getCapabilities());
-
- mapConnBundleTOs = new HashMap<>();
- for (ConnBundleTO connBundleTO : restClient.getAllBundles()) {
- // by location
- if (!mapConnBundleTOs.containsKey(connBundleTO.getLocation())) {
- mapConnBundleTOs.put(connBundleTO.getLocation(), new HashMap<String, Map<String, ConnBundleTO>>());
- }
- final Map<String, Map<String, ConnBundleTO>> byLocation = mapConnBundleTOs.get(connBundleTO.getLocation());
-
- // by name
- if (!byLocation.containsKey(connBundleTO.getBundleName())) {
- byLocation.put(connBundleTO.getBundleName(), new HashMap<String, ConnBundleTO>());
- }
- final Map<String, ConnBundleTO> byName = byLocation.get(connBundleTO.getBundleName());
-
- // by version
- if (!byName.containsKey(connBundleTO.getVersion())) {
- byName.put(connBundleTO.getVersion(), connBundleTO);
- }
- }
-
- bundleTO = getSelectedBundleTO(connInstanceTO);
- properties = fillProperties(bundleTO, connInstanceTO);
-
- // form - first tab
- final Form<ConnInstanceTO> connectorForm = new Form<>(FORM);
- connectorForm.setModel(new CompoundPropertyModel<>(connInstanceTO));
- connectorForm.setOutputMarkupId(true);
- add(connectorForm);
-
- propertiesContainer = new WebMarkupContainer("container");
- propertiesContainer.setOutputMarkupId(true);
- connectorForm.add(propertiesContainer);
-
- final Form<ConnInstanceTO> connectorPropForm = new Form<>("connectorPropForm");
- connectorPropForm.setModel(new CompoundPropertyModel<>(connInstanceTO));
- connectorPropForm.setOutputMarkupId(true);
- propertiesContainer.add(connectorPropForm);
-
- final AjaxTextFieldPanel displayName = new AjaxTextFieldPanel(
- "displayName", "display name", new PropertyModel<String>(connInstanceTO, "displayName"));
- displayName.setOutputMarkupId(true);
- displayName.addRequiredLabel();
- connectorForm.add(displayName);
-
- final AjaxDropDownChoicePanel<String> location = new AjaxDropDownChoicePanel<>("location", "location",
- new Model<>(bundleTO == null ? null : bundleTO.getLocation()));
- ((DropDownChoice<String>) location.getField()).setNullValid(true);
- location.setStyleSheet("long_dynamicsize");
- location.setChoices(new ArrayList<>(mapConnBundleTOs.keySet()));
- location.setRequired(true);
- location.addRequiredLabel();
- location.setOutputMarkupId(true);
- location.setEnabled(connInstanceTO.getKey() == 0);
- location.getField().setOutputMarkupId(true);
- connectorForm.add(location);
-
- final AjaxDropDownChoicePanel<String> connectorName = new AjaxDropDownChoicePanel<>("connectorName",
- "connectorName",
- new Model<>(bundleTO == null ? null : bundleTO.getBundleName()));
- ((DropDownChoice<String>) connectorName.getField()).setNullValid(true);
- connectorName.setStyleSheet("long_dynamicsize");
- connectorName.setChoices(bundleTO == null
- ? new ArrayList<String>()
- : new ArrayList<>(mapConnBundleTOs.get(connInstanceTO.getLocation()).keySet()));
- connectorName.setRequired(true);
- connectorName.addRequiredLabel();
- connectorName.setEnabled(connInstanceTO.getLocation() != null);
- connectorName.setOutputMarkupId(true);
- connectorName.setEnabled(connInstanceTO.getKey() == 0);
- connectorName.getField().setOutputMarkupId(true);
- connectorForm.add(connectorName);
-
- final AjaxDropDownChoicePanel<String> version = new AjaxDropDownChoicePanel<>("version", "version",
- new Model<>(bundleTO == null ? null : bundleTO.getVersion()));
- version.setStyleSheet("long_dynamicsize");
- version.setChoices(bundleTO == null
- ? new ArrayList<String>()
- : new ArrayList<>(mapConnBundleTOs.get(connInstanceTO.getLocation()).
- get(connInstanceTO.getBundleName()).keySet()));
- version.setRequired(true);
- version.addRequiredLabel();
- version.setEnabled(connInstanceTO.getBundleName() != null);
- version.setOutputMarkupId(true);
- version.addRequiredLabel();
- version.getField().setOutputMarkupId(true);
- connectorForm.add(version);
-
- final SpinnerFieldPanel<Integer> connRequestTimeout = new SpinnerFieldPanel<>("connRequestTimeout",
- "connRequestTimeout", Integer.class,
- new PropertyModel<Integer>(connInstanceTO, "connRequestTimeout"), 0, null);
- connRequestTimeout.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
- connectorForm.add(connRequestTimeout);
-
- if (connInstanceTO.getPoolConf() == null) {
- connInstanceTO.setPoolConf(new ConnPoolConfTO());
- }
- final SpinnerFieldPanel<Integer> poolMaxObjects = new SpinnerFieldPanel<>("poolMaxObjects", "poolMaxObjects",
- Integer.class,
- new PropertyModel<Integer>(connInstanceTO.getPoolConf(), "maxObjects"), 0, null);
- poolMaxObjects.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
- connectorForm.add(poolMaxObjects);
- final SpinnerFieldPanel<Integer> poolMinIdle = new SpinnerFieldPanel<>("poolMinIdle", "poolMinIdle",
- Integer.class,
- new PropertyModel<Integer>(connInstanceTO.getPoolConf(), "minIdle"), 0, null);
- poolMinIdle.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
- connectorForm.add(poolMinIdle);
- final SpinnerFieldPanel<Integer> poolMaxIdle = new SpinnerFieldPanel<>("poolMaxIdle", "poolMaxIdle",
- Integer.class,
- new PropertyModel<Integer>(connInstanceTO.getPoolConf(), "maxIdle"), 0, null);
- poolMaxIdle.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
- connectorForm.add(poolMaxIdle);
- final SpinnerFieldPanel<Long> poolMaxWait = new SpinnerFieldPanel<>("poolMaxWait", "poolMaxWait", Long.class,
- new PropertyModel<Long>(connInstanceTO.getPoolConf(), "maxWait"), 0L, null);
- poolMaxWait.getField().add(new RangeValidator<>(0L, Long.MAX_VALUE));
- connectorForm.add(poolMaxWait);
- final SpinnerFieldPanel<Long> poolMinEvictableIdleTime = new SpinnerFieldPanel<>("poolMinEvictableIdleTime",
- "poolMinEvictableIdleTime", Long.class,
- new PropertyModel<Long>(connInstanceTO.getPoolConf(), "minEvictableIdleTimeMillis"),
- 0L, null);
- poolMinEvictableIdleTime.getField().add(new RangeValidator<>(0L, Long.MAX_VALUE));
- connectorForm.add(poolMinEvictableIdleTime);
-
- // form - first tab - onchange()
- location.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- ((DropDownChoice<String>) location.getField()).setNullValid(false);
- connInstanceTO.setLocation(location.getModelObject());
- target.add(location);
-
- connectorName.setChoices(new ArrayList<>(
- mapConnBundleTOs.get(location.getModelObject()).keySet()));
- connectorName.setEnabled(true);
- connectorName.getField().setModelValue(null);
- target.add(connectorName);
-
- version.setChoices(new ArrayList<String>());
- version.getField().setModelValue(null);
- version.setEnabled(false);
- target.add(version);
-
- properties.clear();
- target.add(propertiesContainer);
- }
- });
- connectorName.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- ((DropDownChoice<String>) connectorName.getField()).setNullValid(false);
- connInstanceTO.setBundleName(connectorName.getModelObject());
- target.add(connectorName);
-
- List<String> versions = new ArrayList<>(
- mapConnBundleTOs.get(location.getModelObject()).get(connectorName.getModelObject()).keySet());
- version.setChoices(versions);
- version.setEnabled(true);
- if (versions.size() == 1) {
- selectVersion(target, connInstanceTO, version, versions.get(0));
- version.getField().setModelObject(versions.get(0));
- } else {
- version.getField().setModelValue(null);
- properties.clear();
- target.add(propertiesContainer);
- }
- target.add(version);
- }
- });
- version.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- selectVersion(target, connInstanceTO, version, version.getModelObject());
- }
- });
-
- // form - second tab (properties)
- final ListView<ConnConfProperty> connPropView = new ConnConfPropertyListView("connectorProperties",
- new PropertyModel<List<ConnConfProperty>>(this, "properties"),
- true, connInstanceTO.getConfiguration());
- connPropView.setOutputMarkupId(true);
- connectorPropForm.add(connPropView);
-
- final AjaxButton check = new IndicatingAjaxButton("check", new ResourceModel("check")) {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- final ConnInstanceTO conn = (ConnInstanceTO) form.getModelObject();
-
- // ensure that connector bundle information is in sync
- conn.setBundleName(bundleTO.getBundleName());
- conn.setVersion(bundleTO.getVersion());
- conn.setConnectorName(bundleTO.getConnectorName());
-
- if (restClient.check(conn)) {
- info(getString("success_connection"));
- } else {
- error(getString("error_connection"));
- }
-
- feedbackPanel.refresh(target);
- }
- };
- connectorPropForm.add(check);
-
- // form - third tab (capabilities)
- final IModel<List<ConnectorCapability>> capabilities
- = new LoadableDetachableModel<List<ConnectorCapability>>() {
-
- private static final long serialVersionUID = 5275935387613157437L;
-
- @Override
- protected List<ConnectorCapability> load() {
- return Arrays.asList(ConnectorCapability.values());
- }
- };
- CheckBoxMultipleChoice<ConnectorCapability> capabilitiesPalette = new CheckBoxMultipleChoice<>(
- "capabilitiesPalette",
- new PropertyModel<List<ConnectorCapability>>(this, "selectedCapabilities"), capabilities);
-
- capabilitiesPalette.add(new AjaxFormChoiceComponentUpdatingBehavior() {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- }
- });
-
- connectorForm.add(capabilitiesPalette);
-
- // form - submit / cancel buttons
- final AjaxButton submit = new IndicatingAjaxButton(APPLY, new Model<>(getString(SUBMIT))) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- final ConnInstanceTO conn = (ConnInstanceTO) form.getModelObject();
-
- conn.setConnectorName(bundleTO.getConnectorName());
- conn.setBundleName(bundleTO.getBundleName());
- conn.setVersion(bundleTO.getVersion());
- conn.getConfiguration().clear();
- conn.getConfiguration().addAll(connPropView.getModelObject());
-
- // Set the model object's capabilities to capabilitiesPalette's converted Set
- conn.getCapabilities().clear();
- conn.getCapabilities().addAll(selectedCapabilities.isEmpty()
- ? EnumSet.noneOf(ConnectorCapability.class)
- : EnumSet.copyOf(selectedCapabilities));
-
- // Reset pool configuration if all fields are null
- if (conn.getPoolConf() != null
- && conn.getPoolConf().getMaxIdle() == null
- && conn.getPoolConf().getMaxObjects() == null
- && conn.getPoolConf().getMaxWait() == null
- && conn.getPoolConf().getMinEvictableIdleTimeMillis() == null
- && conn.getPoolConf().getMinIdle() == null) {
-
- conn.setPoolConf(null);
- }
-
- try {
- if (connInstanceTO.getKey() == 0) {
- restClient.create(conn);
- } else {
- restClient.update(conn);
- }
-
- ((BasePage) pageRef.getPage()).setModalResult(true);
- window.close(target);
- } catch (SyncopeClientException e) {
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- feedbackPanel.refresh(target);
- ((BasePage) pageRef.getPage()).setModalResult(false);
- LOG.error("While creating or updating connector {}", conn, e);
- }
- }
-
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- feedbackPanel.refresh(target);
- }
- };
- String entitlements = connInstanceTO.getKey() == 0
- ? Entitlement.CONNECTOR_CREATE : Entitlement.CONNECTOR_UPDATE;
-
- MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, entitlements);
- connectorForm.add(submit);
-
- final IndicatingAjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- window.close(target);
- }
- };
- cancel.setDefaultFormProcessing(false);
- connectorForm.add(cancel);
- }
-
- private ConnBundleTO getSelectedBundleTO(final ConnInstanceTO connInstanceTO) {
- ConnBundleTO result = null;
- if (connInstanceTO != null
- && StringUtils.isNotBlank(connInstanceTO.getLocation())
- && StringUtils.isNotBlank(connInstanceTO.getBundleName())
- && StringUtils.isNotBlank(connInstanceTO.getVersion())
- && mapConnBundleTOs.containsKey(connInstanceTO.getLocation())) {
-
- Map<String, Map<String, ConnBundleTO>> byLocation = mapConnBundleTOs.get(connInstanceTO.getLocation());
- if (byLocation.containsKey(connInstanceTO.getBundleName())) {
- Map<String, ConnBundleTO> byName = byLocation.get(connInstanceTO.getBundleName());
- if (byName.containsKey(connInstanceTO.getVersion())) {
- result = byName.get(connInstanceTO.getVersion());
- }
- }
- }
- return result;
- }
-
- private List<ConnConfProperty> fillProperties(final ConnBundleTO bundleTO, final ConnInstanceTO connInstanceTO) {
- final List<ConnConfProperty> props = new ArrayList<>();
-
- if (bundleTO != null) {
- for (ConnConfPropSchema key : bundleTO.getProperties()) {
- final ConnConfProperty property = new ConnConfProperty();
- property.setSchema(key);
- if (connInstanceTO.getKey() != 0
- && connInstanceTO.getConfigurationMap().containsKey(key.getName())
- && connInstanceTO.getConfigurationMap().get(key.getName()).getValues() != null) {
-
- property.getValues().addAll(connInstanceTO.getConfigurationMap().get(key.getName()).getValues());
- property.setOverridable(connInstanceTO.getConfigurationMap().get(key.getName()).isOverridable());
- }
-
- if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) {
- property.getValues().addAll(key.getDefaultValues());
- }
-
- props.add(property);
- }
- }
-
- // re-order properties (implements Comparable)
- Collections.sort(props);
- return props;
- }
-
- private void selectVersion(final AjaxRequestTarget target, final ConnInstanceTO connInstanceTO,
- final AjaxDropDownChoicePanel<String> version, final String versionValue) {
-
- connInstanceTO.setVersion(versionValue);
- target.add(version);
-
- bundleTO = getSelectedBundleTO(connInstanceTO);
- properties = fillProperties(bundleTO, connInstanceTO);
- target.add(propertiesContainer);
- }
-
- public List<ConnConfProperty> getProperties() {
- return properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
deleted file mode 100644
index e578255..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResourceModalPage.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.pages;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.AnnotatedBeanPanel;
-import org.apache.syncope.client.console.panels.ResourceConnConfPanel;
-import org.apache.syncope.client.console.panels.ResourceDetailsPanel;
-import org.apache.syncope.client.console.panels.ResourceMappingPanel;
-import org.apache.syncope.client.console.panels.ResourceSecurityPanel;
-import org.apache.syncope.common.lib.to.MappingItemTO;
-import org.apache.syncope.common.lib.to.ProvisionTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.Entitlement;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.ResourceModel;
-
-/**
- * Modal window with Resource form.
- */
-public class ResourceModalPage extends BaseModalPage {
-
- private static final long serialVersionUID = 1734415311027284221L;
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public ResourceModalPage(final PageReference pageRef, final ModalWindow window, final ResourceTO resourceTO,
- final boolean createFlag) {
-
- super();
-
- final Form<ResourceTO> form = new Form<>(FORM);
- form.setModel(new CompoundPropertyModel<>(resourceTO));
-
- //--------------------------------
- // Resource details panel
- //--------------------------------
- form.add(new ResourceDetailsPanel("details", resourceTO,
- resourceRestClient.getPropagationActionsClasses(), createFlag));
-
- form.add(new AnnotatedBeanPanel("systeminformation", resourceTO));
- //--------------------------------
-
- //--------------------------------
- // Resource mapping panels
- //--------------------------------
- form.add(new ResourceMappingPanel("umapping", resourceTO, AnyTypeKind.USER));
- form.add(new ResourceMappingPanel("gmapping", resourceTO, AnyTypeKind.GROUP));
- //--------------------------------
-
- //--------------------------------
- // Resource connector configuration panel
- //--------------------------------
- ResourceConnConfPanel resourceConnConfPanel = new ResourceConnConfPanel("connconf", resourceTO, createFlag);
- MetaDataRoleAuthorizationStrategy.authorize(resourceConnConfPanel, ENABLE, Entitlement.CONNECTOR_READ);
- form.add(resourceConnConfPanel);
- //--------------------------------
-
- //--------------------------------
- // Resource security panel
- //--------------------------------
- form.add(new ResourceSecurityPanel("security", resourceTO));
- //--------------------------------
-
- AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(SUBMIT, SUBMIT)) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- final ResourceTO resourceTO = (ResourceTO) form.getDefaultModelObject();
-
- boolean connObjectKeyError = false;
-
- for (ProvisionTO provision : resourceTO.getProvisions()) {
- if (provision != null) {
- if (provision.getMapping() == null || provision.getMapping().getItems().isEmpty()) {
- resourceTO.getProvisions().remove(provision);
- } else {
- int uConnObjectKeyCount = CollectionUtils.countMatches(
- provision.getMapping().getItems(), new Predicate<MappingItemTO>() {
-
- @Override
- public boolean evaluate(final MappingItemTO item) {
- return item.isConnObjectKey();
- }
- });
-
- connObjectKeyError = uConnObjectKeyCount != 1;
- }
- }
- }
-
- if (connObjectKeyError) {
- error(getString("connObjectKeyValidation"));
- feedbackPanel.refresh(target);
- } else {
- try {
- if (createFlag) {
- resourceRestClient.create(resourceTO);
- } else {
- resourceRestClient.update(resourceTO);
- }
-
- if (pageRef != null && pageRef.getPage() instanceof AbstractBasePage) {
- ((AbstractBasePage) pageRef.getPage()).setModalResult(true);
- }
- window.close(target);
- } catch (Exception e) {
- LOG.error("Failure managing resource {}", resourceTO, e);
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- feedbackPanel.refresh(target);
- }
- }
- }
-
- @Override
-
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- feedbackPanel.refresh(target);
- }
- };
-
- form.add(submit);
- form.setDefaultButton(submit);
-
- final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- window.close(target);
- }
-
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- }
- };
-
- cancel.setDefaultFormProcessing(false);
- form.add(cancel);
-
- add(form);
-
- MetaDataRoleAuthorizationStrategy.authorize(
- submit, ENABLE, createFlag ? Entitlement.RESOURCE_CREATE : Entitlement.RESOURCE_UPDATE);
-
- }
-
- /**
- * Generic resource event.
- */
- public static class ResourceEvent {
-
- /**
- * Request target.
- */
- private final AjaxRequestTarget target;
-
- /**
- * Constructor.
- *
- * @param target request target.
- */
- public ResourceEvent(final AjaxRequestTarget target) {
- this.target = target;
- }
-
- /**
- * Target getter.
- *
- * @return request target.
- */
- public AjaxRequestTarget getTarget() {
- return target;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
new file mode 100644
index 0000000..fee3e06
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
@@ -0,0 +1,476 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import static org.apache.wicket.Component.ENABLE;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.pages.BasePage;
+import org.apache.syncope.client.console.panels.ModalContent;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.SpinnerFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.list.ConnConfPropertyListView;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.lib.to.ConnPoolConfTO;
+import org.apache.syncope.common.lib.types.ConnConfPropSchema;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
+import org.apache.syncope.common.lib.types.Entitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.CheckBoxMultipleChoice;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.validation.validator.RangeValidator;
+
+/**
+ * Modal window with Connector form.
+ */
+public class ConnectorModal extends ModalContent {
+
+ private static final long serialVersionUID = -2025535531121434050L;
+
+ private final Map<String, Map<String, Map<String, ConnBundleTO>>> mapConnBundleTOs;
+
+ private final List<ConnectorCapability> selectedCapabilities;
+
+ private ConnBundleTO bundleTO;
+
+ private List<ConnConfProperty> properties;
+
+ private final WebMarkupContainer propertiesContainer;
+
+ public ConnectorModal(
+ final ModalWindow window, final PageReference pageRef, final ConnInstanceTO connInstanceTO) {
+
+ super(window, pageRef);
+
+ this.add(new Label("new", connInstanceTO.getKey() == 0
+ ? new ResourceModel("new")
+ : new Model<>(StringUtils.EMPTY)));
+ this.add(new Label("key", connInstanceTO.getKey() == 0
+ ? StringUtils.EMPTY
+ : connInstanceTO.getKey()));
+
+ // general data setup
+ selectedCapabilities = new ArrayList<>(connInstanceTO.getKey() == 0
+ ? EnumSet.noneOf(ConnectorCapability.class)
+ : connInstanceTO.getCapabilities());
+
+ mapConnBundleTOs = new HashMap<>();
+ for (ConnBundleTO connBundleTO : connectorRestClient.getAllBundles()) {
+ // by location
+ if (!mapConnBundleTOs.containsKey(connBundleTO.getLocation())) {
+ mapConnBundleTOs.put(connBundleTO.getLocation(), new HashMap<String, Map<String, ConnBundleTO>>());
+ }
+ final Map<String, Map<String, ConnBundleTO>> byLocation = mapConnBundleTOs.get(connBundleTO.getLocation());
+
+ // by name
+ if (!byLocation.containsKey(connBundleTO.getBundleName())) {
+ byLocation.put(connBundleTO.getBundleName(), new HashMap<String, ConnBundleTO>());
+ }
+ final Map<String, ConnBundleTO> byName = byLocation.get(connBundleTO.getBundleName());
+
+ // by version
+ if (!byName.containsKey(connBundleTO.getVersion())) {
+ byName.put(connBundleTO.getVersion(), connBundleTO);
+ }
+ }
+
+ bundleTO = getSelectedBundleTO(connInstanceTO);
+ properties = fillProperties(bundleTO, connInstanceTO);
+
+ // form - first tab
+ final Form<ConnInstanceTO> connectorForm = new Form<>(FORM);
+ connectorForm.setModel(new CompoundPropertyModel<>(connInstanceTO));
+ connectorForm.setOutputMarkupId(true);
+ add(connectorForm);
+
+ propertiesContainer = new WebMarkupContainer("container");
+ propertiesContainer.setOutputMarkupId(true);
+ connectorForm.add(propertiesContainer);
+
+ final Form<ConnInstanceTO> connectorPropForm = new Form<>("connectorPropForm");
+ connectorPropForm.setModel(new CompoundPropertyModel<>(connInstanceTO));
+ connectorPropForm.setOutputMarkupId(true);
+ propertiesContainer.add(connectorPropForm);
+
+ final AjaxTextFieldPanel displayName = new AjaxTextFieldPanel(
+ "displayName", "display name", new PropertyModel<String>(connInstanceTO, "displayName"));
+ displayName.setOutputMarkupId(true);
+ displayName.addRequiredLabel();
+ connectorForm.add(displayName);
+
+ final AjaxDropDownChoicePanel<String> location = new AjaxDropDownChoicePanel<>("location", "location",
+ new Model<>(bundleTO == null ? null : bundleTO.getLocation()));
+ ((DropDownChoice<String>) location.getField()).setNullValid(true);
+ location.setStyleSheet("long_dynamicsize");
+ location.setChoices(new ArrayList<>(mapConnBundleTOs.keySet()));
+ location.setRequired(true);
+ location.addRequiredLabel();
+ location.setOutputMarkupId(true);
+ location.setEnabled(connInstanceTO.getKey() == 0);
+ location.getField().setOutputMarkupId(true);
+ connectorForm.add(location);
+
+ final AjaxDropDownChoicePanel<String> connectorName = new AjaxDropDownChoicePanel<>("connectorName",
+ "connectorName",
+ new Model<>(bundleTO == null ? null : bundleTO.getBundleName()));
+ ((DropDownChoice<String>) connectorName.getField()).setNullValid(true);
+ connectorName.setStyleSheet("long_dynamicsize");
+ connectorName.setChoices(bundleTO == null
+ ? new ArrayList<String>()
+ : new ArrayList<>(mapConnBundleTOs.get(connInstanceTO.getLocation()).keySet()));
+ connectorName.setRequired(true);
+ connectorName.addRequiredLabel();
+ connectorName.setEnabled(connInstanceTO.getLocation() != null);
+ connectorName.setOutputMarkupId(true);
+ connectorName.setEnabled(connInstanceTO.getKey() == 0);
+ connectorName.getField().setOutputMarkupId(true);
+ connectorForm.add(connectorName);
+
+ final AjaxDropDownChoicePanel<String> version = new AjaxDropDownChoicePanel<>("version", "version",
+ new Model<>(bundleTO == null ? null : bundleTO.getVersion()));
+ version.setStyleSheet("long_dynamicsize");
+ version.setChoices(bundleTO == null
+ ? new ArrayList<String>()
+ : new ArrayList<>(mapConnBundleTOs.get(connInstanceTO.getLocation()).
+ get(connInstanceTO.getBundleName()).keySet()));
+ version.setRequired(true);
+ version.addRequiredLabel();
+ version.setEnabled(connInstanceTO.getBundleName() != null);
+ version.setOutputMarkupId(true);
+ version.addRequiredLabel();
+ version.getField().setOutputMarkupId(true);
+ connectorForm.add(version);
+
+ final SpinnerFieldPanel<Integer> connRequestTimeout = new SpinnerFieldPanel<>("connRequestTimeout",
+ "connRequestTimeout", Integer.class,
+ new PropertyModel<Integer>(connInstanceTO, "connRequestTimeout"), 0, null);
+ connRequestTimeout.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
+ connectorForm.add(connRequestTimeout);
+
+ if (connInstanceTO.getPoolConf() == null) {
+ connInstanceTO.setPoolConf(new ConnPoolConfTO());
+ }
+ final SpinnerFieldPanel<Integer> poolMaxObjects = new SpinnerFieldPanel<>("poolMaxObjects", "poolMaxObjects",
+ Integer.class,
+ new PropertyModel<Integer>(connInstanceTO.getPoolConf(), "maxObjects"), 0, null);
+ poolMaxObjects.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
+ connectorForm.add(poolMaxObjects);
+ final SpinnerFieldPanel<Integer> poolMinIdle = new SpinnerFieldPanel<>("poolMinIdle", "poolMinIdle",
+ Integer.class,
+ new PropertyModel<Integer>(connInstanceTO.getPoolConf(), "minIdle"), 0, null);
+ poolMinIdle.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
+ connectorForm.add(poolMinIdle);
+ final SpinnerFieldPanel<Integer> poolMaxIdle = new SpinnerFieldPanel<>("poolMaxIdle", "poolMaxIdle",
+ Integer.class,
+ new PropertyModel<Integer>(connInstanceTO.getPoolConf(), "maxIdle"), 0, null);
+ poolMaxIdle.getField().add(new RangeValidator<>(0, Integer.MAX_VALUE));
+ connectorForm.add(poolMaxIdle);
+ final SpinnerFieldPanel<Long> poolMaxWait = new SpinnerFieldPanel<>("poolMaxWait", "poolMaxWait", Long.class,
+ new PropertyModel<Long>(connInstanceTO.getPoolConf(), "maxWait"), 0L, null);
+ poolMaxWait.getField().add(new RangeValidator<>(0L, Long.MAX_VALUE));
+ connectorForm.add(poolMaxWait);
+ final SpinnerFieldPanel<Long> poolMinEvictableIdleTime = new SpinnerFieldPanel<>("poolMinEvictableIdleTime",
+ "poolMinEvictableIdleTime", Long.class,
+ new PropertyModel<Long>(connInstanceTO.getPoolConf(), "minEvictableIdleTimeMillis"),
+ 0L, null);
+ poolMinEvictableIdleTime.getField().add(new RangeValidator<>(0L, Long.MAX_VALUE));
+ connectorForm.add(poolMinEvictableIdleTime);
+
+ // form - first tab - onchange()
+ location.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ ((DropDownChoice<String>) location.getField()).setNullValid(false);
+ connInstanceTO.setLocation(location.getModelObject());
+ target.add(location);
+
+ connectorName.setChoices(new ArrayList<>(
+ mapConnBundleTOs.get(location.getModelObject()).keySet()));
+ connectorName.setEnabled(true);
+ connectorName.getField().setModelValue(null);
+ target.add(connectorName);
+
+ version.setChoices(new ArrayList<String>());
+ version.getField().setModelValue(null);
+ version.setEnabled(false);
+ target.add(version);
+
+ properties.clear();
+ target.add(propertiesContainer);
+ }
+ });
+ connectorName.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ ((DropDownChoice<String>) connectorName.getField()).setNullValid(false);
+ connInstanceTO.setBundleName(connectorName.getModelObject());
+ target.add(connectorName);
+
+ List<String> versions = new ArrayList<>(
+ mapConnBundleTOs.get(location.getModelObject()).get(connectorName.getModelObject()).keySet());
+ version.setChoices(versions);
+ version.setEnabled(true);
+ if (versions.size() == 1) {
+ selectVersion(target, connInstanceTO, version, versions.get(0));
+ version.getField().setModelObject(versions.get(0));
+ } else {
+ version.getField().setModelValue(null);
+ properties.clear();
+ target.add(propertiesContainer);
+ }
+ target.add(version);
+ }
+ });
+ version.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ selectVersion(target, connInstanceTO, version, version.getModelObject());
+ }
+ });
+
+ // form - second tab (properties)
+ final ListView<ConnConfProperty> connPropView = new ConnConfPropertyListView("connectorProperties",
+ new PropertyModel<List<ConnConfProperty>>(this, "properties"),
+ true, connInstanceTO.getConfiguration());
+ connPropView.setOutputMarkupId(true);
+ connectorPropForm.add(connPropView);
+
+ final AjaxButton check = new IndicatingAjaxButton("check", new ResourceModel("check")) {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ final ConnInstanceTO conn = (ConnInstanceTO) form.getModelObject();
+
+ // ensure that connector bundle information is in sync
+ conn.setBundleName(bundleTO.getBundleName());
+ conn.setVersion(bundleTO.getVersion());
+ conn.setConnectorName(bundleTO.getConnectorName());
+
+ if (connectorRestClient.check(conn)) {
+ info(getString("success_connection"));
+ } else {
+ error(getString("error_connection"));
+ }
+
+ feedbackPanel.refresh(target);
+ }
+ };
+ connectorPropForm.add(check);
+
+ // form - third tab (capabilities)
+ final IModel<List<ConnectorCapability>> capabilities
+ = new LoadableDetachableModel<List<ConnectorCapability>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<ConnectorCapability> load() {
+ return Arrays.asList(ConnectorCapability.values());
+ }
+ };
+ CheckBoxMultipleChoice<ConnectorCapability> capabilitiesPalette = new CheckBoxMultipleChoice<>(
+ "capabilitiesPalette",
+ new PropertyModel<List<ConnectorCapability>>(this, "selectedCapabilities"), capabilities);
+
+ capabilitiesPalette.add(new AjaxFormChoiceComponentUpdatingBehavior() {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ }
+ });
+
+ connectorForm.add(capabilitiesPalette);
+
+ // form - submit / cancel buttons
+ final AjaxButton submit = new IndicatingAjaxButton(APPLY, new Model<>(getString(SUBMIT))) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ final ConnInstanceTO conn = (ConnInstanceTO) form.getModelObject();
+
+ conn.setConnectorName(bundleTO.getConnectorName());
+ conn.setBundleName(bundleTO.getBundleName());
+ conn.setVersion(bundleTO.getVersion());
+ conn.getConfiguration().clear();
+ conn.getConfiguration().addAll(connPropView.getModelObject());
+
+ // Set the model object's capabilities to capabilitiesPalette's converted Set
+ conn.getCapabilities().clear();
+ conn.getCapabilities().addAll(selectedCapabilities.isEmpty()
+ ? EnumSet.noneOf(ConnectorCapability.class)
+ : EnumSet.copyOf(selectedCapabilities));
+
+ // Reset pool configuration if all fields are null
+ if (conn.getPoolConf() != null
+ && conn.getPoolConf().getMaxIdle() == null
+ && conn.getPoolConf().getMaxObjects() == null
+ && conn.getPoolConf().getMaxWait() == null
+ && conn.getPoolConf().getMinEvictableIdleTimeMillis() == null
+ && conn.getPoolConf().getMinIdle() == null) {
+
+ conn.setPoolConf(null);
+ }
+
+ try {
+ if (connInstanceTO.getKey() == 0) {
+ connectorRestClient.create(conn);
+ } else {
+ connectorRestClient.update(conn);
+ }
+
+ ((BasePage) pageRef.getPage()).setModalResult(true);
+ window.close(target);
+ } catch (SyncopeClientException e) {
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ feedbackPanel.refresh(target);
+ ((BasePage) pageRef.getPage()).setModalResult(false);
+ LOG.error("While creating or updating connector {}", conn, e);
+ }
+ }
+
+ @Override
+ protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ feedbackPanel.refresh(target);
+ }
+ };
+ String entitlements = connInstanceTO.getKey() == 0
+ ? Entitlement.CONNECTOR_CREATE : Entitlement.CONNECTOR_UPDATE;
+
+ MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, entitlements);
+ connectorForm.add(submit);
+
+ final IndicatingAjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ window.close(target);
+ }
+ };
+ cancel.setDefaultFormProcessing(false);
+ connectorForm.add(cancel);
+ }
+
+ private ConnBundleTO getSelectedBundleTO(final ConnInstanceTO connInstanceTO) {
+ ConnBundleTO result = null;
+ if (connInstanceTO != null
+ && StringUtils.isNotBlank(connInstanceTO.getLocation())
+ && StringUtils.isNotBlank(connInstanceTO.getBundleName())
+ && StringUtils.isNotBlank(connInstanceTO.getVersion())
+ && mapConnBundleTOs.containsKey(connInstanceTO.getLocation())) {
+
+ Map<String, Map<String, ConnBundleTO>> byLocation = mapConnBundleTOs.get(connInstanceTO.getLocation());
+ if (byLocation.containsKey(connInstanceTO.getBundleName())) {
+ Map<String, ConnBundleTO> byName = byLocation.get(connInstanceTO.getBundleName());
+ if (byName.containsKey(connInstanceTO.getVersion())) {
+ result = byName.get(connInstanceTO.getVersion());
+ }
+ }
+ }
+ return result;
+ }
+
+ private List<ConnConfProperty> fillProperties(final ConnBundleTO bundleTO, final ConnInstanceTO connInstanceTO) {
+ final List<ConnConfProperty> props = new ArrayList<>();
+
+ if (bundleTO != null) {
+ for (ConnConfPropSchema key : bundleTO.getProperties()) {
+ final ConnConfProperty property = new ConnConfProperty();
+ property.setSchema(key);
+ if (connInstanceTO.getKey() != 0
+ && connInstanceTO.getConfigurationMap().containsKey(key.getName())
+ && connInstanceTO.getConfigurationMap().get(key.getName()).getValues() != null) {
+
+ property.getValues().addAll(connInstanceTO.getConfigurationMap().get(key.getName()).getValues());
+ property.setOverridable(connInstanceTO.getConfigurationMap().get(key.getName()).isOverridable());
+ }
+
+ if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) {
+ property.getValues().addAll(key.getDefaultValues());
+ }
+
+ props.add(property);
+ }
+ }
+
+ // re-order properties (implements Comparable)
+ Collections.sort(props);
+ return props;
+ }
+
+ private void selectVersion(final AjaxRequestTarget target, final ConnInstanceTO connInstanceTO,
+ final AjaxDropDownChoicePanel<String> version, final String versionValue) {
+
+ connInstanceTO.setVersion(versionValue);
+ target.add(version);
+
+ bundleTO = getSelectedBundleTO(connInstanceTO);
+ properties = fillProperties(bundleTO, connInstanceTO);
+ target.add(propertiesContainer);
+ }
+
+ public List<ConnConfProperty> getProperties() {
+ return properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/panels/Connectors.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Connectors.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Connectors.java
deleted file mode 100644
index 18f28d7..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Connectors.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import static org.apache.wicket.Component.ENABLE;
-import static org.apache.wicket.Component.RENDER;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.syncope.client.console.PreferenceManager;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.pages.ConnectorModalPage;
-import org.apache.syncope.client.console.rest.ConnectorRestClient;
-import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.types.Entitlement;
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.attributes.AjaxCallListener;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
-import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Resources WebPage.
- */
-public class Connectors extends Panel {
-
- private static final long serialVersionUID = -3789252860990261728L;
-
- protected static final Logger LOG = LoggerFactory.getLogger(Connectors.class);
-
- private static final int WIN_HEIGHT = 600;
-
- private static final int WIN_WIDTH = 1100;
-
- @SpringBean
- private ConnectorRestClient connectorRestClient;
-
- @SpringBean
- private PreferenceManager prefMan;
-
- private final ModalWindow createConnectorWin;
-
- private final ModalWindow editConnectorWin;
-
- private final int connectorPaginatorRows;
-
- private WebMarkupContainer connectorContainer;
-
- /**
- * Modal window to be used for user status management.
- */
- protected final ModalWindow statusmodal = new ModalWindow("statusModal");
-
- /**
- * Schemas to be shown modal window height.
- */
- private static final int STATUS_MODAL_WIN_HEIGHT = 500;
-
- /**
- * Schemas to be shown modal window width.
- */
- private static final int STATUS_MODAL_WIN_WIDTH = 700;
-
- private final PageReference pageRef;
-
- public Connectors(final String id, final PageReference pageRef) {
- super(id);
- this.pageRef = pageRef;
-
- createConnectorWin = new ModalWindow("createConnectorWin");
- add(createConnectorWin);
-
- editConnectorWin = new ModalWindow("editConnectorWin");
- add(editConnectorWin);
-
- statusmodal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- statusmodal.setInitialHeight(STATUS_MODAL_WIN_HEIGHT);
- statusmodal.setInitialWidth(STATUS_MODAL_WIN_WIDTH);
- statusmodal.setCookieName("status-modal");
- add(statusmodal);
-
- AjaxLink<Void> reloadLink = new ClearIndicatingAjaxLink<Void>("reloadLink", pageRef) {
-
- private static final long serialVersionUID = 3109256773218160485L;
-
- @Override
- protected void onClickInternal(final AjaxRequestTarget target) {
- try {
- connectorRestClient.reload();
- info(getString(Constants.OPERATION_SUCCEEDED));
- } catch (Exception e) {
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getFeedbackPanel().refresh(target);
- target.add(connectorContainer);
- }
-
- @Override
- protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
-
- final AjaxCallListener ajaxCallListener = new AjaxCallListener() {
-
- private static final long serialVersionUID = 7160235486520935153L;
-
- @Override
- public CharSequence getPrecondition(final Component component) {
- return "if (!confirm('" + getString("confirmReloadConnectors") + "')) "
- + "{return false;} else {return true;}";
- }
- };
- attributes.getAjaxCallListeners().add(ajaxCallListener);
- }
- };
- MetaDataRoleAuthorizationStrategy.authorize(reloadLink, ENABLE, Entitlement.CONNECTOR_RELOAD);
- add(reloadLink);
-
- connectorPaginatorRows = prefMan.getPaginatorRows(getRequest(), Constants.PREF_CONNECTORS_PAGINATOR_ROWS);
-
- setupConnectors();
- }
-
- private void setupConnectors() {
- List<IColumn<ConnInstanceTO, String>> columns = new ArrayList<>();
-
- columns.add(new PropertyColumn<ConnInstanceTO, String>(
- new StringResourceModel("key", this, null), "key", "key"));
- columns.add(new PropertyColumn<ConnInstanceTO, String>(
- new StringResourceModel("name", this, null), "connectorName", "connectorName"));
- columns.add(new PropertyColumn<ConnInstanceTO, String>(
- new StringResourceModel("displayName", this, null), "displayName", "displayName"));
- columns.add(new PropertyColumn<ConnInstanceTO, String>(
- new StringResourceModel("bundleName", this, null), "bundleName", "bundleName"));
- columns.add(new PropertyColumn<ConnInstanceTO, String>(
- new StringResourceModel("version", this, null), "version", "version"));
- columns.add(new AbstractColumn<ConnInstanceTO, String>(new StringResourceModel("actions", this, null, "")) {
-
- private static final long serialVersionUID = 2054811145491901166L;
-
- @Override
- public String getCssClass() {
- return "action";
- }
-
- @Override
- public void populateItem(final Item<ICellPopulator<ConnInstanceTO>> cellItem, final String componentId,
- final IModel<ConnInstanceTO> model) {
-
- final ConnInstanceTO connectorTO = model.getObject();
-
- final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, pageRef);
-
- panel.add(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- editConnectorWin.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- return new ConnectorModalPage(Connectors.this.pageRef,
- editConnectorWin,
- connectorTO);
- }
- });
-
- editConnectorWin.show(target);
- }
- }, ActionLink.ActionType.EDIT, "Connectors");
-
- panel.add(new ActionLink() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- try {
- connectorRestClient.delete(connectorTO.getKey());
- info(getString(Constants.OPERATION_SUCCEEDED));
- } catch (SyncopeClientException e) {
- error(getString(Constants.ERROR) + ": " + e.getMessage());
-
- LOG.error("While deleting connector " + connectorTO.getKey(), e);
- }
-
- target.add(connectorContainer);
- ((BasePage) pageRef.getPage()).getFeedbackPanel().refresh(target);
- }
- }, ActionLink.ActionType.DELETE, "Connectors");
-
- cellItem.add(panel);
- }
- });
-
- final AjaxDataTablePanel<ConnInstanceTO, String> table = new AjaxDataTablePanel<>(
- "connectorDatatable",
- columns,
- (ISortableDataProvider<ConnInstanceTO, String>) new ConnectorsProvider(),
- connectorPaginatorRows,
- Arrays.asList(new ActionLink.ActionType[] { ActionLink.ActionType.DELETE }),
- connectorRestClient,
- "key",
- "Connectors",
- pageRef);
-
- connectorContainer = new WebMarkupContainer("connectorContainer");
- connectorContainer.add(table);
- connectorContainer.setOutputMarkupId(true);
-
- MetaDataRoleAuthorizationStrategy.authorize(connectorContainer, RENDER, Entitlement.CONNECTOR_LIST);
-
- add(connectorContainer);
-
- ((BasePage) pageRef.getPage()).setWindowClosedCallback(createConnectorWin, connectorContainer);
- ((BasePage) pageRef.getPage()).setWindowClosedCallback(editConnectorWin, connectorContainer);
-
- createConnectorWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- createConnectorWin.setInitialHeight(WIN_HEIGHT);
- createConnectorWin.setInitialWidth(WIN_WIDTH);
- createConnectorWin.setCookieName("create-conn-modal");
-
- editConnectorWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
- editConnectorWin.setInitialHeight(WIN_HEIGHT);
- editConnectorWin.setInitialWidth(WIN_WIDTH);
- editConnectorWin.setCookieName("edit-conn-modal");
-
- AjaxLink<Void> createConnectorLink
- = new ClearIndicatingAjaxLink<Void>("createConnectorLink", pageRef) {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- protected void onClickInternal(final AjaxRequestTarget target) {
- createConnectorWin.setPageCreator(new ModalWindow.PageCreator() {
-
- private static final long serialVersionUID = -7834632442532690940L;
-
- @Override
- public Page createPage() {
- ConnectorModalPage form = new ConnectorModalPage(
- pageRef, editConnectorWin, new ConnInstanceTO());
- return form;
- }
- });
-
- createConnectorWin.show(target);
- }
- };
-
- MetaDataRoleAuthorizationStrategy.authorize(createConnectorLink, ENABLE, Entitlement.CONNECTOR_CREATE);
-
- add(createConnectorLink);
-
- @SuppressWarnings("rawtypes")
- Form paginatorForm = new Form("connectorPaginatorForm");
-
- MetaDataRoleAuthorizationStrategy.authorize(paginatorForm, RENDER, Entitlement.CONNECTOR_LIST);
-
- final DropDownChoice<Integer> rowsChooser = new DropDownChoice<>(
- "rowsChooser",
- new PropertyModel<Integer>(this,
- "connectorPaginatorRows"),
- prefMan.getPaginatorChoices());
-
- rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- prefMan.set(getRequest(), getResponse(), Constants.PREF_CONNECTORS_PAGINATOR_ROWS,
- String.valueOf(connectorPaginatorRows));
- table.setItemsPerPage(connectorPaginatorRows);
-
- target.add(connectorContainer);
- }
- });
-
- paginatorForm.add(rowsChooser);
- add(paginatorForm);
- }
-
- private class ConnectorsProvider extends SortableDataProvider<ConnInstanceTO, String> {
-
- private static final long serialVersionUID = 4445909568349448518L;
-
- private final SortableDataProviderComparator<ConnInstanceTO> comparator;
-
- public ConnectorsProvider() {
- super();
- //Default sorting
- setSort("key", SortOrder.ASCENDING);
- comparator = new SortableDataProviderComparator<>(this);
- }
-
- @Override
- public Iterator<ConnInstanceTO> iterator(final long first, final long count) {
- List<ConnInstanceTO> list = connectorRestClient.getAllConnectors();
-
- Collections.sort(list, comparator);
-
- return list.subList((int) first, (int) first + (int) count).iterator();
- }
-
- @Override
- public long size() {
- return connectorRestClient.getAllConnectors().size();
- }
-
- @Override
- public IModel<ConnInstanceTO> model(final ConnInstanceTO connector) {
-
- return new AbstractReadOnlyModel<ConnInstanceTO>() {
-
- private static final long serialVersionUID = -6033068018293569398L;
-
- @Override
- public ConnInstanceTO getObject() {
- return connector;
- }
- };
- }
- }
-
- @Override
- public void onEvent(final IEvent<?> event) {
- if (event.getPayload() instanceof AbstractSearchResultPanel.EventDataWrapper) {
- ((AbstractSearchResultPanel.EventDataWrapper) event.getPayload()).getTarget().add(connectorContainer);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalContent.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalContent.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalContent.java
new file mode 100644
index 0000000..fbf8802
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalContent.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.rest.ConnectorRestClient;
+import org.apache.syncope.client.console.rest.ResourceRestClient;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Modal window with Resource form.
+ */
+public class ModalContent extends Panel {
+
+ private static final long serialVersionUID = 8611724965544132636L;
+
+ protected static final Logger LOG = LoggerFactory.getLogger(ModalContent.class);
+
+ protected static final String CANCEL = "cancel";
+
+ protected static final String SUBMIT = "submit";
+
+ protected static final String APPLY = "apply";
+
+ protected static final String FORM = "form";
+
+ @SpringBean
+ protected ResourceRestClient resourceRestClient;
+
+ @SpringBean
+ protected ConnectorRestClient connectorRestClient;
+
+ protected NotificationPanel feedbackPanel;
+
+ private final PageReference pageRef;
+
+ private final ModalWindow window;
+
+ public ModalContent(final ModalWindow window, final PageReference pageRef) {
+ super(window.getContentId());
+ this.pageRef = pageRef;
+ this.window = window;
+
+ feedbackPanel = new NotificationPanel(Constants.FEEDBACK);
+ feedbackPanel.setOutputMarkupId(true);
+ add(feedbackPanel);
+ }
+
+ /**
+ * Generic modal event.
+ */
+ public static class ModalEvent {
+
+ /**
+ * Request target.
+ */
+ private final AjaxRequestTarget target;
+
+ /**
+ * Constructor.
+ *
+ * @param target request target.
+ */
+ public ModalEvent(final AjaxRequestTarget target) {
+ this.target = target;
+ }
+
+ /**
+ * Target getter.
+ *
+ * @return request target.
+ */
+ public AjaxRequestTarget getTarget() {
+ return target;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
index 6f2a17b..1b536c4 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
@@ -24,7 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.syncope.client.console.pages.BaseModalPage;
-import org.apache.syncope.client.console.pages.ResourceModalPage.ResourceEvent;
+import org.apache.syncope.client.console.panels.ModalContent.ModalEvent;
import org.apache.syncope.client.console.panels.ResourceDetailsPanel.DetailsModEvent;
import org.apache.syncope.client.console.rest.ConnectorRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel.MultiValueSelectorEvent;
@@ -148,7 +148,7 @@ public class ResourceConnConfPanel extends Panel {
AjaxRequestTarget target = null;
if (event.getPayload() instanceof DetailsModEvent) {
// connector change: update properties and forward event
- target = ((ResourceEvent) event.getPayload()).getTarget();
+ target = ((ModalEvent) event.getPayload()).getTarget();
connConfProperties = getConnConfProperties();
check.setEnabled(!connConfProperties.isEmpty());
@@ -167,7 +167,7 @@ public class ResourceConnConfPanel extends Panel {
/**
* Connector configuration properties modification event.
*/
- public static class ConnConfModEvent extends ResourceEvent {
+ public static class ConnConfModEvent extends ModalEvent {
private final List<ConnConfProperty> configuration;
http://git-wip-us.apache.org/repos/asf/syncope/blob/a2051012/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
index 3095b4e..ff5cac3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
@@ -22,7 +22,7 @@ import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.pages.ResourceModalPage.ResourceEvent;
+import org.apache.syncope.client.console.panels.ModalContent.ModalEvent;
import org.apache.syncope.client.console.rest.ConnectorRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -89,9 +89,9 @@ public class ResourceDetailsPanel extends Panel {
"propagationPrimary"));
add(propagationPrimary);
- final SpinnerFieldPanel<Integer> propagationPriority =
- new SpinnerFieldPanel<>("propagationPriority", "propagationPriority", Integer.class,
- new PropertyModel<Integer>(resourceTO, "propagationPriority"), null, null);
+ final SpinnerFieldPanel<Integer> propagationPriority = new SpinnerFieldPanel<>("propagationPriority",
+ "propagationPriority", Integer.class,
+ new PropertyModel<Integer>(resourceTO, "propagationPriority"), null, null);
add(propagationPriority);
final AjaxDropDownChoicePanel<PropagationMode> propagationMode = new AjaxDropDownChoicePanel<>(
@@ -152,7 +152,7 @@ public class ResourceDetailsPanel extends Panel {
actionsClass.setRequired(true);
item.add(actionsClass);
- AjaxLink<Void> minus = new IndicatingAjaxLink<Void>("drop") {
+ final AjaxLink<Void> minus = new IndicatingAjaxLink<Void>("drop") {
private static final long serialVersionUID = -7978723352517770644L;
@@ -222,7 +222,7 @@ public class ResourceDetailsPanel extends Panel {
new ResourceModel("connector", "connector").getObject(),
new PropertyModel<ConnInstanceTO>(this, "connInstanceTO"));
conn.setChoices(connectors.getObject());
- conn.setChoiceRenderer(new ChoiceRenderer<String>("displayName", "key"));
+ conn.setChoiceRenderer(new ChoiceRenderer<>("displayName", "key"));
conn.getField().setModel(new IModel<ConnInstanceTO>() {
@@ -245,7 +245,7 @@ public class ResourceDetailsPanel extends Panel {
});
conn.addRequiredLabel();
- conn.setEnabled(createFlag);
+ conn.setEnabled(false);
conn.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -292,7 +292,7 @@ public class ResourceDetailsPanel extends Panel {
/**
* Connector instance modification event.
*/
- public static class DetailsModEvent extends ResourceEvent {
+ public static class DetailsModEvent extends ModalEvent {
/**
* Constructor.