Lines 2-29
Link Here
|
2 |
<div v-if="!initialized">{{ $__("Loading") }}</div> |
2 |
<div v-if="!initialized">{{ $__("Loading") }}</div> |
3 |
<div v-else id="usage_data_providers_list"> |
3 |
<div v-else id="usage_data_providers_list"> |
4 |
<template class="toolbar_options"> |
4 |
<template class="toolbar_options"> |
5 |
<Toolbar /> |
5 |
<Toolbar> |
6 |
<div |
6 |
<ToolbarButton |
7 |
v-if="usage_data_provider_count > 0" |
7 |
action="add" |
8 |
id="toolbar" |
8 |
@go-to-add-resource="goToResourceAdd" |
9 |
class="btn-toolbar" |
9 |
:title="$__('New data provider')" |
10 |
> |
10 |
/> |
11 |
<router-link |
11 |
<ToolbarButton |
|
|
12 |
v-if="usage_data_provider_count > 0" |
12 |
:to="{ name: 'UsageStatisticsDataProvidersSummary' }" |
13 |
:to="{ name: 'UsageStatisticsDataProvidersSummary' }" |
13 |
class="btn btn-default" |
14 |
icon="list" |
14 |
> |
15 |
:title="$__('Data providers summary')" |
15 |
<i class="fa fa-list"></i> |
16 |
/> |
16 |
{{ $__("Data providers summary") }}</router-link |
17 |
</Toolbar> |
17 |
> |
|
|
18 |
</div> |
19 |
</template> |
18 |
</template> |
20 |
<div v-if="usage_data_provider_count > 0" class="page-section"> |
19 |
<div v-if="usage_data_provider_count > 0" class="page-section"> |
21 |
<KohaTable |
20 |
<KohaTable |
22 |
ref="table" |
21 |
ref="table" |
23 |
v-bind="tableOptions" |
22 |
v-bind="tableOptions" |
24 |
@show="show_usage_data_provider" |
23 |
@show="goToResourceShow" |
25 |
@edit="edit_usage_data_provider" |
24 |
@edit="goToResourceEdit" |
26 |
@delete="delete_usage_data_provider" |
25 |
@delete="doResourceDelete" |
27 |
@run_now="run_harvester_now" |
26 |
@run_now="run_harvester_now" |
28 |
@test_connection="test_harvester_connection" |
27 |
@test_connection="test_harvester_connection" |
29 |
></KohaTable> |
28 |
></KohaTable> |
Lines 35-61
Link Here
|
35 |
</template> |
34 |
</template> |
36 |
|
35 |
|
37 |
<script> |
36 |
<script> |
38 |
import Toolbar from "./UsageStatisticsDataProvidersToolbar.vue" |
37 |
import Toolbar from "../Toolbar.vue" |
|
|
38 |
import ToolbarButton from "../ToolbarButton.vue" |
39 |
import { inject, ref } from "vue" |
39 |
import { inject, ref } from "vue" |
40 |
import { APIClient } from "../../fetch/api-client.js" |
40 |
import { APIClient } from "../../fetch/api-client.js" |
41 |
import KohaTable from "../KohaTable.vue" |
41 |
import KohaTable from "../KohaTable.vue" |
|
|
42 |
import UsageStatisticsDataProviderResource from "./UsageStatisticsDataProviderResource.vue" |
42 |
|
43 |
|
43 |
export default { |
44 |
export default { |
|
|
45 |
extends: UsageStatisticsDataProviderResource, |
44 |
setup() { |
46 |
setup() { |
45 |
const AVStore = inject("AVStore") // Left in for future permissions fixes |
47 |
const AVStore = inject("AVStore") // Left in for future permissions fixes |
46 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
48 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
47 |
|
49 |
|
48 |
const { setConfirmationDialog, setMessage, setWarning } = |
|
|
49 |
inject("mainStore") |
50 |
|
51 |
const table = ref() |
50 |
const table = ref() |
52 |
|
51 |
|
53 |
return { |
52 |
return { |
|
|
53 |
...UsageStatisticsDataProviderResource.setup(), |
54 |
get_lib_from_av, |
54 |
get_lib_from_av, |
55 |
map_av_dt_filter, |
55 |
map_av_dt_filter, |
56 |
setConfirmationDialog, |
|
|
57 |
setMessage, |
58 |
setWarning, |
59 |
table, |
56 |
table, |
60 |
} |
57 |
} |
61 |
}, |
58 |
}, |
Lines 67-73
export default {
Link Here
|
67 |
tableOptions: { |
64 |
tableOptions: { |
68 |
columns: this.getTableColumns(), |
65 |
columns: this.getTableColumns(), |
69 |
options: {}, |
66 |
options: {}, |
70 |
url: () => this.table_url(), |
67 |
url: () => this.getResourceTableUrl(), |
71 |
table_settings: this.usage_data_provider_table_settings, |
68 |
table_settings: this.usage_data_provider_table_settings, |
72 |
add_filters: true, |
69 |
add_filters: true, |
73 |
actions: { |
70 |
actions: { |
Lines 103-161
export default {
Link Here
|
103 |
error => {} |
100 |
error => {} |
104 |
) |
101 |
) |
105 |
}, |
102 |
}, |
106 |
table_url() { |
|
|
107 |
let url = "/api/v1/erm/usage_data_providers" |
108 |
return url |
109 |
}, |
110 |
show_usage_data_provider(usage_data_provider, dt, event) { |
111 |
event.preventDefault() |
112 |
|
113 |
this.$router.push({ |
114 |
name: "UsageStatisticsDataProvidersShow", |
115 |
params: { |
116 |
usage_data_provider_id: |
117 |
usage_data_provider.erm_usage_data_provider_id, |
118 |
}, |
119 |
}) |
120 |
}, |
121 |
edit_usage_data_provider(usage_data_provider, dt, event) { |
122 |
this.$router.push({ |
123 |
name: "UsageStatisticsDataProvidersFormAddEdit", |
124 |
params: { |
125 |
usage_data_provider_id: |
126 |
usage_data_provider.erm_usage_data_provider_id, |
127 |
}, |
128 |
}) |
129 |
}, |
130 |
delete_usage_data_provider(usage_data_provider, dt, event) { |
131 |
this.setConfirmationDialog( |
132 |
{ |
133 |
title: this.$__( |
134 |
"Are you sure you want to remove this data provider?" |
135 |
), |
136 |
message: usage_data_provider.name, |
137 |
accept_label: this.$__("Yes, delete"), |
138 |
cancel_label: this.$__("No, do not delete"), |
139 |
}, |
140 |
() => { |
141 |
const client = APIClient.erm |
142 |
client.usage_data_providers |
143 |
.delete(usage_data_provider.erm_usage_data_provider_id) |
144 |
.then( |
145 |
success => { |
146 |
this.setMessage( |
147 |
this.$__("Data provider %s deleted").format( |
148 |
usage_data_provider.name |
149 |
), |
150 |
true |
151 |
) |
152 |
dt.draw() |
153 |
}, |
154 |
error => {} |
155 |
) |
156 |
} |
157 |
) |
158 |
}, |
159 |
run_harvester_now(usage_data_provider, dt, event) { |
103 |
run_harvester_now(usage_data_provider, dt, event) { |
160 |
const { erm_usage_data_provider_id: id, name } = usage_data_provider |
104 |
const { erm_usage_data_provider_id: id, name } = usage_data_provider |
161 |
|
105 |
|
Lines 307-315
export default {
Link Here
|
307 |
orderable: true, |
251 |
orderable: true, |
308 |
render: function (data, type, row, meta) { |
252 |
render: function (data, type, row, meta) { |
309 |
return ( |
253 |
return ( |
310 |
'<a href="/cgi-bin/koha/erm/eusage/usage_data_providers/' + |
254 |
'<a role="button" class="show">' + |
311 |
row.erm_usage_data_provider_id + |
|
|
312 |
'" class="show">' + |
313 |
escape_str( |
255 |
escape_str( |
314 |
`${row.name} (#${row.erm_usage_data_provider_id})` |
256 |
`${row.name} (#${row.erm_usage_data_provider_id})` |
315 |
) + |
257 |
) + |
Lines 347-354
export default {
Link Here
|
347 |
this.getUsageDataProviderCount() |
289 |
this.getUsageDataProviderCount() |
348 |
} |
290 |
} |
349 |
}, |
291 |
}, |
350 |
components: { Toolbar, KohaTable }, |
292 |
components: { Toolbar, ToolbarButton, KohaTable }, |
351 |
name: "DataProvidersList", |
293 |
name: "UsageStatisticsDataProvidersList", |
352 |
} |
294 |
} |
353 |
</script> |
295 |
</script> |
354 |
|
296 |
|