Skip to content

Commit

Permalink
Merge pull request #519 from datagov-cz/issue-al-176
Browse files Browse the repository at this point in the history
[AL-176] Response to discussions
  • Loading branch information
bindeali authored Dec 21, 2023
2 parents 6615c00 + c33453f commit 61e637d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 134 deletions.
8 changes: 2 additions & 6 deletions src/locale/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const cs: { [Property in keyof typeof en]: string } = {
modalNewElemIRI: "Pojem bude vytvořen s tímto IRI:",
terms: "pojmy",
termsCase: "pojmů",
fromList: "Z pracovního prostoru",
otherVocabularies: "Mimo pracovní prostor",
fromList: "Ze seznamu",
otherVocabularies: "Ostatní slovníky",
authenticationError:
"Chyba autentikace. Prosím, kontaktujte serverového administrátora.",
authenticationUpdateError:
Expand Down Expand Up @@ -163,7 +163,6 @@ export const cs: { [Property in keyof typeof en]: string } = {
vocabularyNotFound: "URL definice slovníků chybí nebo není správné",
validate: "Zkontrolovat",
removeConcept: "Smazat pojem",
removeReadOnlyConcept: "Odstranit pojem z pracovního prostoru",
writeEnabledVocabulary: "Tento slovník je upravitelný.",
readOnlyVocabulary: "Pojmy z toho slovníku jsou pouze pro čtení.",
modalRemoveConceptTitle: "Smazat pojem?",
Expand Down Expand Up @@ -218,9 +217,6 @@ export const cs: { [Property in keyof typeof en]: string } = {
connectionListShowFilter: "Zobrazit/skrýt filtr",
connectionListEmptyFilter: "Zrušit filtr",
downloadingTerms: "Přidávání vybraných pojmů...",
modalRemoveReadOnlyConceptDescription:
"Opravdu chcete smazat pojem? Daný pojem zůstane ve svém slovníku, pouze se odstraní ze seznamu pojmů společně s vazbami směřujícími k tomuto pojmu.",
updatingWorkspaceVersion: "Aktualizace verze aplikačního kontextu...",
vocabularyNotFullyRepresented:
"Tento slovník není v seznamu zastoupen všemi jeho pojmy. Klikněte sem pro zobrazení všech pojmů tohoto slovníku.",
criticalAlert: "Důležité upozornění",
Expand Down
8 changes: 2 additions & 6 deletions src/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const en = {
unsorted: "No type",
updating: "Saving...",
removeConcept: "Delete term",
removeReadOnlyConcept: "Remove term from workspace",
writeEnabledVocabulary: "This is an editable vocabulary.",
readOnlyVocabulary: "This is a vocabulary whose terms are read-only.",
newVersion:
Expand Down Expand Up @@ -201,8 +200,8 @@ export const en = {
help: "Help",
modalNewElemError: "You must enter a label in order to create a new term.",
selectVocabulary: "Term will be created in:",
fromList: "From workspace",
otherVocabularies: "From outside the workspace",
fromList: "From list",
otherVocabularies: "Other vocabularies",
view: "View",
switchColors: "Vocabulary color scheme",
reportIssue: "Report an issue",
Expand All @@ -221,11 +220,8 @@ export const en = {
connectionListShowFilter: "Show/hide filter options",
connectionListEmptyFilter: "Disable filter",
downloadingTerms: "Adding selected term(s) into the term list...",
modalRemoveReadOnlyConceptDescription:
"Are you sure you want to remove the term? This will remove the term and created connections to the term from the list, but won't delete the term from its own vocabulary.",
vocabularyNotFullyRepresented:
"The term list does not contain all terms from this vocabulary. Click here to show all terms of this vocabulary.",
updatingWorkspaceVersion: "Updating application context version...",
criticalAlert: "Critical alert",
obsoleteDiagramsAlertIntro:
"OntoGrapher has detected that a vocabulary has been removed. As such, these following diagrams are unpublishable and should be deleted:",
Expand Down
34 changes: 7 additions & 27 deletions src/panels/VocabularyPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
FlexDocumentIDTable,
FlexDocumentSearch,
} from "../config/FlexDocumentSearch";
import { LanguageObject } from "../config/Languages";
import { Locale } from "../config/Locale";
import {
AppSettings,
Expand All @@ -20,6 +21,7 @@ import {
CacheSearchResults,
CacheSearchVocabularies,
} from "../datatypes/CacheSearchResults";
import { initLanguageObject } from "../function/FunctionEditVars";
import { isElementVisible } from "../function/FunctionElem";
import { filterEquivalent } from "../function/FunctionEquivalents";
import {
Expand All @@ -34,9 +36,6 @@ import VocabularyConcept from "./element/VocabularyConcept";
import VocabularyFolder from "./element/VocabularyFolder";
import { VocabularySelector } from "./element/VocabularySelector";
import ModalRemoveConcept from "./modal/ModalRemoveConcept";
import ModalRemoveReadOnlyConcept from "./modal/ModalRemoveReadOnlyConcept";
import { LanguageObject } from "../config/Languages";
import { initLanguageObject } from "../function/FunctionEditVars";

interface Props {
projectLanguage: string;
Expand All @@ -51,7 +50,6 @@ interface State {
vocabs: { label: string; value: string }[];
search: string;
modalRemoveItem: boolean;
modalRemoveReadOnlyItem: boolean;
selectedElements: string[];
shownElements: { [key: string]: { [key: string]: string[] } };
selectedID: string;
Expand All @@ -73,7 +71,6 @@ export default class VocabularyPanel extends React.Component<Props, State> {
vocabs: [],
search: "",
modalRemoveItem: false,
modalRemoveReadOnlyItem: false,
selectedElements: AppSettings.selectedElements,
shownElements: {},
selectedID: "",
Expand All @@ -84,8 +81,6 @@ export default class VocabularyPanel extends React.Component<Props, State> {
};
this.handleChangeSearch = this.handleChangeSearch.bind(this);
this.handleOpenRemoveItemModal = this.handleOpenRemoveItemModal.bind(this);
this.handleOpenRemoveReadOnlyItemModal =
this.handleOpenRemoveReadOnlyItemModal.bind(this);
this.updateElements = this.updateElements.bind(this);
this.filter = this.filter.bind(this);
this.update = this.update.bind(this);
Expand Down Expand Up @@ -224,6 +219,11 @@ export default class VocabularyPanel extends React.Component<Props, State> {
)
)
.forEach((elem) => {
if (
WorkspaceVocabularies[vocab].readOnly &&
Object.values(WorkspaceElements[elem].hidden).every((e) => e)
)
return;
const types = WorkspaceTerms[elem].types;
for (const key in Shapes) {
if (filterEquivalent(types, key)) {
Expand All @@ -245,13 +245,6 @@ export default class VocabularyPanel extends React.Component<Props, State> {
});
}

handleOpenRemoveReadOnlyItemModal(id: string) {
this.setState({
selectedID: id,
modalRemoveReadOnlyItem: true,
});
}

getFolders(): JSX.Element[] {
const result: JSX.Element[] = [];
for (const vocabulary of Object.keys(WorkspaceVocabularies)) {
Expand All @@ -276,7 +269,6 @@ export default class VocabularyPanel extends React.Component<Props, State> {
readOnly={WorkspaceVocabularies[vocabulary].readOnly}
update={this.updateElements}
openRemoveItem={this.handleOpenRemoveItemModal}
openRemoveReadOnlyItem={this.handleOpenRemoveReadOnlyItemModal}
showDetails={this.props.updateDetailPanel}
/>
);
Expand Down Expand Up @@ -462,18 +454,6 @@ export default class VocabularyPanel extends React.Component<Props, State> {
performTransaction={this.props.performTransaction}
projectLanguage={this.props.projectLanguage}
/>
<ModalRemoveReadOnlyConcept
modal={this.state.modalRemoveReadOnlyItem}
id={this.state.selectedID}
close={() => {
this.setState({ modalRemoveReadOnlyItem: false });
}}
update={() => {
this.updateElements(true);
this.props.update();
}}
performTransaction={this.props.performTransaction}
/>
</div>
</ResizableBox>
);
Expand Down
30 changes: 3 additions & 27 deletions src/panels/element/VocabularyConcept.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
import DeleteIcon from "@mui/icons-material/Delete";
import InfoIcon from "@mui/icons-material/Info";
import RemoveCircleIcon from "@mui/icons-material/RemoveCircle";
import classNames from "classnames";
import React from "react";
import { Button, OverlayTrigger, Tooltip } from "react-bootstrap";
import { Locale } from "../../config/Locale";
import {
AppSettings,
WorkspaceElements,
WorkspaceTerms,
} from "../../config/Variables";
import { CellColors } from "../../config/visual/CellColors";
import { resetDiagramSelection } from "../../function/FunctionDiagram";
import { highlightCells, unHighlightCells } from "../../function/FunctionDraw";
import { isElementHidden } from "../../function/FunctionElem";
import { getLabelOrBlank } from "../../function/FunctionGetVars";
import { centerElementInView } from "../../function/FunctionGraph";
import { ReactComponent as HiddenElementSVG } from "../../svg/hiddenElement.svg";
import { CellColors } from "../../config/visual/CellColors";
import { highlightCells, unHighlightCells } from "../../function/FunctionDraw";
import { Locale } from "../../config/Locale";

interface Props {
id: string;
openRemoveItem: (id: string) => void;
openRemoveReadOnlyItem: (id: string) => void;
showDetails: Function;
readOnly: boolean;
projectLanguage: string;
Expand Down Expand Up @@ -129,28 +127,6 @@ export default class VocabularyConcept extends React.Component<Props, State> {
}}
/>
</Button>
{this.props.readOnly && (
<OverlayTrigger
placement="right"
delay={{ show: 250, hide: 0 }}
overlay={
<Tooltip>
{Locale[AppSettings.interfaceLanguage].removeReadOnlyConcept}
</Tooltip>
}
>
<Button
variant="light"
className="plainButton"
onClick={(event) => {
event.stopPropagation();
this.props.openRemoveReadOnlyItem(this.props.id);
}}
>
<RemoveCircleIcon />
</Button>
</OverlayTrigger>
)}
{!this.props.readOnly && (
<OverlayTrigger
placement="right"
Expand Down
68 changes: 0 additions & 68 deletions src/panels/modal/ModalRemoveReadOnlyConcept.tsx

This file was deleted.

0 comments on commit 61e637d

Please sign in to comment.