feat: introduce hashids permalink keys (#19324)

* feat: introduce hashids permalink keys

* implement dashboard permalinks

* remove shorturl notice from UPDATING.md

* lint

* fix test

* introduce KeyValueResource

* make filterState optional

* fix test

* fix resource names
This commit is contained in:
Ville Brofeldt
2022-03-24 21:53:09 +02:00
committed by GitHub
parent dc769a9a34
commit f4b71abb22
39 changed files with 344 additions and 367 deletions

View File

@@ -27,24 +27,22 @@ from superset.explore.permalink.types import ExplorePermalinkValue
from superset.explore.utils import check_access
from superset.key_value.commands.get import GetKeyValueCommand
from superset.key_value.exceptions import KeyValueGetFailedError, KeyValueParseKeyError
from superset.key_value.types import KeyType
from superset.key_value.utils import decode_permalink_id
logger = logging.getLogger(__name__)
class GetExplorePermalinkCommand(BaseExplorePermalinkCommand):
def __init__(
self, actor: User, key: str, key_type: KeyType,
):
def __init__(self, actor: User, key: str):
self.actor = actor
self.key = key
self.key_type = key_type
def run(self) -> Optional[ExplorePermalinkValue]:
self.validate()
try:
key = decode_permalink_id(self.key, salt=self.salt)
value: Optional[ExplorePermalinkValue] = GetKeyValueCommand(
resource=self.resource, key=self.key, key_type=self.key_type
resource=self.resource, key=key,
).run()
if value:
chart_id: Optional[int] = value.get("chartId")