Skip to content

Commit 8e22860

Browse files
committed
fix: add oa_locations_embargoed when create apikey and use * if all selected
1 parent d64a611 commit 8e22860

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

services/frontend/components/administration/apikey/CreateDialog.vue

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@
7070
<v-divider />
7171
<v-card-title> {{ t('administration.apikey.attributes') }} </v-card-title>
7272
<UnpaywallArgsSelectorAttributes
73-
:simple="attributesSimple"
74-
:best-oa-location="attributesBestOaLocation"
75-
:first-oa-location="attributesFirstOaLocation"
76-
:oa-locations="attributesOaLocations"
77-
:z-authors="attributesZAuthors"
7873
@attributes="updateAttributes"
7974
/>
8075
</v-form>
@@ -140,12 +135,6 @@ const validForm = computed(() => attributes.value?.length > 0
140135
&& name.value?.length > 0
141136
&& access.value?.length > 0);
142137
143-
const attributesSimple = computed(() => attributes.value?.filter((e) => !e.includes('.')));
144-
const attributesBestOaLocation = computed(() => attributes.value?.filter((e) => e.includes('best_oa_location')).map((e) => e.split('.')[1]));
145-
const attributesFirstOaLocation = computed(() => attributes.value?.filter((e) => e.includes('first_oa_location')).map((e) => e.split('.')[1]));
146-
const attributesOaLocations = computed(() => attributes.value?.filter((e) => e.includes('oa_locations')).map((e) => e.split('.')[1]));
147-
const attributesZAuthors = computed(() => attributes.value?.filter((e) => e.includes('z_authors')).map((e) => e.split('.')[1]));
148-
149138
async function createApikey() {
150139
loading.value = true;
151140
try {
@@ -174,13 +163,12 @@ async function createApikey() {
174163
emit('update:modelValue', false);
175164
}
176165
177-
function updateAttributes(attributesSelected) {
178-
// TODO 50 is the sum of attributes available through ezunpaywall
179-
if (attributesSelected.length === 50) {
166+
function updateAttributes(selectedAttributes) {
167+
// 18 + 5 + 4 * 11 = 67 is the sum of attributes available through ezunpaywall
168+
if (selectedAttributes.length === 66) {
180169
attributes.value = ['*'];
181170
} else {
182-
attributes.value = attributesSelected;
171+
attributes.value = selectedAttributes;
183172
}
184173
}
185-
186174
</script>

0 commit comments

Comments
 (0)