fix(basic.gblib): WA page bug removal.

This commit is contained in:
Rodrigo Rodriguez 2023-03-03 19:10:31 -03:00
parent 4314a37916
commit d902e14f78
4 changed files with 23 additions and 22 deletions

View file

@ -228,7 +228,7 @@ export class DialogKeywords {
* *
* @example x = TODAY * @example x = TODAY
*/ */
public async getToday({}) { public async getToday({ }) {
let d = new Date(), let d = new Date(),
month = '' + (d.getMonth() + 1), month = '' + (d.getMonth() + 1),
day = '' + d.getDate(), day = '' + d.getDate(),
@ -264,28 +264,28 @@ export class DialogKeywords {
* *
* @example EXIT * @example EXIT
*/ */
public async exit({}) {} public async exit({ }) { }
/** /**
* Get active tasks. * Get active tasks.
* *
* @example list = ACTIVE TASKS * @example list = ACTIVE TASKS
*/ */
public async getActiveTasks({ pid }) {} public async getActiveTasks({ pid }) { }
/** /**
* Creates a new deal. * Creates a new deal.
* *
* @example CREATE DEAL dealname,contato,empresa,amount * @example CREATE DEAL dealname,contato,empresa,amount
*/ */
public async createDeal({ pid, dealName, contact, company, amount }) {} public async createDeal({ pid, dealName, contact, company, amount }) { }
/** /**
* Finds contacts in XRM. * Finds contacts in XRM.
* *
* @example list = FIND CONTACT "Sandra" * @example list = FIND CONTACT "Sandra"
*/ */
public async fndContact({ pid, name }) {} public async fndContact({ pid, name }) { }
public getContentLocaleWithCulture(contentLocale) { public getContentLocaleWithCulture(contentLocale) {
switch (contentLocale) { switch (contentLocale) {
@ -488,7 +488,7 @@ export class DialogKeywords {
* @example SAVE "contacts.xlsx", name, email, NOW * @example SAVE "contacts.xlsx", name, email, NOW
* *
*/ */
public async getNow({}) { public async getNow({ }) {
const contentLocale = this.min.core.getParam<string>( const contentLocale = this.min.core.getParam<string>(
this.min.instance, this.min.instance,
'Default Content Language', 'Default Content Language',
@ -724,7 +724,7 @@ export class DialogKeywords {
* @example MENU * @example MENU
* *
*/ */
public async showMenu({}) { public async showMenu({ }) {
// https://github.com/GeneralBots/BotServer/issues/237 // https://github.com/GeneralBots/BotServer/issues/237
// return await beginDialog('/menu'); // return await beginDialog('/menu');
} }
@ -828,7 +828,7 @@ export class DialogKeywords {
const answer = min.cbMap[userId].promise; const answer = min.cbMap[userId].promise;
if (kind === 'sheet') { if (kind === 'sheet') {
// Retrieves the .xlsx file associated with the HEAR var AS file.xlsx. // Retrieves the .xlsx file associated with the HEAR var AS file.xlsx.
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(this.min); let { baseUrl, client } = await GBDeployer.internalGetDriveClient(this.min);
@ -864,12 +864,11 @@ export class DialogKeywords {
let list = []; let list = [];
for (; index < results.text.length; index++) { for (; index < results.text.length; index++) {
if (results.text[index][0] !== '') { if (results.text[index][0] !== '') {
list.push( results.text[index][0]); list.push(results.text[index][0]);
} }
else else {
{
break; break;
} }
} }
// Search the answer in one of valid list items loaded from sheeet. // Search the answer in one of valid list items loaded from sheeet.
@ -1121,7 +1120,7 @@ export class DialogKeywords {
/** /**
* Talks to the user by using the specified text. * Talks to the user by using the specified text.
*/ */
public async getTalk({ pid, text }) { public async getTalk({ pid, text }): Promise<{ status: number }> {
GBLog.info(`BASIC: TALK '${text}'.`); GBLog.info(`BASIC: TALK '${text}'.`);
const { min, user } = await DialogKeywords.getProcessInfo(pid); const { min, user } = await DialogKeywords.getProcessInfo(pid);
@ -1130,6 +1129,7 @@ export class DialogKeywords {
await min.conversationalService['sendOnConversation'](min, user, text); await min.conversationalService['sendOnConversation'](min, user, text);
} }
return { status: 0 };
} }
private static getChannel(): string { private static getChannel(): string {

View file

@ -139,7 +139,7 @@ export class KeywordsExpressions {
/^\s*open\s*(.*)/gim, /^\s*open\s*(.*)/gim,
($0, $1, $2) => { ($0, $1, $2) => {
let sessionName; let sessionName;
let kind = ''; let kind = null;
let pos; let pos;
if (pos = $1.match(/\s*AS\s*\#/)) { if (pos = $1.match(/\s*AS\s*\#/)) {
@ -655,7 +655,7 @@ export class KeywordsExpressions {
// page is not string. // page is not string.
// https://github.com/GeneralBots/BotServer/issues/310 // https://github.com/GeneralBots/BotServer/issues/310
const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']); const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']);
return `await wa.click ({pid: pid, ${params}})`; return `await wa.getClick ({pid: pid, ${params}})`;
} }
]; ];
@ -764,7 +764,7 @@ export class KeywordsExpressions {
/^\s*set\s*(.*)/gim, /^\s*set\s*(.*)/gim,
($0, $1, $2) => { ($0, $1, $2) => {
const params = this.getParams($1, ['file', 'address', 'value']); const params = this.getParams($1, ['file', 'address', 'value']);
return `await sys.set ({pid: pid, ${params}})`; return `await sys.getSet ({pid: pid, handle:page, ${params}})`;
} }
]; ];
keywords[i++] = [ keywords[i++] = [

View file

@ -488,14 +488,15 @@ export class SystemKeywords {
* @example SET page, "elementHTMLSelector", "text" * @example SET page, "elementHTMLSelector", "text"
* *
*/ */
public async set({ pid, file, address, value }): Promise<any> { public async getSet({ pid, page, file, address, value }): Promise<any> {
const { min, user } = await DialogKeywords.getProcessInfo(pid); const { min, user } = await DialogKeywords.getProcessInfo(pid);
// Handles calls for HTML stuff // Handles calls for HTML stuff
if (file._javascriptEnabled) { if (file.indexOf("#") != -1 ||
const page = file; file.indexOf("[") != -1 ) {
GBLog.info(`BASIC: Web automation setting ${page}' to '${value}' (SET). `); value = address;
GBLog.info(`BASIC: Web automation setting ${file}' to '${value}' (SET). `);
await this.wa.setElementText({ page, selector: address, text: value }); await this.wa.setElementText({ page, selector: address, text: value });
return; return;
@ -1694,7 +1695,7 @@ export class SystemKeywords {
const address = `${cell}:${cell}`; const address = `${cell}:${cell}`;
if (value !== found[columnName]) { if (value !== found[columnName]) {
await this.set({ pid, file, address, value }); await this.getSet({ pid, file, page:null, address, value });
merges++; merges++;
} }
} }

View file

@ -277,7 +277,7 @@ export class WebAutomationServices {
* *
* @example CLICK page,"#idElement" * @example CLICK page,"#idElement"
*/ */
public async click({ pid, handle, frameOrSelector, selector }) { public async getClick({ pid, handle, frameOrSelector, selector }) {
const page = this.getPageByHandle(handle); const page = this.getPageByHandle(handle);
GBLog.info(`BASIC: Web Automation CLICK element: ${frameOrSelector}.`); GBLog.info(`BASIC: Web Automation CLICK element: ${frameOrSelector}.`);
if (selector) { if (selector) {