Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
73948443
Commit
73948443
authored
Apr 01, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
warn when plugin try using setFile
parent
7bb6393b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
+34
-7
fileManager.js
src/app/files/fileManager.js
+18
-2
tooltip.js
src/app/ui/tooltip.js
+16
-5
No files found.
src/app/files/fileManager.js
View file @
73948443
'use strict'
import
{
ApiFactory
}
from
'remix-plugin'
import
yo
from
'yo-yo'
const
EventEmitter
=
require
(
'events'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
var
CompilerImport
=
require
(
'../compiler/compiler-imports'
)
import
{
ApiFactory
}
from
'remix-plugin'
var
toaster
=
require
(
'../ui/tooltip'
)
/*
attach to files event (removed renamed)
...
...
@@ -129,7 +131,21 @@ class FileManager extends ApiFactory {
})
}
setFile
(
path
,
content
)
{
async
setFile
(
path
,
content
)
{
if
(
this
.
currentRequest
)
{
let
reject
=
false
const
actions
=
yo
`<div class="btn-group">
<button class="btn btn-secondary btn-sm" onclick=
${(
e
)
=>
{
reject
=
true
;
e
.
target
.
innerHTML
=
'Aborted'
}}
>
Abort
<
/button
>
<
/div>
`
await
toaster
(
`
${
this
.
currentRequest
.
from
}
is modyfing to
${
path
}
`
,
actions
,
{
time
:
140000
})
if
(
reject
)
{
throw
new
Error
(
`set file operation on
${
path
}
aborted by user.`
)
}
}
this._setFileInternal(path, content)
}
_setFileInternal (path, content) {
const provider = this.fileProviderOf(path)
if (!provider) throw new Error(`
$
{
path
}
not
availble
`)
// TODO : Add permission
...
...
src/app/ui/tooltip.js
View file @
73948443
...
...
@@ -6,14 +6,25 @@ var css = require('./styles/tooltip-styles')
* @param {string} tooltipText The text shown by the tooltip
* @param {HTMLElement} [action] An HTMLElement to display for action
*/
module
.
exports
=
function
addTooltip
(
tooltipText
,
action
)
{
module
.
exports
=
function
addTooltip
(
tooltipText
,
action
,
opts
)
{
opts
=
defaultOptions
(
opts
)
var
tooltip
=
yo
`
<div class="
${
css
.
tooltip
}
bg-secondary">
<span>
${
tooltipText
}
</span>
${
action
}
</div>`
document
.
body
.
appendChild
(
tooltip
)
setTimeout
(
function
()
{
document
.
body
.
removeChild
(
tooltip
)
},
7000
)
return
new
Promise
((
resolve
,
reject
)
=>
{
document
.
body
.
appendChild
(
tooltip
)
setTimeout
(
function
()
{
document
.
body
.
removeChild
(
tooltip
)
resolve
()
},
opts
.
time
)
})
}
let
defaultOptions
=
(
opts
)
=>
{
opts
=
opts
||
{}
return
{
time
:
opts
.
time
||
70000
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment