{"app":{"id":13,"summary":"S3 File Explorer","versions":[44,45,46,49,50,51,68],"created_by":"adam186","created_at":"2023-04-10T19:41:27.222Z","votes":0,"approved":true,"apps":["s3"],"app_type":"openapp","external_embed_url":null,"value":{"css":{"textcomponent":{"text":{"class":"","style":""},"container":{"class":"","style":""}},"tablecomponent":{"container":{"class":"","style":""},"tableBody":{"class":"","style":""},"tableFooter":{"class":"","style":""},"tableHeader":{"class":"","style":""}},"containercomponent":{"container":{"class":"","style":""}}},"grid":[{"3":{"h":1,"w":1,"x":0,"y":0,"fixed":true},"12":{"h":1,"w":3,"x":0,"y":0,"id":"b","fixed":true},"id":"b","data":{"id":"b","type":"textcomponent","customCss":{"text":{"class":"","style":""},"container":{"class":"","style":""}},"configuration":{"style":{"type":"static","value":"Title"},"tooltip":{"type":"static","value":""},"copyButton":{"type":"static","value":false}},"componentInput":{"eval":"Files","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"center","horizontalAlignment":"left"}},{"3":{"h":3,"w":1,"x":0,"y":12,"fixed":true},"12":{"h":1,"w":1,"x":3,"y":0,"id":"d","fixed":true},"id":"d","data":{"id":"d","type":"iconcomponent","customCss":{"icon":{"class":"text-gray-600","style":""},"container":{"class":"","style":""}},"configuration":{"icon":{"type":"static","value":"FolderSearch"},"size":{"type":"static","value":24},"color":{"type":"static","value":"currentColor"},"strokeWidth":{"type":"static","value":2}},"verticalAlignment":"center","horizontalAlignment":"right"}},{"3":{"h":1,"w":2,"x":0,"y":11,"fixed":true},"12":{"h":1,"w":3,"x":4,"y":0,"id":"c","fixed":true},"id":"c","data":{"id":"c","type":"textinputcomponent","customCss":{"input":{"class":"rounded","style":""}},"configuration":{"placeholder":{"type":"static","value":"Search by file name (prefix)"},"defaultValue":{"type":"static"}},"verticalAlignment":"center"}},{"3":{"h":8,"w":2,"x":0,"y":15,"fixed":false},"12":{"h":9,"w":5,"x":7,"y":0,"id":"e","fixed":false},"id":"e","data":{"id":"e","type":"containercomponent","customCss":{"container":{"class":"","style":""}},"configuration":{},"numberOfSubgrids":1}},{"3":{"h":10,"w":3,"x":0,"y":1,"fixed":true},"12":{"h":23,"w":7,"x":0,"y":1,"id":"a","fixed":true},"id":"a","data":{"id":"a","type":"tablecomponent","customCss":{"container":{"class":"","style":""},"tableBody":{"class":"","style":""},"tableFooter":{"class":"","style":""},"tableHeader":{"class":"","style":""}},"actionButtons":[{"id":"a_a","type":"buttoncomponent","customCss":{"button":{"class":"","style":""}},"recomputeIds":["bg_0"],"configuration":{"size":{"type":"static","value":"xs"},"color":{"type":"static","value":"red"},"label":{"type":"static","value":"Delete"},"disabled":{"expr":"false","type":"eval"},"afterIcon":{"type":"static","value":"Trash2"},"onSuccess":{"type":"oneOf","selected":"sendToast","configuration":{"none":{},"setTab":{"setTab":{"type":"static","value":[]}},"gotoUrl":{"url":{"type":"static","value":""},"newTab":{"type":"static","value":true}},"sendToast":{"message":{"type":"static","value":"Successful delete"}}}},"beforeIcon":{"type":"static"},"fillContainer":{"type":"static","value":false},"triggerOnAppLoad":{"type":"static","value":false}},"componentInput":{"type":"runnable","fields":{"s3":{"type":"static","value":"$res:u/adam/my_s3","format":"resource-s3","fieldType":"object"},"object_name":{"type":"connected","value":null,"fieldType":"string","connection":{"path":"selectedRow.key","componentId":"a"}}},"runnable":{"name":"Delete object","type":"runnableByName","inlineScript":{"path":"u/adam/file-explorer/Delete object","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["s3","object_name"],"properties":{"s3":{"type":"object","format":"resource-s3","default":null},"object_name":{"type":"string","default":null}}},"content":"import { Resource } from \"https://deno.land/x/windmill@v1.85.0/mod.ts\";\nimport { S3Client } from \"https://deno.land/x/s3_lite_client@0.5.0/mod.ts\";\n\nexport async function main(s3: Resource<\"s3\">, object_name: string) {\n  const s3client = new S3Client(s3);\n  return await s3client.deleteObject(object_name)\n}","language":"deno"}},"fieldType":"any","recomputeOnInputChanged":true},"verticalAlignment":"center","horizontalAlignment":"center"}],"configuration":{"search":{"type":"static","value":"Disabled"},"columnDefs":{"type":"static","value":[]},"pagination":{"type":"oneOf","selected":"auto","configuration":{"auto":{"pageSize":{"type":"static","value":20}},"manual":{"pageCount":{"type":"static","value":-1}}}},"initialState":{"type":"static"},"downloadButton":{"type":"static"}},"componentInput":{"type":"connected","value":[{"id":1,"age":42,"name":"A cell with a long name"},{"id":2,"age":84,"name":"A briefer cell"}],"fieldType":"array","connection":{"path":"result","componentId":"bg_0"},"subFieldType":"object"}}},{"3":{"h":8,"w":2,"x":0,"y":23,"fixed":false},"12":{"h":15,"w":5,"x":7,"y":9,"id":"k","fixed":false},"id":"k","data":{"id":"k","type":"containercomponent","customCss":{"container":{"class":"","style":""}},"configuration":{},"numberOfSubgrids":1}}],"theme":{"css":"","type":"inlined"},"subgrids":{"e-0":[{"3":{"h":1,"w":1,"x":0,"y":0,"fixed":false},"12":{"h":1,"w":12,"x":0,"y":0,"id":"f","fixed":false},"id":"f","data":{"id":"f","type":"textcomponent","customCss":{},"configuration":{"style":{"type":"static","value":"Subtitle"},"tooltip":{"type":"static","value":""},"copyButton":{"type":"static","value":false}},"componentInput":{"eval":"Upload","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"center","horizontalAlignment":"left"}},{"3":{"h":1,"w":1,"x":1,"y":0,"fixed":false},"12":{"h":1,"w":12,"x":0,"y":1,"id":"g","fixed":false},"id":"g","data":{"id":"g","type":"textcomponent","customCss":{"text":{"class":"","style":""},"container":{"class":"","style":""}},"configuration":{"style":{"type":"static","value":"Label"},"tooltip":{"type":"static","value":""},"copyButton":{"type":"static","value":false}},"componentInput":{"eval":"Access level","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"bottom","horizontalAlignment":"left"}},{"3":{"h":1,"w":2,"x":0,"y":1,"fixed":false},"12":{"h":1,"w":12,"x":0,"y":2,"id":"h","fixed":false},"id":"h","data":{"id":"h","type":"selectcomponent","customCss":{"input":{"style":"border-radius: 4px;"}},"configuration":{"items":{"type":"static","value":[{"label":"Private","value":"private"},{"label":"Public (read only)","value":"public-read"},{"label":"Public (read, write)","value":"public-read-write"}]},"create":{"type":"static","value":false},"disabled":{"type":"static"},"fullWidth":{"type":"static"},"placeholder":{"type":"static","value":"Select an item"},"defaultValue":{"type":"static","value":"private"},"preselectFirst":{"type":"static"}},"verticalAlignment":"center"}},{"3":{"h":4,"w":3,"x":0,"y":2,"fixed":false},"12":{"h":4,"w":12,"x":0,"y":3,"id":"i","fixed":false},"id":"i","data":{"id":"i","type":"fileinputcomponent","customCss":{},"configuration":{"text":{"type":"static","value":"Drag and drop files or click to select them"},"allowMultiple":{"type":"static","value":true},"acceptedFileTypes":{"type":"static","value":["*"]}}}},{"3":{"h":1,"w":1,"x":0,"y":6,"fixed":false},"12":{"h":1,"w":12,"x":0,"y":7,"id":"j","fixed":false},"id":"j","data":{"id":"j","type":"buttoncomponent","customCss":{},"recomputeIds":["bg_0"],"configuration":{"size":{"type":"static","value":"xs"},"color":{"type":"static","value":"dark"},"label":{"type":"static","value":"Upload file(s)"},"disabled":{"expr":"!i.result?.length","type":"eval"},"afterIcon":{"type":"static"},"onSuccess":{"type":"oneOf","selected":"sendToast","configuration":{"none":{},"setTab":{"setTab":{"type":"static","value":[]}},"gotoUrl":{"url":{"type":"static","value":""},"newTab":{"type":"static","value":true}},"sendToast":{"message":{"type":"static","value":"Successful upload"}}}},"beforeIcon":{"type":"static","value":"Upload"},"fillContainer":{"type":"static","value":true},"triggerOnAppLoad":{"type":"static","value":false}},"componentInput":{"type":"runnable","fields":{"s3":{"type":"static","value":"$res:u/adam/my_s3","format":"resource-s3","fieldType":"object"},"acl":{"type":"connected","value":null,"fieldType":"string","connection":{"path":"result","componentId":"h"}},"objects":{"type":"connected","value":null,"fieldType":"array","connection":{"path":"result","componentId":"i"}}},"runnable":{"name":"Upload objects","type":"runnableByName","inlineScript":{"path":"u/adam/file-explorer/Upload objects","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["s3","objects","acl"],"properties":{"s3":{"type":"object","format":"resource-s3","default":null},"acl":{"type":"string","default":null},"objects":{"type":"array","items":{"type":"object"},"default":null}}},"content":"import { Resource } from \"https://deno.land/x/windmill@v1.85.0/mod.ts\";\nimport { S3Client } from \"https://deno.land/x/s3_lite_client@0.5.0/mod.ts\";\nimport { decode } from \"https://deno.land/std@0.181.0/encoding/base64.ts\";\n\nexport async function main(\n  s3: Resource<\"s3\">,\n  objects: {name: string, data: string}[],\n  acl: string,\n) {\n  const s3client = new S3Client(s3);\n  const promises = objects.map(({name, data}) => {\n    const contentType = data.slice(5, data.indexOf(\";\"))\n    return s3client.putObject(\n      name,\n      contentType.startsWith('image') ? decode(data.slice(data.indexOf(',') + 1)) : data,\n      {\n        metadata: {\n          \"x-amz-acl\": acl,\n          \"Content-Type\": contentType\n        },\n      },\n    );\n  });\n  return await Promise.all(promises);\n}\n","language":"deno"}},"fieldType":"any","recomputeOnInputChanged":true},"verticalAlignment":"center","horizontalAlignment":"center"}}],"k-0":[{"3":{"h":1,"w":1,"x":0,"y":0,"fixed":false},"12":{"h":1,"w":5,"x":0,"y":0,"id":"l","fixed":false},"id":"l","data":{"id":"l","type":"textcomponent","customCss":{},"configuration":{"style":{"type":"static","value":"Subtitle"},"tooltip":{"type":"static","value":""},"copyButton":{"type":"static","value":false}},"componentInput":{"eval":"Preview","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"center","horizontalAlignment":"left"}},{"3":{"h":1,"w":1,"x":0,"y":9,"fixed":false},"12":{"h":1,"w":7,"x":5,"y":0,"id":"o","fixed":false},"id":"o","data":{"id":"o","type":"buttoncomponent","customCss":{},"configuration":{"size":{"type":"static","value":"xs"},"color":{"type":"static","value":"dark"},"label":{"type":"static","value":"Open presigned URL"},"disabled":{"expr":"!a.selectedRow","type":"eval"},"afterIcon":{"type":"static","value":"ExternalLink"},"onSuccess":{"type":"oneOf","selected":"gotoUrl","configuration":{"none":{},"setTab":{"setTab":{"type":"static","value":[]}},"gotoUrl":{"url":{"type":"connected","value":"","connection":{"path":"result","componentId":"o"}},"newTab":{"type":"static","value":true}},"sendToast":{"message":{"type":"static","value":""}}}},"beforeIcon":{"type":"static"},"fillContainer":{"type":"static","value":false},"triggerOnAppLoad":{"type":"static","value":false}},"componentInput":{"type":"runnable","fields":{"s3":{"type":"static","value":"$res:u/adam/my_s3","format":"resource-s3","fieldType":"object"},"object_name":{"type":"connected","value":null,"fieldType":"string","connection":{"path":"selectedRow.key","componentId":"a"}}},"runnable":{"name":"Get object signed URL","type":"runnableByName","inlineScript":{"path":"u/adam/file-explorer/Get object signed URL","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["s3","object_name"],"properties":{"s3":{"type":"object","format":"resource-s3","default":null},"object_name":{"type":"string","default":null}}},"content":"import { Resource } from \"https://deno.land/x/windmill@v1.85.0/mod.ts\";\nimport { S3Client } from \"https://deno.land/x/s3_lite_client@0.5.0/mod.ts\";\n\nexport async function main(s3: Resource<\"s3\">, object_name: string) {\n  const s3client = new S3Client(s3);\n  return await s3client.getPresignedUrl('GET', object_name)\n}","language":"deno"}},"fieldType":"any","recomputeOnInputChanged":true},"verticalAlignment":"center","horizontalAlignment":"right"}},{"3":{"h":8,"w":2,"x":0,"y":1,"fixed":false},"12":{"h":13,"w":12,"x":0,"y":1,"id":"m","fixed":false},"id":"m","data":{"id":"m","type":"displaycomponent","customCss":{"header":{"class":"hidden","style":""},"container":{"class":"overflow-auto","style":""}},"configuration":{"title":{"type":"static"},"hideDetails":{"type":"static"}},"componentInput":{"type":"runnable","value":{"key":"file.pdf","etag":"9a192d8b1a7dc652a19835f6f08098bd","size":1016315,"type":"Object","lastModified":"2023-04-10T15:09:39.000Z"},"fields":{"s3":{"type":"static","value":"$res:u/adam/my_s3","format":"resource-s3","fieldType":"object"},"object":{"type":"connected","value":null,"fieldType":"object","connection":{"path":"selectedRow","componentId":"a"}}},"runnable":{"name":"Get object preview","type":"runnableByName","inlineScript":{"path":"u/faton/newapp/Get_object_preview","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["s3","object"],"properties":{"s3":{"type":"object","format":"resource-s3","default":null},"object":{"type":"object","default":null,"properties":{"key":{"type":"string"}}}}},"content":"import { Resource } from \"https://deno.land/x/windmill@v1.85.0/mod.ts\";\nimport { S3Client } from \"https://deno.land/x/s3_lite_client@0.5.0/mod.ts\";\nimport { encode, decode } from \"https://deno.land/std@0.181.0/encoding/base64.ts\";\n\nexport async function main(s3: Resource<\"s3\">, object: {key: string}) {\n  if(!(s3 && object)) {\n    return 'Select a file in the table'\n  }\n  const s3client = new S3Client(s3);\n  const res = await s3client.getObject(object.key)\n  const ct = res.headers.get('Content-Type')\n  const type = ct?.slice(ct.indexOf('/') + 1)\n  if(!type) {\n    return object\n  }\n  if(['png', 'jpeg', 'gif', 'svg'].includes(type)) {\n    return {\n      [type]: encode(await res.arrayBuffer())\n    }\n  } else if(ct?.startsWith('text/')) {\n    const textDecoder = new TextDecoder('utf-8')\n    const encodedText = await res.text()\n    const binaryText = decode(encodedText.slice(encodedText.indexOf(',') + 1))\n    const decodedText = textDecoder.decode(binaryText)\n    return type === 'html' ? { html: decodedText } : decodedText\n  } else if(type === 'json') {\n    const textDecoder = new TextDecoder('utf-8')\n    const encodedText = await res.text()\n    const binaryText = decode(encodedText.slice(encodedText.indexOf(',') + 1))\n    const decodedText = textDecoder.decode(binaryText)\n    return JSON.parse(decodedText)\n  }\n  return object\n}","language":"deno"}},"fieldType":"object","connection":{"path":"selectedRow","componentId":"a"},"autoRefresh":true,"recomputeOnInputChanged":true}}}]},"fullscreen":true,"norefreshbar":false,"hiddenInlineScripts":[{"name":"Get objects","type":"runnableByName","fields":{"s3":{"type":"static","value":"$res:u/adam/my_s3","format":"resource-s3","fieldType":"object"},"prefix":{"type":"connected","value":null,"fieldType":"string","connection":{"path":"result","componentId":"c"}},"pageSize":{"type":"static","value":null,"fieldType":"number"},"bucketName":{"type":"static","value":null,"fieldType":"string"},"maxResults":{"type":"static","value":null,"fieldType":"number"}},"autoRefresh":true,"inlineScript":{"path":"u/adam/file-explorer/Get objects","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["s3"],"properties":{"s3":{"type":"object","format":"resource-s3","default":null},"prefix":{"type":"string","default":null},"pageSize":{"type":"number","default":null},"bucketName":{"type":"string","default":null},"maxResults":{"type":"number","default":null}}},"content":"import { Resource } from \"https://deno.land/x/windmill@v1.85.0/mod.ts\";\nimport { removeObjectEmptyFields } from \"https://deno.land/x/windmill_helpers@v1.1.1/mod.ts\";\nimport { S3Client } from \"https://deno.land/x/s3_lite_client@0.5.0/mod.ts\";\n\nexport async function main(\n  s3: Resource<\"s3\">,\n  prefix?: string,\n  bucketName?: string,\n  maxResults?: number,\n  pageSize?: number,\n) {\n  if(!s3) {\n    return []\n  }\n  const s3client = new S3Client(s3);\n  const options = removeObjectEmptyFields({\n    prefix,\n    bucketName,\n    maxResults,\n    pageSize,\n  })\n  const objects = s3client.listObjects(options);\n\n  const result: any[] = []\n  for await (const obj of objects) {\n    result.push(obj)\n  }\n\n  return result\n}","language":"deno"},"noBackendValue":[{"key":"file.pdf","etag":"9a192d8b1a7dc652a19835f6f08098bd","size":1016315,"type":"Object","lastModified":"2023-04-10T15:09:39.000Z"},{"key":"message.txt","etag":"28e3fe7912a0c5cb16c66b4030b8fb76","size":31,"type":"Object","lastModified":"2023-04-10T18:38:41.000Z"},{"key":"nuggies.jpeg","etag":"f7e709f7cced95593c226bbea8e68f59","size":26391,"type":"Object","lastModified":"2023-04-10T19:31:05.000Z"},{"key":"soc.png","etag":"bfd41c220cbc7b1c4df96ce0bce536a7","size":33618,"type":"Object","lastModified":"2023-04-10T19:31:29.000Z"},{"key":"test.html","etag":"dc442c4d05a03f81ce07bf01fc1e2cb9","size":422,"type":"Object","lastModified":"2023-04-10T19:08:06.000Z"},{"key":"tiny.json","etag":"7fab870591a2fefd78f084dda6159d56","size":57,"type":"Object","lastModified":"2023-04-10T19:13:32.000Z"}],"recomputeOnInputChanged":true}],"unusedInlineScripts":[]},"description":"Fetch, preview, upload and delete files from your AWS S3 bucket.","vcreated_at":"2023-11-01T13:40:23.142Z","vcreated_by":"faton ramadani2","comments":[]}}