-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
910a77d
commit e551887
Showing
19 changed files
with
531 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
11 changes: 11 additions & 0 deletions
11
...-graphql/src/main/java/net/nemerosa/ontrack/graphql/schema/EntityNotFoundByIdException.kt
This file contains 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,11 @@ | ||
package net.nemerosa.ontrack.graphql.schema | ||
|
||
import net.nemerosa.ontrack.model.exceptions.NotFoundException | ||
import net.nemerosa.ontrack.model.structure.ProjectEntityType | ||
|
||
class EntityNotFoundByIdException( | ||
type: ProjectEntityType, | ||
id: Int, | ||
) : NotFoundException( | ||
"""Cannot find ${type.displayName} with ID $id.""" | ||
) |
This file contains 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 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
43 changes: 43 additions & 0 deletions
43
...ack-ui-graphql/src/test/java/net/nemerosa/ontrack/graphql/schema/PropertiesMutationsIT.kt
This file contains 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,43 @@ | ||
package net.nemerosa.ontrack.graphql.schema | ||
|
||
import net.nemerosa.ontrack.extension.api.support.TestPropertyType | ||
import net.nemerosa.ontrack.graphql.AbstractQLKTITSupport | ||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNotNull | ||
|
||
class PropertiesMutationsIT : AbstractQLKTITSupport() { | ||
|
||
@Test | ||
fun `Setting a property using the generic mutation`() { | ||
asAdmin { | ||
project { | ||
run( | ||
""" | ||
mutation { | ||
setGenericProperty(input: { | ||
entityType: PROJECT, | ||
entityId: $id, | ||
type: "${TestPropertyType::class.java.name}", | ||
value: { | ||
configuration: "test-config", | ||
value: "test-value" | ||
} | ||
}) { | ||
errors { | ||
message | ||
} | ||
} | ||
} | ||
""" | ||
) | ||
val property = propertyService.getPropertyValue(this, TestPropertyType::class.java) | ||
assertNotNull(property) { | ||
assertEquals("test-config", it.configuration.name) | ||
assertEquals("test-value", it.value) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains 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 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 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
19 changes: 19 additions & 0 deletions
19
ontrack-web-core/components/core/model/properties/PropertyAddButton.js
This file contains 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,19 @@ | ||
import {Button} from "antd"; | ||
import {FaPlus} from "react-icons/fa"; | ||
import PropertyDialog, {usePropertyDialog} from "@components/core/model/properties/PropertyDialog"; | ||
|
||
export default function PropertyAddButton({entityType, entityId, propertyList}) { | ||
|
||
const dialog = usePropertyDialog({}) | ||
|
||
const startDialog = () => { | ||
dialog.start({entityType, entityId, propertyList}) | ||
} | ||
|
||
return ( | ||
<> | ||
<Button size="small" icon={<FaPlus/>} title="Add a property" onClick={startDialog}/> | ||
<PropertyDialog dialog={dialog}/> | ||
</> | ||
) | ||
} |
Oops, something went wrong.