Skip to content

Commit

Permalink
Merge branch 'develop' into feature/global_indexservice
Browse files Browse the repository at this point in the history
  • Loading branch information
thoniTUB authored Apr 23, 2024
2 parents 6c6a19e + 8db1581 commit 113d80b
Show file tree
Hide file tree
Showing 41 changed files with 1,761 additions and 714 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package com.bakdata.conquery.models.config.auth;

import java.util.Collections;
import java.util.List;
import java.util.Set;

import com.bakdata.conquery.apiv1.auth.ProtoRole;
import com.bakdata.conquery.apiv1.auth.ProtoUser;
import com.bakdata.conquery.io.cps.CPSType;
import com.bakdata.conquery.models.auth.permissions.AdminPermission;
import com.bakdata.conquery.models.auth.permissions.DatasetPermission;
import com.bakdata.conquery.models.auth.permissions.SuperPermission;
import io.dropwizard.validation.ValidationMethod;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import lombok.Getter;
import lombok.Data;

@CPSType(base = AuthorizationConfig.class, id = "DEFAULT")
@Getter
@Data
public class DefaultAuthorizationConfig implements AuthorizationConfig {

@Valid
Expand All @@ -21,10 +25,14 @@ public class DefaultAuthorizationConfig implements AuthorizationConfig {
.permissions(Set.of(AdminPermission.DOMAIN))
.build());

@NotEmpty
@Valid
private List<ProtoUser> initialUsers;
private List<ProtoUser> initialUsers = Collections.emptyList();

@NotEmpty
private List<String> overviewScope;
private List<String> overviewScope = List.of(DatasetPermission.DOMAIN, AdminPermission.DOMAIN, SuperPermission.DOMAIN);

@ValidationMethod(message = "No initial entities defined. Access will not be possible")
public boolean isInitialAccessPossible() {
return !(initialRoles.isEmpty() && initialUsers.isEmpty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,40 @@ public void totals() {

assertThat(search.getTotal(filter)).isEqualTo(5);
}

@Test
public void totalsEmptyFiler() {
final IndexConfig indexConfig = new IndexConfig();
FilterSearch search = new FilterSearch(indexConfig);

// Column Searchable
SelectFilter<String> filter = new SingleSelectFilter();
ConceptTreeConnector connector = new ConceptTreeConnector();
TreeConcept concept = new TreeConcept();
Column column = new Column();
Table table = new Table();
Dataset dataset = new Dataset("test_dataset");

table.setName("test_table");
table.setDataset(dataset);
concept.setDataset(dataset);
concept.setName("test_concept");
concept.setConnectors(List.of(connector));
connector.setName("test_connector");
connector.setFilters(List.of(filter));
connector.setConcept(concept);
column.setTable(table);
column.setName("test_column");
column.setSearchDisabled(true);
filter.setColumn(column);
filter.setConnector(connector);

// Register
filter.getSearchReferences().forEach(searchable -> {
search.addSearches(Map.of(searchable, searchable.createTrieSearch(indexConfig)));
});
search.shrinkSearch(column);

assertThat(search.getTotal(filter)).isEqualTo(0);
}
}
1 change: 1 addition & 0 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-debugger": "warn",
"eqeqeq": "error",
"jsx-a11y/accessible-emoji": "off",
"no-case-declarations": "off",
Expand Down
5 changes: 4 additions & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ Depending on the use-case, we're still calling the same concepts differently som

### Styles

- Emotion is used for theming and styles. The plan is to migrate (back) to styled-components or to another css-in-js solution, because emotion's "styled" is less TypeScript compatible in some edge cases like generic component props (see usage of Dropzone).
- Currently, we're mostly using Emotion for theming and styles.
- The plan is to slowly migrate to [Tailwind CSS](https://tailwindcss.com/) and [tailwind-styled-components](https://github.com/MathiasGilson/Tailwind-Styled-Component).
- New styles should be written using tailwind.
- Reasoning: Theming with Emotion is verbose, Emotion's "styled" is less TypeScript compatible in some edge cases like generic component props (see usage of Dropzone). But the main reason for migrating to tailwind, of course, is that tailwind means a lot less boilerplate code. It also allows for more consistent styling and offers a great dev UX.

### State

Expand Down
35 changes: 35 additions & 0 deletions frontend/mock-api/forms/export-form.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,41 @@
},
"validations": ["NOT_EMPTY"]
},
{
"name": "theDisclosure",
"type": "DISCLOSURE_LIST",
"label": {
"de": "Datenschutz"
},
"creatable": true,
"tooltip": {
"de": "Der Datenschutz ist ein wichtiges Thema, deshalb musst du hier zustimmen."
},
"fields": [
{
"type": "HEADLINE",
"label": {
"de": "Datenschutztext"
}
},
{
"type": "CHECKBOX",
"name": "disclosureCheckbox",
"label": {
"de": "Ich habe den Datenschutztext gelesen und bin einverstanden."
}
},
{
"type": "NUMBER",
"name": "timesIlike",
"label": {
"de": "Gefällt mir SO sehr"
},
"defaultValue": 1,
"min": 1
}
]
},
{
"name": "timeMode",
"type": "TABS",
Expand Down
12 changes: 6 additions & 6 deletions frontend/mock-api/mockApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const chance = new Chance();
// Taken from:
// http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
function shuffleArray<T>(array: T[]) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ export default function mockApi(app: Application) {

setTimeout(() => {
const ids: unknown[] = [];
const possibleTagsWithProbabilities = [
const possibleTagsWithProbabilities: [string, number][] = [
["research", 0.3],
["fun", 0.02],
["test", 0.02],
Expand All @@ -257,7 +257,7 @@ export default function mockApi(app: Application) {
["Another very long long tagname, 2020", 0.001],
];

for (var i = 24700; i < 25700; i++) {
for (let i = 24700; i < 25700; i++) {
const notExecuted = Math.random() < 0.1;

ids.push({
Expand Down Expand Up @@ -548,7 +548,7 @@ export default function mockApi(app: Application) {
"interesting",
];

for (var i = 84600; i < 85600; i++) {
for (let i = 84600; i < 85600; i++) {
configs.push({
id: i,
label: "Saved Config",
Expand Down
Loading

0 comments on commit 113d80b

Please sign in to comment.