ToolJet/server/data-migrations/1687720044583-BackfillAddOrgEnvironmentConstantsGroupPermissions.ts
Arpit ee79b2015a
Feature - Workspace environment constants (#6810)
* init--

* org constants: controllers, services, module and api for creating new constants

* read operation: all constants from all envs and all constants from a env

* update and delete operation

* updated delete msg

* encrypt constant value before saving and decrypt before sending back to controller

* adds group permission for org constants and required migrations

* adds ability to create constant

* adds group permissions and fixes migrations

* adds workspace constant permission to workspace settings UI

* ToolJetUI - componenst, ref: ee/5c92dc9c03b73d7006562d71d639fe4eb1971dee

* Org constants UI

* UI updates: display constant value as per enviroment

* Added client side pagination

* groups without create/edit/delete permission can only view the the constants

* group permission: Create and Edit - UI updates

* create/update/date flow - UI

* extending api support to create constant in multiple environments

* UI - add constant for multiple envs

* disable name input for update operation

* UI fixes and updates

* adds deprecating banner to variables dashboard

* removes update/create from UI --variables

* adding depricating soon alert in codehinter when workspace vars are used

* extra check to display the banner in preview of cdehinter

* resolves constants for admin in client-side

* resolves constants client-side and server side for queries

* include grp permission for create/delete for org constants

* resolves org constants in runJS and runPY

* cleanup

* updated the tab UI

* fixed: constant pagination footer

* fixes client side pagination bug

* adds docs link

* ui updates and fixes ui flickering on closing the drawer

* refactor updating table data

* adds error state to constant forms

* remove the alert from runJS and runPY after 5s

* added max length constraint for constant value

* refactor: component form

* delete only constant as per environment

* remove unwanted logs

* resolves constants in gds connection forms

* resolve gds source options for testConnections, preview and runQuery

* UI style fixes: banner

* remove alert banner for runJS and runPY

* input text color fixed

* style fixes for disabled inputs

* Edit constant- Until value is changed- CTA should be disabled

* adds tooltip for table name and value

* adds tooltip for disbaled input in edit drawer

* updated the tooltip position

* handle input height on type for large strings

* added empty state

* adds new badge for workspace constants

* substring should be different for viewers

* resolve constants in viewer

* add support to resolve constants for widgets and queires in public apps

* changed the api endpoint for org constant for env

* bugfix: handle org constants for encrypted value from source options

* add support to resolve app variables and constants in a single single

* fixes: multiple multiline and same line variables

* refactor

* cleanup

* remove encryption for ce

* remove group permission from permission dashboard

* text transform for badge

* added padding for each table row

* updated alert banner padding

* updated alert banner padding

* updates width for empty banner

* refactor

* adds tests for constant api

* added validations for constant name

* updates textare dynamic form

* updates the resolvers for constants

* removes decryptiong for source options in services

* refactor - frontend

* resolved conflicts

* fixes: typo-1 ~ workspace variables alert

* fixes: inconsistency in alert info icon

* fixes: naming convention consistency

* fixes: dark theme for confirm box

* disable create button for  add constant with same name,

* adds error state for updating constant with same value

* fixes: error message typo

* fixes: error message typo

* fixes position of tooltip

* fixes frontend lint issues

* update lock file

* UI updates and typos

* cleanup-refactor

* checking error state before creating

* should check all error states

* resolving multiple constants and app variables in a single line

* reafactore

* fixed: depricating icon : codehinter preview box

* remove log

* remove repeated logic for deleteOrgEnvironmentConstant

* only return status code for delete request for org constants

* Add data-cy for workspace constants elements (#7251)

* updates contants doc link

---------

Co-authored-by: Ajith KV <ajith.jaban@gmail.com>
2023-08-14 14:28:51 +05:30

24 lines
961 B
TypeScript

import { MigrationInterface, QueryRunner } from 'typeorm';
import { GroupPermission } from '../src/entities/group_permission.entity';
export class BackfillAddOrgEnvironmentConstantsGroupPermissions1687720044583 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
const entityManager = queryRunner.manager;
const GroupPermissionRepository = entityManager.getRepository(GroupPermission);
await GroupPermissionRepository.update(
{ group: 'admin' },
{ orgEnvironmentConstantCreate: true, orgEnvironmentConstantDelete: true }
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
const entityManager = queryRunner.manager;
const GroupPermissionRepository = entityManager.getRepository(GroupPermission);
await GroupPermissionRepository.update(
{ group: 'admin' },
{ orgEnvironmentConstantCreate: false, orgEnvironmentConstantDelete: false }
);
}
}