Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/CB-4457-subcollections-firestore…
Browse files Browse the repository at this point in the history
…' into CB-4457-subcollections-firestore
  • Loading branch information
DenisSinelnikov committed Feb 12, 2024
2 parents 9e79b53 + 6b603e7 commit 20e60af
Show file tree
Hide file tree
Showing 34 changed files with 284 additions and 216 deletions.
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DocumentDataAction extends DatabaseDataResultAction<IDocumentElemen
static dataFormat = [ResultDataFormat.Document];

get documents(): IDatabaseDataDocument[] {
return this.result.data?.rowsWithMetaData?.map(row => row.data?.[0]) || [];
return this.result.data?.rowsWithMetaData?.map(row => row.data[0]) || [];
}

get count(): number {
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 20e60af

Please sign in to comment.