Update FileManager

pull/3094/head
Grandschtroumpf 6 years ago
parent 813ed433d1
commit 98be306275
  1. 8
      src/app/files/fileManager.js
  2. 2
      src/app/tabs/testTab/testTab.js
  3. 2
      test-browser/plugin/index.html
  4. 4
      test-browser/plugin/plugin.js

@ -15,12 +15,14 @@ import { FileSystemApi } from 'remix-plugin'
const profile = { const profile = {
displayName: 'file manager', displayName: 'file manager',
name: 'fileManager', name: 'fileManager',
methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'],
events: ['currentFileChanged'],
description: 'service - read/write to any files or folders, require giving permissions', description: 'service - read/write to any files or folders, require giving permissions',
permission: true permission: true
} }
// File System profile
// - events: ['currentFileChanged']
// - methods: ['getFolder', 'getCurrentFile', 'getFile', 'setFile']
class FileManager extends FileSystemApi { class FileManager extends FileSystemApi {
constructor (localRegistry) { constructor (localRegistry) {
super(profile) super(profile)
@ -220,7 +222,7 @@ class FileManager extends FileSystemApi {
} }
} }
getFilesFromPath (path) { getFolder (path) {
// TODO : Change provider with promise // TODO : Change provider with promise
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const provider = this.fileProviderOf(path) const provider = this.fileProviderOf(path)

@ -26,7 +26,7 @@ class TestTabLogic {
var tests = [] var tests = []
let files let files
try { try {
files = await this.fileManager.getFilesFromPath(path) files = await this.fileManager.getFolder(path)
} catch (e) { } catch (e) {
cb(e.message) cb(e.message)
} }

@ -48,7 +48,7 @@
<input type="button" id="getcontentof">get content of</input> <br> <input type="button" id="getcontentof">get content of</input> <br>
<input type="button" id="getcurrent">get current</input> <br> <input type="button" id="getcurrent">get current</input> <br>
<input type="button" id="sethighlight">set highlight</input> <br> <input type="button" id="sethighlight">set highlight</input> <br>
<input type="button" id="getfilesfrompath">get files from path</input> <br> <input type="button" id="getFolder">get files from path</input> <br>
<input type="button" id="addnetwork">add network</input> <br> <input type="button" id="addnetwork">add network</input> <br>
<input type="button" id="removenetwork">remove network</input> <br> <input type="button" id="removenetwork">remove network</input> <br>
<br> <br>

@ -74,8 +74,8 @@ window.onload = function () {
function (error, result) { console.log(error, result) }) function (error, result) { console.log(error, result) })
}) })
document.querySelector('input#getfilesfrompath').addEventListener('click', function () { document.querySelector('input#getFolder').addEventListener('click', function () {
extension.call('editor', 'getFilesFromPath', [document.getElementById('filename').value], extension.call('fileManager', 'getFolder', [document.getElementById('filename').value],
function (error, result) { console.log(error, result) }) function (error, result) { console.log(error, result) })
}) })

Loading…
Cancel
Save