Skip to content

Commit

Permalink
Merge pull request #263 from Ioannis/ExternalIdentityRoles_associatio…
Browse files Browse the repository at this point in the history
…ns_url_mveas

Fix URLs missing associations. Improving mvea tile render on error.
  • Loading branch information
Ioannis authored Dec 19, 2024
2 parents 5436748 + 8a18879 commit 50e86b1
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/config/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@
"indexes": {
"urls_i1": { "columns": [ "type_id" ] }
},
"mvea": [ "person", "external_identity" ],
"mvea": [ "person", "person_role", "external_identity", "external_identity_role" ],
"sourced": true
},

Expand Down
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/error.po
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ msgstr "{0} already exists with this name"
msgid "exists.GroupMember"
msgstr "{0} is already a member of Group {1}"

msgid "data.Load"
msgstr "Failed to Load Data"

msgid "fields"
msgstr "Please recheck these fields: {0}"

Expand Down
3 changes: 2 additions & 1 deletion app/src/Model/Table/UrlsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function initialize(array $config): void {
// Define associations
$this->belongsTo('People');
$this->belongsTo('ExternalIdentities');
$this->belongsTo('ExternalIdentityRoles');
$this->belongsTo('Types');
$this->belongsTo('SourceUrls')
->setClassName('Urls')
Expand All @@ -82,7 +83,7 @@ public function initialize(array $config): void {

$this->setDisplayField('url');

$this->setPrimaryLink(['external_identity_id', 'person_id']);
$this->setPrimaryLink(['external_identity_id', 'external_identity_role_id', 'person_id', 'person_role_id']);
$this->setRequiresCO(true);
$this->setRedirectGoal('self');
$this->setRedirectGoal(action: 'delete', goal: 'deleted');
Expand Down
11 changes: 6 additions & 5 deletions app/src/View/Helper/VueHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class VueHelper extends Helper {
],
'error' => [
'javascript.copy',
'javascript.requires.https'
'javascript.requires.https',
'data.Load',
],
'field' => [
'email',
Expand All @@ -58,15 +59,15 @@ class VueHelper extends Helper {
'datepicker.hour',
'datepicker.minute',
'status',
'unverified'
'unverified',
],
'information' => [
'global.attributes.none',
'global.value.none',
'global.visit.link',
'record',
'report.for',
'value.copied'
'value.copied',
],
'operation' => [
'add',
Expand All @@ -79,12 +80,12 @@ class VueHelper extends Helper {
'copy',
'copy.value',
'primary',
'visit.link'
'visit.link',
],
'result' => [
'failed',
'removed',
'updated'
'updated',
]
];

Expand Down
13 changes: 11 additions & 2 deletions app/templates/element/mveaJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
<script type="module">
<?php if(Cake\Core\Configure::read('debug')): ?>
import Mveas from "<?= $this->Url->script('comanage/components/mvea/mveas.js') ?>?time=<?= time() ?>";
import FailedMveas from "<?= $this->Url->script('comanage/components/mvea/failed-mveas.js') ?>?time=<?= time() ?>";
<?php else: ?>
import Mveas from "<?= $this->Url->script('comanage/components/mvea/mveas.js') ?>";
import FailedMveas from "<?= $this->Url->script('comanage/components/mvea/failed-mveas.js') ?>";
<?php endif; ?>

const app = Vue.createApp({
Expand All @@ -70,7 +72,8 @@
}
},
components: {
Mveas
Mveas,
FailedMveas
},
methods: {
getMveas(mveaType,entityType) {
Expand All @@ -88,12 +91,13 @@
},
setMveas(xhr) {
this.mveas = xhr.responseJSON;
this.isLoading = false
},
setError(txt) {
this.error = txt;
},
generalXhrFailCallback(xhr) {
stopSpinner();
stopMiniSpinner();
this.successTxt = '';
if(xhr.statusText != undefined && xhr.statusText != '') {
this.setError(xhr.statusText)
Expand All @@ -102,6 +106,7 @@
console.error(xhr);
this.setError(this.txt.error500);
}
this.isLoading = false
},
launchModal(title,url,componentRef) {
window.cmMveaModal.launch(title,url,componentRef);
Expand All @@ -127,10 +132,14 @@
<li><span class="visually-hidden">Loading...</span></li>
</ul>
<mveas
v-if="this.mveas !== ''"
:mveas="this.mveas"
:core="this.core"
:txt="this.txt">
</mveas>
<failed-mveas v-if="this.mveas === '' && !this.isLoading"
:core="this.core"
:txt="this.txt"/>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions app/webroot/js/comanage/comanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ function stopSpinner() {
$("#co-loading").hide();
}

function stopMiniSpinner() {
$(".co-loading-mini").hide();
}

// Show fields in .form-list output.
// fields - array of field IDs
// isPageLoad - boolean, true for first page load
Expand Down
39 changes: 39 additions & 0 deletions app/webroot/js/comanage/components/mvea/failed-mveas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* COmanage Registry MVEA Component JavaScript
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID 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.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

export default {
props: {
core: Object,
txt: Object
},
template: `
<ul class="cm-mvea fields co-alert alert-danger">
<li class="field-data-container cm-mvea-no-attributes-msg">
<div class="field-data">{{ this.txt['error.data.Load'] }}</div>
</li>
</ul>
`
}

0 comments on commit 50e86b1

Please sign in to comment.