chore: JS icon update (#27020)

## Description
> This PR updates the JS Icon to the new yellow colored one. 

#### PR fixes following issue(s)
Fixes #24093 

#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Chore

>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
Nilansh Bansal 2023-09-08 19:26:20 +05:30 committed by GitHub
parent e989088997
commit 73fd5b39aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,45 @@
package com.appsmith.server.migrations.db.ce;
import com.appsmith.server.domains.Plugin;
import com.appsmith.server.domains.QPlugin;
import io.mongock.api.annotations.ChangeUnit;
import io.mongock.api.annotations.Execution;
import io.mongock.api.annotations.RollbackExecution;
import lombok.RequiredArgsConstructor;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import java.util.List;
import static com.appsmith.server.repositories.ce.BaseAppsmithRepositoryCEImpl.fieldName;
import static org.springframework.data.mongodb.core.query.Criteria.where;
import static org.springframework.data.mongodb.core.query.Query.query;
import static org.springframework.data.mongodb.core.query.Update.update;
@RequiredArgsConstructor
@ChangeUnit(order = "022", id = "update-js-plugin-icon")
public class Migration022UpdateJSPluginIcon {
private final MongoTemplate mongoTemplate;
@RollbackExecution
public void rollbackExecution() {}
@Execution
public void executeMigration() {
Criteria jsFunctionsPlugin = where("name").is("JS Functions");
final Query query = query((new Criteria()).andOperator(jsFunctionsPlugin));
query.fields().include(fieldName(QPlugin.plugin.iconLocation));
List<Plugin> plugins = mongoTemplate.find(query, Plugin.class);
for (final Plugin plugin : plugins) {
if (plugin.getIconLocation() != null) {
final String updatedJSIconUrl = plugin.getIconLocation().replace("JSFile.svg", "js-yellow.svg");
mongoTemplate.updateFirst(
query(where(fieldName(QPlugin.plugin.id)).is(plugin.getId())),
update(fieldName(QPlugin.plugin.iconLocation), updatedJSIconUrl),
Plugin.class);
}
}
}
}