@lcap/nasl 2.20.1-beta.2 → 2.20.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/classes/EntityProperty.html +1 -1
- package/out/automate/engine/operators.d.ts +10 -1
- package/out/automate/engine/operators.js +14 -5
- package/out/automate/engine/operators.js.map +1 -1
- package/out/automate/engine/viewCache.d.ts +1 -0
- package/out/automate/template/myProcess.d.ts +1 -0
- package/out/automate/template/myProcess.js +9021 -9021
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/concepts/Abort__.d.ts +25 -0
- package/out/concepts/Abort__.js +80 -0
- package/out/concepts/Abort__.js.map +1 -0
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +1 -0
- package/out/concepts/CallInterface__.js +32 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +2 -2
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +31 -0
- package/out/concepts/DatabaseTypeAnnotation__.js +78 -0
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -0
- package/out/concepts/Destination__.js +6 -6
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +1 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.d.ts +53 -0
- package/out/concepts/Integration__.js +143 -0
- package/out/concepts/Integration__.js.map +1 -0
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +9 -0
- package/out/concepts/Interface__.js +54 -0
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +42 -0
- package/out/concepts/JavaLogic__.js +122 -0
- package/out/concepts/JavaLogic__.js.map +1 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MicroApp__.d.ts +51 -0
- package/out/concepts/MicroApp__.js +113 -0
- package/out/concepts/MicroApp__.js.map +1 -0
- package/out/concepts/Module__.d.ts +1 -1
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +2 -0
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.js.map +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/config.d.ts +1 -1
- package/out/decorators/index.d.ts +2 -2
- package/out/generator/icestark.d.ts +2 -0
- package/out/generator/icestark.js +48 -0
- package/out/generator/icestark.js.map +1 -0
- package/out/generator/microApp.d.ts +2 -0
- package/out/generator/microApp.js +35 -0
- package/out/generator/microApp.js.map +1 -0
- package/out/generator/permission.d.ts +1 -1
- package/out/generator/qiankun.d.ts +2 -0
- package/out/generator/qiankun.js +52 -0
- package/out/generator/qiankun.js.map +1 -0
- package/out/manager/stepRecorder.d.ts +20 -0
- package/out/manager/stepRecorder.js +110 -0
- package/out/manager/stepRecorder.js.map +1 -0
- package/out/sentry/index.d.ts +29 -0
- package/out/sentry/index.js +111 -0
- package/out/sentry/index.js.map +1 -0
- package/out/server/getMemberIdentifier.js +3 -2
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -3
- package/out/server/getScope.d.ts +1 -1
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +11 -1
- package/out/server/naslServer.js.map +1 -1
- package/out/service/creator/add.configs.js +2 -0
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/creator/index.js +2 -0
- package/out/service/creator/index.js.map +1 -1
- package/out/service/storage/api.d.ts +18 -0
- package/out/service/storage/api.js +12 -0
- package/out/service/storage/api.js.map +1 -1
- package/out/service/storage/init.d.ts +41 -1
- package/out/service/storage/init.js +172 -42
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/service.d.ts +9 -1
- package/out/service/storage/service.js +27 -1
- package/out/service/storage/service.js.map +1 -1
- package/out/templator/genCreateBlock.js +1 -1
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -3
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +1 -1
- package/out/templator/genTableBlock.js +2 -2
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +1 -1
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/translator/index.d.ts +1 -1
- package/out/translator/lsp.d.ts +3 -3
- package/out/utils/index.d.ts +4 -4
- package/package.json +2 -2
- package/src/automate/engine/operators.js +13 -5
- package/src/automate/template/myProcess.js +11451 -11452
- package/src/automate/upgrader/2.20.js +1 -0
- package/src/concepts/CallInterface__.ts +34 -20
- package/src/concepts/CallLogic__.ts +2 -2
- package/src/concepts/Destination__.ts +6 -6
- package/src/concepts/Interface__.ts +59 -7
- package/src/concepts/OqlQueryComponent__.ts +2 -0
- package/src/concepts/Param__.ts +1 -1
- package/src/server/getMemberIdentifier.ts +5 -2
- package/src/server/naslServer.ts +8 -1
- package/src/service/creator/add.configs.js +3 -0
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/creator/index.js +3 -0
- package/src/service/storage/api.js +12 -0
- package/src/service/storage/init.ts +204 -41
- package/src/service/storage/service.ts +29 -1
- package/src/templator/genCreateBlock.ts +1 -1
- package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -2
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -3
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genSelectBlock.ts +1 -1
- package/src/templator/genTableBlock.ts +2 -2
- package/src/templator/genUpdateBlock.ts +1 -1
- package/out/automate/engine/2.14-components.d.ts +0 -1115
- package/out/automate/engine/2.14-components.js +0 -1087
- package/out/automate/engine/2.14-components.js.map +0 -1
- package/yarn-error.log +0 -2087
|
@@ -3,6 +3,7 @@ import { getConceptConstructor } from '../../decorators';
|
|
|
3
3
|
import { config } from '../../config';
|
|
4
4
|
import Vue from 'vue';
|
|
5
5
|
import storageService from './service';
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
6
7
|
/// #if !process.env.NODE_ENV || process.env.BUILD_TARGET === 'node'
|
|
7
8
|
import * as fs from 'fs-extra';
|
|
8
9
|
import * as jsoner from './jsoner';
|
|
@@ -10,6 +11,9 @@ import * as jsoner from './jsoner';
|
|
|
10
11
|
|
|
11
12
|
export const batchQuery = storageService.batchQuery;
|
|
12
13
|
export const batchAction = storageService.batchAction;
|
|
14
|
+
export const batchInstruct = storageService.batchInstruct;
|
|
15
|
+
|
|
16
|
+
let tabTimestamp: string;
|
|
13
17
|
|
|
14
18
|
function getLogic(key: string, app: any, diffLogicList: string[]) {
|
|
15
19
|
if (!diffLogicList.includes(key)) {
|
|
@@ -123,7 +127,6 @@ function getMiniAppChange(target: any, obj: any, action: string) {
|
|
|
123
127
|
* 执行更新
|
|
124
128
|
*/
|
|
125
129
|
async function doAction(app: any, actionItem: any) {
|
|
126
|
-
app.emit('saving');
|
|
127
130
|
let hasFrontEnd = false;
|
|
128
131
|
let hasBackEnd = false;
|
|
129
132
|
const actionList: any[] = [];
|
|
@@ -265,9 +268,186 @@ async function doAction(app: any, actionItem: any) {
|
|
|
265
268
|
}
|
|
266
269
|
} catch (error) {
|
|
267
270
|
console.log(error);
|
|
271
|
+
taskQueue.refreshNasl(app, {
|
|
272
|
+
errorInfo: {
|
|
273
|
+
message: error?.message,
|
|
274
|
+
stack: error?.stack,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const instructList = [{
|
|
281
|
+
uuid: uuidv4().replace(/-/g, ''),
|
|
282
|
+
actions: actionList,
|
|
283
|
+
}];
|
|
284
|
+
saveNasl({app, hasFrontEnd, hasBackEnd, instructList });
|
|
285
|
+
|
|
286
|
+
if (!app._historying) {
|
|
287
|
+
if (app._historyIndex !== app._historyList.length) {
|
|
288
|
+
app._historyList = app._historyList.splice(0, app._historyIndex);
|
|
289
|
+
}
|
|
290
|
+
app._historyList.push({
|
|
291
|
+
actionMsg,
|
|
292
|
+
list: list.map((item: any) => item.originEvent),
|
|
293
|
+
});
|
|
294
|
+
app._historyIndex = app._historyList.length;
|
|
295
|
+
} else {
|
|
296
|
+
const actionMap = {
|
|
297
|
+
undo: '已撤销操作:',
|
|
298
|
+
redo: '已重做操作:',
|
|
299
|
+
};
|
|
300
|
+
let msg = actionMap[action as 'undo' | 'redo'];
|
|
301
|
+
msg += actionMsg;
|
|
302
|
+
Vue.prototype.$toast.info(msg);
|
|
303
|
+
app._historying = false;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
type Instruct = {
|
|
308
|
+
uuid: string,
|
|
309
|
+
actions: any[],
|
|
310
|
+
};
|
|
311
|
+
type TaskOption = {
|
|
312
|
+
app: any,
|
|
313
|
+
hasFrontEnd: boolean,
|
|
314
|
+
hasBackEnd: boolean,
|
|
315
|
+
instructList: Instruct[],
|
|
316
|
+
};
|
|
317
|
+
enum TaskQueueStatus {
|
|
318
|
+
ExceedMaxTaskCount,
|
|
319
|
+
Retrying,
|
|
320
|
+
};
|
|
321
|
+
type RefreshNaslOptions = {
|
|
322
|
+
errorInfo: {
|
|
323
|
+
message?: string,
|
|
324
|
+
stack?: string,
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
class TaskQueue {
|
|
329
|
+
queue: TaskOption[] = []
|
|
330
|
+
lastQueue: TaskOption[] = []
|
|
331
|
+
running: Boolean = false
|
|
332
|
+
maxTaskCount: number = 10
|
|
333
|
+
status?: TaskQueueStatus = undefined
|
|
334
|
+
|
|
335
|
+
addTask(task: TaskOption) {
|
|
336
|
+
this.queue.push(task);
|
|
337
|
+
|
|
338
|
+
if(this.queue.length >= this.maxTaskCount) {
|
|
339
|
+
this.status = TaskQueueStatus.ExceedMaxTaskCount;
|
|
340
|
+
task.app.emit('ExceedMaxTaskCount');
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
this.run();
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
clear() {
|
|
347
|
+
this.queue = [];
|
|
348
|
+
this.lastQueue = [];
|
|
349
|
+
this.status = undefined;
|
|
350
|
+
this.running = false;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async run(queue = this.queue) {
|
|
354
|
+
if(this.running) return;
|
|
355
|
+
if(queue.length === 0) return;
|
|
356
|
+
|
|
357
|
+
const app = queue[0].app;
|
|
358
|
+
let hasFrontEnd = false;
|
|
359
|
+
let hasBackEnd = false;
|
|
360
|
+
let instructList: Instruct[] = [];
|
|
361
|
+
|
|
362
|
+
for(const task of queue) {
|
|
363
|
+
if(task.hasFrontEnd) hasFrontEnd = true;
|
|
364
|
+
if(task.hasBackEnd) hasBackEnd = true;
|
|
365
|
+
instructList = instructList.concat(task.instructList);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if(queue === this.queue) {
|
|
369
|
+
this.lastQueue = [...queue];
|
|
370
|
+
this.queue = [];
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
this.running = true;
|
|
374
|
+
const error = await _saveNasl({
|
|
375
|
+
app, hasFrontEnd, hasBackEnd, instructList,
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// code: 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
|
|
379
|
+
// code: 500502 msg: "该应用已在新tab 页打开,请刷新!" 不重试或刷新
|
|
380
|
+
if(!error)
|
|
381
|
+
this.recover(app);
|
|
382
|
+
else if (![401650, 500502].includes(error.code)) {
|
|
383
|
+
// 连接失败,或超时,或后端持久化异常
|
|
384
|
+
if((error.message === 'Network Error' || error.message?.includes('timeout') || error.code === 500500)
|
|
385
|
+
&& this.status !== TaskQueueStatus.Retrying) {
|
|
386
|
+
this.running = false;
|
|
387
|
+
this.retry();
|
|
388
|
+
} else
|
|
389
|
+
this.refreshNasl(app);
|
|
390
|
+
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
this.running = false;
|
|
395
|
+
|
|
396
|
+
this.run();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
retry() {
|
|
400
|
+
if(this.lastQueue.length === 0) return;
|
|
401
|
+
|
|
402
|
+
const app = this.lastQueue[0].app;
|
|
403
|
+
this.status = TaskQueueStatus.Retrying;
|
|
404
|
+
app.emit('Retrying');
|
|
405
|
+
this.run(this.lastQueue);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async refreshNasl(app: App, options: RefreshNaslOptions = { errorInfo: {} }) {
|
|
409
|
+
const failedQueue = this.lastQueue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
|
|
410
|
+
hasFrontEnd, hasBackEnd, instructList,
|
|
411
|
+
}));
|
|
412
|
+
const queue = this.queue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
|
|
413
|
+
hasFrontEnd, hasBackEnd, instructList,
|
|
414
|
+
}));
|
|
415
|
+
await storageService.saveFrontendNasl({
|
|
416
|
+
body: {
|
|
417
|
+
nasl: app.toJSON(),
|
|
418
|
+
failedQueue,
|
|
419
|
+
queue,
|
|
420
|
+
errorInfo: options.errorInfo,
|
|
421
|
+
},
|
|
422
|
+
}).catch((err: any) => {
|
|
423
|
+
console.log('备份 nasl 失败:', err);
|
|
424
|
+
});
|
|
425
|
+
this.clear();
|
|
268
426
|
app.emit('refresh');
|
|
269
427
|
}
|
|
270
428
|
|
|
429
|
+
recover(app: App) {
|
|
430
|
+
switch(this.status) {
|
|
431
|
+
case TaskQueueStatus.ExceedMaxTaskCount:
|
|
432
|
+
app.emit('BelowMaxTaskCount');
|
|
433
|
+
this.status = undefined;
|
|
434
|
+
break;
|
|
435
|
+
case TaskQueueStatus.Retrying:
|
|
436
|
+
app.emit('SuccessRetry');
|
|
437
|
+
this.status = undefined;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export const taskQueue = new TaskQueue();
|
|
444
|
+
async function saveNasl(options: TaskOption) {
|
|
445
|
+
taskQueue.addTask(options);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
async function _saveNasl(options: TaskOption) {
|
|
449
|
+
const { app, hasFrontEnd, hasBackEnd, instructList } = options;
|
|
450
|
+
app.emit('saving');
|
|
271
451
|
let ChangedNASLType = '';
|
|
272
452
|
if (hasFrontEnd && hasBackEnd) {
|
|
273
453
|
ChangedNASLType = 'both';
|
|
@@ -279,50 +459,35 @@ async function doAction(app: any, actionItem: any) {
|
|
|
279
459
|
let err;
|
|
280
460
|
if (config.storage.protocol === 'http') {
|
|
281
461
|
try {
|
|
282
|
-
await storageService.
|
|
283
|
-
body:
|
|
462
|
+
await storageService.batchInstruct({
|
|
463
|
+
body: instructList,
|
|
284
464
|
headers: {
|
|
285
465
|
appId: app.id,
|
|
286
466
|
ChangedNASLType,
|
|
467
|
+
tabTimestamp,
|
|
287
468
|
// 其他封装在 storageService 里了
|
|
288
469
|
},
|
|
289
470
|
});
|
|
290
471
|
} catch (error) {
|
|
291
472
|
err = error;
|
|
292
|
-
|
|
293
|
-
// 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
|
|
294
|
-
if (error?.code !== 401650)
|
|
295
|
-
app.emit('refresh');
|
|
296
473
|
}
|
|
297
474
|
} else if (config.storage.protocol === 'mock') {
|
|
298
475
|
// Do nothing
|
|
299
476
|
} else {
|
|
300
477
|
const json = await fs.readJSON(config.storage.basePath);
|
|
478
|
+
|
|
479
|
+
let actionList: any[] = [];
|
|
480
|
+
for(const { actions } of instructList) {
|
|
481
|
+
actionList = actionList.concat(actions);
|
|
482
|
+
}
|
|
483
|
+
|
|
301
484
|
jsoner.batchAction(json, actionList);
|
|
302
485
|
await fs.writeJSON(config.storage.basePath, json, {
|
|
303
486
|
spaces: 4,
|
|
304
487
|
});
|
|
305
488
|
}
|
|
306
489
|
app.emit('saved', err);
|
|
307
|
-
|
|
308
|
-
if (app._historyIndex !== app._historyList.length) {
|
|
309
|
-
app._historyList = app._historyList.splice(0, app._historyIndex);
|
|
310
|
-
}
|
|
311
|
-
app._historyList.push({
|
|
312
|
-
actionMsg,
|
|
313
|
-
list: list.map((item: any) => item.originEvent),
|
|
314
|
-
});
|
|
315
|
-
app._historyIndex = app._historyList.length;
|
|
316
|
-
} else {
|
|
317
|
-
const actionMap = {
|
|
318
|
-
undo: '已撤销操作:',
|
|
319
|
-
redo: '已重做操作:',
|
|
320
|
-
};
|
|
321
|
-
let msg = actionMap[action as 'undo' | 'redo'] || '';
|
|
322
|
-
msg += actionMsg;
|
|
323
|
-
Vue.prototype.$toast.info(msg);
|
|
324
|
-
app._historying = false;
|
|
325
|
-
}
|
|
490
|
+
return err;
|
|
326
491
|
}
|
|
327
492
|
|
|
328
493
|
export function handleApp(app: any) {
|
|
@@ -354,7 +519,11 @@ export function handleApp(app: any) {
|
|
|
354
519
|
if (!app._noTimer) {
|
|
355
520
|
app._timer = setTimeout(() => {
|
|
356
521
|
console.error('收集超时,请及时排查原因');
|
|
357
|
-
|
|
522
|
+
taskQueue.refreshNasl(app, {
|
|
523
|
+
errorInfo: {
|
|
524
|
+
message: '收集超时,请及时排查原因',
|
|
525
|
+
}
|
|
526
|
+
});
|
|
358
527
|
}, 2500);
|
|
359
528
|
}
|
|
360
529
|
if (!app._isCollectingCount) {
|
|
@@ -443,7 +612,7 @@ export async function loadApp(appId?: string) {
|
|
|
443
612
|
let app: App;
|
|
444
613
|
if (config.storage.protocol === 'http') {
|
|
445
614
|
// 请求
|
|
446
|
-
const
|
|
615
|
+
const res = await storageService.batchQuery({
|
|
447
616
|
body: [
|
|
448
617
|
{
|
|
449
618
|
path: 'app',
|
|
@@ -452,22 +621,16 @@ export async function loadApp(appId?: string) {
|
|
|
452
621
|
],
|
|
453
622
|
headers: {
|
|
454
623
|
appId,
|
|
624
|
+
checkTabOpenTime: 'true',
|
|
455
625
|
// 其他封装在 storageService 里了
|
|
456
626
|
},
|
|
627
|
+
config: {
|
|
628
|
+
shortResponse: false,
|
|
629
|
+
},
|
|
457
630
|
});
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
// data?.[0].frontends.push({
|
|
462
|
-
// id: '111',
|
|
463
|
-
// concept: 'Frontend',
|
|
464
|
-
// name: 'pcFrontend1',
|
|
465
|
-
// title: 'pc端',
|
|
466
|
-
// type: 'pc',
|
|
467
|
-
// views: data?.[0].views,
|
|
468
|
-
// variables: data?.[0].frontendVariables,
|
|
469
|
-
// componentDependencies: data?.[0].componentDependencies,
|
|
470
|
-
// });
|
|
631
|
+
|
|
632
|
+
tabTimestamp = res?.headers?.tabtimestamp;
|
|
633
|
+
const data = res?.data?.result;
|
|
471
634
|
app = new App(Object.assign(data?.[0], { id: appId }));
|
|
472
635
|
} else if (config.storage.protocol === 'mock') {
|
|
473
636
|
app = new App({
|
|
@@ -4,7 +4,7 @@ import api from './api';
|
|
|
4
4
|
const service = createService(api);
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
batchQuery({ body, headers }: { body: Array<any>, headers: Record<string, string
|
|
7
|
+
batchQuery({ body, headers, config }: { body: Array<any>, headers: Record<string, string>, config?: object }) {
|
|
8
8
|
const appData = (window as any).appData;
|
|
9
9
|
|
|
10
10
|
return service.batchQuery({
|
|
@@ -15,6 +15,7 @@ export default {
|
|
|
15
15
|
'request-versionChangedTime': appData?.versionChangedTime || '',
|
|
16
16
|
operateArea: appData?.branchStatus === 'merging' ? 'merge_conflict' : '',
|
|
17
17
|
}, headers),
|
|
18
|
+
config,
|
|
18
19
|
});
|
|
19
20
|
},
|
|
20
21
|
batchAction({ body, headers }: { body: Array<any>, headers: Record<string, string> }) {
|
|
@@ -30,4 +31,31 @@ export default {
|
|
|
30
31
|
}, headers),
|
|
31
32
|
});
|
|
32
33
|
},
|
|
34
|
+
batchInstruct({ body, headers }: { body: Array<any>, headers: Record<string, string> }) {
|
|
35
|
+
const appData = (window as any).appData;
|
|
36
|
+
|
|
37
|
+
return service.batchInstruct({
|
|
38
|
+
body,
|
|
39
|
+
headers: Object.assign({
|
|
40
|
+
appId: appData?.appId,
|
|
41
|
+
'request-appBaseVersion': (window as any).appData?.baseVersion || '',
|
|
42
|
+
'request-versionChangedTime': (window as any).appData?.versionChangedTime || '',
|
|
43
|
+
operateArea: (window as any).appData?.branchStatus === 'merging' ? 'merge_conflict' : '',
|
|
44
|
+
}, headers),
|
|
45
|
+
config: {
|
|
46
|
+
timeout: 1000 * 60,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
saveFrontendNasl({ body }: { body: any }) {
|
|
51
|
+
const appData = (window as any).appData;
|
|
52
|
+
|
|
53
|
+
return service.saveFrontendNasl({
|
|
54
|
+
body,
|
|
55
|
+
headers: {
|
|
56
|
+
appId: appData?.appId,
|
|
57
|
+
skipVersionCheck: true,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
33
61
|
};
|
|
@@ -49,7 +49,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
49
49
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
50
50
|
formItem += `
|
|
51
51
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
52
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
52
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
53
53
|
</u-select>
|
|
54
54
|
`;
|
|
55
55
|
} else
|
|
@@ -53,7 +53,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
53
53
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
54
54
|
formItem += `
|
|
55
55
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
56
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
56
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
57
57
|
</u-select>
|
|
58
58
|
`;
|
|
59
59
|
} else
|
|
@@ -152,7 +152,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
152
152
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
153
153
|
formItem += `
|
|
154
154
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.load}"
|
|
155
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
155
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
156
156
|
</u-select>
|
|
157
157
|
`;
|
|
158
158
|
} else
|
|
@@ -47,7 +47,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
47
47
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
48
48
|
formItem += `
|
|
49
49
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
50
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
50
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
51
51
|
</u-select>
|
|
52
52
|
`;
|
|
53
53
|
} else
|
|
@@ -148,8 +148,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
148
148
|
text-field="${lowerEntityName}.${displayedProperty.name}"
|
|
149
149
|
value-field="${lowerEntityName}.${relationProperty.name}"
|
|
150
150
|
:data-source="${selectNameGroup.viewLogicLoad}"
|
|
151
|
-
:
|
|
152
|
-
:remote-paging="true"
|
|
151
|
+
:pagination="true"
|
|
153
152
|
${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''}
|
|
154
153
|
v-model="${vModel}">
|
|
155
154
|
</u-select>
|
|
@@ -49,7 +49,7 @@ export function genEditTableColumnTemplate(entity: Entity, property: EntityPrope
|
|
|
49
49
|
formItem += `
|
|
50
50
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
51
51
|
:autofocus="true" :opened="true" append-to="body" @blur="${nameGroup.viewLogicBlurUpdate}" @select="${nameGroup.viewLogicBlurUpdate}"
|
|
52
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
52
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" :value.sync="${valueExpression}">
|
|
53
53
|
</u-select>
|
|
54
54
|
`;
|
|
55
55
|
} else
|
|
@@ -111,7 +111,7 @@ export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, selec
|
|
|
111
111
|
|
|
112
112
|
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
113
113
|
value-field="${nameGroup.viewVariableEntity}.id"
|
|
114
|
-
:
|
|
114
|
+
:pagination="true" :show-sizer="true" :default-column-width="300" editable>
|
|
115
115
|
<u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
|
|
116
116
|
|
|
117
117
|
${properties.map((property) => genEditTableColumnTemplate(entity, property, nameGroup, selectNameGroupMap) + '\n').join('')}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
17
17
|
return `<u-select clearable placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
18
18
|
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
19
|
-
value-field="${nameGroup.lowerEntity}.id" :
|
|
19
|
+
value-field="${nameGroup.lowerEntity}.id" :pagination="true">
|
|
20
20
|
</u-select>`;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -63,7 +63,7 @@ export function genTableTemplate(entity: Entity, nameGroup: NameGroup, modifyabl
|
|
|
63
63
|
|
|
64
64
|
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
|
|
65
65
|
value-field="${nameGroup.viewVariableEntity}.id"
|
|
66
|
-
:
|
|
66
|
+
:pagination="true" :show-sizer="true">
|
|
67
67
|
<u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
|
|
68
68
|
|
|
69
69
|
${properties.map((property) => genTableColumnTemplate(property, currentName) + '\n').join('')}
|
|
@@ -258,7 +258,7 @@ export function genTableColumnBlock(property: EntityProperty, oldNode: ViewEleme
|
|
|
258
258
|
|
|
259
259
|
return `
|
|
260
260
|
<template>
|
|
261
|
-
<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" :
|
|
261
|
+
<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" :pagination="true" :show-sizer="true" data-schema="${nameGroup.structure}">
|
|
262
262
|
${properties.map((property) => genTableColumnTemplate(property) + '\n').join('')}
|
|
263
263
|
</u-table-view>
|
|
264
264
|
</template>
|
|
@@ -49,7 +49,7 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
49
49
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
50
50
|
formItem += `
|
|
51
51
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
52
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
52
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
53
53
|
</u-select>
|
|
54
54
|
`;
|
|
55
55
|
} else
|