lot new stuff

This commit is contained in:
Robert Nasarek 2023-10-23 09:51:43 +02:00
parent e0db22915b
commit 2178db78f5
17 changed files with 72 additions and 18 deletions

0
README.md Normal file → Executable file
View file

12
css/style.css Normal file → Executable file
View file

@ -1,30 +1,30 @@
/* Reset the table styles */
table.wisski-cloud-account-manager-table {
table.wcam--table {
border-collapse: collapse;
width: 100%;
}
/* Style for table headers */
table.wisski-cloud-account-manager-table th {
table.wcam--table th {
background-color: #f2f2f2;
padding: 8px;
text-align: center;
}
/* Alternate row background color */
table.wisski-cloud-account-manager-table tr:nth-child(even) {
table.wcam--table tr:nth-child(even) {
background-color: #f2f2f2;
}
/* Style for table cells */
table.wisski-cloud-account-manager-table td {
table.wcam--table td {
padding: 8px;
border: 1px solid #dddddd;
}
/* Center-align certain cells */
table.wisski-cloud-account-manager-table td.valid,
table.wisski-cloud-account-manager-table td.provisioned {
table.wcam--table td.valid,
table.wcam--table td.provisioned {
text-align: center;
}

42
js/accountOptions.js Normal file
View file

@ -0,0 +1,42 @@
(function ($, Drupal, once) {
'use strict';
/**
* Implements collapsing of individual pathbuilder rows using a caret
*/
Drupal.behaviors.accountOptions = {
attach: function (context, settings) {
once('accountOptions', '#wcam--table', context).forEach(function (form) {
$('.wcam--select').change(function () {
console.log($(this))
let selectedOption = $(this).val();
let itemId = $(this).closest('tr').find('.wcam--row--item-id').text();
switch (selectedOption) {
case 'delete':
// Führen Sie hier Ihren JavaScript-Code für 'delete' aus.
console.log('delete:', itemId);
break;
case 'edit':
// Führen Sie hier Ihren JavaScript-Code für 'edit' aus.
console.log('Edit:', itemId);
break;
case 'provise':
// Führen Sie hier Ihren JavaScript-Code für 'provise' aus.
console.log('Provise', itemId);
break;
case 'validate':
// Führen Sie hier Ihren JavaScript-Code für 'validate' aus.
console.log('Die Option "validate" wurde ausgewählt.');
break;
default:
console.log('Eine andere Option wurde ausgewählt.');
}
});
});
}
};
})(jQuery, Drupal, once);

0
src/Controller/WisskiCloudAccountManagerController.php Normal file → Executable file
View file

4
src/Form/WisskiCloudAccountManagerCreateForm.php Normal file → Executable file
View file

@ -8,6 +8,7 @@ use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\wisski_cloud_account_manager\WisskiCloudAccountManagerDaemonApiActions;
use mysql_xdevapi\Exception;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@ -230,6 +231,9 @@ class WisskiCloudAccountManagerCreateForm extends FormBase {
$account["subdomain"] = $field['subdomain'];
$accountResponse = $this->wisskiCloudAccountManagerDaemonApiActions->addAccount($account);
if (!$accountResponse['success']) {
throw new Exception('Get no valid response from api daemon. Can not send validiation email.');
};
$this->wisskiCloudAccountManagerDaemonApiActions->sendValidationEmail($accountResponse['data']['email'], $accountResponse['data']['validationCode']);
$this->messenger()

15
src/Form/WisskiCloudAccountManagerSettingsForm.php Normal file → Executable file
View file

@ -36,35 +36,35 @@ class WisskiCloudAccountManagerSettingsForm extends ConfigFormBase {
$config = $this->config('wisski_cloud_account_manager.settings');
$form['daemonUrl'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('The WissKI Cloud API Daemon URL'),
'#description' => $this->t('Provide the complete base URL with protocol, domain (resp. service name in docker), ports and API path, i. e. "http://wisski_cloud_api_daemon:3000/wisski-cloud-daemon/api/v1"'),
'#default_value' => $config->get('daemonUrl'),
];
$form['allAccounts'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('All accounts URL path'),
'#description' => $this->t('Provide the endpoint to the GET endpoint for all accounts, i. e. "http://wisski_cloud_api_daemon:3000/wisski-cloud-daemon/api/v1/account/all"'),
'#description' => $this->t('Provide the endpoint to the GET endpoint for all accounts, i. e. "/account/all"'),
'#default_value' => $config->get('allAccounts'),
];
$form['accountPostUrlPath'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('POST URL path'),
'#description' => $this->t('Provide the path to the POST endpoint, i. e. "/account"'),
'#default_value' => $config->get('accountPostUrlPath'),
];
$form['accountFilterByData'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('Filter by Data URL path'),
'#description' => $this->t('Provide the path to the Get account by data endpoint, i. e. "/account/by_data"'),
'#default_value' => $config->get('accountFilterByData'),
];
$form['accountValidation'] = [
'#type' => 'url',
'#type' => 'textfield',
'#title' => $this->t('User Validation URL path'),
'#description' => $this->t('Provide the path to the account validation PUT endpoint, i. e. "/account/validation"'),
'#default_value' => $config->get('accountValidation'),
@ -121,8 +121,9 @@ class WisskiCloudAccountManagerSettingsForm extends ConfigFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('wisski_cloud_account_manager.settings');
$config->set('daemonURL', $form_state->getValue('daemonURL'))
$config->set('daemonUrl', $form_state->getValue('daemonUrl'))
->set('accountPostUrlPath', $form_state->getValue('accountPostUrlPath'))
->set('allAccounts', $form_state->getValue('allAccounts'))
->set('accountFilterByData', $form_state->getValue('accountFilterByData'))
->set('accountProvisionAndValidationCheck', $form_state->getValue('accountProvisionAndValidationCheck'))
->set('accountValidation', $form_state->getValue('accountValidation'))

0
src/WisskiCloudAccountManagerDaemonApiActions.php Normal file → Executable file
View file

View file

@ -1,7 +1,7 @@
{# wisski_cloud_account_manager/templates/wisski_cloud_account_manager_account_managing_page.html.twig #}
<div>
{% if accounts is not empty %}
<table class="wisski-cloud-account-manager-table">
<table id="wcam--table" class="wcam--table">
<tr>
<th>Id</th>
<th>Person name</th>
@ -13,8 +13,8 @@
<th>Options</th>
</tr>
{% for item in accounts.data %}
<tr>
<td>{{ item._id }}</td>
<tr class="wcam--table--row">
<td class="wcam--row--item-id">{{ item._id }}</td>
<td>{{ item.personName }}</td>
<td>{{ item.email }}</td>
<td>{{ item.username }}</td>
@ -37,8 +37,9 @@
{% else %}
unknown
{% endif %}</td>
<td><label for="account-edit"></label>
<select name="account-edit" id="account-edit">
<td><label for="wcam--account-edit--{{ item._id }}"></label>
<select class="wcam--select" name="account-edit" id="wcam--account-edit--{{ item._id }}">
<option value="">select...</option>
<option value="edit">edit</option>
{% if item.valid == 0 %}
<option value="validate">validate</option>

View file

0
wisski_cloud_account_manager.info.yml Normal file → Executable file
View file

6
wisski_cloud_account_manager.libraries.yml Normal file → Executable file
View file

@ -3,3 +3,9 @@ wisski_cloud_account_manager:
css:
theme:
css/style.css: {}
js:
js/accountOptions.js: {}
dependencies:
- core/jquery
- core/drupalSettings
- core/Drupal

0
wisski_cloud_account_manager.links.menu.yml Normal file → Executable file
View file

0
wisski_cloud_account_manager.module Normal file → Executable file
View file

0
wisski_cloud_account_manager.permissions.yml Normal file → Executable file
View file

0
wisski_cloud_account_manager.routing.yml Normal file → Executable file
View file

0
wisski_cloud_account_manager.services.yml Normal file → Executable file
View file