Skip to content

Commit 420731a

Browse files
committed
Merge branch 'release' into feature/4149-button-widget-style
2 parents eee70bb + 2c437a4 commit 420731a

File tree

11 files changed

+153
-79
lines changed

11 files changed

+153
-79
lines changed

.github/workflows/client-test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,15 @@ jobs:
312312
- name: Wait for 30 seconds for server to start
313313
run: |
314314
sleep 30s
315-
ps -ef | grep server-1.0-SNAPSHOT
315+
316+
- name: Exit if Server hasnt started
317+
run: |
318+
if [[ `ps -ef | grep "server-1.0-SNAPSHOT" | grep java |wc -l` == 0 ]]; then
319+
echo "Server Not Started";
320+
exit 1;
321+
else
322+
echo "Server Found";
323+
fi
316324
317325
- name: Use Node.js 14.15.4
318326
uses: actions/setup-node@v1

.github/workflows/external-client-test.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ jobs:
7777
APPSMITH_ENCRYPTION_SALT: "salt"
7878
APPSMITH_IS_SELF_HOSTED: false
7979
run: |
80-
mvn --batch-mode versions:set \
80+
./build.sh versions:set \
8181
-DnewVersion=${{ steps.vars.outputs.version }} \
8282
-DgenerateBackupPoms=false \
8383
-DprocessAllModules=true
84-
mvn --batch-mode package
8584
8685
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
8786
- name: Upload server build bundle
@@ -328,8 +327,15 @@ jobs:
328327
- name: Wait for 30 seconds for server to start
329328
run: |
330329
sleep 30s
331-
ps -ef | grep server-1.0-SNAPSHOT
332-
330+
331+
- name: Exit if Server hasnt started
332+
run: |
333+
if [[ `ps -ef | grep "server-1.0-SNAPSHOT" | grep java |wc -l` == 0 ]]; then
334+
echo "Server Not Started";
335+
exit 1;
336+
else
337+
echo "Server Found";
338+
fi
333339
334340
- name: Installing Yarn serve
335341
run: |

app/client/src/components/editorComponents/CodeEditor/index.tsx

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ import { getInputValue, removeNewLineChars } from "./codeEditorUtils";
6161
import { commandsHelper } from "./commandsHelper";
6262
import { getEntityNameAndPropertyPath } from "workers/evaluationUtils";
6363
import Button from "components/ads/Button";
64-
import styled from "styled-components";
65-
import { Colors } from "constants/Colors";
6664
import { getPluginIdToImageLocation } from "sagas/selectors";
6765

6866
const AUTOCOMPLETE_CLOSE_KEY_CODES = [
@@ -126,19 +124,6 @@ type State = {
126124
hinterOpen: boolean;
127125
};
128126

129-
const CommandBtnContainer = styled.div<{ isFocused: boolean }>`
130-
position: absolute;
131-
right: 1px;
132-
height: 33px;
133-
width: 33px;
134-
top: 1px;
135-
display: none;
136-
transition: 0.3s all ease;
137-
align-items: center;
138-
justify-content: center;
139-
background: ${(props) => (props.isFocused ? Colors.MERCURY : "#fafafa")};
140-
z-index: 2;
141-
`;
142127
class CodeEditor extends Component<Props, State> {
143128
static defaultProps = {
144129
marking: [bindingMarker],
@@ -525,23 +510,18 @@ class CodeEditor extends Component<Props, State> {
525510
theme={this.props.theme}
526511
>
527512
{showLightningMenu !== false && !this.state.isFocused && (
528-
<CommandBtnContainer
529-
className="slash-commands"
530-
isFocused={this.state.isFocused}
531-
>
532-
<Button
533-
className="commands-button"
534-
onClick={() => {
535-
const newValue =
536-
typeof this.props.input.value === "string"
537-
? this.props.input.value + "/"
538-
: "/";
539-
this.updatePropertyValue(newValue, newValue.length);
540-
}}
541-
tag="button"
542-
text="/"
543-
/>
544-
</CommandBtnContainer>
513+
<Button
514+
className="commands-button"
515+
onClick={() => {
516+
const newValue =
517+
typeof this.props.input.value === "string"
518+
? this.props.input.value + "/"
519+
: "/";
520+
this.updatePropertyValue(newValue, newValue.length);
521+
}}
522+
tag="button"
523+
text="/"
524+
/>
545525
)}
546526
<EvaluatedValuePopup
547527
errors={errors}

app/client/src/components/editorComponents/CodeEditor/styledComponents.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export const DynamicAutocompleteInputWrapper = styled.div<{
304304
}
305305
}
306306
}
307-
.slash-commands {
307+
.commands-button {
308308
display: flex;
309309
}
310310
}
@@ -314,15 +314,20 @@ export const DynamicAutocompleteInputWrapper = styled.div<{
314314
}
315315
.commands-button {
316316
z-index: 2;
317-
width: 24px;
318-
height: 24px;
317+
width: 20px;
318+
position: absolute;
319+
right: 5px;
320+
top: 7px;
321+
height: 20px;
319322
background: transparent;
323+
display: none;
320324
color: #f86a2b;
321325
border: none;
322326
font-weight: bold;
323-
font-size: 15px;
327+
font-size: 14px;
324328
font-style: italic;
325329
padding: 0 0 3px;
330+
margin: 0 !important;
326331
&:hover {
327332
background: #f86a2b;
328333
color: white;

app/client/src/components/editorComponents/GlobalSearch/index.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ const getSectionTitle = (title: string, icon: any) => ({
9292
icon,
9393
});
9494

95+
const getQueryIndexForSorting = (item: SearchItem, query: string) => {
96+
if (item.kind === SEARCH_ITEM_TYPES.document) {
97+
const title = item?._highlightResult?.title?.value;
98+
return title.indexOf(algoliaHighlightTag);
99+
} else {
100+
const title = getItemTitle(item) || "";
101+
return title.toLowerCase().indexOf(query.toLowerCase());
102+
}
103+
};
104+
95105
const getSortedResults = (
96106
query: string,
97107
filteredActions: Array<any>,
@@ -108,11 +118,8 @@ const getSortedResults = (
108118
...filteredDatasources,
109119
...documentationSearchResults,
110120
].sort((a: any, b: any) => {
111-
const titleA = getItemTitle(a) || "";
112-
const titleB = getItemTitle(b) || "";
113-
114-
const queryIndexA = titleA.toLowerCase().indexOf(query.toLowerCase());
115-
const queryIndexB = titleB.toLowerCase().indexOf(query.toLowerCase());
121+
const queryIndexA = getQueryIndexForSorting(a, query);
122+
const queryIndexB = getQueryIndexForSorting(b, query);
116123

117124
if (queryIndexA === queryIndexB) {
118125
const pageA = getItemPage(a);

app/client/src/components/editorComponents/GlobalSearch/parseDocumentationContent.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ const updateDocumentDescriptionTitle = (documentObj: any, item: any) => {
8383
// append documentation button after title:
8484
const ctaElement = getDocumentationCTA(path) as Node;
8585
firstChild.appendChild(ctaElement);
86-
87-
removeBadHighlights(firstChild, item.query);
8886
}
8987
};
9088

@@ -155,6 +153,9 @@ const parseDocumentationContent = (item: any): string | undefined => {
155153
} catch (e) {}
156154
});
157155

156+
// update description title
157+
updateDocumentDescriptionTitle(documentObj, item);
158+
158159
// Combine adjacent highlighted nodes into a single one
159160
let adjacentMatches: string[] = [];
160161
const letterRegex = /[a-zA-Z]/g;
@@ -222,8 +223,6 @@ const parseDocumentationContent = (item: any): string | undefined => {
222223

223224
// Remove highlight for nodes that don't match well
224225
removeBadHighlights(documentObj, query);
225-
// update description title
226-
updateDocumentDescriptionTitle(documentObj, item);
227226
let content = updateYoutubeEmbedingsWithIframe(documentObj.body.innerHTML);
228227
content = strip(content).trim();
229228
return content;

app/server/appsmith-plugins/postgresPlugin/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
<groupId>org.postgresql</groupId>
5050
<artifactId>postgresql</artifactId>
5151
<version>42.2.12</version>
52-
<scope>runtime</scope>
5352
</dependency>
5453

5554
<dependency>

app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.apache.commons.lang.ObjectUtils;
3232
import org.pf4j.Extension;
3333
import org.pf4j.PluginWrapper;
34+
import org.postgresql.util.PGobject;
3435
import org.springframework.util.CollectionUtils;
3536
import org.springframework.util.StringUtils;
3637
import reactor.core.publisher.Mono;
@@ -360,6 +361,18 @@ private Mono<ActionExecutionResult> executeCommon(HikariDataSource connection,
360361
value = objectMapper.readTree(resultSet.getString(i));
361362
} else {
362363
value = resultSet.getObject(i);
364+
365+
/**
366+
* Any type that JDBC does not understand gets mapped to PGobject. PGobject has
367+
* two attributes: type and value. Hence, when PGobject gets serialized, it gets
368+
* converted into a JSON like {"type":"citext", "value":"someText"}. Since we are
369+
* only interested in the value and not the type, it makes sense to extract out
370+
* the value as a string.
371+
* Reference: https://jdbc.postgresql.org/documentation/publicapi/org/postgresql/util/PGobject.html
372+
*/
373+
if (value instanceof PGobject) {
374+
value = ((PGobject) value).getValue();
375+
}
363376
}
364377

365378
row.put(metaData.getColumnName(i), value);

app/server/appsmith-plugins/postgresPlugin/src/test/java/com/external/plugins/PostgresPluginTest.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ public static void setUp() {
9696
statement.execute("DROP TABLE IF EXISTS users");
9797
}
9898

99+
/**
100+
* - Add citext module
101+
* - https://www.postgresql.org/docs/current/citext.html
102+
*/
103+
try (Statement statement = connection.createStatement()) {
104+
statement.execute("CREATE EXTENSION CITEXT;");
105+
}
106+
99107
try (Statement statement = connection.createStatement()) {
100108
statement.execute("CREATE TABLE users (\n" +
101109
" id serial PRIMARY KEY,\n" +
@@ -126,11 +134,13 @@ public static void setUp() {
126134
" name timestamptz default now()\n" +
127135
")");
128136

129-
statement.execute("CREATE TABLE jsontest (\n" +
137+
statement.execute("CREATE TABLE dataTypeTest (\n" +
130138
" id serial PRIMARY KEY,\n" +
131139
" item json,\n" +
132-
" origin jsonb" +
140+
" origin jsonb,\n" +
141+
" citextdata citext" +
133142
")");
143+
134144
}
135145

136146
try (Statement statement = connection.createStatement()) {
@@ -168,9 +178,9 @@ public static void setUp() {
168178

169179
try (Statement statement = connection.createStatement()) {
170180
statement.execute(
171-
"INSERT INTO jsontest VALUES (" +
181+
"INSERT INTO dataTypeTest VALUES (" +
172182
"1, '{\"type\":\"racket\", \"manufacturer\":\"butterfly\"}'," +
173-
"'{\"country\":\"japan\", \"city\":\"kyoto\"}'"+
183+
"'{\"country\":\"japan\", \"city\":\"kyoto\"}', 'A Lincoln'"+
174184
")");
175185
}
176186

@@ -364,22 +374,23 @@ public void testStructure() {
364374
);
365375
assertEquals(campusTable.getKeys().size(), 0);
366376

367-
final DatasourceStructure.Table jsonTestTable = structure.getTables().get(1);
368-
assertEquals("public.jsontest", jsonTestTable.getName());
377+
final DatasourceStructure.Table dataTypeTestTable = structure.getTables().get(1);
378+
assertEquals("public.datatypetest", dataTypeTestTable.getName());
369379
assertEquals(DatasourceStructure.TableType.TABLE, campusTable.getType());
370380
assertArrayEquals(
371381
new DatasourceStructure.Column[]{
372382
new DatasourceStructure.Column(
373383
"id",
374384
"int4",
375-
"nextval('jsontest_id_seq'::regclass)",
385+
"nextval('datatypetest_id_seq'::regclass)",
376386
true),
377387
new DatasourceStructure.Column("item", "json", null, false),
378-
new DatasourceStructure.Column("origin", "jsonb", null, false)
388+
new DatasourceStructure.Column("origin", "jsonb", null, false),
389+
new DatasourceStructure.Column("citextdata", "citext", null, false)
379390
},
380-
jsonTestTable.getColumns().toArray()
391+
dataTypeTestTable.getColumns().toArray()
381392
);
382-
assertEquals(jsonTestTable.getKeys().size(), 1);
393+
assertEquals(dataTypeTestTable.getKeys().size(), 1);
383394

384395
final DatasourceStructure.Table possessionsTable = structure.getTables().get(2);
385396
assertEquals("public.possessions", possessionsTable.getName());
@@ -1096,9 +1107,9 @@ public void testSettingCommentedBindingPreparedStatement() {
10961107
}
10971108

10981109
@Test
1099-
public void testJsonTypes() {
1110+
public void testDataTypes() {
11001111
ActionConfiguration actionConfiguration = new ActionConfiguration();
1101-
actionConfiguration.setBody("SELECT * FROM jsontest");
1112+
actionConfiguration.setBody("SELECT * FROM dataTypeTest");
11021113
DatasourceConfiguration dsConfig = createDatasourceConfiguration();
11031114
Mono<HikariDataSource> connectionPoolMono = pluginExecutor.datasourceCreate(dsConfig);
11041115
Mono<ActionExecutionResult> resultMono = connectionPoolMono
@@ -1115,6 +1126,7 @@ public void testJsonTypes() {
11151126
assertEquals("butterfly", node.get("item").get("manufacturer").asText());
11161127
assertEquals("japan", node.get("origin").get("country").asText());
11171128
assertEquals("kyoto", node.get("origin").get("city").asText());
1129+
assertEquals("A Lincoln", node.get("citextdata").asText());
11181130
})
11191131
.verifyComplete();
11201132
}

app/server/appsmith-server/src/main/java/com/appsmith/server/services/CommentServiceImpl.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,25 @@ public Mono<Comment> create(String threadId, Comment comment, String originHeade
113113
}
114114
});
115115

116-
Mono<CommentThread> commentThreadMono = threadRepository.findById(threadId, AclPermission.COMMENT_ON_THREAD)
117-
.flatMap(commentThread -> {
118-
if (CommentUtils.isAnyoneMentioned(comment) && Boolean.TRUE.equals(commentThread.getIsPrivate())) {
119-
return convertToPublic(commentThread);
120-
}
121-
return Mono.just(commentThread);
122-
});
116+
return userMono.flatMap(user ->
117+
threadRepository
118+
.findById(threadId, AclPermission.COMMENT_ON_THREAD)
119+
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, "comment thread", threadId)))
120+
.flatMap(commentThread -> updateThreadIfRequired(commentThread, comment, user))
121+
.flatMap(commentThread -> create(commentThread, user, comment, originHeader, true))
122+
);
123+
}
123124

125+
private Mono<CommentThread> updateThreadIfRequired(CommentThread commentThread, Comment comment, User user) {
126+
commentThread.setViewedByUsers(Set.of(user.getUsername()));
127+
if(commentThread.getResolvedState().getActive() == TRUE) {
128+
commentThread.getResolvedState().setActive(FALSE);
129+
}
124130

125-
return userMono.zipWith(commentThreadMono)
126-
.switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.ACL_NO_RESOURCE_FOUND, "comment thread", threadId)))
127-
.flatMap(tuple -> {
128-
final User user = tuple.getT1();
129-
final CommentThread thread = tuple.getT2();
130-
return create(thread, user, comment, originHeader, true);
131-
});
131+
if (CommentUtils.isAnyoneMentioned(comment) && Boolean.TRUE.equals(commentThread.getIsPrivate())) {
132+
return convertToPublic(commentThread).flatMap(threadRepository::save);
133+
}
134+
return threadRepository.save(commentThread);
132135
}
133136

134137
/**
@@ -140,7 +143,7 @@ public Mono<Comment> create(String threadId, Comment comment, String originHeade
140143
private Mono<CommentThread> convertToPublic(CommentThread commentThread) {
141144
return applicationService.findById(commentThread.getApplicationId())
142145
.zipWith(sequenceService.getNext(CommentThread.class, commentThread.getApplicationId()))
143-
.flatMap(objects -> {
146+
.map(objects -> {
144147
Application application = objects.getT1();
145148
commentThread.setSequenceId("#" + objects.getT2());
146149
commentThread.setIsPrivate(FALSE);
@@ -155,7 +158,7 @@ private Mono<CommentThread> convertToPublic(CommentThread commentThread) {
155158
commentThread.getAuthorUsername()
156159
).get(AclPermission.MANAGE_THREAD.getValue()));
157160
commentThread.setPolicies(policies);
158-
return threadRepository.save(commentThread);
161+
return commentThread;
159162
});
160163
}
161164

0 commit comments

Comments
 (0)