def get_redirect_url(self, *args, **kwargs):
        """
        So backwards, it's forwards.

        The "name" of the chart to restart is set in the template for
        list-tools, if there's a live deployment.

        That's numberwang.
        """
        name = self.kwargs["name"]

        start_background_task(
            "tool.restart",
            {
                "tool_name": name,
                "user_id": self.request.user.id,
                "id_token": self.request.user.get_id_token(),
            },
        )

        messages.success(
            self.request,
            f"Restarting {name}...",
        )
        return super().get_redirect_url(*args, **kwargs)
    def get_redirect_url(self, *args, **kwargs):
        name = self.kwargs['name']

        start_background_task(
            'tool.restart', {
                'tool_name': name,
                'user_id': self.request.user.id,
                'id_token': self.request.user.get_id_token(),
            })

        messages.success(
            self.request,
            f"Restarting {name}...",
        )
        return super().get_redirect_url(*args, **kwargs)
    def get_redirect_url(self, *args, **kwargs):
        name = kwargs['name']

        start_background_task(
            'tool.upgrade', {
                'tool_name': name,
                'user_id': self.request.user.id,
                'id_token': self.request.user.get_id_token(),
            })

        messages.success(
            self.request,
            f"Upgrading {name}... this may take several minutes",
        )
        return super().get_redirect_url(*args, **kwargs)
    def get_redirect_url(self, *args, **kwargs):
        name = self.kwargs["name"]

        start_background_task(
            "tool.restart",
            {
                "tool_name": name,
                "user_id": self.request.user.id,
                "id_token": self.request.user.get_id_token(),
            },
        )

        messages.success(
            self.request,
            f"Restarting {name}...",
        )
        return super().get_redirect_url(*args, **kwargs)
    def get_success_url(self):
        """
        The form is valid, so kick off the background job to run the helm
        chart and signal to the user the reset is underway.
        """
        start_background_task(
            "home.reset",
            {
                "user_id": self.request.user.id,
            },
        )

        messages.success(
            self.request,
            "Home directory reset. Wait a few seconds and restart RStudio.",
        )
        return reverse_lazy("list-tools")
    def get_redirect_url(self, *args, **kwargs):
        name = kwargs["name"]

        start_background_task(
            "tool.deploy",
            {
                "tool_name": name,
                "version": self.request.POST["version"],
                "user_id": self.request.user.id,
                "id_token": self.request.user.get_id_token(),
            },
        )

        messages.success(
            self.request,
            f"Deploying {name}... this may take several minutes",
        )
        return super().get_redirect_url(*args, **kwargs)
    def get_redirect_url(self, *args, **kwargs):
        """
        This is the most backwards thing you'll see for a while. The helm
        task to deploy the tool apparently must happen when the view class
        attempts to redirect to the target url. I'm sure there's a good
        reason why.
        """
        # If there's already a tool deployed, we need to get this from a
        # hidden field posted back in the form. This is used by helm to delete
        # the currently installed chart for the tool before installing the
        # new chart.
        old_chart_name = self.request.POST.get("deployed_chart_name", None)
        # The selected option from the "version" select control contains the
        # data we need.
        chart_info = self.request.POST["version"]
        # The tool name and version are stored in the selected option's value
        # attribute and then split on "__" to extract them. Why? Because we
        # need both pieces of information to kick off the background helm
        # deploy.
        tool_name, version = chart_info.split("__")

        # Kick off the helm chart as a background task.
        start_background_task(
            "tool.deploy",
            {
                "tool_name": tool_name,
                "version": version,
                "user_id": self.request.user.id,
                "id_token": self.request.user.get_id_token(),
                "old_chart_name": old_chart_name,
            },
        )
        # Tell the user stuff's happening.
        messages.success(
            self.request,
            f"Deploying {tool_name}... this may take several minutes",
        )
        # Continue the redirect to the target URL (list-tools).
        return super().get_redirect_url(*args, **kwargs)