Janitor Button: stay in progress mode

Hello Bruno @bnomei,

I use your Janitor plugin to post a webhook request. It works but my Janitor button stay in its progress mode in the panel. This webhook trigger a deploy process on my server.

I would like that the button come back to its initial mode when the deploy process is ended.
Is that possible ? What did I miss ?

This is my code:

blueprints

fields:
          deployjanitor:
            type: janitor
            label: Deploy
            icon: refresh
            progress: Deploy...
            job: deployJanitor 

config.php

'bnomei.janitor.jobs' => [
    'deployJanitor' => function (Kirby\Cms\Page $page = null, string $data = null) {
	        // $page => page object where the button as pressed
	        // $data => 'my custom data'
	    	$url = 'https:/my_webhook_url';
			$options = [
			    'headers' => [
			        'Access-Control-Allow-Origin: *',
					'Access-Control-Allow-Methods: POST',
					'Access-Control-Allow-Headers: X-Requested-With'
			    ],
			    'method'  => 'POST'
			 ];
			$response = Remote::request($url, $options);
	        return [
	            'status' => 200,
	            'label' => $page->title() . ' - ' . $response,
	        ];
	    },
	],

last question: what is β€œlabel” in the return array ?

Thanks for your help :slight_smile:

I think label is the label of the button once the job is complete. The button shows up in green (status 200) with the label provided.

My issue is rather the opposite: when redirecting to a URL and then going back to the panel, the button is still showing the progress for probably 2 seconds (default cool down period?). I tried overriding the cool down to 0 but that didn’t help. Anyway, different issue :slight_smile:

When I remove 'label' => $page->title(), the progress mode show 2s as expected

yes.