1
1
import { TASK_STATUS_STRING } from './constants.js'
2
- // import { linkTo } from '@nextcloud/router'
3
- // import { getRequestToken } from '@nextcloud/auth'
4
2
import { showError } from '@nextcloud/dialogs'
5
3
6
- // __webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
7
- // __webpack_public_path__ = linkTo('assistant', 'js/') // eslint-disable-line
8
4
window . assistantPollTimerId = null
9
5
10
6
// TODO add param to lock on specific task type
@@ -50,8 +46,8 @@ export async function openAssistantForm({
50
46
isInsideViewer = undefined , closeOnResult = false , actionButtons = undefined ,
51
47
customId = '' , identifier = '' ,
52
48
} ) {
53
- const { default : Vue } = await import ( /* webpackChunkName: "vue-lazy" */ 'vue' )
54
- const { default : AssistantTextProcessingModal } = await import ( /* webpackChunkName: "assistant-modal-lazy" */ './components/AssistantTextProcessingModal.vue' )
49
+ const { default : Vue } = await import ( 'vue' )
50
+ const { default : AssistantTextProcessingModal } = await import ( './components/AssistantTextProcessingModal.vue' )
55
51
Vue . mixin ( { methods : { t, n } } )
56
52
57
53
// fallback to the last used one
@@ -197,22 +193,22 @@ export async function cancelTaskPolling() {
197
193
198
194
export async function getTask ( taskId ) {
199
195
window . assistantAbortController = new AbortController ( )
200
- const { default : axios } = await import ( /* webpackChunkName: "axios-lazy" */ '@nextcloud/axios' )
201
- const { generateOcsUrl } = await import ( /* webpackChunkName: "router-gen-lazy" */ '@nextcloud/router' )
196
+ const { default : axios } = await import ( '@nextcloud/axios' )
197
+ const { generateOcsUrl } = await import ( '@nextcloud/router' )
202
198
const url = generateOcsUrl ( 'taskprocessing/task/{taskId}' , { taskId } )
203
199
return axios . get ( url , { signal : window . assistantAbortController . signal } )
204
200
}
205
201
206
202
export async function setNotifyReady ( taskId ) {
207
- const { default : axios } = await import ( /* webpackChunkName: "axios-lazy" */ '@nextcloud/axios' )
208
- const { generateOcsUrl } = await import ( /* webpackChunkName: "router-gen-lazy" */ '@nextcloud/router' )
203
+ const { default : axios } = await import ( '@nextcloud/axios' )
204
+ const { generateOcsUrl } = await import ( '@nextcloud/router' )
209
205
const url = generateOcsUrl ( '/apps/assistant/api/v1/task/{taskId}/notify' , { taskId } )
210
206
return axios . post ( url , { } )
211
207
}
212
208
213
209
export async function cancelTask ( taskId ) {
214
- const { default : axios } = await import ( /* webpackChunkName: "axios-lazy" */ '@nextcloud/axios' )
215
- const { generateOcsUrl } = await import ( /* webpackChunkName: "router-gen-lazy" */ '@nextcloud/router' )
210
+ const { default : axios } = await import ( '@nextcloud/axios' )
211
+ const { generateOcsUrl } = await import ( '@nextcloud/router' )
216
212
const url = generateOcsUrl ( 'taskprocessing/task/{taskId}' , { taskId } )
217
213
return axios . delete ( url , { } )
218
214
}
@@ -228,8 +224,8 @@ export async function cancelTask(taskId) {
228
224
*/
229
225
export async function scheduleTask ( appId , customId , taskType , inputs ) {
230
226
window . assistantAbortController = new AbortController ( )
231
- const { default : axios } = await import ( /* webpackChunkName: "axios-lazy" */ '@nextcloud/axios' )
232
- const { generateOcsUrl } = await import ( /* webpackChunkName: "router-gen-lazy" */ '@nextcloud/router' )
227
+ const { default : axios } = await import ( '@nextcloud/axios' )
228
+ const { generateOcsUrl } = await import ( '@nextcloud/router' )
233
229
saveLastSelectedTaskType ( taskType )
234
230
const url = generateOcsUrl ( 'taskprocessing/schedule' )
235
231
const params = {
@@ -242,8 +238,8 @@ export async function scheduleTask(appId, customId, taskType, inputs) {
242
238
}
243
239
244
240
async function saveLastSelectedTaskType ( taskType ) {
245
- const { default : axios } = await import ( /* webpackChunkName: "axios-lazy" */ '@nextcloud/axios' )
246
- const { generateUrl } = await import ( /* webpackChunkName: "router-gen-lazy" */ '@nextcloud/router' )
241
+ const { default : axios } = await import ( '@nextcloud/axios' )
242
+ const { generateUrl } = await import ( '@nextcloud/router' )
247
243
248
244
const req = {
249
245
values : {
@@ -255,8 +251,8 @@ async function saveLastSelectedTaskType(taskType) {
255
251
}
256
252
257
253
async function getLastSelectedTaskType ( ) {
258
- const { default : axios } = await import ( /* webpackChunkName: "axios-lazy" */ '@nextcloud/axios' )
259
- const { generateUrl } = await import ( /* webpackChunkName: "router-gen-lazy" */ '@nextcloud/router' )
254
+ const { default : axios } = await import ( '@nextcloud/axios' )
255
+ const { generateUrl } = await import ( '@nextcloud/router' )
260
256
261
257
const req = {
262
258
params : {
@@ -316,10 +312,10 @@ async function showAssistantTaskResult(taskId) {
316
312
* @return {Promise<void> }
317
313
*/
318
314
export async function openAssistantTask ( task , { isInsideViewer = undefined , actionButtons = undefined } = { } ) {
319
- const { default : Vue } = await import ( /* webpackChunkName: "vue-lazy" */ 'vue' )
315
+ const { default : Vue } = await import ( 'vue' )
320
316
Vue . mixin ( { methods : { t, n } } )
321
- const { showError } = await import ( /* webpackChunkName: "dialogs-lazy" */ '@nextcloud/dialogs' )
322
- const { default : AssistantTextProcessingModal } = await import ( /* webpackChunkName: "assistant-modal-lazy" */ './components/AssistantTextProcessingModal.vue' )
317
+ const { showError } = await import ( '@nextcloud/dialogs' )
318
+ const { default : AssistantTextProcessingModal } = await import ( './components/AssistantTextProcessingModal.vue' )
323
319
324
320
const modalId = 'assistantTextProcessingModal'
325
321
const modalElement = document . createElement ( 'div' )
@@ -432,8 +428,8 @@ export async function addAssistantMenuEntry() {
432
428
menuEntry . id = 'assistant'
433
429
headerRight . prepend ( menuEntry )
434
430
435
- const { default : Vue } = await import ( /* webpackChunkName: "vue-lazy" */ 'vue' )
436
- const { default : AssistantHeaderMenuEntry } = await import ( /* webpackChunkName: "assistant-header-lazy" */ './components/AssistantHeaderMenuEntry.vue' )
431
+ const { default : Vue } = await import ( 'vue' )
432
+ const { default : AssistantHeaderMenuEntry } = await import ( './components/AssistantHeaderMenuEntry.vue' )
437
433
Vue . mixin ( { methods : { t, n } } )
438
434
439
435
const View = Vue . extend ( AssistantHeaderMenuEntry )
0 commit comments