forked from ToolJet/ToolJet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added instruction text property in file picker widget to add custom i…
…nstructions (ToolJet#2731) * added instruction text property in file pciker to make user unable to provide custom instructions * Added default instruction text * made the changes to make sure existing app do not crashes because of instructionText prop * Solve issue - existing file pickers wont display anything if we don't default to the default instruction text * changes in operation.json file * migration script for adding instructionText prop * removed unwanted operations.json file Co-authored-by: Kavin Venkatachalam <kavin.saratha@gmail.com>
- Loading branch information
1 parent
802ad5e
commit 29db040
Showing
5 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
42 changes: 42 additions & 0 deletions
42
server/migrations/1653472569828-addedInstructionTextPropInFilePickerWidget.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { AppVersion } from '../src/entities/app_version.entity'; | ||
|
||
export class addedInstructionTextPropInFilePickerWidget1653472569828 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const entityManager = queryRunner.manager; | ||
const appVersions = await entityManager.find(AppVersion); | ||
|
||
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 === 'FilePicker') { | ||
component.component.definition.properties.instructionText = { | ||
value: 'Drag and Drop some files here, or click to select files', | ||
}; | ||
components[componentId] = { | ||
...component, | ||
component: { | ||
...component.component, | ||
definition: { | ||
...component.component.definition, | ||
}, | ||
}, | ||
}; | ||
} | ||
} | ||
|
||
definition['components'] = components; | ||
version.definition = definition; | ||
|
||
await entityManager.update(AppVersion, { id: version.id }, { definition }); | ||
} | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> {} | ||
} |