Skip to content

Conversation

@aleksei-burlakov
Copy link
Contributor

Big changes are coming to the hawk-apiserver. Its newer version will move some logic from hawk itself, and this requires a small amount of glue code in hawk (to make it working in hawk-apiserver). This glue code is introduced in the first two “Dev” commits. The final commit, “Tests”, only adds new end-to-end tests.

Aleksei Burlakov added 2 commits December 16, 2025 12:41
…-apserver

The created/updated/delete status is kept in the rails internal
cookies, which are not accessible from hawk-apiserver.
However, newer versions of hawk require this status.
The newer versions of hawk-apiserver need to check if the sessions
is still logged in.
end

def types
flash[:success] = _("Primitive deleted successfully") if params[:flash] == "deleted"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't catch up on the context for the recent changes.
What does this flash mean here? Could it be replaced with a more meaningful word?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yap, this is not obvious.

Basically, what it does is show a green so-called flash alert if there is a URL parameter flash=deleted. It's specifically designed for the newer version of hawk-apiserver. This newer version of hawk-apiserver implements cib/live/primitives/{primitive-id}/edit (there is a button "Delete"), and if you delete a primitive, hawk would forward you to cib/live/resources/types and prompt a success alert.

Original Ruby hawk knows that a primitive was deleted from its internal cookies. When redirected from the hawk-apiserver, we have to inform hawk somehow, so we do this via the URL flash parameter.

I will create a PR for hawk-apiserver, and comment on the flash=deleted to make it clearer.

self.check_and_click_by_xpath(Error.COOL_PRIMITIVE_ERR, [Xpath.DROP_DOWN_FORMAT.format(resource_number_from_top),
Xpath.COOL_PRIMITIVE_EDIT])

# Second, rename the cool_primitive to hot_primitive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename should be copy here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

submit_btn.click()

if self.verify_success():
print("INFO: cool_primitive successfully renamed copied as hot_primitive")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here? renamed or copied

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied=) Good catch!

Copy link
Contributor

@liangxin1300 liangxin1300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other parts look good to me

Thanks!

* test_copy_primitive
* test_rename_primitive
* test_delete_primitive
The test_click_on_status is removed because it's implied in the new
tests
@aleksei-burlakov aleksei-burlakov merged commit 65cf4f0 into ClusterLabs:master Dec 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants