From e3c409fd5f8f25feaeb428d1362c4a971676ca82 Mon Sep 17 00:00:00 2001 From: Dusan Date: Wed, 6 Nov 2024 09:10:19 +0100 Subject: [PATCH] update --- tools/db-browser/.gitignore | 4 - tools/db-browser/README.md | 0 tools/db-browser/api/browse/data.php | 103 -------- tools/db-browser/browse.php | 232 ------------------ tools/db-browser/composer.json | 11 - tools/db-browser/create.php | 183 --------------- tools/db-browser/databases.php | 294 ----------------------- tools/db-browser/download.php | 150 ------------ tools/db-browser/edit.php | 200 ---------------- tools/db-browser/export.php | 93 -------- tools/db-browser/files/logo.png | Bin 15603 -> 0 bytes tools/db-browser/import.php | 337 --------------------------- tools/db-browser/includes/footer.php | 15 -- tools/db-browser/includes/header.php | 51 ---- tools/db-browser/includes/lib.php | 216 ----------------- tools/db-browser/index.php | 62 ----- tools/db-browser/init.php | 21 -- tools/db-browser/login.php | 123 ---------- tools/db-browser/logout.php | 16 -- tools/db-browser/record.php | 40 ---- tools/db-browser/style.css | 167 ------------- tools/db-browser/test-import.json | 23 -- tools/db-browser/userinfo.php | 88 ------- 23 files changed, 2429 deletions(-) delete mode 100644 tools/db-browser/.gitignore delete mode 100644 tools/db-browser/README.md delete mode 100644 tools/db-browser/api/browse/data.php delete mode 100644 tools/db-browser/browse.php delete mode 100644 tools/db-browser/composer.json delete mode 100644 tools/db-browser/create.php delete mode 100644 tools/db-browser/databases.php delete mode 100644 tools/db-browser/download.php delete mode 100644 tools/db-browser/edit.php delete mode 100644 tools/db-browser/export.php delete mode 100644 tools/db-browser/files/logo.png delete mode 100644 tools/db-browser/import.php delete mode 100644 tools/db-browser/includes/footer.php delete mode 100644 tools/db-browser/includes/header.php delete mode 100644 tools/db-browser/includes/lib.php delete mode 100644 tools/db-browser/index.php delete mode 100644 tools/db-browser/init.php delete mode 100644 tools/db-browser/login.php delete mode 100644 tools/db-browser/logout.php delete mode 100644 tools/db-browser/record.php delete mode 100644 tools/db-browser/style.css delete mode 100644 tools/db-browser/test-import.json delete mode 100644 tools/db-browser/userinfo.php diff --git a/tools/db-browser/.gitignore b/tools/db-browser/.gitignore deleted file mode 100644 index 3b7eb62..0000000 --- a/tools/db-browser/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/vendor -/log -/config.php -composer.lock \ No newline at end of file diff --git a/tools/db-browser/README.md b/tools/db-browser/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/tools/db-browser/api/browse/data.php b/tools/db-browser/api/browse/data.php deleted file mode 100644 index 4d900de..0000000 --- a/tools/db-browser/api/browse/data.php +++ /dev/null @@ -1,103 +0,0 @@ - $columns[$order[0]['column']], - 'direction' => $direction - ]; -} - -checkIfClientIsLogged(); - -$api = new \DtxsPhpClient\Client\Client(getApiConfig()); -$api->getAccessToken(); - -$params = $_GET; - -$api->setDatabase($params['database']); - -$aggregate = false; -$search = (string) $params['search']['value']; -if (strlen($search) > 2) $aggregate = true; - -$allFilteredRecords = $api->getRecords( - NULL, - NULL, - [ - 'aggregate' => $aggregate, - 'skip' => 0, - 'limit' => 0, - 'search' => addslashes($search), - ] -); - -$orderBy = getOrderBy($params['order']); - -$filteredRecords = $api->getRecords( - NULL, - NULL, - [ - 'aggregate' => $aggregate, - 'skip' => (int) $params['start'], - 'limit' => (int) $params['length'], - 'sort' => [ - $orderBy['sort'] => $orderBy['direction'] - ], - 'search' => addslashes($search) - ] -); - -$filteredRecordsFormatted = []; -foreach ($filteredRecords as $recordKey => $record) { - $tmpContent = $record['content']; - - unset($tmpContent['RecordInfo']); - - $filteredRecordsFormatted[$recordKey] = $record; - - $filteredRecordsFormatted[$recordKey]['content'] = formatRecordContentToHtml( - $tmpContent, - $params['database'], - $api - ); - - $filteredRecordsFormatted[$recordKey]['recordInfo'] = json_encode( - $record['content']['RecordInfo'], - JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE - ); - - $filteredRecordsFormatted[$recordKey]['recordInfo'] = - trim($filteredRecordsFormatted[$recordKey]['recordInfo'], "{} ") - ; - - $filteredRecordsFormatted[$recordKey]['recordInfo'] = - preg_replace('/\n /', "\n", $filteredRecordsFormatted[$recordKey]['recordInfo']) - ; - - $filteredRecordsFormatted[$recordKey]['editButton'] = - $record['class'] != "Database.Information" - ? "Edit" - : "" - ; -} - -echo json_encode([ - 'start' => $params['start'], - 'recordsTotal' => count($filteredRecords), - 'recordsFiltered' => count($allFilteredRecords), - 'data' => $filteredRecordsFormatted -]); \ No newline at end of file diff --git a/tools/db-browser/browse.php b/tools/db-browser/browse.php deleted file mode 100644 index 669a051..0000000 --- a/tools/db-browser/browse.php +++ /dev/null @@ -1,232 +0,0 @@ -getAccessToken(); - - if (!empty($databaseToDelete)) { - $api->setDatabase($databaseToDelete); - $api->deleteDatabase(); - header("Location: databases.php"); - } - - if ($database != "") { - echo " -
- -
- "; - } else { - echo " -
- -
-
-
-

- Database: is not selected -  Select database -

-
-
- "; - exit(); - } - - // activate database - $res = $api->setDatabase($database); - - // get all records - $allRecords = $api->getRecords(); - - // generate table - echo " -
-
-
- Back to list of databases - -
-

List of records from {$database}

-
- - -
- "; - - echo " - - "; -} catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - echo " - - "; -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $responseBody = @json_decode($e->getResponse()->getBody(true), TRUE); - echo " - - "; -} - -require __DIR__."/includes/footer.php"; diff --git a/tools/db-browser/composer.json b/tools/db-browser/composer.json deleted file mode 100644 index f1dae5a..0000000 --- a/tools/db-browser/composer.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "require": { - "wai-blue/dtxs-client-php": "@dev" - }, - "repositories": [ - { - "type": "path", - "url": "../php-api-client" - } - ] -} diff --git a/tools/db-browser/create.php b/tools/db-browser/create.php deleted file mode 100644 index aa749da..0000000 --- a/tools/db-browser/create.php +++ /dev/null @@ -1,183 +0,0 @@ - - - -"; - -echo " -

Create record

-"; - -try { - $api = new \DtxsDtxsPhpClient\Client\Client(getApiConfig()); - - // get access token - $api->getAccessToken(); - - $api->setDatabase($databaseToCreateRecord); - - if ($create) { - try { - $createdRecordId = $api->createRecord([ - "class" => $saveClass, - "content" => formatContent($saveContent) - ]); - - header("Location: browse.php?db={$databaseToCreateRecord}"); - } catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - throw new \DtxsPhpClient\Client\Exception\RequestException($e->getMessage()); - } - } else { - - $schemas = loadSchemas($api); - - // $schemasOptions = ""; - $schemasButtons = ""; - foreach (array_keys($schemas) as $schema) { - // $schemasOptions .= ""; - $schemasButtons .= " - {$schema} - "; - } - - echo " -
- -
- {$schemasButtons} -
-
-
-
- - - Cancel -
-
- - "; - } -} catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - echo " - - "; -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $responseBody = @json_decode($e->getResponse()->getBody(true), TRUE); - echo " - - "; -} - -require __DIR__."/includes/footer.php"; diff --git a/tools/db-browser/databases.php b/tools/db-browser/databases.php deleted file mode 100644 index 827e2af..0000000 --- a/tools/db-browser/databases.php +++ /dev/null @@ -1,294 +0,0 @@ - - - -"; - -try { - // Initiate API client - $api = new \DtxsPhpClient\Client\Client(getApiConfig()); - - // Get access token - $api->getAccessToken(); - - // Create new database - if (!empty($databaseToCreate)) { - try { - $api->createDatabase($databaseToCreate); - header("Location: browse.php?db={$databaseToCreate}"); - } catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - echo " - - "; - } - } - - // Delete database records - if (!empty($databaseToEmpty)) { - // database to empty - $api->setDatabase($databaseToEmpty); - $allRecords = $api->getRecords(['class' => ['$not' => ['$regex' => 'Database.Information']]]); - - foreach ($allRecords as $record) { - $api->deleteRecord($record['_id']); - } - - header("Location: databases.php"); - } - - // Get all databases - $allDatabases = $api->getDatabases(["class" => "Database.Information"]); - - echo " - - - "; - - // generate table - echo " -
-
-
-

List of databases

-
- - - - - - - - - - "; - - foreach ($allDatabases as $key => $database) { - echo " - - - - - "; - } - - echo " - -
Database nameAction
{$database['name']} - Browse - Import - Export - -
-
- "; - - echo " - - - - "; -} catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - echo " - - "; -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $responseBody = @json_decode($e->getResponse()->getBody(true), TRUE); - - echo " - - "; -} - -require __DIR__."/includes/footer.php"; - -?> diff --git a/tools/db-browser/download.php b/tools/db-browser/download.php deleted file mode 100644 index 8caeb81..0000000 --- a/tools/db-browser/download.php +++ /dev/null @@ -1,150 +0,0 @@ -downloadFile($f); - -echo "
{$fileContents}
"; - - -/* - -********************** pokusy s STS - -require __DIR__."/init.php"; -require __DIR__."/includes/header.php"; - -checkIfClientIsLogged(); - -$f = ($_GET['f'] ?? ""); - -if (empty($f)) exit("No file to download specified."); - -$api = new \DtxsPhpClient\Client\Client(getApiConfig()); - -// $fileContents = $api->downloadFile($f); - -// initiate S3 client -// $api->s3Client = new \Aws\S3\S3Client([ -// 'version' => 'latest', -// 'region' => 'us-east-1', -// 'endpoint' => $api->s3Endpoint, -// 'use_path_style_endpoint' => true, -// 'credentials' => [ -// 'key' => $this->userName, -// 'secret' => $this->userPassword, -// ], -// 'http' => ['verify' => FALSE], -// ]); - - // $response = $api->guzzle->get( - // $api->s3Endpoint."?Action=AssumeRoleWithWebIdentity&WebIdentityToken=".$api->getAccessToken()."&Version=2011-06-15" - // ); - -// var_dump($response); - -// see https://gist.github.com/manics/305f4cc56d0ac6431893cde17b1ba8c4 -// see https://docs.min.io/minio/baremetal/security/openid-external-identity-management/configure-openid-external-identity-management.html#minio-external-identity-management-openid-configure - -// // https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_provider.html -// $provider = \Aws\Credentials\CredentialProvider::assumeRoleWithWebIdentityCredentialProvider(); -// $provider = \Aws\Credentials\CredentialProvider::memoize($provider); - -// $stsClient = new Aws\Sts\StsClient([ -// 'endpoint' => $api->s3Endpoint, -// 'region' => 'us-east-2', -// 'version' => '2011-06-15', -// 'credentials' => [ -// 'key' => 'minioadmin', -// 'secret' => 'minioadmin' -// ], -// // 'debug' => TRUE, -// ]); - -try { - $accessToken = $api->getAccessToken([ - 'scope' => 'openid web-origins offline_access phone roles address email profile microprofile-jwt openid', - ]); - // // var_dump($accessToken); - // $result = $stsClient->AssumeRoleWithWebIdentity([ - // 'WebIdentityToken' => $accessToken, - // 'RoleArn' => "arn:aws:iam::123456789012:role/xaccounts3access", - // 'RoleSessionName' => "default", - // ]); - // var_dump($result); - - // $url = $api->s3Endpoint."?Action=AssumeRoleWithWebIdentity&WebIdentityToken={$accessToken}&Version=2011-06-15"; - // var_dump(file_get_contents($url)); - $container = []; - $stack = GuzzleHttp\HandlerStack::create(); - $stack->push(GuzzleHttp\Middleware::history($container)); - - $response = $api->guzzle->request( - "GET", - $api->s3Endpoint, - [ - 'body' => json_encode([ - "Action" => "AssumeRoleWithWebIdentity", - "WebIdentityToken" => $accessToken, - "Version" => "2011-06-15", - "DurationSeconds" => "86000", - ]), - 'handler' => $stack, - ] - ); - - var_dump($response); - -} catch(Exception $e) { - - foreach ($container as $transaction) { - var_dump($transaction['request']); - echo (string) $transaction['request']->getBody(); // Hello World - } - echo "



ERROR!!!";var_dump(get_class($e), $e->getMessage()); - exit(); -} - -$s3Client = new \Aws\S3\S3Client([ - // 'version' => '2006-03-01', - // 'region' => 'us-west-2', - - 'version' => 'latest', - 'region' => 'us-east-1', - 'endpoint' => $api->s3Endpoint, - 'use_path_style_endpoint' => true, - // 'credentials' => [ - // 'key' => $this->userName, - // 'secret' => $this->userPassword, - // ], - 'http' => ['verify' => FALSE], - - 'credentials' => [ - 'key' => $result['Credentials']['AccessKeyId'], - 'secret' => $result['Credentials']['SecretAccessKey'], - 'token' => $result['Credentials']['SessionToken'] - ] -]); - - -echo "
{$fileContents}
"; - -*/ \ No newline at end of file diff --git a/tools/db-browser/edit.php b/tools/db-browser/edit.php deleted file mode 100644 index 3e51a2d..0000000 --- a/tools/db-browser/edit.php +++ /dev/null @@ -1,200 +0,0 @@ - - - -"; - -$recordId = $_GET['_id'] ?? ""; -$save = $_GET['save'] ?? ""; -$database = $_GET['db'] ?? "testDatabase"; -$recordToDelete = $_GET['delete'] ?? ""; - -$displayStart = $_GET['display-start'] ?? 0; -$pageLength = $_GET['page-length'] ?? 10; - -try { - // initiate API client - $api = new \DtxsPhpClient\Client\Client(getApiConfig()); - - $api->getAccessToken(); - - $api->setDatabase($database); - - if (!empty($recordToDelete)) { - $api->deleteRecord($recordToDelete); - header("Location: browse.php?db={$database}"); - } - - if (empty($recordId)) { - echo " - - "; - exit(); - } - - $record = $api->getRecord($recordId); - - if (!empty($save)) { - $api->updateRecord($recordId, ["content" => formatContent($save)]); - header("Location: browse.php?db={$database}&display-start={$displayStart}&page-length={$pageLength}&scroll-to-id={$recordId}"); - } - - $schemas = loadSchemas($api); - - echo " -
-
- Back to list of records - ". - ( - $record["class"] != "Database.Information" - ? "" - : "" - ) - ." -
-

Edit record {$recordId}

-
-
- -
- Save - Cancel -
-
- "; - echo " - - "; -} catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - $type = "question"; - - if (!empty($exception["responseBody"]["error"])) { - $exception["reason"] = $exception["responseBody"]["error"]; - $type = "error"; - } - - echo " - - "; -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $responseBody = @json_decode($e->getResponse()->getBody(true), TRUE); - echo " - - "; -} \ No newline at end of file diff --git a/tools/db-browser/export.php b/tools/db-browser/export.php deleted file mode 100644 index 6e77b3e..0000000 --- a/tools/db-browser/export.php +++ /dev/null @@ -1,93 +0,0 @@ - Back to list of databases - -
-

Export data from {$databaseToImport}

-
- - - "; - - exit; -} - -try { - $api = new \DtxsPhpClient\Client\Client(getApiConfig()); - - $api->getAccessToken(); - - $api->setDatabase($databaseToImport); - - $allRecords = $api->getRecords(); - - header('Content-type: application/json'); - - $date = date('Y_m_d'); - - if ($exportMethod == 'file') header("Content-disposition: attachment; filename={$databaseToImport}_{$date}.json"); - echo json_encode($allRecords); -} catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - var_dump($e->getMessage()); -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $responseBody = @json_decode($e->getResponse()->getBody(true), TRUE); - echo " - - "; -} diff --git a/tools/db-browser/files/logo.png b/tools/db-browser/files/logo.png deleted file mode 100644 index 178080be070e3d51f0395164debc19168a817497..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15603 zcmX|obzB?I7i}O|kwS~R63>Ec$j*4lzVzS z01`_0tJP#4m3>b=Rh*r5bWlit1tEMP6AnXz96U{i)CNA`i&VjHPZKcmOh_ebmB+}` zmKELp{rMwhQgHU-=w@o|shJ8p9|lfUDL5En+4q5Ylx+`J)EEGEgSTmANtuXcJGw6} zrV;5%)pPE8%y*sjD7xR-PMw7F=n`~)IX=NInJxKaTXb}Mpb<47CHixH?YH1j=liKV z?PTW#rw$%Nd*F=Qu;Zy-`J1lK?P!Ujxl1>#$WQJJ{OJ9U9IjgR2ryx# zl@Z!rmj&YF!JUNE=}M;gCmo^x1tUeCS^B>iO@r(+&D!d?o^)>8E~02s_=Lj90|}-Sj5s(jcTgVC>;5qU__@gD05;&Me{#3tmZLt_FIw5?pLlpQ zo4}%{>SZq#$^Y9nK$r}(AQKJ;3eG2F>e#S4-W9=E$x=%sLYiC|8goJ@A%T^E7Zz(< zKa~5cYGVC;$|n~jbwyj~4H#XhY?*#?E7x3inED>3(wO z)%7b;lK&+#=)0jrJvpNW0{z9JMpEoCs!+Ldf35km8qf92YvBg?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zq5xdv9P|*~!@@yMPc4Q_c`_mX*$2B+Ay?{}XqB}_w=i19P!;VL^xz~+#VOoB5yr(4 zkD$r97T&a*ih@S%#Y}e4p}ja*!k!v$ci2el+>F`Pu>pyn*6`JMplBV*cNrKMr>WwaH)9oTF->ru* zQdxp7?96G@hdS*pCC96s^w*w}K%^YpK-4}(b5SM5~!&~+{~Cc~xo%%3|XvOI=p z?aE0;62pI4uja^}Zn!nz*Pzx?Mm`pljdB|sTS=Z!?aD$BYU{U4*}oAkXuT=$rm~er zI2U)4_?Glq$Z7of^%C9h!OCv1fdTtGB69%lDGlZ3PMg!-keS2_D5=#7beGhlJY+nvQW`0p zRV&U*+>l7EA-VgKFM=jjJQ|lzVBCs<^DBZS0FHJ!j;rEtKV^gq%X^|$`G0cITBZD- zm}T3)v!5@K-3U6}S}Z#E*hKgreffDKuWu9AF`kZ(MYJNaed^NF2SyL0?+f(O5XeAD zEh&8Co+KP^X_Gf&5;oU7UOEq!)L#_c zQ^=Y*pJ8eZ#ICJloMg6V|J*FifCIsHQ5`8;xc?KTrUSQyRsMIUCEFzpBC=Jh8ybkt zQ$~165#>KgsA#rB46t=Lei_hp+2&=EAS$n3`00tz;;#5viMdcFocZgiY8H$1B=Qc#bk+r|jyR30*YK zUoAZMP2xU<8y>sNeG{hQTlw-BA`AcM9yeTZ9zO8mB=*YoKZ&ay>HpK3qGeyLzT2Ah zf+Dl8E{m+t8v2A)g3A3xgOxn*!s{%=aB$L#HT&iEeNbP@Gjd59Jzi>xAibUQk| z(1PU9G6HQk&K87RbzC=a+^$`3=_r*->SKJ3?&3cNa{zm&LyIg&!Zg Ywqg!*ei!)=6*E9WL{_-!mwv$i0g@lY00000 diff --git a/tools/db-browser/import.php b/tools/db-browser/import.php deleted file mode 100644 index ab752f5..0000000 --- a/tools/db-browser/import.php +++ /dev/null @@ -1,337 +0,0 @@ - -

- -
-
-

- Database: is not selected -  Select database -

-
-
- "; - - exit(); -} - -$data = NULL; - -if (isset($_FILES['data'])) { - if ($_FILES['data']['error']) { - echo " -
-
An error occurred
- - Back to import -
- "; - - exit; - } - - $data = file_get_contents($_FILES['data']['tmp_name']); -} - -if ($data == NULL) { - $data = $_POST['data'] ?? ""; -} - -if (empty($data)) { - if ($importMethod == NULL) { - echo " - Back to list of databases - -
-

Import data to {$database}

-
- -
-
- -
- -
-
-
- -
- -
- "; - - exit; - } else if ($importMethod == 'raw') { - echo " - Back to import - -
-

Paste raw JSON data

-
- -
-
-
- -
- -
-
- "; - } -} else { - $api = new \DtxsPhpClient\Client\Client(getApiConfig()); - $api->getAccessToken(); - $api->setDatabase($database); - - $errors = []; - $log = []; - - $schemas = loadSchemas($api); - $records = json_decode($data, TRUE); - $recordIdConversionTable = []; - - // to avoid cross-reference problems, the classes must be imported in a - // certain order - $classesImportOrder = [ - // first, classes with no ReferencedClass - "Actors.Roles", - - // then the other classes - "Actors.Robots", - "Actors.Persons", - "Actors.Teams", - "Applications", - "Assets.Tangibles.Tools", - "Methods", - "Assets.Intangibles.Documents", - "Safety.Risks.Categories", - "Safety.Risks.Register", - "Tasks", - "Assets.Intangibles.Calculations.DoseUptake", - "PlantData.SiteStructure.Rooms", - "Assets.Intangibles.Measurements.CartesianMeasurementSets", - "Assets.Intangibles.Measurements.CartesianMeasurements", - "Assets.Intangibles.Measurements.PartMeasurements", - "Assets.Intangibles.SpatialTemporals", - "Assets.Intangibles.VirtualPostIts", - "Assets.Tangibles.Consumables", - "Assets.Tangibles.Equipments", - "Safety.Regulatory.Frameworks", - "Safety.Regulatory.ClearanceLimits", // tu nieco nesedi - "Safety.Regulatory.WasteCategories", - "Safety.Regulatory.WasteAcceptanceCriterias", - "Wastes.PackageTypes", - "Assets.Tangibles.Parts", - "Costs.Estimations", - "Costs.UnitCostFactorSets", - "Events", - "Materials", - "PlantData.NuclideVectors", - "PlantData.RadiationSources", - "PlantData.SiteStructure.Buildings", - "PlantData.SiteStructure.Floors", - "PlantData.Space.Cartesian", - "PlantData", - "Safety.States", - "Wastes.ManagementProcesses", - "Wastes.Sorters", - "Wastes.WasteAcceptanceCriterias", - "Workplaces", - "Scenarios", - "Scenarios.Runs" - ]; - - $importedRecords = []; - - foreach ($classesImportOrder as $classToImport) { - foreach ($records as $record) { - try { - validateRecord($record, $schemas); - - if ($record['class'] != $classToImport) continue; - - // Convert RecordIds in the record's content - $recordContentStr = json_encode($record['content']); - foreach ($recordIdConversionTable as $convertFrom => $convertTo) { - $recordContentStr = str_replace( - '"'.$convertFrom.'"', - '"'.$convertTo.'"', - $recordContentStr - ); - } - $record['content'] = json_decode($recordContentStr, TRUE); - - // Fetch original record - $originalRecord = $api->getRecord($record['_id']); - - $importedRecords[$classToImport][] = [ - '_id' => $record['_id'], - 'type' => 'updated' - ]; - - $importedRecordId = $api->updateRecord( - $record['_id'], - [ - "class" => $record['class'], - "content" => $record['content'], - ] - ); - } catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - // If record not exists create him - if ($exception["responseBody"]["error"] == "The record does not exist") { - $importedRecords[$classToImport][] = [ - '_id' => $record['_id'], - 'type' => 'inserted' - ]; - - $importedRecordId = $api->createRecord([ - "_id" => $record["_id"], - "class" => $record['class'], - "content" => $record['content'], - ]); - } else { - $errors[] = $exception['responseBody']; - - echo " - - "; - } - } - } - } - - if (!empty($errors)) { - echo " -
-

Errors found!


- ".join("", $errors)." -
- "; - } else { - echo " - Back to list of databases - -
-

Import to the {$database} was successful!

- Browse imported records -
- "; - - foreach ($importedRecords as $recordClass => $records) { - echo "
Imported records from class {$recordClass}. (" . count($records) . ")
"; - - foreach ($records as $record) { - if ($record['type'] == 'updated') echo "Updated _id = {$record['_id']}
"; - else if ($record['type'] == 'inserted') echo "Created _id = {$record['_id']}
"; - } - } - - echo "
"; - } - -} - -echo " - - -"; - -function validateRecord($record, $schemas) { - if (empty($record['_id'])) { - throw new \Exception("Record has no _id."); - } - - if (empty($record['class'])) { - throw new \Exception("Record {$record['_id']} has no class."); - } - - // if (empty($schemas[$record['class']])) { - // throw new \Exception("Unknown class for record {$record['_id']}."); - // } - - if (empty($record['content'])) { - throw new \Exception("Record {$record['_id']} has no content."); - } - - if (!is_array($record['content'])) { - throw new \Exception("Content of the record {$record['_id']} has an invalid format."); - } -} \ No newline at end of file diff --git a/tools/db-browser/includes/footer.php b/tools/db-browser/includes/footer.php deleted file mode 100644 index d57c189..0000000 --- a/tools/db-browser/includes/footer.php +++ /dev/null @@ -1,15 +0,0 @@ - - -"; diff --git a/tools/db-browser/includes/header.php b/tools/db-browser/includes/header.php deleted file mode 100644 index 8eace28..0000000 --- a/tools/db-browser/includes/header.php +++ /dev/null @@ -1,51 +0,0 @@ - - - DTXS DB Browser - - - - - - - - - - - - - - - -
-
-

DTXS DB browser

-
Version 1.1.0
-
- ".(!empty(getClientData()) ? " - - " : "")." -
-"; \ No newline at end of file diff --git a/tools/db-browser/includes/lib.php b/tools/db-browser/includes/lib.php deleted file mode 100644 index 891d8fa..0000000 --- a/tools/db-browser/includes/lib.php +++ /dev/null @@ -1,216 +0,0 @@ -getRecords(); - foreach ($records as $record) { - if (empty($addEnumsToSchema_allRecordsByClass[$record['class']])) { - $addEnumsToSchema_allRecordsByClass[$record['class']] = []; - } - - $addEnumsToSchema_allRecordsByClass[$record['class']][] = $record; - } - } - - if (is_array($schema)) { - foreach ($schema as $key => $value) { - $schema[$key] = addEnumsToSchema($api, $value); - } - } - - if (!empty($schema["_DTXS"]["ReferencedClass"])) { - - $referencedClasses = []; - - if (is_string($schema["_DTXS"]["ReferencedClass"])) { - $referencedClasses = [$schema["_DTXS"]["ReferencedClass"]]; - } else if (is_array($schema["_DTXS"]["ReferencedClass"])) { - $referencedClasses = $schema["_DTXS"]["ReferencedClass"]; - } - - $schema["enum"] = [""]; - $schema["options"]["enum_titles"] = [""]; - - foreach ($referencedClasses as $referencedClass) { - // $records = $api->getRecords(["class" => $referencedClass]); - $records = $addEnumsToSchema_allRecordsByClass[$referencedClass] ?? []; - - foreach ($records as $record) { - $tmp = $record['content']; - unset($tmp['RecordInfo']); - - $schema["enum"][] = $record['_id']; - $schema["options"]["enum_titles"][] = json_encode($tmp); - } - - } - } - - return $schema; -} - -function loadSchemas($api) { - $schemas = []; - - $schemasDir = __DIR__."/../../api-classes/render/schemas"; - - foreach (scandir($schemasDir) as $file) { - if (in_array($file, [".", ".."])) continue; - - $schema = str_replace(".json", "", $file); - $schemas[$schema] = json_decode(file_get_contents("{$schemasDir}/{$file}"), TRUE); - } - - $records = $api->getRecords(); - - if (count($records) < 2000) { - $schemas = addEnumsToSchema($api, $schemas); - } - - return $schemas; -} - -function setClientData(array $clientData = []) : void { - $_SESSION["clientData"] = $clientData; -} - -function getClientData() : array { - return isset($_SESSION["clientData"]) ? $_SESSION["clientData"] : []; -} - -function checkIfClientIsLogged() : void { - if (empty(getClientData())) { - header("Location: login.php"); - } -} - -function getApiConfig() : array { - global $apiConfig; - return array_merge(getClientData(), $apiConfig); -} - -function formatRecordContentToHtml($content, $database, $api, $referenceDetailUrl = "edit.php", $expandReferences = FALSE) { - - $contentHtml = json_encode( - $content, - JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE - ); - - $contentHtml = trim($contentHtml, "{} "); // remove starting and trailing {} - $contentHtml = preg_replace('/\n /', "\n", $contentHtml); - $contentHtml = trim($contentHtml); - $contentHtml = preg_replace_callback( - '/"File": "(.+)"/', - function($matches) { - return "\"File\": \"{$matches[1]}\" - "; - }, - $contentHtml - ); - - preg_match_all('/"([a-f\d]{24})"/', $contentHtml, $tmpMatches); - $tmpReferenceIds = array_unique(array_map(function($m) { return $m; }, $tmpMatches[1])); - - if (count($tmpReferenceIds) > 0) { - foreach ($tmpReferenceIds as $tmpReferenceId) { - try { - $tmpReferenceRecord = $api->getRecord($tmpReferenceId); - if ($tmpReferenceRecord === NULL) continue; - - if ($expandReferences) { - $tmpReferenceHtml = json_encode($tmpReferenceRecord); - } else { - $tmpTitle = json_encode($tmpReferenceRecord, JSON_PRETTY_PRINT); - $tmpTitle = str_replace("'", "`", $tmpTitle); - $tmpTitle = str_replace('"', "`", $tmpTitle); - } - - $contentHtml = str_replace( - '"'.$tmpReferenceRecord['_id'].'"', - "{$tmpReferenceRecord['_id']}" - .($expandReferences ? "
{$tmpReferenceHtml}
" : "") - , - $contentHtml - ); - } catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - //$exception = json_decode($e->getMessage(), TRUE); - } - } - } - - return $contentHtml; -} - -function formatContent(string $content) { - $content = json_decode($content, TRUE); - - foreach ($content as $contentKey => $contentValue) { - switch ($contentKey) { - case "UnitCostFactors": - case "Costs": - case "ActivityLimit": - case "ChemicalComposition": - case "Isotopes": - case "ChemicalComposition": - case "WorkDifficultyFactors": - case "ContaminationLimit": - case "Requirements": - case "Parameters": - case "OuterContaminationLimit": - case "InnerContaminationLimit": - $content[$contentKey] = json_decode($contentValue, TRUE) ?? []; - break; - case "Value": - foreach ($contentValue as $contentValueKey => $contentValueValue) { - if (is_string($contentValueValue)) { - $content[$contentKey][$contentValueKey] = json_decode($contentValueValue, TRUE) ?? []; - } - } - break; - } - } - - return $content; -} - -function titleInLookupRecord($tmpLookupRecord) { - $replaced = preg_replace_callback('/([a-f\d]{24})/', function ($id) { return "{$id[0]} "; }, json_encode($tmpLookupRecord)); - - return str_replace("'", "`", json_encode(json_decode($replaced), JSON_PRETTY_PRINT)); -} \ No newline at end of file diff --git a/tools/db-browser/index.php b/tools/db-browser/index.php deleted file mode 100644 index 1306639..0000000 --- a/tools/db-browser/index.php +++ /dev/null @@ -1,62 +0,0 @@ - - - DTXS DB Browser - - - - - - - -
-
- dtxs-logo -
- ".(!empty(getClientData()) ? " - - " : "")." -
-
- -
-
-

DTXS DB browser

-

Version 1.1.0

-
-"; diff --git a/tools/db-browser/init.php b/tools/db-browser/init.php deleted file mode 100644 index fe15a8b..0000000 --- a/tools/db-browser/init.php +++ /dev/null @@ -1,21 +0,0 @@ - -
-
-
-
- - -
-
- - -
- -
-
-
-
- "; - - if (isset($_POST["submitLogin"])) { - try { - $clientData = [ - "userName" => isset($_POST["userName"]) ? $_POST["userName"] : "", - "userPassword" => isset($_POST["userPassword"]) ? $_POST["userPassword"] : "" - ]; - - $apiConfig = array_merge($clientData, $apiConfig); - - // initiate API client - $api = new \DtxsPhpClient\Client\Client($apiConfig); - - // get access token - $api->getAccessToken(); - - // set client data - setClientData($clientData); - - header("Location: databases.php"); - } catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - throw new \DtxsPhpClient\Client\Exception\RequestException($e->getMessage()); - } catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; - } - } -} catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - echo " - - "; -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $response = $e->getResponse(); - echo " - - "; -} - -require __DIR__."/includes/footer.php"; \ No newline at end of file diff --git a/tools/db-browser/logout.php b/tools/db-browser/logout.php deleted file mode 100644 index 159a733..0000000 --- a/tools/db-browser/logout.php +++ /dev/null @@ -1,16 +0,0 @@ -getAccessToken(); - $api->setDatabase($database); - - $allRecords = $api->getRecords(); - $record = $api->getRecord($recordId); - - $tmpContent = $record['content']; - unset($tmpContent['RecordInfo']); - - echo " -

Record

-
- Database: {$database}
- Record ID: {$recordId}
- Record class: {$record['class']}
-
- Record content: -
-
-
".formatRecordContentToHtml($tmpContent, $database, $api, "record.php", TRUE, $allRecords)."
-
- "; - } catch (\DtxsPhpClient\Client\Exception\RequestException $e) { - $exception = json_decode($e->getMessage(), TRUE); - - echo "ERROR: ".$exception; - } -} \ No newline at end of file diff --git a/tools/db-browser/style.css b/tools/db-browser/style.css deleted file mode 100644 index 30f2136..0000000 --- a/tools/db-browser/style.css +++ /dev/null @@ -1,167 +0,0 @@ -.wrapper { - margin: 25px; -} - -.btn-primary { - background: rgb(2, 88, 174); - border: 1px solid rgb(2, 88, 174); -} - -.btn-outline-primary { - border:1px solid rgb(2, 88, 174); - color: rgb(2, 88, 174); -} - -.btn-outline-primary:hover { - background-color: rgb(2, 88, 174); -} - -.btn-danger { - background: rgb(189, 3, 3); - border: 1px solid rgb(189, 3, 3); -} - -.btn-success { - background: rgb(2, 153, 72); - border: 1px solid rgb(2, 153, 72); -} - -.text-primary { - color: rgb(2, 88, 174) !important; -} - -.nav-link { - font-size: 16px; -} - -.page-item.active .page-link { - background: rgb(2, 88, 174); -} - -.active-page { - border-bottom: 2px solid rgb(2, 88, 174); -} - -.nav-item a { - color: #212529; -} - -#cover-spin { - position:fixed; - width:100%; - left:0;right:0;top:0;bottom:0; - background-color: rgba(255,255,255,0.5); - z-index:9999; -} - -@-webkit-keyframes spin { -from {-webkit-transform:rotate(0deg);} -to {-webkit-transform:rotate(360deg);} -} - -@keyframes spin { -from {transform:rotate(0deg);} -to {transform:rotate(360deg);} -} - -#cover-spin::after { - color: rgb(2, 88, 174); - content:''; - display:block; - position:absolute; - top:40%; - font-size: 50px; - text-indent: -9999em; - overflow: hidden; - width: 1em; - height: 1em; - border-radius: 50%; - margin: 50px auto; - position: relative; - -webkit-transform: translateZ(0); - -ms-transform: translateZ(0); - transform: translateZ(0); - -webkit-animation: load6 1.3s infinite ease, round 1.3s infinite ease; - animation: load6 1.3s infinite ease, round 1.3s infinite ease; -} - -.loader { - color: #ffffff; - font-size: 90px; - text-indent: -9999em; - overflow: hidden; - width: 1em; - height: 1em; - border-radius: 50%; - margin: 72px auto; - position: relative; - -webkit-transform: translateZ(0); - -ms-transform: translateZ(0); - transform: translateZ(0); - -webkit-animation: load6 1.7s infinite ease, round 1.7s infinite ease; - animation: load6 1.7s infinite ease, round 1.7s infinite ease; -} -@-webkit-keyframes load6 { - 0% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; - } - 5%, - 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; - } - 10%, - 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; - } - 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; - } - 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; - } - 100% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; - } -} -@keyframes load6 { - 0% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; - } - 5%, - 95% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; - } - 10%, - 59% { - box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; - } - 20% { - box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; - } - 38% { - box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; - } - 100% { - box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; - } -} -@-webkit-keyframes round { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} -@keyframes round { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} diff --git a/tools/db-browser/test-import.json b/tools/db-browser/test-import.json deleted file mode 100644 index 19a5edd..0000000 --- a/tools/db-browser/test-import.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "_id": "role_engineer_test", - "class": "Actors.Roles", - "content": { - "RoleName": "Engineer TEST", - "EfficiencyCoefficient": 1, - "UnproductiveTime": 2, - "EffectiveWorkdayHours": 3 - } - }, - { - "_id": "person_john_doe_test", - "class": "Actors.Persons", - "content": { - "GivenName": "John", - "FamilyName": "Doe TEST", - "AvailableRoleIds": [ - "role_engineer_test" - ] - } - } -] \ No newline at end of file diff --git a/tools/db-browser/userinfo.php b/tools/db-browser/userinfo.php deleted file mode 100644 index 12efb26..0000000 --- a/tools/db-browser/userinfo.php +++ /dev/null @@ -1,88 +0,0 @@ - - - -"; - -try { - - $apiConfig = getApiConfig(); - - // initiate API client - $api = new \DtxsPhpClient\Client\Client($apiConfig); - - // get access token - $api->getAccessToken(); - - echo " -
-
-
-

My profile

-
-
-
-

Username: {$apiConfig['userName']}

-
-
-

Client ID: {$apiConfig['clientId']}

-
-
-

Token endpoint: {$apiConfig['iamTokenEndpoint']}

-
-
-

API endpoint: {$apiConfig['apiEndpoint']}

-
-
-
-
- "; - -} catch (\GuzzleHttp\Exception\ConnectException $e) { - echo " - - "; -} catch(\GuzzleHttp\Exception\ClientException $e) { - $responseBody = @json_decode($e->getResponse()->getBody(true), TRUE); - echo " - - "; -} - -require __DIR__."/includes/footer.php";