Skip to content

Commit

Permalink
Merge branch 'devel' into CB-4651-change-wrap-lines-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dariamarutkina authored Feb 12, 2024
2 parents 1e87347 + 898e7d9 commit b974b1c
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 218 deletions.
4 changes: 2 additions & 2 deletions config/core/initial-data.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
teams: [
{
subjectId: "admin",
name: "Admin",
teamName: "Admin",
description: "Administrative access. Has all permissions.",
permissions: [ "admin" ]
},
{
subjectId: "user",
name: "User",
teamName: "User",
description: "All users, including anonymous.",
permissions: [ ]
}
Expand Down
2 changes: 2 additions & 0 deletions project.deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dbeaver-common
dbeaver
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@
/**
* General constants
*/
public class DBWConstants {
public interface DBWConstants {

public static final String PERMISSION_ADMIN = DBAPermissionRealm.PERMISSION_ADMIN;
String PERMISSION_ADMIN = DBAPermissionRealm.PERMISSION_ADMIN;

public static final String PERMISSION_CONFIGURATION_MANAGER = RMConstants.PERMISSION_CONFIGURATION_MANAGER;
public static final String PERMISSION_PRIVATE_PROJECT_ACCESS = "private-project-access";
String PERMISSION_CONFIGURATION_MANAGER = RMConstants.PERMISSION_CONFIGURATION_MANAGER;
String PERMISSION_PRIVATE_PROJECT_ACCESS = "private-project-access";
String PERMISSION_SECRET_MANAGER = "secret-manager";

public static final String PERMISSION_EDIT_STRUCTURE = "edit-meta";
public static final String PERMISSION_EDIT_DATA = "edit-data";

public static final String STATE_ATTR_SIGN_IN_STATE = "state.signin";
String PERMISSION_EDIT_STRUCTURE = "edit-meta";
String PERMISSION_EDIT_DATA = "edit-data";

public enum SignInState {
String STATE_ATTR_SIGN_IN_STATE = "state.signin";

enum SignInState {
GLOBAL,
EMBEDDED
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.rm.RMProjectType;
import org.jkiss.dbeaver.model.secret.DBSSecretController;
import org.jkiss.dbeaver.model.security.*;
import org.jkiss.dbeaver.model.security.user.SMTeam;
import org.jkiss.dbeaver.model.security.user.SMUser;
Expand Down Expand Up @@ -178,6 +179,10 @@ public boolean deleteUser(@NotNull WebSession webSession, String userName) throw
}
webSession.addInfoMessage("Delete user - " + userName);
try {
var secretController = DBSSecretController.getSessionSecretControllerOrNull(webSession);
if (secretController != null) {
secretController.deleteSubjectSecrets(userName);
}
webSession.getAdminSecurityController().deleteUser(userName);
} catch (Exception e) {
throw new DBWebException("Error deleting user", e);
Expand Down Expand Up @@ -235,6 +240,10 @@ public boolean deleteTeam(@NotNull WebSession webSession, String teamId, boolean
if (Arrays.stream(userTeams).anyMatch(team -> team.getTeamId().equals(teamId))) {
throw new DBWebException("You can not delete your own team");
}
var secretController = DBSSecretController.getSessionSecretControllerOrNull(webSession);
if (secretController != null) {
secretController.deleteSubjectSecrets(teamId);
}
adminSecurityController.deleteTeam(teamId, force);
return true;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.jkiss.dbeaver.model.rm.RMController;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.rm.RMResource;
import org.jkiss.dbeaver.model.secret.DBSSecretController;
import org.jkiss.dbeaver.model.security.*;
import org.jkiss.dbeaver.model.websocket.WSConstants;
import org.jkiss.dbeaver.model.websocket.event.WSProjectUpdateEvent;
Expand Down Expand Up @@ -265,6 +266,14 @@ public RMProject createProject(
@Override
public boolean deleteProject(@NotNull WebSession session, @NotNull String projectId) throws DBWebException {
try {
var project = session.getProjectById(projectId);
if (project == null) {
throw new DBException("Project not found: " + projectId);
}
if (project.isUseSecretStorage()) {
var secretController = DBSSecretController.getProjectSecretController(project);
secretController.deleteProjectSecrets(project.getId());
}
getResourceController(session).deleteProject(projectId);
session.removeSessionProject(projectId);
WebAppUtils.getWebApplication().getEventController().addEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
teams: [
{
subjectId: "admin",
name: "Admin",
teamName: "Admin",
description: "Administrative access. Has all permissions.",
permissions: [ "admin" ]
},
{
subjectId: "user",
name: "User",
teamName: "User",
description: "All users, including anonymous.",
permissions: [ ]
}
Expand Down
27 changes: 10 additions & 17 deletions webapp/packages/core-blocks/src/FormControls/Filter.m.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,36 @@
min-height: 24px;
}
.inputField {
display: none;
display: block;
width: 300px;
&.max {
width: 100%;
}
&.toggled {
display: block;
}

& .input {
& input {
padding-right: 40px !important;
}

}
.iconButton {
position: absolute;
right: 0;
top: 0;
right: 4px;
top: 4px;
margin: 0;
width: 24px;
height: 24px;
border-radius: 2px;
cursor: auto;

&.toggled {
right: 4px;
top: 4px;
}
&.cross {
&.cross svg {
width: 16px;
height: 16px;
top: 8px;
right: 8px;
}

&.cross.manualMode {
right: 32px;
}
}

.toggleMode {
.manualMode {
composes: theme-background-primary theme-text-on-primary from global;
cursor: pointer;
}
76 changes: 41 additions & 35 deletions webapp/packages/core-blocks/src/FormControls/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import { observer } from 'mobx-react-lite';
import { useCallback, useEffect, useState } from 'react';
import { useCallback } from 'react';

import { IconButton } from '../IconButton';
import { s } from '../s';
Expand All @@ -16,12 +16,13 @@ import filterStyle from './Filter.m.css';
import { InputField } from './InputField';

interface BaseProps {
toggleMode?: boolean;
placeholder?: string;
disabled?: boolean;
disableActions?: boolean;
applyDisabled?: boolean;
max?: boolean;
className?: string;
onToggle?: (status: boolean) => void;
onApply?: (value: string) => void;
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
}
Expand All @@ -44,19 +45,19 @@ export const Filter = observer<ControlledProps | ObjectsProps<any, any>>(functio
state,
name,
value: valueControlled,
toggleMode,
placeholder,
disabled,
disableActions,
applyDisabled,
max,
className,
onApply,
onChange,
onToggle,
onKeyDown,
onClick,
}) {
const styles = useS(filterStyle);
const [inputRef, ref] = useFocus<HTMLInputElement>({});
const [toggled, setToggled] = useState(!toggleMode);
const [inputRef] = useFocus<HTMLInputElement>({});

const filter = useCallback(
(value: string | number, name?: string) => {
Expand All @@ -73,55 +74,60 @@ export const Filter = observer<ControlledProps | ObjectsProps<any, any>>(functio
[onChange, state],
);

const toggle = useCallback(() => {
if (!toggleMode) {
return;
}

if (toggled) {
filter('');
}
let value: any = valueControlled;

setToggled(!toggled);
if (state && name !== undefined && name in state) {
value = state[name];
}

if (onToggle) {
onToggle(!toggled);
function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {
if (event.key === 'Enter' && onApply && !applyDisabled) {
onApply(value);
}
}, [toggleMode, toggled, onToggle, filter]);

useEffect(() => {
if (toggled && toggleMode) {
ref.reference?.focus();
}
}, [toggled, toggleMode, ref.reference]);
onKeyDown?.(event);
}

let value: any = valueControlled;
function clean() {
filter('', name);

if (state && name !== undefined && name in state) {
value = state[name];
if (onApply) {
onApply('');
}
}

const manualMode = !!onApply;
const edited = !!String(value);

return (
<div className={s(styles, { filterContainer: true }, className)} onClick={onClick}>
<InputField
ref={inputRef}
className={s(styles, { inputField: true, max, toggled })}
className={s(styles, { inputField: true, max })}
placeholder={placeholder}
disabled={disabled}
name={name}
value={value}
onChange={filter}
onKeyDown={onKeyDown}
onKeyDown={handleKeyDown}
/>
{String(value) ? (

{edited && (
<IconButton
className={s(styles, { iconButton: true, cross: true, toggleMode })}
className={s(styles, { iconButton: true, cross: true, manualMode })}
name="cross"
disabled={disabled}
onClick={() => filter('', name)}
disabled={disabled || disableActions}
onClick={clean}
/>
)}

{(!edited || manualMode) && (
<IconButton
className={s(styles, { iconButton: true, manualMode })}
name="search"
disabled={disabled || applyDisabled || disableActions}
onClick={onApply ? () => onApply(value) : undefined}
/>
) : (
<IconButton className={s(styles, { iconButton: true, toggled, toggleMode })} name="search" disabled={disabled} onClick={toggle} />
)}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default [
['ui_upload', 'Upload'],
['ui_import', 'Import'],
['ui_view', 'View'],
['ui_show_more', 'Show more'],
['ui_limit', 'Limit'],
['ui_file_size', 'File size'],
['ui_processing_synchronization', 'Synchronization...'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default [
['ui_upload', 'Upload'],
['ui_import', 'Import'],
['ui_view', 'View'],
['ui_show_more', 'Show more'],
['ui_limit', 'Limit'],
['ui_file_size', 'File size'],
['ui_processing_synchronization', 'Synchronization...'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default [
['ui_upload', 'Загрузить'],
['ui_import', 'Импортировать'],
['ui_view', 'Смотреть'],
['ui_show_more', 'Показать больше'],
['ui_limit', 'Лимит'],
['ui_file_size', 'Размер файла'],
['ui_processing_synchronization', 'Синхронизация...'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default [
['ui_upload', 'Upload'],
['ui_import', 'Import'],
['ui_view', 'View'],
['ui_show_more', 'Show more'],
['ui_limit', 'Limit'],
['ui_file_size', 'File size'],
['ui_processing_synchronization', 'Synchronization...'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IResultSetContentValue } from './IResultSetContentValue';

export interface IResultSetBinaryFileValue extends IResultSetContentValue {
export interface IResultSetBinaryValue extends IResultSetContentValue {
binary: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import type { IResultSetContentValue } from './IResultSetContentValue';
import type { IResultSetElementKey } from './IResultSetDataKey';

export interface IResultSetDataContentAction {
activeElement: IResultSetElementKey | null;
isContentTruncated: (content: IResultSetContentValue) => boolean;
isBlobTruncated: (element: IResultSetElementKey) => boolean;
isTextTruncated: (element: IResultSetElementKey) => boolean;
isDownloadable: (element: IResultSetElementKey) => boolean;
getFileDataUrl: (element: IResultSetElementKey) => Promise<string>;
resolveFileDataUrl: (element: IResultSetElementKey) => Promise<string>;
Expand Down
Loading

0 comments on commit b974b1c

Please sign in to comment.