Merge pull request #480 from ylei-tsubame/patch-screenshot-icons
Web UI: patch server screenshot representationsmain
commit
51319b2389
30 changed files with 183 additions and 62 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,55 @@ |
|||||||
|
const before = (time: number, limit: number): boolean => { |
||||||
|
const diff = time - limit; |
||||||
|
|
||||||
|
return diff > 0; |
||||||
|
}; |
||||||
|
|
||||||
|
const now = (ms?: boolean): number => { |
||||||
|
let nao = Date.now(); |
||||||
|
|
||||||
|
if (!ms) nao = Math.floor(nao / 1000); |
||||||
|
|
||||||
|
return nao; |
||||||
|
}; |
||||||
|
|
||||||
|
const last = ( |
||||||
|
time: number, |
||||||
|
duration: number, |
||||||
|
{ ms }: { ms?: boolean } = {}, |
||||||
|
): boolean => { |
||||||
|
const diff = now(ms) - time; |
||||||
|
|
||||||
|
return diff <= duration; |
||||||
|
}; |
||||||
|
|
||||||
|
const elapsed = ( |
||||||
|
duration: number, |
||||||
|
): { h: number; m: number; s: number; unit: string; value: number } => { |
||||||
|
let src = duration; |
||||||
|
|
||||||
|
const parts = [60, 60].reduce<number[]>((previous, multiplier) => { |
||||||
|
const remainder = src % multiplier; |
||||||
|
|
||||||
|
previous.push(remainder); |
||||||
|
|
||||||
|
src = (src - remainder) / multiplier; |
||||||
|
|
||||||
|
return previous; |
||||||
|
}, []); |
||||||
|
|
||||||
|
const [s, m, h] = [...parts, src]; |
||||||
|
|
||||||
|
const significant = [ |
||||||
|
{ unit: 'h', value: h }, |
||||||
|
{ unit: 'm', value: m }, |
||||||
|
].find(({ value }) => value) ?? { unit: 's', value: s }; |
||||||
|
|
||||||
|
return { |
||||||
|
h, |
||||||
|
m, |
||||||
|
s, |
||||||
|
...significant, |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
export { before, elapsed, last, now }; |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
|||||||
self.__BUILD_MANIFEST=function(s,c,a,t,e,n,i,d,f,b,u,k,h,j,r,g,l,_){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,a,t,d,f,h,"static/chunks/717-8bd60b96d67fd464.js",c,e,n,i,j,r,"static/chunks/pages/index-03c43a0be65dfb49.js"],"/_error":["static/chunks/pages/_error-2280fa386d040b66.js"],"/anvil":[s,a,t,d,f,h,c,e,n,i,j,"static/chunks/pages/anvil-5058ba8058633c3d.js"],"/config":[s,a,t,u,"static/chunks/586-4e70511cf6d7632f.js",c,e,n,i,b,k,g,"static/chunks/pages/config-0cb597caf390573f.js"],"/file-manager":["static/chunks/29107295-fbcfe2172188e46f.js",s,a,t,d,"static/chunks/176-7308c25ba374961e.js",c,e,i,b,"static/chunks/pages/file-manager-1ae01a78e266275a.js"],"/init":[s,a,d,f,u,l,c,e,n,i,_,"static/chunks/pages/init-053607258b5d7d64.js"],"/login":[s,a,t,c,e,n,b,k,"static/chunks/pages/login-1b987b077ffc3420.js"],"/manage-element":[s,a,t,d,f,u,l,"static/chunks/111-2605129c170ed35d.js",c,e,n,i,b,k,_,g,"static/chunks/pages/manage-element-6b42a013966413d3.js"],"/server":[s,t,"static/chunks/227-a3756585a7ef09ae.js",c,r,"static/chunks/pages/server-db52258419acacf3.js"],sortedPages:["/","/_app","/_error","/anvil","/config","/file-manager","/init","/login","/manage-element","/server"]}}("static/chunks/382-f51344f6f9208507.js","static/chunks/62-532ed713980da8db.js","static/chunks/438-0147a63d98e89439.js","static/chunks/894-e57948de523bcf96.js","static/chunks/195-fa06e61dd4339031.js","static/chunks/987-1ff0d82724b0e58b.js","static/chunks/157-d1418743accab385.js","static/chunks/182-08683bbe95fbb010.js","static/chunks/434-07ec1dcc649bdd0c.js","static/chunks/248-749f2bec4cb43d28.js","static/chunks/644-c7c6e21c71345aed.js","static/chunks/336-8a7866afcf131f68.js","static/chunks/485-77798bccc4308d0e.js","static/chunks/825-0b3ee47570192a02.js","static/chunks/94-e103c3735f0e061b.js","static/chunks/560-0ed707609765e23a.js","static/chunks/676-6159ce853338cc1f.js","static/chunks/86-447b52c8195dea3d.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); |
self.__BUILD_MANIFEST=function(s,c,a,t,e,n,i,f,d,b,u,k,h,j,r,g,l,_){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,a,t,f,d,h,"static/chunks/433-a3be905e7a7d3bfc.js",c,e,n,i,j,r,"static/chunks/pages/index-6ff72adab3a682db.js"],"/_error":["static/chunks/pages/_error-2280fa386d040b66.js"],"/anvil":[s,a,t,f,d,h,c,e,n,i,j,"static/chunks/pages/anvil-5ff2efa937105177.js"],"/config":[s,a,t,u,"static/chunks/586-4e70511cf6d7632f.js",c,e,n,i,b,k,g,"static/chunks/pages/config-0cb597caf390573f.js"],"/file-manager":["static/chunks/29107295-fbcfe2172188e46f.js",s,a,t,f,"static/chunks/176-7308c25ba374961e.js",c,e,i,b,"static/chunks/pages/file-manager-1ae01a78e266275a.js"],"/init":[s,a,f,d,u,l,c,e,n,i,_,"static/chunks/pages/init-053607258b5d7d64.js"],"/login":[s,a,t,c,e,n,b,k,"static/chunks/pages/login-1b987b077ffc3420.js"],"/manage-element":[s,a,t,f,d,u,l,"static/chunks/111-2605129c170ed35d.js",c,e,n,i,b,k,_,g,"static/chunks/pages/manage-element-6b42a013966413d3.js"],"/server":[s,t,"static/chunks/528-72edc50189f30fa9.js",c,r,"static/chunks/pages/server-4ac03eba56ccfcbf.js"],sortedPages:["/","/_app","/_error","/anvil","/config","/file-manager","/init","/login","/manage-element","/server"]}}("static/chunks/382-f51344f6f9208507.js","static/chunks/62-532ed713980da8db.js","static/chunks/438-0147a63d98e89439.js","static/chunks/894-e57948de523bcf96.js","static/chunks/195-fa06e61dd4339031.js","static/chunks/987-1ff0d82724b0e58b.js","static/chunks/157-d1418743accab385.js","static/chunks/182-08683bbe95fbb010.js","static/chunks/434-07ec1dcc649bdd0c.js","static/chunks/248-749f2bec4cb43d28.js","static/chunks/644-c7c6e21c71345aed.js","static/chunks/336-8a7866afcf131f68.js","static/chunks/485-77798bccc4308d0e.js","static/chunks/825-0b3ee47570192a02.js","static/chunks/94-8322ed453a3c08f0.js","static/chunks/560-0ed707609765e23a.js","static/chunks/676-6159ce853338cc1f.js","static/chunks/86-447b52c8195dea3d.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue