From c35401c247ec9423c828980cba8f8c8495b4231c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 7 Aug 2021 15:45:44 +0300 Subject: [PATCH] Work in progress --- app/controllers/web/console.php | 33 +- app/views/console/database/collection.phtml | 412 +++++--------------- 2 files changed, 100 insertions(+), 345 deletions(-) diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index c3dcccca4..793e8411d 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -4,9 +4,7 @@ use Utopia\App; use Utopia\View; use Utopia\Config\Config; use Utopia\Domains\Domain; -use Utopia\Database\Database; -use Appwrite\Database\Validator\Authorization; -use Appwrite\Database\Validator\UID; +use Utopia\Database\Validator\UID; use Utopia\Storage\Storage; App::init(function ($layout) { @@ -212,25 +210,11 @@ App::get('/console/database/collection') ->param('id', '', new UID(), 'Collection unique ID.') ->inject('response') ->inject('layout') - ->inject('dbForExternal') - ->action(function ($id, $response, $layout, $dbForExternal) { + ->action(function ($id, $response, $layout) { /** @var Appwrite\Utopia\Response $response */ /** @var Utopia\View $layout */ - /** @var Utopia\Database\Database $dbForExternal */ - - Authorization::disable(); - $collection = $dbForExternal->getCollection($id); - Authorization::reset(); - - if ($collection->isEmpty()) { - throw new Exception('Collection not found', 404); - } $page = new View(__DIR__.'/../../views/console/database/collection.phtml'); - - $page - ->setParam('collection', $collection) - ; $layout ->setParam('title', APP_NAME.' - Database Collection') @@ -250,25 +234,14 @@ App::get('/console/database/document') ->label('scope', 'console') ->param('collection', '', new UID(), 'Collection unique ID.') ->inject('layout') - ->inject('dbForExternal') - ->action(function ($collection, $layout, $dbForExternal) { + ->action(function ($collection, $layout) { /** @var Utopia\View $layout */ - /** @var Utopia\Database\Database $dbForExternal */ - - Authorization::disable(); - $collection = $dbForExternal->getCollection($collection); - Authorization::reset(); - - if ($collection->isEmpty()) { - throw new Exception('Collection not found', 404); - } $page = new View(__DIR__.'/../../views/console/database/document.phtml'); $searchFiles = new View(__DIR__.'/../../views/console/database/search/files.phtml'); $searchDocuments = new View(__DIR__.'/../../views/console/database/search/documents.phtml'); $page - ->setParam('db', $dbForExternal) ->setParam('collection', $collection) ->setParam('searchFiles', $searchFiles) ->setParam('searchDocuments', $searchDocuments) diff --git a/app/views/console/database/collection.phtml b/app/views/console/database/collection.phtml index 72d75dc3e..8aef16222 100644 --- a/app/views/console/database/collection.phtml +++ b/app/views/console/database/collection.phtml @@ -1,9 +1,3 @@ -getParam('collection', []); -$rules = $collection->getAttribute('rules', []); -$maxCells = 10; -?> -
- $rule): - if($i > $maxCells) { - break; - } - $label = (isset($rule['label'])) ? $rule['label'] : ''; - ?> - escape($label); ?> - + UID - $rule): - if($i > $maxCells) { - break; - } - $label = $rule['label'] ?? ''; - $key = $rule['key'] ?? ''; - $type = $rule['type'] ?? ''; - $array = $rule['array'] ?? ''; - ?> - - - - - - - - {...} - - - - - - - [...] - - - - + 42343 @@ -164,11 +123,56 @@ $maxCells = 10;
- + Add Document +
  • +

    Attributes x

    + + + + + xxx + +
    +
    +

    No Attributes Found

    + +

    Create your first attribute to get started

    +
    + +
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    +
    +
    +
  • +
  • +

    Indexes

    +
  • +
  • +

    Queue

    + +
    +

    No Attributes Found in the Queue

    + +

    Create your first attribute to get started

    +
    +
  • Settings

    @@ -198,119 +202,6 @@ $maxCells = 10; -

    Rules

    - -
    -
    -
    -

    No attribute rules added yet.

    -
    -
    - - - -
    -
      -
    • -
      - - - -

      -
      - - - - -
      - - - - - - - - - - - -
      - required -
      - -
      - optional -
      -

      - -
      - -
      - - - -
      -
      - - -
      -
      - -
      - -
      -
      -
      - - - - - -
      -   Required -
      - -
      -   Array -
      - -
      -
      - - - - -
      -
    • -
    -
    - -
    - - -
    @@ -364,172 +255,63 @@ $maxCells = 10;
    - - - -
  • - - - - - - - - - - - - - - - -
    + + + \ No newline at end of file