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
f177d81e
Commit
f177d81e
authored
Jul 22, 2019
by
Rob Stupay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix file-explorer for Gist rename deletes
parent
737402e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
33 deletions
+21
-33
file-explorer.js
src/app/files/file-explorer.js
+20
-32
gist-handler.js
src/lib/gist-handler.js
+1
-1
No files found.
src/app/files/file-explorer.js
View file @
f177d81e
...
@@ -411,14 +411,32 @@ fileExplorer.prototype.toGist = function (id) {
...
@@ -411,14 +411,32 @@ fileExplorer.prototype.toGist = function (id) {
token
:
tokenAccess
token
:
tokenAccess
})
})
if
(
id
)
{
if
(
id
)
{
const
fileList
=
Object
.
keys
(
this
.
files
.
origGistFiles
)
const
updatedFileList
=
Object
.
keys
(
packaged
)
// Telling the GIST API to remove files
const
allItems
=
fileList
.
filter
(
fileName
=>
updatedFileList
.
indexOf
(
fileName
)
===
-
1
)
.
reduce
((
acc
,
deleteFileName
)
=>
({
...
acc
,
[
deleteFileName
]:
null
}),
this
.
files
.
origGistFiles
)
// adding new files
updatedFileList
.
forEach
(
file
=>
allItems
[
file
]
=
packaged
[
file
])
tooltip
(
'Saving gist ('
+
id
+
') ...'
)
tooltip
(
'Saving gist ('
+
id
+
') ...'
)
gists
.
edit
({
gists
.
edit
({
description
:
description
,
description
:
description
,
public
:
true
,
public
:
true
,
files
:
packaged
,
files
:
allItems
,
id
:
id
id
:
id
},
(
error
,
result
)
=>
{
},
(
error
,
result
)
=>
{
proccedResult
(
error
,
result
)
proccedResult
(
error
,
result
)
if
(
!
error
)
{
for
(
const
key
in
allItems
)
{
if
(
allItems
[
key
]
===
null
)
delete
allItems
[
key
]
}
this
.
files
.
origGistFiles
=
allItems
}
})
})
}
else
{
}
else
{
tooltip
(
'Creating a new gist ...'
)
tooltip
(
'Creating a new gist ...'
)
...
@@ -491,40 +509,10 @@ fileExplorer.prototype.copyFiles = function () {
...
@@ -491,40 +509,10 @@ fileExplorer.prototype.copyFiles = function () {
// ------------------ gist publish --------------
// ------------------ gist publish --------------
fileExplorer
.
prototype
.
updateGist
=
function
()
{
fileExplorer
.
prototype
.
updateGist
=
function
()
{
let
self
=
this
const
gistId
=
this
.
files
.
id
var
gistId
=
this
.
files
.
id
var
fileList
=
Object
.
keys
(
this
.
files
.
files
)
// fileList is an array of files in the github gist - not the updated one
var
updatedFileList
// loop through fileList and check if each element is in updatedFileList
// if one is not there in updated file list add it and make its content null
self
.
packageFiles
(
self
.
files
,
(
error
,
packaged
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
updatedFileList
=
Object
.
keys
(
packaged
)
}
})
if
(
!
gistId
)
{
if
(
!
gistId
)
{
tooltip
(
'no gist content is currently loaded.'
)
tooltip
(
'no gist content is currently loaded.'
)
}
else
{
}
else
{
// check that the file list is still the same
// console.log('RS ' , this.files)
// make an array with just the names of the files
// self.packageFiles(self.files, (error, packaged) => {
// if (error) {
// console.log(error)
// } else {
// console.log('file list is: ', packaged)
// }
// })
this
.
toGist
(
gistId
)
this
.
toGist
(
gistId
)
}
}
}
}
...
...
src/lib/gist-handler.js
View file @
f177d81e
...
@@ -56,7 +56,7 @@ function GistHandler (_window) {
...
@@ -56,7 +56,7 @@ function GistHandler (_window) {
fileManager
.
setBatchFiles
(
data
.
files
,
'gist'
,
(
errorLoadingFile
)
=>
{
fileManager
.
setBatchFiles
(
data
.
files
,
'gist'
,
(
errorLoadingFile
)
=>
{
if
(
!
errorLoadingFile
)
{
if
(
!
errorLoadingFile
)
{
gistProvider
.
id
=
gistId
gistProvider
.
id
=
gistId
gistProvider
.
f
iles
=
data
.
files
gistProvider
.
origGistF
iles
=
data
.
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