Skip to content

Commit

Permalink
Graph button hidden if no graph. #2377
Browse files Browse the repository at this point in the history
  • Loading branch information
knirirr committed Oct 18, 2024
1 parent a642f54 commit 40f03b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/components/Records/Record/GeneralInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
<Licence v-if="currentRecord.fairsharingRecord.registry==='Collection'" />

<!-- Duplicate link to graph (see also action menu) -->
<div class="d-flex flex-row">
<div
v-if="currentRecord['fairsharingRecord'].hasGraph"
class="d-flex flex-row"
>
<router-link :to="`/graph/${currentRecord['fairsharingRecord'].id}`">
<v-btn
class="my-5"
Expand Down
1 change: 1 addition & 0 deletions src/lib/GraphClient/queries/getRecord.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"exhaustiveLicences",
"urlForLogo",
"lastReviewed",
"hasGraph",
{
"name": "reviews",
"fields": [
Expand Down
8 changes: 6 additions & 2 deletions src/views/Records/Record.vue
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ export default {
}
}
},
{
name: () => {
if (!_module.userIsLoggedIn){
Expand Down Expand Up @@ -690,7 +689,12 @@ export default {
},
{
name: function() { return "View Relation Graph" },
isDisabled: function(){ return false },
isDisabled: function(){
if (_module.currentRecord['fairsharingRecord'].hasGraph) {
return false;
}
return true;
},
method: function(){
_module.$router.push({
path: "/graph/" + _module.currentRecord['fairsharingRecord'].id
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/views/Records/Record.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ describe("Record.vue", function () {
expect(wrapper.vm.buttons[2].name()).toEqual("Watch record");
expect(wrapper.vm.buttons[2].isDisabled()).toBe(false);
expect(wrapper.vm.buttons[3].name()).toEqual("View Relation Graph");
expect(wrapper.vm.buttons[3].isDisabled()).toBe(false);
expect(wrapper.vm.buttons[3].isDisabled()).toBe(true);
expect(wrapper.vm.buttons[4].name()).toEqual("View record history");
expect(wrapper.vm.buttons[4].isDisabled()).toBe(false);
expect(wrapper.vm.buttons[5].name()).toEqual(
Expand Down

0 comments on commit 40f03b1

Please sign in to comment.