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
5cf89212
Commit
5cf89212
authored
Sep 30, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify remove input field command
parent
55d68f64
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
index.ts
libs/remix-ui/workspace/src/lib/actions/index.ts
+1
-15
payload.ts
libs/remix-ui/workspace/src/lib/actions/payload.ts
+2
-2
workspace.ts
libs/remix-ui/workspace/src/lib/reducers/workspace.ts
+27
-2
No files found.
libs/remix-ui/workspace/src/lib/actions/index.ts
View file @
5cf89212
...
...
@@ -73,21 +73,7 @@ export const fetchDirectory = async (path: string) => {
}
export
const
removeInputField
=
async
(
path
:
string
)
=>
{
const
provider
=
plugin
.
fileManager
.
currentFileProvider
()
const
promise
=
new
Promise
((
resolve
)
=>
{
provider
.
resolveDirectory
(
path
,
(
error
,
fileTree
)
=>
{
if
(
error
)
console
.
error
(
error
)
resolve
(
fileTree
)
})
})
promise
.
then
((
files
)
=>
{
dispatch
(
removeInputFieldSuccess
(
path
,
files
))
}).
catch
((
error
)
=>
{
console
.
error
(
error
)
})
return
promise
dispatch
(
removeInputFieldSuccess
(
path
))
}
export
const
deleteWorkspace
=
async
(
workspaceName
:
string
)
=>
{
...
...
libs/remix-ui/workspace/src/lib/actions/payload.ts
View file @
5cf89212
...
...
@@ -97,10 +97,10 @@ export const addInputFieldSuccess = (path: string, fileTree, type: 'file' | 'fol
}
}
export
const
removeInputFieldSuccess
=
(
path
:
string
,
fileTree
)
=>
{
export
const
removeInputFieldSuccess
=
(
path
:
string
)
=>
{
return
{
type
:
'REMOVE_INPUT_FIELD'
,
payload
:
{
path
,
fileTree
}
payload
:
{
path
}
}
}
...
...
libs/remix-ui/workspace/src/lib/reducers/workspace.ts
View file @
5cf89212
...
...
@@ -357,11 +357,11 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
...
state
,
browser
:
{
...
state
.
browser
,
files
:
state
.
mode
===
'browser'
?
fetchDirectoryContent
(
state
,
payload
,
payload
.
path
+
'/'
+
'blank'
)
:
state
.
browser
.
files
files
:
state
.
mode
===
'browser'
?
removeInputField
(
state
,
payload
.
path
)
:
state
.
browser
.
files
},
localhost
:
{
...
state
.
localhost
,
files
:
state
.
mode
===
'localhost'
?
fetchDirectoryContent
(
state
,
payload
,
payload
.
path
+
'/'
+
'blank'
)
:
state
.
localhost
.
files
files
:
state
.
mode
===
'localhost'
?
removeInputField
(
state
,
payload
.
path
)
:
state
.
localhost
.
files
},
focusEdit
:
null
}
...
...
@@ -597,6 +597,31 @@ const fileRemoved = (state: BrowserState, path: string): { [x: string]: Record<s
return
files
}
const
removeInputField
=
(
state
:
BrowserState
,
path
:
string
):
{
[
x
:
string
]:
Record
<
string
,
FileType
>
}
=>
{
let
files
=
state
.
mode
===
'browser'
?
state
.
browser
.
files
:
state
.
localhost
.
files
const
root
=
state
.
mode
===
'browser'
?
state
.
browser
.
currentWorkspace
:
state
.
mode
if
(
path
===
root
)
{
delete
files
[
root
][
path
+
'/'
+
'blank'
]
return
files
}
const
_path
=
splitPath
(
state
,
path
)
const
prevFiles
=
_
.
get
(
files
,
_path
)
if
(
prevFiles
)
{
prevFiles
.
child
&&
prevFiles
.
child
[
path
+
'/'
+
'blank'
]
&&
delete
prevFiles
.
child
[
path
+
'/'
+
'blank'
]
files
=
_
.
set
(
files
,
_path
,
{
isDirectory
:
true
,
path
,
name
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
extractNameFromKey
(
path
).
split
(
'-'
)[
1
]
:
extractNameFromKey
(
path
),
type
:
extractNameFromKey
(
path
).
indexOf
(
'gist-'
)
===
0
?
'gist'
:
'folder'
,
child
:
prevFiles
?
prevFiles
.
child
:
{}
})
}
return
files
}
// IDEA: Modify function to remove blank input field without fetching content
const
fetchDirectoryContent
=
(
state
:
BrowserState
,
payload
:
{
fileTree
,
path
:
string
,
type
?:
'file'
|
'folder'
},
deletePath
?:
string
):
{
[
x
:
string
]:
Record
<
string
,
FileType
>
}
=>
{
if
(
!
payload
.
fileTree
)
return
state
.
mode
===
'browser'
?
state
.
browser
.
files
:
state
[
state
.
mode
].
files
...
...
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