Skip to content

Commit f58f93d

Browse files
committed
adding other boolean fields
1 parent 65e8895 commit f58f93d

21 files changed

+852
-5
lines changed

src/components/Records/Search/Input/AdvancedSearch/QueryBuilderComponents/GroupCtrlSlot/GroupCtrlSlot.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<div class="query-builder-group-slot__group-control pa-4 d-flex">
44
<!-- General Component -->
55
<GeneralRule :group-ctrl="groupCtrl" />
6+
<!-- Other Boolean Component -->
7+
<OtherBooleanRule :group-ctrl="groupCtrl" />
68
<!-- Database Component -->
79
<DatabaseRule :group-ctrl="groupCtrl" />
810
<!-- Policy Component -->
@@ -18,10 +20,10 @@
1820
</template>
1921

2022
<script>
21-
import {DatabaseRule,GeneralRule, PolicyRule} from "./index";
23+
import {DatabaseRule,GeneralRule, OtherBooleanRule, PolicyRule } from "./index";
2224
export default {
2325
name: "GroupCtrlSlot",
24-
components:{GeneralRule, DatabaseRule, PolicyRule},
26+
components:{GeneralRule, OtherBooleanRule, DatabaseRule, PolicyRule},
2527
props: {
2628
groupCtrl: {
2729
type: Object,
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
2+
<template>
3+
<div class="d-flex mr-4">
4+
<select
5+
v-model="selectedOtherBooleanRule"
6+
class="query-builder-group-slot__rule-selection mb-3"
7+
>
8+
<option
9+
disabled
10+
value=""
11+
>
12+
Select an additional rule
13+
</option>
14+
<option
15+
v-for="rule in otherBooleanQueryBuilderComponents()"
16+
:key="rule.identifier"
17+
:value="rule.identifier"
18+
v-text="rule.name"
19+
/>
20+
</select>
21+
<button
22+
:disabled="selectedOtherBooleanRule === ''"
23+
class="query-builder-group-slot__rule-adding-button ml-3"
24+
@click="addNewRule(groupCtrl, selectedOtherBooleanRule)"
25+
>
26+
Add Rule
27+
</button>
28+
</div>
29+
</template>
30+
31+
<script>
32+
import { sortBy } from "lodash"
33+
34+
import {
35+
GuidanceToHelpEnableCompliance,
36+
HasPublication,
37+
IsImplemented,
38+
MonitoringOfCompliance,
39+
RecommendsDatabase,
40+
RecommendsStandard,
41+
UpdatingOfDmp,
42+
UsesPersistentIdentifier} from "../index";
43+
export default {
44+
name: "OtherBooleanRule",
45+
props: {
46+
groupCtrl: {
47+
type: Object,
48+
default: null
49+
}
50+
},
51+
data: () => {
52+
return {
53+
selectedOtherBooleanRule: "",
54+
};
55+
},
56+
57+
methods:{
58+
otherBooleanQueryBuilderComponents() {
59+
return sortBy([
60+
{
61+
identifier: "isImplemented",
62+
name: "Is Implemented",
63+
component: IsImplemented,
64+
initialValue: "",
65+
},
66+
{
67+
identifier: "hasPublication",
68+
name: "Has Publication",
69+
component: HasPublication,
70+
initialValue: "",
71+
},
72+
{
73+
identifier: "usesPersistentIdentifier",
74+
name: "Uses Persistent Identifier",
75+
component: UsesPersistentIdentifier,
76+
initialValue: "",
77+
},
78+
{
79+
identifier: "recommendsDatabase",
80+
name: "Recommends Database",
81+
component: RecommendsDatabase,
82+
initialValue: "",
83+
},
84+
{
85+
identifier: "recommendsStandard",
86+
name: "Recommends Standard",
87+
component: RecommendsStandard,
88+
initialValue: "",
89+
},
90+
{
91+
identifier: "updatingOfDmp",
92+
name: "Updating Of Dmp",
93+
component: UpdatingOfDmp,
94+
initialValue: "",
95+
},
96+
{
97+
identifier: "guidanceToHelpEnableCompliance",
98+
name: "Guidance To Help Enable Compliance",
99+
component: GuidanceToHelpEnableCompliance,
100+
initialValue: "",
101+
},
102+
{
103+
identifier: "monitoringOfCompliance",
104+
name: "Monitoring Of Compliance",
105+
component: MonitoringOfCompliance,
106+
initialValue: "",
107+
},
108+
], "name")
109+
},
110+
111+
/**
112+
* Add rule to query builder
113+
* @param item - Object
114+
* @param selectedRule - String
115+
*/
116+
addNewRule(item, selectedRule) {
117+
item.addRule(selectedRule)
118+
this.selectedOtherBooleanRule = ''
119+
},
120+
}
121+
};
122+
</script>
123+

src/components/Records/Search/Input/AdvancedSearch/QueryBuilderComponents/GroupCtrlSlot/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ export const DatabaseRule = () =>
55
import("./DatabaseRule.vue");
66

77
export const PolicyRule = () =>
8-
import("./PolicyRule.vue");
8+
import("./PolicyRule.vue");
9+
export const OtherBooleanRule = () =>
10+
import("./OtherBooleanRule.vue");
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="d-flex width-90">
3+
<TooltipComponent :tool-tip-text="toolTipText" />
4+
<RadioComponent
5+
v-model="model"
6+
:item-value="itemValue"
7+
@input="selectedValue"
8+
/>
9+
</div>
10+
</template>
11+
12+
<script>
13+
import RadioComponent from "../RadioComponent.vue";
14+
import TooltipComponent from "../TooltipComponent.vue";
15+
16+
export default {
17+
name: "GuidanceToHelpEnableCompliance",
18+
components: { TooltipComponent, RadioComponent },
19+
props: {
20+
value: {
21+
type: String,
22+
default: "",
23+
},
24+
},
25+
data: () => {
26+
return {
27+
itemValue:"",
28+
toolTipText: "GuidanceToHelpEnableCompliance",
29+
30+
};
31+
},
32+
computed: {
33+
model: {
34+
get() {
35+
return this.value;
36+
},
37+
set(value) {
38+
this.$emit("input", value);
39+
},
40+
},
41+
},
42+
watch: {
43+
itemSelected(newValue) {
44+
this.itemValue = newValue;
45+
},
46+
},
47+
mounted() {
48+
//Pre-fill selected values on edit advanced search fields
49+
this.itemValue = this.value;
50+
},
51+
52+
methods: {
53+
selectedValue(item) {
54+
this.itemSelected = item;
55+
},
56+
},
57+
};
58+
</script>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="d-flex width-90">
3+
<TooltipComponent :tool-tip-text="toolTipText" />
4+
<RadioComponent
5+
v-model="model"
6+
:item-value="itemValue"
7+
@input="selectedValue"
8+
/>
9+
</div>
10+
</template>
11+
12+
<script>
13+
import RadioComponent from "../RadioComponent.vue";
14+
import TooltipComponent from "../TooltipComponent.vue";
15+
16+
export default {
17+
name: "HasPublication",
18+
components: { TooltipComponent, RadioComponent },
19+
props: {
20+
value: {
21+
type: String,
22+
default: "",
23+
},
24+
},
25+
data: () => {
26+
return {
27+
itemValue:"",
28+
toolTipText: "HasPublication",
29+
30+
};
31+
},
32+
computed: {
33+
model: {
34+
get() {
35+
return this.value;
36+
},
37+
set(value) {
38+
this.$emit("input", value);
39+
},
40+
},
41+
},
42+
watch: {
43+
itemSelected(newValue) {
44+
this.itemValue = newValue;
45+
},
46+
},
47+
mounted() {
48+
//Pre-fill selected values on edit advanced search fields
49+
this.itemValue = this.value;
50+
},
51+
52+
methods: {
53+
selectedValue(item) {
54+
this.itemSelected = item;
55+
},
56+
},
57+
};
58+
</script>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="d-flex width-90">
3+
<TooltipComponent :tool-tip-text="toolTipText" />
4+
<RadioComponent
5+
v-model="model"
6+
:item-value="itemValue"
7+
@input="selectedValue"
8+
/>
9+
</div>
10+
</template>
11+
12+
<script>
13+
import RadioComponent from "../RadioComponent.vue";
14+
import TooltipComponent from "../TooltipComponent.vue";
15+
16+
export default {
17+
name: "IsImplemented",
18+
components: { TooltipComponent, RadioComponent },
19+
props: {
20+
value: {
21+
type: String,
22+
default: "",
23+
},
24+
},
25+
data: () => {
26+
return {
27+
itemValue:"",
28+
toolTipText: "IsImplemented",
29+
30+
};
31+
},
32+
computed: {
33+
model: {
34+
get() {
35+
return this.value;
36+
},
37+
set(value) {
38+
this.$emit("input", value);
39+
},
40+
},
41+
},
42+
watch: {
43+
itemSelected(newValue) {
44+
this.itemValue = newValue;
45+
},
46+
},
47+
mounted() {
48+
//Pre-fill selected values on edit advanced search fields
49+
this.itemValue = this.value;
50+
},
51+
52+
methods: {
53+
selectedValue(item) {
54+
this.itemSelected = item;
55+
},
56+
},
57+
};
58+
</script>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="d-flex width-90">
3+
<TooltipComponent :tool-tip-text="toolTipText" />
4+
<RadioComponent
5+
v-model="model"
6+
:item-value="itemValue"
7+
@input="selectedValue"
8+
/>
9+
</div>
10+
</template>
11+
12+
<script>
13+
import RadioComponent from "../RadioComponent.vue";
14+
import TooltipComponent from "../TooltipComponent.vue";
15+
16+
export default {
17+
name: "MonitoringOfCompliance",
18+
components: { TooltipComponent, RadioComponent },
19+
props: {
20+
value: {
21+
type: String,
22+
default: "",
23+
},
24+
},
25+
data: () => {
26+
return {
27+
itemValue:"",
28+
toolTipText: "MonitoringOfCompliance",
29+
30+
};
31+
},
32+
computed: {
33+
model: {
34+
get() {
35+
return this.value;
36+
},
37+
set(value) {
38+
this.$emit("input", value);
39+
},
40+
},
41+
},
42+
watch: {
43+
itemSelected(newValue) {
44+
this.itemValue = newValue;
45+
},
46+
},
47+
mounted() {
48+
//Pre-fill selected values on edit advanced search fields
49+
this.itemValue = this.value;
50+
},
51+
52+
methods: {
53+
selectedValue(item) {
54+
this.itemSelected = item;
55+
},
56+
},
57+
};
58+
</script>

0 commit comments

Comments
 (0)