|
| 1 | +(function() { |
| 2 | + "use strict"; |
| 3 | + try { |
| 4 | + if (typeof document != "undefined") { |
| 5 | + var elementStyle = document.createElement("style"); |
| 6 | + elementStyle.appendChild(document.createTextNode(".activity[data-v-c28f4480] {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n height: 100%;\n}\n.activity__actions[data-v-c28f4480] {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.activity__list[data-v-c28f4480] {\n flex-grow: 1;\n overflow: scroll;\n}\n.activity__empty-content[data-v-c28f4480] {\n height: 100%;\n}\n[data-v-c28f4480] .empty-content__icon span {\n background-size: 64px;\n width: 64px;\n height: 64px;\n}")); |
| 7 | + document.head.appendChild(elementStyle); |
| 8 | + } |
| 9 | + } catch (e) { |
| 10 | + console.error("vite-plugin-css-injected-by-js", e); |
| 11 | + } |
| 12 | +})(); |
| 13 | +const appName = "activity"; |
| 14 | +const appVersion = "7.0.0-dev.0"; |
| 15 | +import { l as lightningBoltSVG } from "./activity-sidebar.mjs"; |
| 16 | +import { c as _export_sfc, n as NcLoadingIcon, b as NcIconSvgWrapper, j as cancelableClient, k as generateOcsUrl } from "./NcCheckboxRadioSwitch-ChNSuhe6-DALftZ4Z.chunk.mjs"; |
| 17 | +import { d as defineComponent, r as ref, x as onMounted, B as getCurrentInstance, y as onBeforeUnmount, a as createElementBlock, b as openBlock, M as translate, l as nextTick, m as resolveComponent, E as createCommentVNode, e as createBlock, i as withCtx, h as createVNode, F as Fragment, N as renderList, n as normalizeClass } from "./index-BDkHJXhQ.chunk.mjs"; |
| 18 | +import { N as NcEmptyContent, A as ActivityComponent, e as ActivityModel } from "./ActivityComponent-Dm8Il1yC.chunk.mjs"; |
| 19 | +import { g as getActivityFilters, a as getAdditionalEntries, b as getSidebarActions } from "./api-DR5kSjBu.chunk.mjs"; |
| 20 | +import { l as logger } from "./logger-uIIWoPgu.chunk.mjs"; |
| 21 | +import "./preload-helper-BNx4Cq8O.chunk.mjs"; |
| 22 | +import "./index-C6VBhB33.chunk.mjs"; |
| 23 | +const _sfc_main = /* @__PURE__ */ defineComponent({ |
| 24 | + __name: "ActivitySidebarPlugin", |
| 25 | + props: { |
| 26 | + plugin: { type: Object, required: true }, |
| 27 | + node: { type: null, required: true } |
| 28 | + }, |
| 29 | + emits: ["reload-activities"], |
| 30 | + setup(__props, { expose: __expose, emit: __emit }) { |
| 31 | + __expose(); |
| 32 | + const props = __props; |
| 33 | + const emit = __emit; |
| 34 | + const attachTarget = ref(); |
| 35 | + onMounted(() => props.plugin.mount(attachTarget.value, { |
| 36 | + node: props.node, |
| 37 | + context: getCurrentInstance()?.proxy ?? void 0, |
| 38 | + reload: () => emit("reload-activities") |
| 39 | + })); |
| 40 | + onBeforeUnmount(() => props.plugin.unmount()); |
| 41 | + const __returned__ = { props, emit, attachTarget }; |
| 42 | + Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true }); |
| 43 | + return __returned__; |
| 44 | + } |
| 45 | +}); |
| 46 | +const _hoisted_1$1 = { ref: "attachTarget" }; |
| 47 | +function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { |
| 48 | + return openBlock(), createElementBlock( |
| 49 | + "div", |
| 50 | + _hoisted_1$1, |
| 51 | + null, |
| 52 | + 512 |
| 53 | + /* NEED_PATCH */ |
| 54 | + ); |
| 55 | +} |
| 56 | +const ActivitySidebarPlugin = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render$1], ["__file", "/home/anna/Desktop/Nextcloud/nextcloud-docker-dev/workspace/server/apps-extra/activity/src/components/ActivitySidebarPlugin.vue"]]); |
| 57 | +const ActivityTab$1 = defineComponent({ |
| 58 | + name: "ActivityTab", |
| 59 | + components: { |
| 60 | + ActivityComponent, |
| 61 | + NcEmptyContent, |
| 62 | + NcIconSvgWrapper, |
| 63 | + NcLoadingIcon, |
| 64 | + ActivitySidebarPlugin |
| 65 | + }, |
| 66 | + props: { |
| 67 | + /** |
| 68 | + * The node currently displayed in the sidebar |
| 69 | + */ |
| 70 | + node: { |
| 71 | + type: Object, |
| 72 | + required: true |
| 73 | + }, |
| 74 | + /** |
| 75 | + * The folder shown in the files app |
| 76 | + */ |
| 77 | + // eslint-disable-next-line vue/no-unused-properties |
| 78 | + folder: { |
| 79 | + type: Object, |
| 80 | + required: false, |
| 81 | + default: void 0 |
| 82 | + }, |
| 83 | + /** |
| 84 | + * The view shown in the files app |
| 85 | + */ |
| 86 | + // eslint-disable-next-line vue/no-unused-properties |
| 87 | + view: { |
| 88 | + type: Object, |
| 89 | + required: false, |
| 90 | + default: void 0 |
| 91 | + } |
| 92 | + }, |
| 93 | + expose: ["update"], |
| 94 | + data() { |
| 95 | + return { |
| 96 | + error: "", |
| 97 | + loading: true, |
| 98 | + activities: [], |
| 99 | + lightningBoltSVG, |
| 100 | + sidebarPlugins: [] |
| 101 | + }; |
| 102 | + }, |
| 103 | + watch: { |
| 104 | + node: { |
| 105 | + immediate: true, |
| 106 | + async handler() { |
| 107 | + await this.update(); |
| 108 | + } |
| 109 | + } |
| 110 | + }, |
| 111 | + async mounted() { |
| 112 | + if (this.node) { |
| 113 | + await this.update(); |
| 114 | + } |
| 115 | + }, |
| 116 | + methods: { |
| 117 | + /** |
| 118 | + * Update current view and fetch new activities |
| 119 | + */ |
| 120 | + async update() { |
| 121 | + this.sidebarPlugins = []; |
| 122 | + const sidebarPlugins = getSidebarActions(); |
| 123 | + if (sidebarPlugins.length > 0) { |
| 124 | + nextTick(() => { |
| 125 | + this.sidebarPlugins = sidebarPlugins; |
| 126 | + }); |
| 127 | + } |
| 128 | + this.resetState(); |
| 129 | + await this.getActivities(); |
| 130 | + }, |
| 131 | + /** |
| 132 | + * Get the existing activities |
| 133 | + */ |
| 134 | + async getActivities() { |
| 135 | + try { |
| 136 | + this.loading = true; |
| 137 | + const activities = await this.processActivities(await this.loadRealActivities()); |
| 138 | + const otherEntries = await getAdditionalEntries({ node: this.node }); |
| 139 | + this.activities = [...activities, ...otherEntries].sort((a, b) => b.timestamp - a.timestamp); |
| 140 | + } catch (error) { |
| 141 | + this.error = translate("activity", "Unable to load the activity list"); |
| 142 | + logger.error("Error loading the activity list", { error }); |
| 143 | + } finally { |
| 144 | + this.loading = false; |
| 145 | + } |
| 146 | + }, |
| 147 | + /** |
| 148 | + * Reset the current view to its default state |
| 149 | + */ |
| 150 | + resetState() { |
| 151 | + this.loading = true; |
| 152 | + this.error = ""; |
| 153 | + this.activities = []; |
| 154 | + }, |
| 155 | + /** |
| 156 | + * Load activites from API |
| 157 | + */ |
| 158 | + async loadRealActivities() { |
| 159 | + try { |
| 160 | + const { data } = await cancelableClient.get( |
| 161 | + generateOcsUrl("apps/activity/api/v2/activity/filter"), |
| 162 | + { |
| 163 | + params: { |
| 164 | + format: "json", |
| 165 | + object_type: "files", |
| 166 | + object_id: this.node.fileid |
| 167 | + } |
| 168 | + } |
| 169 | + ); |
| 170 | + return data.ocs.data; |
| 171 | + } catch (error) { |
| 172 | + if (error.response !== void 0 && error.response.status === 304) { |
| 173 | + return []; |
| 174 | + } |
| 175 | + throw error; |
| 176 | + } |
| 177 | + }, |
| 178 | + /** |
| 179 | + * Process the API response activities and apply filter |
| 180 | + * |
| 181 | + * @param activities the activites |
| 182 | + */ |
| 183 | + processActivities(activities) { |
| 184 | + activities = activities.map((activity) => new ActivityModel(activity)); |
| 185 | + logger.debug(`Processed ${activities.length} activity(ies)`, { |
| 186 | + activities, |
| 187 | + node: this.node |
| 188 | + }); |
| 189 | + const filters = getActivityFilters(); |
| 190 | + return activities.filter((activity) => !filters || filters.every((filter) => filter(activity))); |
| 191 | + }, |
| 192 | + t: translate |
| 193 | + } |
| 194 | +}); |
| 195 | +const _hoisted_1 = { |
| 196 | + key: 0, |
| 197 | + class: "activity__actions" |
| 198 | +}; |
| 199 | +const _hoisted_2 = { |
| 200 | + key: 3, |
| 201 | + class: "activity__list" |
| 202 | +}; |
| 203 | +function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { |
| 204 | + const _component_NcIconSvgWrapper = resolveComponent("NcIconSvgWrapper"); |
| 205 | + const _component_NcEmptyContent = resolveComponent("NcEmptyContent"); |
| 206 | + const _component_ActivitySidebarPlugin = resolveComponent("ActivitySidebarPlugin"); |
| 207 | + const _component_NcLoadingIcon = resolveComponent("NcLoadingIcon"); |
| 208 | + const _component_ActivityComponent = resolveComponent("ActivityComponent"); |
| 209 | + return openBlock(), createElementBlock( |
| 210 | + "div", |
| 211 | + { |
| 212 | + class: normalizeClass([{ "icon-loading": _ctx.loading }, "activity"]) |
| 213 | + }, |
| 214 | + [ |
| 215 | + createCommentVNode(" error message "), |
| 216 | + _ctx.error || !_ctx.node ? (openBlock(), createBlock(_component_NcEmptyContent, { |
| 217 | + key: 0, |
| 218 | + name: _ctx.error |
| 219 | + }, { |
| 220 | + icon: withCtx(() => [ |
| 221 | + createVNode(_component_NcIconSvgWrapper, { svg: _ctx.lightningBoltSVG }, null, 8, ["svg"]) |
| 222 | + ]), |
| 223 | + _: 1 |
| 224 | + /* STABLE */ |
| 225 | + }, 8, ["name"])) : (openBlock(), createElementBlock( |
| 226 | + Fragment, |
| 227 | + { key: 1 }, |
| 228 | + [ |
| 229 | + createCommentVNode(" activities actions "), |
| 230 | + _ctx.sidebarPlugins.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [ |
| 231 | + (openBlock(true), createElementBlock( |
| 232 | + Fragment, |
| 233 | + null, |
| 234 | + renderList(_ctx.sidebarPlugins, (plugin, index) => { |
| 235 | + return openBlock(), createBlock(_component_ActivitySidebarPlugin, { |
| 236 | + key: index, |
| 237 | + plugin, |
| 238 | + node: _ctx.node, |
| 239 | + onReloadActivities: _cache[0] || (_cache[0] = ($event) => _ctx.getActivities()) |
| 240 | + }, null, 8, ["plugin", "node"]); |
| 241 | + }), |
| 242 | + 128 |
| 243 | + /* KEYED_FRAGMENT */ |
| 244 | + )) |
| 245 | + ])) : createCommentVNode("v-if", true), |
| 246 | + createCommentVNode(" activities content "), |
| 247 | + _ctx.loading ? (openBlock(), createBlock(_component_NcEmptyContent, { |
| 248 | + key: 1, |
| 249 | + class: "activity__empty-content", |
| 250 | + name: _ctx.t("activity", "Loading activities") |
| 251 | + }, { |
| 252 | + icon: withCtx(() => [ |
| 253 | + createVNode(_component_NcLoadingIcon) |
| 254 | + ]), |
| 255 | + _: 1 |
| 256 | + /* STABLE */ |
| 257 | + }, 8, ["name"])) : _ctx.activities.length === 0 ? (openBlock(), createBlock(_component_NcEmptyContent, { |
| 258 | + key: 2, |
| 259 | + class: "activity__empty-content", |
| 260 | + name: _ctx.t("activity", "No activity yet") |
| 261 | + }, { |
| 262 | + icon: withCtx(() => [ |
| 263 | + createVNode(_component_NcIconSvgWrapper, { svg: _ctx.lightningBoltSVG }, null, 8, ["svg"]) |
| 264 | + ]), |
| 265 | + _: 1 |
| 266 | + /* STABLE */ |
| 267 | + }, 8, ["name"])) : (openBlock(), createElementBlock("ul", _hoisted_2, [ |
| 268 | + (openBlock(true), createElementBlock( |
| 269 | + Fragment, |
| 270 | + null, |
| 271 | + renderList(_ctx.activities, (activity) => { |
| 272 | + return openBlock(), createBlock(_component_ActivityComponent, { |
| 273 | + key: activity.id, |
| 274 | + activity, |
| 275 | + "show-previews": false, |
| 276 | + onReload: _cache[1] || (_cache[1] = ($event) => _ctx.getActivities()) |
| 277 | + }, null, 8, ["activity"]); |
| 278 | + }), |
| 279 | + 128 |
| 280 | + /* KEYED_FRAGMENT */ |
| 281 | + )) |
| 282 | + ])) |
| 283 | + ], |
| 284 | + 64 |
| 285 | + /* STABLE_FRAGMENT */ |
| 286 | + )) |
| 287 | + ], |
| 288 | + 2 |
| 289 | + /* CLASS */ |
| 290 | + ); |
| 291 | +} |
| 292 | +const ActivityTab = /* @__PURE__ */ _export_sfc(ActivityTab$1, [["render", _sfc_render], ["__scopeId", "data-v-c28f4480"], ["__file", "/home/anna/Desktop/Nextcloud/nextcloud-docker-dev/workspace/server/apps-extra/activity/src/views/ActivityTab.vue"]]); |
| 293 | +export { |
| 294 | + ActivityTab as default |
| 295 | +}; |
| 296 | +//# sourceMappingURL=ActivityTab-hCq1WvWt.chunk.mjs.map |
0 commit comments