@adcops/autocore-react 3.3.77 → 3.3.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Indicator.d.ts.map +1 -1
- package/dist/components/Indicator.js +1 -1
- package/dist/components/tis/ProjectManager.d.ts.map +1 -1
- package/dist/components/tis/ProjectManager.js +1 -1
- package/package.json +1 -1
- package/src/components/Indicator.tsx +17 -6
- package/src/components/tis/ProjectManager.tsx +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Indicator.d.ts","sourceRoot":"","sources":["../../src/components/Indicator.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,WAAW,cAAc;IAC3B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAiBD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"Indicator.d.ts","sourceRoot":"","sources":["../../src/components/Indicator.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,MAAM,WAAW,cAAc;IAC3B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAiBD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAyG9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useContext,useEffect,useState}from"react";import clsx from"clsx";import{EventEmitterContext}from"../core/EventEmitterContext";import{IndicatorColor}from"../core/IndicatorColor";export{IndicatorColor};const pickColor=(o,t,r,e)=>!0===o?t:!1===o?r:e;export const Indicator=({value:o,onColor:t=IndicatorColor.IndicatorGreen,offColor:r=IndicatorColor.IndicatorOff,invalidColor:e=IndicatorColor.IndicatorInvalid,topic:n,className:i,style:s,label:a,children:c})=>{const{subscribe:l,unsubscribe:d}=useContext(EventEmitterContext),[
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useContext,useEffect,useState}from"react";import clsx from"clsx";import{EventEmitterContext}from"../core/EventEmitterContext";import{IndicatorColor}from"../core/IndicatorColor";export{IndicatorColor};const pickColor=(o,t,r,e)=>!0===o?t:!1===o?r:e;export const Indicator=({value:o,onColor:t=IndicatorColor.IndicatorGreen,offColor:r=IndicatorColor.IndicatorOff,invalidColor:e=IndicatorColor.IndicatorInvalid,topic:n,className:i,style:s,label:a,children:c})=>{const{subscribe:l,unsubscribe:d}=useContext(EventEmitterContext),[x,p]=useState(void 0);useEffect(()=>{if(!n||!l)return;const o=l(n,o=>{p(null==o?void 0:!!o)});return()=>{try{d&&void 0!==o&&d(o)}catch{}}},[n,l,d]);const u=pickColor(void 0!==o?o:x,t,r,e);if(null!=c){const o={backgroundColor:u,color:"white",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"inset 2px 2px 3px rgba(0, 0, 0, 0.55), inset -1px -1px 2px rgba(255, 255, 255, 0.20)",boxSizing:"border-box",...s};return _jsx("span",{className:clsx("indicator",i),style:o,role:"status","aria-label":"string"==typeof a?a:void 0,children:c})}const m={alignItems:"center",width:"auto",flex:"0 0 auto",...s},f={backgroundColor:u,width:"22px",borderRadius:0,boxShadow:"inset 1px 1px 2px rgba(0, 0, 0, 0.5), inset -1px -1px 1px rgba(255, 255, 255, 0.18)"};return _jsxs("div",{className:clsx("p-inputgroup indicator",i),style:m,role:"status",children:[_jsx("span",{className:"p-inputgroup-addon",style:f,children:" "}),void 0!==a&&_jsx("span",{className:"p-inputgroup-addon",children:a})]})};export default Indicator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectManager.d.ts","sourceRoot":"","sources":["../../../src/components/tis/ProjectManager.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProjectManager.d.ts","sourceRoot":"","sources":["../../../src/components/tis/ProjectManager.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAU5E,MAAM,WAAW,mBAAmB;IAChC,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAyBD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+UxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import React,{useCallback,useContext,useEffect,useState}from"react";import{Button}from"primereact/button";import{DataTable}from"primereact/datatable";import{Column}from"primereact/column";import{
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import React,{useCallback,useContext,useEffect,useState}from"react";import{Button}from"primereact/button";import{DataTable}from"primereact/datatable";import{Column}from"primereact/column";import{confirmDialog}from"primereact/confirmdialog";import{ProgressBar}from"primereact/progressbar";import{EventEmitterContext}from"../../core/EventEmitterContext";import{MessageType}from"../../hub/CommandMessage";import{useTis}from"./TisProvider";const formatBytes=e=>{if(!Number.isFinite(e)||e<=0)return"0 B";const t=["B","KiB","MiB","GiB","TiB","PiB"];let r=0,s=e;for(;s>=1024&&r<t.length-1;)s/=1024,r++;return`${s.toFixed(s>=100?0:s>=10?1:2)} ${t[r]}`},formatDate=e=>{if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()};export const ProjectManager=e=>{const t=useTis(),r=e.projectId??t.selection.projectId,{invoke:s}=useContext(EventEmitterContext),[a,i]=useState([]),[o,n]=useState(!1),[l,c]=useState(null),[d,m]=useState(!1),[p,u]=useState(!1),[f,h]=useState(null),[g,_]=useState(""),y=useCallback(async()=>{if(r){n(!0);try{const e=await s("tis.list_tests",MessageType.Request,{project_id:r});e?.success&&e.data?.tests?i(e.data.tests):i([])}catch(e){i([])}finally{n(!1)}}else i([])},[r,s]),j=useCallback(async()=>{try{const e=await s("tis.disk_usage",MessageType.Request,{});e?.success&&e.data?(h(e.data),_("")):(h(null),_(e?.error_message??"disk_usage failed"))}catch(e){h(null),_(e instanceof Error?e.message:String(e))}},[s]);useEffect(()=>{y()},[y,t.state.activeRunId]),useEffect(()=>{j()},[j]);const b=e=>{const a=e?.run_id??"",i=e?.sample_id??"";confirmDialog({header:"Delete test",icon:"pi pi-exclamation-triangle",acceptLabel:"Delete",rejectLabel:"Cancel",acceptClassName:"p-button-danger",message:_jsxs("div",{children:[_jsxs("p",{style:{marginTop:0},children:["Permanently delete run ",_jsx("code",{children:a}),i?_jsxs(_Fragment,{children:[" (sample ",_jsx("code",{children:i}),")"]}):null,"?"]}),_jsxs("p",{style:{marginBottom:0,fontSize:"0.875rem",color:"#9ca3af"},children:["Removes ",_jsx("code",{children:"test.json"}),", cycles, raw and filtered data for this run. This action cannot be undone."]})]}),accept:()=>{(async e=>{const a=e?.run_id,i=e?.method_id;if(r&&i&&a){c(a);try{const e=await s("tis.delete_test",MessageType.Request,{project_id:r,method_id:i,run_id:a});if(!e?.success)return void alert(`Failed to delete test ${a}`+(e?.error_message?`: ${e.error_message}`:""));await y(),t.selection.runId===a&&t.setSelection({runId:null})}catch(e){alert(`Delete failed: ${e instanceof Error?e.message:String(e)}`)}finally{c(null)}}})(e)}})},x=e=>{const t="string"==typeof e?.sample_id?e.sample_id:"";if(t)return t;const r=e?.config;return r&&"object"==typeof r&&"string"==typeof r.sample_id?r.sample_id:""},v=f&&f.total_bytes>0?Math.min(100,Math.round(f.used_bytes/f.total_bytes*100)):0;return _jsxs("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box"},children:[_jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem",gap:"0.5rem",flexWrap:"wrap"},children:[_jsx("h3",{style:{margin:0},children:r?`Project Manager: ${r}`:"Project Manager (no project selected)"}),_jsxs("div",{style:{display:"flex",gap:"0.4rem",alignItems:"center",flexWrap:"wrap"},children:[_jsx(Button,{icon:p?"pi pi-spin pi-spinner":"pi pi-box",label:"Download Archive",size:"small",outlined:!0,disabled:!r||p||d,onClick:async()=>{if(r){u(!0);try{const e=await s("tis.export_project_zip",MessageType.Request,{project_id:r});if(!e?.success)return void alert("Failed to build project archive"+(e?.error_message?`: ${e.error_message}`:""));const t="string"==typeof e.data?.download_url?e.data.download_url:"";if(!t)return void alert("Server did not return a download URL for the archive.");const a=document.createElement("a");a.href=t,a.download="string"==typeof e.data?.filename?e.data.filename:`${r}_project_archive.zip`,document.body.appendChild(a),a.click(),a.remove()}catch(e){alert(`Download failed: ${e instanceof Error?e.message:String(e)}`)}finally{u(!1)}}},tooltip:"Download a ZIP of the entire project directory",tooltipOptions:{position:"bottom"}}),_jsx(Button,{icon:d?"pi pi-spin pi-spinner":"pi pi-trash",label:"Delete Project",size:"small",severity:"danger",disabled:!r||d||p,onClick:()=>{if(!r)return;const e=a.length;confirmDialog({header:"Delete project",icon:"pi pi-exclamation-triangle",acceptLabel:"Delete Project",rejectLabel:"Cancel",acceptClassName:"p-button-danger",message:_jsxs("div",{children:[_jsxs("p",{style:{marginTop:0},children:["Permanently delete project ",_jsx("code",{children:r})," and all ",_jsx("strong",{children:e})," test",1===e?"":"s"," inside it?"]}),_jsx("p",{style:{marginBottom:0,fontSize:"0.875rem",color:"#9ca3af"},children:"This removes every method, run, cycle, and raw/filtered blob under the project. Consider downloading the archive first. This action cannot be undone."})]}),accept:()=>{(async()=>{if(r){m(!0);try{const e=await s("tis.delete_project",MessageType.Request,{project_id:r});if(!e?.success)return void alert(`Failed to delete project ${r}`+(e?.error_message?`: ${e.error_message}`:""));t.setSelection({projectId:null,methodId:null,sampleId:null,runId:null}),await t.refreshProjects(),await j(),i([])}catch(e){alert(`Delete failed: ${e instanceof Error?e.message:String(e)}`)}finally{m(!1)}}})()}})},tooltip:"Permanently delete the project and every test inside it",tooltipOptions:{position:"bottom"}}),_jsx(Button,{icon:"pi pi-refresh",label:"Refresh",size:"small",onClick:()=>{y(),j()},disabled:o})]})]}),_jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 1rem",border:"1px solid #2a2a2a",borderRadius:4,background:"#161616"},children:[_jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",flexWrap:"wrap",gap:"0.5rem"},children:[_jsx("strong",{children:"Server Disk Space"}),f?_jsxs("span",{style:{fontSize:"0.875rem",color:"#9ca3af"},children:[formatBytes(f.available_bytes)," free of ",formatBytes(f.total_bytes)," ","(",100-v,"% available)"]}):_jsx("span",g?{style:{fontSize:"0.875rem",color:"#f87171"},children:g}:{style:{fontSize:"0.875rem",color:"#9ca3af"},children:"Loading…"})]}),f&&_jsxs(_Fragment,{children:[_jsx(ProgressBar,{value:v,showValue:!1,style:{height:"0.5rem",marginTop:"0.5rem"},color:v>=90?"#dc2626":v>=75?"#f59e0b":void 0}),_jsx("div",{style:{fontSize:"0.75rem",color:"#6b7280",marginTop:"0.4rem"},children:_jsx("code",{children:f.base_directory})})]})]}),_jsxs(DataTable,{value:a,loading:o,paginator:!0,rows:10,emptyMessage:r?"No tests in this project.":"Select a project to manage.",scrollable:!0,scrollHeight:"flex",tableStyle:{minWidth:0},style:{width:"100%"},children:[_jsx(Column,{header:"Sample ID",body:x,sortable:!0,sortFunction:e=>{const t=[...e.data];return t.sort((t,r)=>x(t).localeCompare(x(r))*(e.order??1)),t},style:{minWidth:"8rem"}}),_jsx(Column,{field:"start_time",header:"Date/Time",sortable:!0,body:e=>formatDate(e.start_time),style:{minWidth:"12rem"}}),_jsx(Column,{field:"method_id",header:"Test Method",sortable:!0,style:{minWidth:"10rem"}}),_jsx(Column,{field:"run_id",header:"Run ID",sortable:!0,style:{minWidth:"12rem"}}),_jsx(Column,{header:"Action",style:{width:"8rem"},body:e=>{const t=l===e.run_id;return _jsx(Button,{icon:t?"pi pi-spin pi-spinner":"pi pi-trash",label:"Delete",size:"small",severity:"danger",outlined:!0,disabled:null!==l||d,onClick:()=>b(e),tooltip:"Permanently delete this test",tooltipOptions:{position:"left"}})}})]})]})};
|
package/package.json
CHANGED
|
@@ -134,7 +134,7 @@ export const Indicator: React.FC<IndicatorProps> = ({
|
|
|
134
134
|
const displayValue = value !== undefined ? value : subscribedValue;
|
|
135
135
|
const color = pickColor(displayValue, onColor, offColor, invalidColor);
|
|
136
136
|
|
|
137
|
-
// Children mode: square, filled,
|
|
137
|
+
// Children mode: square, filled, sunken look. Sized by the caller's
|
|
138
138
|
// className (e.g. `ac-toolbar-icon-btn`) so it lines up with sibling
|
|
139
139
|
// IndicatorButtons in the same toolbar.
|
|
140
140
|
if (children !== undefined && children !== null) {
|
|
@@ -147,10 +147,17 @@ export const Indicator: React.FC<IndicatorProps> = ({
|
|
|
147
147
|
// Square corners distinguish a passive indicator from an
|
|
148
148
|
// interactive button (PrimeReact buttons round to ~6px).
|
|
149
149
|
borderRadius: 0,
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
|
|
150
|
+
// Classic Win95-style chiseled-in bevel: dark shadow on
|
|
151
|
+
// the top + left (the "wall" above the recess casts a
|
|
152
|
+
// shadow into it) plus a lighter highlight on the bottom +
|
|
153
|
+
// right (light bouncing back out). The previous single
|
|
154
|
+
// top-only shadow read as raised because the bottom edge
|
|
155
|
+
// had nothing to contrast it. The shadow opacities are
|
|
156
|
+
// chosen to remain legible against every IndicatorColor
|
|
157
|
+
// — green, red, orange, blue, gray, black.
|
|
158
|
+
boxShadow:
|
|
159
|
+
'inset 2px 2px 3px rgba(0, 0, 0, 0.55), ' +
|
|
160
|
+
'inset -1px -1px 2px rgba(255, 255, 255, 0.20)',
|
|
154
161
|
boxSizing: 'border-box',
|
|
155
162
|
...style,
|
|
156
163
|
};
|
|
@@ -180,7 +187,11 @@ export const Indicator: React.FC<IndicatorProps> = ({
|
|
|
180
187
|
backgroundColor: color,
|
|
181
188
|
width: '22px',
|
|
182
189
|
borderRadius: 0,
|
|
183
|
-
|
|
190
|
+
// Same Win95-sunken treatment as the children-mode box, dialed
|
|
191
|
+
// down a touch since the swatch is only 22px wide.
|
|
192
|
+
boxShadow:
|
|
193
|
+
'inset 1px 1px 2px rgba(0, 0, 0, 0.5), ' +
|
|
194
|
+
'inset -1px -1px 1px rgba(255, 255, 255, 0.18)',
|
|
184
195
|
};
|
|
185
196
|
|
|
186
197
|
return (
|
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
* Mounts under the operator-facing Project tab, alongside <ProjectSelector>.
|
|
14
14
|
* Reads `selection.projectId` from <TisProvider> so it follows whatever
|
|
15
15
|
* project the operator has picked.
|
|
16
|
+
*
|
|
17
|
+
* Requires that a <ConfirmDialog> instance be registered in web app somewhere.
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
19
21
|
import { Button } from 'primereact/button';
|
|
20
22
|
import { DataTable } from 'primereact/datatable';
|
|
21
23
|
import { Column } from 'primereact/column';
|
|
22
|
-
import {
|
|
24
|
+
import { confirmDialog } from 'primereact/confirmdialog';
|
|
23
25
|
import { ProgressBar } from 'primereact/progressbar';
|
|
24
26
|
import { EventEmitterContext } from '../../core/EventEmitterContext';
|
|
25
27
|
import { MessageType } from '../../hub/CommandMessage';
|
|
@@ -256,7 +258,6 @@ export const ProjectManager: React.FC<ProjectManagerProps> = (props) => {
|
|
|
256
258
|
|
|
257
259
|
return (
|
|
258
260
|
<div style={{ width: '100%', maxWidth: '100%', boxSizing: 'border-box' }}>
|
|
259
|
-
<ConfirmDialog />
|
|
260
261
|
|
|
261
262
|
<div style={{
|
|
262
263
|
display: 'flex',
|