import influxframework


def execute():
	navbar_settings = influxframework.get_single("Navbar Settings")

	if influxframework.db.exists("Navbar Item", {"item_label": "Manage Subscriptions"}):
		return

	for idx, row in enumerate(navbar_settings.settings_dropdown[2:], start=4):
		row.idx = idx

	navbar_settings.append(
		"settings_dropdown",
		{
			"item_label": "Manage Subscriptions",
			"item_type": "Action",
			"action": "influxframework.ui.toolbar.redirectToUrl()",
			"is_standard": 1,
			"hidden": 1,
			"idx": 3,
		},
	)

	navbar_settings.save()
