Files
WPS3Media/ui/pro/ToolRunningStatus.svelte
Malin 3248cbb029 feat: add S3-compatible storage provider (MinIO, Ceph, R2, etc.)
Adds a new 'S3-Compatible Storage' provider that works with any
S3-API-compatible object storage service, including MinIO, Ceph,
Cloudflare R2, Backblaze B2, and others.

Changes:
- New provider class: classes/providers/storage/s3-compatible-provider.php
  - Provider key: s3compatible
  - Reads user-configured endpoint URL from settings
  - Uses path-style URL access (required by most S3-compatible services)
  - Supports credentials via AS3CF_S3COMPAT_ACCESS_KEY_ID /
    AS3CF_S3COMPAT_SECRET_ACCESS_KEY wp-config.php constants
  - Disables AWS-specific features (Block Public Access, Object Ownership)
- New provider SVG icons (s3compatible.svg, -link.svg, -round.svg)
- Registered provider in main plugin class with endpoint setting support
- Updated StorageProviderSubPage to show endpoint URL input for S3-compatible
- Built pro settings bundle with rollup (Svelte 4.2.19)
- Added package.json and updated rollup.config.mjs for pro-only builds
2026-03-03 12:30:18 +01:00

95 lines
2.7 KiB
Svelte

<script>
import {push} from "svelte-spa-router";
import {urls} from "../js/stores";
import {running, tools, toolsLocked} from "./stores";
import {numToShortString, numToString} from "../js/numToString";
import ProgressBar from "../components/ProgressBar.svelte";
import ToolRunningButtons from "./ToolRunningButtons.svelte";
/**
* Returns the currently running tool's details.
*
* @param {Object} tools
* @param {string} running
*
* @return {unknown}
*/
function runningTool( tools, running ) {
return Object.values( tools ).find( ( tool ) => tool.id === running );
}
/**
* Get status description for tool.
*
* @param {Object} tool
* @param {boolean} isRunning
*
* @return {string}
*/
function toolStatus( tool, isRunning ) {
if ( !isRunning ) {
return "";
}
if ( tool.short_status_description ) {
return tool.short_status_description;
}
return tool.busy_description;
}
$: isRunning = !!$running;
$: tool = runningTool( $tools, $running );
$: icon = tools.icon( tool, isRunning, true );
// Buttons should be disabled if another tool is running, current tool is in process of pausing or cancelling, or all tools locked.
$: disabled = isRunning && (($running && $running !== tool.id) || (tool.is_processing && tool.is_paused) || tool.is_cancelled || $toolsLocked);
$: starting = !!(isRunning && tool.progress < 1 && !tool.is_paused);
$: status = isRunning ? "(" + numToShortString( tool.queue.processed ) + "/" + numToShortString( tool.queue.total ) + ") " + toolStatus( tool, isRunning ) : "";
$: title = isRunning ? tool.name + ": " + tool.progress + "% (" + numToString( tool.queue.processed ) + "/" + numToString( tool.queue.total ) + ")" : "";
/**
* Returns the numeric percentage progress for the running job.
*
* @param {Object} tool
* @param {boolean} isRunning
*
* @return {number}
*/
function getPercentComplete( tool, isRunning ) {
if ( isRunning ) {
return tool.progress;
}
return 0;
}
$: percentComplete = getPercentComplete( tool, isRunning );
</script>
{#if tool}
<div class="nav-status-wrapper tool-running">
<!-- TODO: Fix a11y. -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="nav-status" {title} on:click={() => push("/tools")}>
<p class="status-text" {title}>
<strong>{tool.progress}%</strong>
<span> {@html status}</span>
</p>
<ProgressBar
{percentComplete}
{starting}
running={isRunning}
paused={tool.is_paused}
{title}
/>
<div class="animation-running" {title}>
<img src="{$urls.assets + 'img/icon/' + icon}" alt="{tool.status_description}"/>
</div>
</div>
<ToolRunningButtons {tool} {disabled} small/>
</div>
{/if}