From b49cd2c79e65b3eb036091b3490bee6688f6c552 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Tue, 11 Jul 2023 09:02:16 -0400 Subject: [PATCH] Add Identifier attributes to Group "canvas" (CFM-291) (#107) * Add Identifier attributes to Group "canvas" (CFM-291) * Move "add" button closer to title (CFM-291) --- app/src/Model/Table/GroupsTable.php | 5 +++++ app/templates/Groups/fields-nav.inc | 19 +++++++++++++++++++ app/templates/element/mveaJs.php | 8 +------- app/webroot/css/co-base.css | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/src/Model/Table/GroupsTable.php b/app/src/Model/Table/GroupsTable.php index 4abd3c4ca..a975a46f7 100644 --- a/app/src/Model/Table/GroupsTable.php +++ b/app/src/Model/Table/GroupsTable.php @@ -50,6 +50,7 @@ class GroupsTable extends Table { use \App\Lib\Traits\PermissionsTrait; use \App\Lib\Traits\PrimaryLinkTrait; use \App\Lib\Traits\ProvisionableTrait; + use \App\Lib\Traits\QueryModificationTrait; use \App\Lib\Traits\TableMetaTrait; use \App\Lib\Traits\ValidationTrait; use \App\Lib\Traits\SearchFilterTrait; @@ -97,6 +98,10 @@ public function initialize(array $config): void { $this->setPrimaryLink('co_id'); $this->setAllowLookupPrimaryLink(['provision', 'reconcile']); $this->setRequiresCO(true); + + $this->setEditContains([ + 'Identifiers' + ]); $this->setAutoViewVars([ 'statuses' => [ diff --git a/app/templates/Groups/fields-nav.inc b/app/templates/Groups/fields-nav.inc index d829fd77a..cab3c9729 100644 --- a/app/templates/Groups/fields-nav.inc +++ b/app/templates/Groups/fields-nav.inc @@ -25,6 +25,15 @@ * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) */ +// List the MVEAs that may be shown on the mveaCanvas +// When this array exists, the mveaCanvas.php element will render +$mveas = [ + 'identifiers' +]; + +// Name the MVEAs Entity Type +$mveasEntityType = "group"; + // XXX: if CFM-218 (Make fields.inc configuration only) is accepted, move the contents of this file into fields.inc $topLinks = [ [ @@ -63,6 +72,16 @@ $topLinks = [ ] ]; +// $addMenuLinks is also given slightly different treatment from the typical $topLinks found in most views: +// it is a page-global menu used for adding MVEAs and is given special treatment in element/mveaCanvas.php. +$addMenuLinks = [ + [ + 'controller' => 'identifiers', + 'action' => 'add', + 'icon' => 'fingerprint' + ] +]; + $subnav = [ 'name' => 'group', 'active' => 'properties' diff --git a/app/templates/element/mveaJs.php b/app/templates/element/mveaJs.php index 9518b6498..a0cac1fa8 100644 --- a/app/templates/element/mveaJs.php +++ b/app/templates/element/mveaJs.php @@ -74,13 +74,7 @@ }, methods: { getMveas(mveaType,entityType) { - var entityTypeIdRef = 'person_id'; - if(entityType == 'person_role') { - entityTypeIdRef = 'person_role_id'; - } - if(entityType == 'external_identity') { - entityTypeIdRef = 'external_identity_id'; - } + var entityTypeIdRef = entityType + '_id'; let url = 'Url->build(['controller' => 'api', 'action' => 'v2']) ?>/' + mveaType + '?' + entityTypeIdRef + '=&extended'; diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index d34afc39e..07bf585d0 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -1090,7 +1090,7 @@ html.dark-mode #pagination { } #mvea-canvas-title-container { display: flex; - justify-content: space-between; + gap: 0.5em; align-items: center; margin: 3em 0 -0.5em; }