0.91.8 Pre-release (#2350)

* add vscode ide's ignore list

* fix passing nested query in nested getAst calls

* chore: update nocodb-sdk to local path

* fix: ignore duplicating app config

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: swagger columnNameParam type

re: #2208
Signed-off-by: mertmit <mertmit99@gmail.com>

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* enhancement: hide slider on escape key

Signed-off-by: Pranav C <pranavxc@gmail.com>

* Add information about maximum value for `limit` in REST API

* refactor: folder structure

* refactor: folder structure

* test: webhook (WIP)

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* test: webhook

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* test/cypress: corrections post develop branch refactoring

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* fix: handle null

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: path correction

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: assign validation for correct column(LTAR)

re #2228

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: disable api docs access for viewer role

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* docs: Repair broken link

* fix: DatePickerCell invalid date handling

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: nested insert correction in belongs to

re #2228

Signed-off-by: Pranav C <pranavxc@gmail.com>

* feat: compare with non-os products

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: Persian language moving across table

Signed-off-by: mertmit <mertmit99@gmail.com>

* docs: env variables

* docs: env variables reorder

* docs: env variables reorder

* fix: i18n corrections (WeT-Klb)

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* chore: image text corrections (@WeT-Klb)

* chore: upgrade nc-help

Signed-off-by: Pranav C <pranavxc@gmail.com>

* docs: security.md

* Update packages/nocodb/src/lib/noco/meta/api/swagger/helpers/templates/params.ts

Co-authored-by: աɨռɢӄաօռɢ <wingkwong.code@gmail.com>

* Update SqliteUi.ts - set float for decimal case in getAbstractType (#2260)

* set float for decimal case in getAbstractType

* fix: add cross-env to nc-gui package.json (#2275)

* add cross-env to nc-gui package.json

* fix: sanitize project title

* chore: disable pr release for draft

* chore: attachment log during airtable import

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* modification of the traduction

I aslo add some stuff according to the README (it was a different display so i didn't add a lot)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* fix: change password cache logic

* fix: add missing job name back

* fix: prop types for FlipCard component

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: invalid char in content-disposition header

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* fix: question mark in CONCAT

* fix: handling lookup column reference in formula

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: throw err if user is already a project user

* chore: revise error msg

* fix: package lock corrections

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* test/ trigger

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* fix: lock file version

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* fix: package lock after npm/node upgrade

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* fix: cypress package lock json

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* test: lock node-version to 16.15.0

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>

* enhancement: allow custom limit values

* chore: update query limit description

* chore: bump to 16.15.0

* fix: node version

* fix: handle invalid limit numbers

Signed-off-by: Pranav C <pranavxc@gmail.com>

* docs: update default value of pagination max limit value

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: pg database type money

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: hasmany pagination - api correction

re #2242

Signed-off-by: Pranav C <pranavxc@gmail.com>

* script: add nc_017_add_user_token_exp_column

* fix: add token_expired

* fix: return unauthorized if token is expired

* chore: revise toast message

* chore: sign out n redirect to sign in page after changing password

* fix: SingeSelect/MultiSelect webhook trigger (#2309)

* fix: SingleSelect webhook trigger

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: MultiSelect webhook trigger

Signed-off-by: mertmit <mertmit99@gmail.com>

* Fix: Remove user reference from webhook context (#2337)

* fix: remove user info from webhook handlebar context

Signed-off-by: Pranav C <pranavxc@gmail.com>

* docs: update webhook context variables docs

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: only check token_expired in non-public base

* fix: make rating readonly in lookup column (#2340)

re #2045

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: exclude sensitive data related to server from SMTP test api

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: session across broswers

* fix: reload related table metadata after relation column delete (#2345)

re #2344

Signed-off-by: Pranav C <pranavxc@gmail.com>

* Fix: Sanitise comment data  (#2343)

* fix: sanitise row comment description

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: add dom purify and sanitize content

- Add DOMPurify in nuxt
- On update value encode html tags to render as text in comment

Signed-off-by: Pranav C <pranavxc@gmail.com>

* fix: add missing dependency

Signed-off-by: Pranav C <pranavxc@gmail.com>

Co-authored-by: cattong <tangym@jifenbang.net>
Co-authored-by: LepkoQQ <LepkoQQ@users.noreply.github.com>
Co-authored-by: Pranav C <pranavxc@gmail.com>
Co-authored-by: mertmit <mertmit99@gmail.com>
Co-authored-by: navi <oof1lab@gmail.com>
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Nils Reichardt <nils@reichardt.io>
Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
Co-authored-by: Toon van Ramshorst <ramshorst@gmail.com>
Co-authored-by: GurukiranMH <89529565+GurukiranMH@users.noreply.github.com>
Co-authored-by: QuentinDstl <qdesautel@gmail.com>
This commit is contained in:
աɨռɢӄաօռɢ
2022-06-14 11:34:16 +08:00
committed by GitHub
parent 0a4219c0b0
commit b2f8f0674e
446 changed files with 27316 additions and 8778 deletions

View File

@@ -0,0 +1,392 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
import { loginPage } from "../../support/page_objects/navigation";
// locally configured hook (server.js)
let hookPath = "http://localhost:9090/hook";
function createWebhook(hook, test) {
cy.get(".nc-btn-webhook").should("exist").click();
cy.get(".nc-btn-create-webhook").should("exist").click();
// hardcode "Content-type: application/json"
cy.get(".nc-tab-hook-header").click({ force: true });
cy.get(".nc-input-hook-header-key")
.should("exist")
.find("input")
.eq(0)
.clear({ force: true })
.type("Content-Type", { force: true });
cy.get(".nc-input-hook-header-value")
.should("exist")
.find("input")
.eq(0)
.clear({ force: true })
.type("application/json", { force: true });
// common routine for both create & modify to configure hook
configureWebhook(hook, test);
}
function deleteWebhook(index) {
cy.get(".nc-btn-webhook").should("exist").click();
cy.get(".nc-hook-delete-icon").eq(index).click({ force: true });
cy.get("body").type("{esc}");
}
function openWebhook(index) {
cy.get(".nc-btn-webhook").should("exist").click();
cy.get(".nc-hook").eq(index).click({ force: true });
}
function configureWebhook(hook, test) {
// configure what ever is present. ignore rest
// currently works for only URL type
if (hook?.title) {
cy.get(".nc-text-field-hook-title")
.should("exist")
.find("input")
.clear()
.type(hook.title);
}
if (hook?.event) {
cy.get(".nc-text-field-hook-event").should("exist").click();
cy.getActiveMenu()
.find(`[role="option"]`)
.contains(hook.event)
.should("exist")
.click();
}
if (hook?.url?.path) {
cy.get(".nc-text-field-hook-url-path")
.should("exist")
.find("input")
.clear()
.type(hook.url.path);
}
if (hook?.deleteCondition === true) {
cy.get(".nc-filter-item-remove-btn")
.should("exist")
.click({ force: true });
}
if (hook?.condition) {
cy.get(".nc-check-box-hook-condition").should("exist").click();
cy.get(".menu-filter-dropdown")
.last()
.find("button")
.contains("Add Filter")
.click();
cy.get(".nc-filter-field-select")
.should("exist")
.last()
.click()
.type(hook.condition.column);
cy.getActiveMenu()
.find(`.nc-fld-${hook.condition.column}`)
.should("exist")
.click();
cy.get(".nc-filter-operation-select").should("exist").last().click();
cy.getActiveMenu()
.find(`.v-list-item:contains(${hook.condition.operator})`)
.click();
if (
hook.condition.operator != "is null" &&
hook.condition.operator != "is not null"
) {
cy.get(".nc-filter-value-select input:text")
.should("exist")
.last()
.type(`${hook.condition.value}`);
cy.get(".nc-filter-operation-select").last().click();
}
}
if (test) {
cy.get(".nc-btn-webhook-test").should("exist").click();
cy.toastWait("some text");
}
cy.get(".nc-btn-webhook-save").should("exist").click();
cy.toastWait("some text");
cy.get(".nc-icon-hook-navigate-left").should("exist").click();
cy.get("body").type("{esc}");
}
function clearServerData() {
// clear stored data in server
cy.request("http://localhost:9090/hook/clear");
// ensure stored message count is 0
cy.request("http://localhost:9090/hook/count").then((msg) => {
cy.log(msg.body);
expect(msg.body).to.equal(0);
});
}
function addNewRow(index, cellValue) {
cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.get(".nc-add-new-row-btn").click({ force: true });
cy.get("#data-table-form-Title > input").first().type(cellValue);
cy.getActiveModal()
.find("button")
.contains("Save row")
.click({ force: true });
cy.toastWait("updated successfully");
mainPage.getCell("Title", index).contains(cellValue).should("exist");
}
function updateRow(index, cellValue) {
mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true });
cy.get("#data-table-form-Title > input").first().clear().type(cellValue);
cy.getActiveModal()
.find("button")
.contains("Save row")
.click({ force: true });
cy.toastWait("updated successfully");
}
function verifyHookTrigger(count, lastValue) {
cy.request("http://localhost:9090/hook/count").then((msg) => {
cy.log(msg.body);
expect(msg.body).to.equal(count);
});
if (count) {
cy.request("http://localhost:9090/hook/last").then((msg) => {
cy.log(msg.body);
expect(msg.body.Title).to.equal(lastValue);
});
}
}
function deleteRow(index) {
mainPage.getCell("Title", index).rightclick({ force: true });
// delete row
cy.getActiveMenu()
.find('.v-list-item:contains("Delete Row")')
.first()
.click({ force: true });
}
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`Webhook`, () => {
before(() => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.createTable("Temp");
});
after(() => {
cy.deleteTable("Temp");
});
it("Create: 'After Insert' event", () => {
createWebhook({
title: "hook-1",
event: "After Insert",
type: "URL",
url: {
method: "POST",
path: hookPath,
},
});
clearServerData();
addNewRow(1, "Poole");
verifyHookTrigger(1, "Poole");
updateRow(1, "Delaware");
verifyHookTrigger(1, "Poole");
deleteRow(1);
verifyHookTrigger(1, "Poole");
});
it("Add 'After Update' event", () => {
createWebhook({
title: "hook-2",
event: "After Update",
type: "URL",
url: {
method: "POST",
path: hookPath,
},
});
clearServerData();
addNewRow(1, "Poole");
verifyHookTrigger(1, "Poole");
updateRow(1, "Delaware");
verifyHookTrigger(2, "Delaware");
deleteRow(1);
verifyHookTrigger(2, "Delaware");
});
it("Add 'After Delete' event", () => {
createWebhook({
title: "hook-3",
event: "After Delete",
type: "URL",
url: {
method: "POST",
path: hookPath,
},
});
clearServerData();
addNewRow(1, "Poole");
verifyHookTrigger(1, "Poole");
updateRow(1, "Delaware");
verifyHookTrigger(2, "Delaware");
deleteRow(1);
verifyHookTrigger(3, "Delaware");
});
it("Modify webhook", () => {
openWebhook(0);
configureWebhook({ event: "After Delete" });
openWebhook(1);
configureWebhook({ event: "After Delete" });
clearServerData();
addNewRow(1, "Poole");
verifyHookTrigger(0, "");
updateRow(1, "Delaware");
verifyHookTrigger(0, "");
deleteRow(1);
verifyHookTrigger(3, "Delaware");
});
it("Delete webhook", () => {
deleteWebhook(2);
deleteWebhook(1);
deleteWebhook(0);
clearServerData();
addNewRow(1, "Poole");
verifyHookTrigger(0, "");
updateRow(1, "Delaware");
verifyHookTrigger(0, "");
deleteRow(1);
verifyHookTrigger(0, "");
});
it("Create, with condition", () => {
// create 3 webhooks with all three events, with condition this time
createWebhook({
title: "hook-with-condition-1",
event: "After Insert",
type: "URL",
url: {
method: "POST",
path: hookPath,
},
condition: {
column: "Title",
operator: "is like",
value: "Poole",
},
});
createWebhook({
title: "hook-with-condition-2",
event: "After Update",
type: "URL",
url: {
method: "POST",
path: hookPath,
},
condition: {
column: "Title",
operator: "is like",
value: "Poole",
},
});
createWebhook({
title: "hook-with-condition-3",
event: "After Delete",
type: "URL",
url: {
method: "POST",
path: hookPath,
},
condition: {
column: "Title",
operator: "is like",
value: "Poole",
},
});
clearServerData();
addNewRow(1, "Poole");
addNewRow(2, "Delaware");
verifyHookTrigger(1, "Poole");
updateRow(1, "Delaware");
updateRow(2, "Poole");
verifyHookTrigger(2, "Poole");
deleteRow(2);
deleteRow(1);
verifyHookTrigger(3, "Poole");
});
it("Modify trigger condition", () => {
openWebhook(0);
configureWebhook({ deleteCondition: true });
openWebhook(1);
configureWebhook({ deleteCondition: true });
openWebhook(2);
configureWebhook({ deleteCondition: true });
clearServerData();
addNewRow(1, "Poole");
addNewRow(2, "Delaware");
verifyHookTrigger(2, "Delaware");
updateRow(1, "Delaware");
updateRow(2, "Poole");
verifyHookTrigger(4, "Poole");
deleteRow(2);
deleteRow(1);
verifyHookTrigger(6, "Delaware");
});
it("Delete trigger condition", () => {
deleteWebhook(2);
deleteWebhook(1);
deleteWebhook(0);
clearServerData();
addNewRow(1, "Poole");
verifyHookTrigger(0, "");
updateRow(1, "Delaware");
verifyHookTrigger(0, "");
deleteRow(1);
verifyHookTrigger(0, "");
});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Raju Udava <sivadstala@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/