mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-29 17:38:07 +00:00
* Add query params option to Go-to-app action This commit adds support for setting query params for the go-to-app action. When the new app is launched, the passed in object will be sent as search query params. * Allow user to enter URL params in multiple input boxes * Abstract goto-app action logic to a separate container * Supply necessary newline * Set 'type' of 'app' property of go-to-app action to 'text' * List only those apps that has proper slugs for goto-app action * Modify goto-app action config panel to support Event Manager * Use EventManager instead of EventSelector for table action config * Add data migration to make old apps support multiple event handlers * Fix UpdateDefinitionsForTableActionEvent migration This commit ensures that the migration recreates onClick event properly * Fix bug that caused an 'onBulkUpdate' event to be created during migration * Remove EventSelector * Add margin above `remove handler` button on Table actions inspector panel
64 lines
2.6 KiB
TypeScript
64 lines
2.6 KiB
TypeScript
import { AppVersion } from "../src/entities/app_version.entity";
|
|
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
|
|
export class UpdateDefinitionsForTableActionEvent1629971478272 implements MigrationInterface {
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
const entityManager = queryRunner.manager;
|
|
const queryBuilder = queryRunner.connection.createQueryBuilder();
|
|
const appVersionRepository = entityManager.getRepository(AppVersion);
|
|
|
|
const appVersions = await appVersionRepository.find();
|
|
|
|
for(const version of appVersions) {
|
|
const definition = version['definition'];
|
|
|
|
if(definition) {
|
|
const components = definition['components'];
|
|
|
|
for(const componentId of Object.keys(components)) {
|
|
const component = components[componentId];
|
|
if((component.component.component === 'Table') && component.component.definition.properties.actions) {
|
|
const actions = component.component.definition.properties.actions.value;
|
|
|
|
for(const actionIndex in actions) {
|
|
const onClickEvent = actions[actionIndex].onClick;
|
|
|
|
if(onClickEvent) {
|
|
const newEvents = [{actionId: onClickEvent.actionId, eventId: 'onClick', ...onClickEvent.options} ];
|
|
actions[actionIndex]['events'] = newEvents
|
|
} else {
|
|
actions[actionIndex]['events'] = []
|
|
}
|
|
|
|
|
|
component.component.definition.properties.actions.value = actions;
|
|
components[componentId] = {
|
|
...component,
|
|
component: {
|
|
...component.component,
|
|
definition: {
|
|
...component.component.definition,
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
definition['components'] = components;
|
|
version.definition = definition;
|
|
|
|
await queryBuilder.update(AppVersion)
|
|
.set({ definition })
|
|
.where('id = :id', { id: version.id })
|
|
.execute();
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
}
|
|
|
|
}
|