View | Details | Raw Unified | Return to bug 39320
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/Widgets/ERMCounts.vue (-13 / +26 lines)
Lines 4-15 Link Here
4
            <ul class="count-list">
4
            <ul class="count-list">
5
                <li v-for="def in countDefinitions" :key="def.name">
5
                <li v-for="def in countDefinitions" :key="def.name">
6
                    <strong>
6
                    <strong>
7
                        <router-link v-if="def.page" :to="{ name: def.page }">
7
                        <router-link
8
                            v-if="def.page && !def.loading"
9
                            :to="{ name: def.page }"
10
                        >
8
                            {{ createCountText(def) }}
11
                            {{ createCountText(def) }}
9
                        </router-link>
12
                        </router-link>
10
                        <span v-else class="inactive-link">{{
13
                        <span v-else class="inactive-link">
11
                            createCountText(def)
14
                            <div
12
                        }}</span>
15
                                class="spinner-border spinner-border-sm"
16
                                role="status"
17
                            ></div>
18
                            {{ createCountText(def) }}
19
                        </span>
13
                    </strong>
20
                    </strong>
14
                </li>
21
                </li>
15
            </ul>
22
            </ul>
Lines 46-65 export default { Link Here
46
            },
53
            },
47
            emit
54
            emit
48
        );
55
        );
56
        baseWidget.loading.value = false;
49
        const countDefinitions = reactive([
57
        const countDefinitions = reactive([
50
            {
58
            {
51
                page: "AgreementsList",
59
                page: "AgreementsList",
52
                name: "agreements_count",
60
                name: "agreements_count",
53
                i18nLabel: count =>
61
                i18nLabel: count =>
54
                    __n("%s agreement", "%s agreements", count).format(count),
62
                    __n("%s agreement", "%s agreements", count).format(count),
55
                count: 0,
63
                count: "",
64
                loading: true,
56
            },
65
            },
57
            {
66
            {
58
                page: "LicensesList",
67
                page: "LicensesList",
59
                name: "licenses_count",
68
                name: "licenses_count",
60
                i18nLabel: count =>
69
                i18nLabel: count =>
61
                    __n("%s license", "%s licenses", count).format(count),
70
                    __n("%s license", "%s licenses", count).format(count),
62
                count: 0,
71
                count: "",
72
                loading: true,
63
            },
73
            },
64
            {
74
            {
65
                page: "EHoldingsLocalPackagesList",
75
                page: "EHoldingsLocalPackagesList",
Lines 68-74 export default { Link Here
68
                    __n("%s local package", "%s local packages", count).format(
78
                    __n("%s local package", "%s local packages", count).format(
69
                        count
79
                        count
70
                    ),
80
                    ),
71
                count: 0,
81
                count: "",
82
                loading: true,
72
            },
83
            },
73
            {
84
            {
74
                page: "EHoldingsLocalTitlesList",
85
                page: "EHoldingsLocalTitlesList",
Lines 77-83 export default { Link Here
77
                    __n("%s local title", "%s local titles", count).format(
88
                    __n("%s local title", "%s local titles", count).format(
78
                        count
89
                        count
79
                    ),
90
                    ),
80
                count: 0,
91
                count: "",
92
                loading: true,
81
            },
93
            },
82
            {
94
            {
83
                page: "UsageStatisticsDataProvidersList",
95
                page: "UsageStatisticsDataProvidersList",
Lines 88-94 export default { Link Here
88
                        "%s usage data providers",
100
                        "%s usage data providers",
89
                        count
101
                        count
90
                    ).format(count),
102
                    ).format(count),
91
                count: 0,
103
                count: "",
104
                loading: true,
92
            },
105
            },
93
        ]);
106
        ]);
94
107
Lines 124-140 export default { Link Here
124
                endpoints.forEach(({ name, endpoint }) => {
137
                endpoints.forEach(({ name, endpoint }) => {
125
                    endpoint
138
                    endpoint
126
                        .then(response => {
139
                        .then(response => {
127
                            const definition = countDefinitions.find(i => i.name === name);
140
                            const definition = countDefinitions.find(
141
                                i => i.name === name
142
                            );
128
                            if (definition) {
143
                            if (definition) {
129
                                definition.count = response;
144
                                definition.count = response;
145
                                definition.loading = false;
130
                            }
146
                            }
131
                        })
147
                        })
132
                        .catch(error => {
148
                        .catch(error => {
133
                            console.error(`Error fetching ${name}:`, error);
149
                            console.error(`Error fetching ${name}:`, error);
134
                        });
150
                        });
135
                });
151
                });
136
137
                baseWidget.loading.value = false;
138
            } catch (error) {
152
            } catch (error) {
139
                console.error(error);
153
                console.error(error);
140
            }
154
            }
141
- 

Return to bug 39320