Merge branch 'release' of github.com:appsmithorg/appsmith into release
This commit is contained in:
commit
c7429faed4
|
|
@ -33,6 +33,7 @@ const SearchComponent = (props: SearchProps) => {
|
|||
return (
|
||||
<SearchInputWrapper
|
||||
leftIcon="search"
|
||||
type="search"
|
||||
onChange={handleSearch}
|
||||
placeholder={props.placeholder}
|
||||
value={value}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export const TableWrapper = styled.div<{ width: number; height: number }>`
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
.tableWrap {
|
||||
height: 100%;
|
||||
display: block;
|
||||
|
|
@ -22,7 +23,8 @@ export const TableWrapper = styled.div<{ width: number; height: number }>`
|
|||
color: ${Colors.BLUE_BAYOUX};
|
||||
position: relative;
|
||||
overflow-y: auto;
|
||||
height: ${props => props.height - TABLE_SIZES.TABLE_HEADER_HEIGHT}px;
|
||||
/* Subtracting 9px to handling widget padding */
|
||||
height: ${props => props.height - TABLE_SIZES.TABLE_HEADER_HEIGHT - 9}px;
|
||||
.thead,
|
||||
.tbody {
|
||||
overflow: hidden;
|
||||
|
|
@ -255,6 +257,7 @@ export const TableHeaderWrapper = styled.div`
|
|||
align-items: center;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid ${Colors.GEYSER_LIGHT};
|
||||
min-width: 700px;
|
||||
`;
|
||||
|
||||
export const CommonFunctionsMenuWrapper = styled.div`
|
||||
|
|
|
|||
|
|
@ -334,11 +334,18 @@ export const renderCell = (
|
|||
.map((item: string, index: number) => {
|
||||
if (imageRegex.test(item)) {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="image-cell"
|
||||
style={{ backgroundImage: `url("${item}")` }}
|
||||
/>
|
||||
<a
|
||||
onClick={e => e.stopPropagation()}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={item}
|
||||
>
|
||||
<div
|
||||
key={index}
|
||||
className="image-cell"
|
||||
style={{ backgroundImage: `url("${item}")` }}
|
||||
/>
|
||||
</a>
|
||||
);
|
||||
} else {
|
||||
return <div>Invalid Image</div>;
|
||||
|
|
@ -401,11 +408,7 @@ const TableAction = (props: {
|
|||
setLoading(false);
|
||||
};
|
||||
return (
|
||||
<ActionWrapper
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<ActionWrapper>
|
||||
<Button
|
||||
loading={loading}
|
||||
onClick={() => {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ export const StyledDropDownContainer = styled.div`
|
|||
word-break: break-word;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from "components/designSystems/appsmith/TableUtilities";
|
||||
import { TABLE_SIZES } from "components/designSystems/appsmith/Table";
|
||||
import { VALIDATION_TYPES } from "constants/WidgetValidation";
|
||||
import { RenderMode, RenderModes } from "constants/WidgetConstants";
|
||||
import { RenderModes } from "constants/WidgetConstants";
|
||||
import {
|
||||
WidgetPropertyValidationType,
|
||||
BASE_WIDGET_VALIDATION,
|
||||
|
|
@ -33,7 +33,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
prevPageKey: VALIDATION_TYPES.TEXT,
|
||||
label: VALIDATION_TYPES.TEXT,
|
||||
selectedRowIndex: VALIDATION_TYPES.NUMBER,
|
||||
searchKey: VALIDATION_TYPES.TEXT,
|
||||
searchKeyword: VALIDATION_TYPES.TEXT,
|
||||
// columnActions: VALIDATION_TYPES.ARRAY_ACTION_SELECTOR,
|
||||
// onRowSelected: VALIDATION_TYPES.ACTION_SELECTOR,
|
||||
// onPageChange: VALIDATION_TYPES.ACTION_SELECTOR,
|
||||
|
|
@ -50,7 +50,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
pageNo: 1,
|
||||
pageSize: undefined,
|
||||
selectedRowIndex: -1,
|
||||
searchKey: "",
|
||||
searchKeyword: "",
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
return {
|
||||
onRowSelected: true,
|
||||
onPageChange: true,
|
||||
onSearch: true,
|
||||
onSearchTextChanged: true,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -198,9 +198,12 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
};
|
||||
|
||||
searchTableData = (tableData: object[]) => {
|
||||
if (!tableData || !tableData.length) {
|
||||
return [];
|
||||
}
|
||||
const searchKey =
|
||||
this.props.searchKey !== undefined
|
||||
? this.props.searchKey.toString().toUpperCase()
|
||||
this.props.searchKeyword !== undefined
|
||||
? this.props.searchKeyword.toString().toUpperCase()
|
||||
: "";
|
||||
return tableData.filter((item: object) => {
|
||||
return Object.values(item)
|
||||
|
|
@ -246,7 +249,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
isLoading={this.props.isLoading}
|
||||
widgetId={this.props.widgetId}
|
||||
widgetName={this.props.widgetName}
|
||||
searchKey={this.props.searchKey}
|
||||
searchKey={this.props.searchKeyword}
|
||||
renderMode={this.props.renderMode}
|
||||
hiddenColumns={hiddenColumns}
|
||||
columnActions={this.props.columnActions}
|
||||
|
|
@ -297,11 +300,12 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
|
|||
}
|
||||
|
||||
handleSearchTable = (searchKey: any) => {
|
||||
const { onSearch } = this.props;
|
||||
super.updateWidgetMetaProperty("searchKey", searchKey);
|
||||
if (onSearch) {
|
||||
const { onSearchTextChanged } = this.props;
|
||||
this.resetSelectedRowIndex();
|
||||
super.updateWidgetMetaProperty("searchKeyword", searchKey);
|
||||
if (onSearchTextChanged) {
|
||||
super.executeAction({
|
||||
dynamicString: onSearch,
|
||||
dynamicString: onSearchTextChanged,
|
||||
event: {
|
||||
type: EventType.ON_SEARCH,
|
||||
},
|
||||
|
|
@ -381,12 +385,12 @@ export interface TableWidgetProps extends WidgetProps {
|
|||
nextPageKey?: string;
|
||||
prevPageKey?: string;
|
||||
label: string;
|
||||
searchKey: string;
|
||||
searchKeyword: string;
|
||||
tableData: object[];
|
||||
onPageChange?: string;
|
||||
pageSize: number;
|
||||
onRowSelected?: string;
|
||||
onSearch: string;
|
||||
onSearchTextChanged: string;
|
||||
selectedRowIndex?: number;
|
||||
columnActions?: ColumnAction[];
|
||||
serverSidePaginationEnabled?: boolean;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.appsmith.server.migrations;
|
||||
|
||||
import com.appsmith.external.models.AuthenticationDTO;
|
||||
import com.appsmith.external.models.Policy;
|
||||
import com.appsmith.server.constants.FieldName;
|
||||
import com.appsmith.server.domains.Action;
|
||||
import com.appsmith.server.domains.Application;
|
||||
|
|
@ -40,10 +41,13 @@ import java.time.Instant;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.appsmith.server.acl.AclPermission.EXECUTE_ACTIONS;
|
||||
import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
|
||||
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;
|
||||
|
|
@ -543,4 +547,34 @@ public class DatabaseChangelog {
|
|||
mongoTemplate.save(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@ChangeSet(order = "020", id = "execute-action-for-read-action", author = "")
|
||||
public void giveExecutePermissionToReadActionUsers(MongoTemplate mongoTemplate) {
|
||||
final List<Action> actions = mongoTemplate.find(
|
||||
query(where("policies").exists(true)),
|
||||
Action.class
|
||||
);
|
||||
|
||||
for (final Action action : actions) {
|
||||
Set<Policy> policies = action.getPolicies();
|
||||
if (policies.size() > 0) {
|
||||
Optional<Policy> readActionsOptional = policies.stream().filter(policy -> policy.getPermission().equals(READ_ACTIONS.getValue())).findFirst();
|
||||
if (readActionsOptional.isPresent()) {
|
||||
Policy readActionPolicy = readActionsOptional.get();
|
||||
|
||||
Optional<Policy> executeActionsOptional = policies.stream().filter(policy -> policy.getPermission().equals(EXECUTE_ACTIONS.getValue())).findFirst();
|
||||
if (executeActionsOptional.isPresent()) {
|
||||
Policy executeActionPolicy = executeActionsOptional.get();
|
||||
executeActionPolicy.getUsers().addAll(readActionPolicy.getUsers());
|
||||
} else {
|
||||
// this policy doesnt exist. create and add this to the policy set
|
||||
Policy newExecuteActionPolicy = Policy.builder().permission(EXECUTE_ACTIONS.getValue())
|
||||
.users(readActionPolicy.getUsers()).build();
|
||||
action.getPolicies().add(newExecuteActionPolicy);
|
||||
}
|
||||
mongoTemplate.save(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user