Repository navigation
[Enhancement #820] Add support for custom attribute removal #848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ledsoft
merged 13 commits into
kbss-cvut:development
from
lukaskabc:lukaskabc/ui/820-delete-custom-attributes
Sep 4, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f189a47
[Feat] Make sort-icon use cursor pointer
lukaskabc 2e600ee
[Feat] Add "for" attribute to the AbstractInput label when label has …
lukaskabc 4351898
[Feat] Add default page size constant to pagination page sizes
lukaskabc fd4ca9b
[Feat] Add function for loading saved page size
lukaskabc fa0757a
[Enhancement #820] Implement support for custom attributes removal
lukaskabc d292aa8
[Ref] Refactor CustomAttributeRemoveDialog to unify removal confirmat…
lukaskabc a5c265d
[Enhancement #820] Add option to keep custom attribute usages and rem…
lukaskabc 7ac99be
[Ref] Remove force parameter from removeCustomAttribute
lukaskabc cf1ff4d
[Ref] Replace string concatenation with string templates and update c…
lukaskabc c655c4d
[Ref] Move CustomAttribute related async actions to AsyncCustomizatio…
lukaskabc 47946d6
[Ref] Rename DEFAULT_PAGE_SIZE constant to DEFAULT_TREE_SELECT_FETCH_…
lukaskabc 91e778d
[Ref] Rename RDFStatement to RdfIriStatement and remove RDF4J from na…
lukaskabc 0da521b
[Ref] Remove debug logging
lukaskabc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| import { PageRequest, ThunkDispatch } from "../util/Types"; | ||
| import { | ||
| asyncActionFailure, | ||
| asyncActionRequest, | ||
| asyncActionSuccess, | ||
| publishMessage, | ||
| } from "./SyncActions"; | ||
| import Constants from "../util/Constants"; | ||
| import Ajax, { content, param } from "../util/Ajax"; | ||
| import { ErrorData } from "../model/ErrorInfo"; | ||
| import VocabularyUtils, { IRI } from "../util/VocabularyUtils"; | ||
| import ActionType from "./ActionType"; | ||
| import { RdfStatement } from "../model/RdfStatement"; | ||
| import { CustomAttribute, CustomAttributeData } from "../model/RdfsResource"; | ||
| import { createPropertyImpl, getPropertiesImpl } from "./AsyncActions"; | ||
| import Message from "../model/Message"; | ||
| import MessageType from "../model/MessageType"; | ||
|
|
||
| export function getCustomAttributes() { | ||
| return getPropertiesImpl<CustomAttributeData, CustomAttribute>( | ||
| { type: ActionType.GET_CUSTOM_ATTRIBUTES }, | ||
| "/data/custom-attributes", | ||
| (d) => new CustomAttribute(d), | ||
| () => [] | ||
| ); | ||
| } | ||
|
|
||
| export function createCustomAttribute(attribute: CustomAttribute) { | ||
| return createPropertyImpl( | ||
| attribute, | ||
| { type: ActionType.CREATE_CUSTOM_ATTRIBUTE }, | ||
| "/data/custom-attributes" | ||
| ); | ||
| } | ||
|
|
||
| export function updateCustomAttribute(attribute: CustomAttribute) { | ||
| const action = { type: ActionType.UPDATE_CUSTOM_ATTRIBUTE }; | ||
| return (dispatch: ThunkDispatch) => { | ||
| dispatch(asyncActionRequest(action, true)); | ||
| return Ajax.put( | ||
| Constants.API_PREFIX + | ||
| "/data/custom-attributes/" + | ||
| VocabularyUtils.create(attribute.iri).fragment, | ||
| content(attribute.toJsonLd()) | ||
| ) | ||
| .then(() => { | ||
| dispatch(asyncActionSuccess(action)); | ||
| dispatch( | ||
| publishMessage( | ||
| new Message( | ||
| { | ||
| messageId: | ||
| "administration.customization.customAttributes.update.success", | ||
| }, | ||
| MessageType.SUCCESS | ||
| ) | ||
| ) | ||
| ); | ||
| }) | ||
| .catch((error: ErrorData) => dispatch(asyncActionFailure(action, error))); | ||
| }; | ||
| } | ||
|
|
||
| export function loadCustomAttributeUsage( | ||
| attributeIri: IRI, | ||
| pageRequest: PageRequest | ||
| ) { | ||
| return (dispatch: ThunkDispatch) => { | ||
| const action = { type: ActionType.LOAD_CUSTOM_ATTRIBUTE_USAGE }; | ||
| dispatch(asyncActionRequest(action, true)); | ||
| return Ajax.getResponse( | ||
| `${Constants.API_PREFIX}/data/custom-attributes/${attributeIri.fragment}/usage`, | ||
| param("namespace", attributeIri.namespace) | ||
| .param("size", pageRequest.size.toString()) | ||
| .param("page", pageRequest.page.toString()) | ||
| ) | ||
| .then((res) => { | ||
| dispatch(asyncActionSuccess(action)); | ||
| return { | ||
| data: res.data as RdfStatement[], | ||
| totalStatements: res?.headers[Constants.Headers.X_TOTAL_COUNT] || 0, | ||
| }; | ||
| }) | ||
| .catch((error: ErrorData) => dispatch(asyncActionFailure(action, error))); | ||
| }; | ||
| } | ||
|
|
||
| export function removeCustomAttribute( | ||
| attributeIri: IRI, | ||
| removeUsages: boolean | ||
| ) { | ||
| return (dispatch: ThunkDispatch) => { | ||
| const action = { type: ActionType.REMOVE_CUSTOM_ATTRIBUTE }; | ||
| dispatch(asyncActionRequest(action, false)); | ||
| return Ajax.delete( | ||
| `${Constants.API_PREFIX}/data/custom-attributes/${attributeIri.fragment}`, | ||
| param("namespace", attributeIri.namespace).param( | ||
| "removeUsages", | ||
| removeUsages.toString() | ||
| ) | ||
| ) | ||
| .then(() => dispatch(asyncActionSuccess(action))) | ||
| .catch((error: ErrorData) => dispatch(asyncActionFailure(action, error))); | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.