Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
epoc-editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
learninglab
epoc
epoc-editor
Commits
db35e23e
Commit
db35e23e
authored
1 year ago
by
VIAUD Nathan
Browse files
Options
Downloads
Patches
Plain Diff
improvement(dev): normalize import behavior
parent
80621d01
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#963599
passed
1 year ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
electron/components/file.js
+32
-16
32 additions, 16 deletions
electron/components/file.js
src/shared/services/editor.service.ts
+1
-2
1 addition, 2 deletions
src/shared/services/editor.service.ts
src/views/LandingPage.vue
+1
-1
1 addition, 1 deletion
src/views/LandingPage.vue
with
34 additions
and
19 deletions
electron/components/file.js
+
32
−
16
View file @
db35e23e
...
...
@@ -6,9 +6,10 @@ const AdmZip = require('adm-zip');
const
glob
=
require
(
'
glob
'
);
const
{
wait
}
=
require
(
'
./utils
'
);
const
Store
=
require
(
'
electron-store
'
);
const
store
=
new
Store
();
const
electronStore
=
new
Store
();
const
store
=
require
(
'
./store
'
);
const
recentFiles
=
s
tore
.
get
(
'
recentFiles
'
,
[]).
filter
((
r
)
=>
{
const
recentFiles
=
electronS
tore
.
get
(
'
recentFiles
'
,
[]).
filter
((
r
)
=>
{
return
fs
.
existsSync
(
r
.
filepath
);
});
...
...
@@ -131,31 +132,46 @@ const openEpocProject = async function (filepath) {
zip
.
extractAllTo
(
workdir
,
true
,
false
,
null
);
if
(
!
fs
.
existsSync
(
path
.
join
(
workdir
,
'
project.json
'
)))
{
const
project
=
await
importEpoc
(
filepath
,
startTime
,
workdir
);
store
.
updateState
(
'
projects
'
,
{
[
BrowserWindow
.
getFocusedWindow
().
id
]:
project
});
console
.
log
(
'
filepath
'
,
filepath
);
return
{
project
,
imported
:
true
};
}
}
catch
(
err
)
{
console
.
log
(
'
error
'
,
err
);
return
null
;
}
const
project
=
{
name
:
path
.
basename
(
filepath
),
modified
:
fs
.
statSync
(
filepath
).
mtime
,
filepath
,
workdir
,
};
try
{
// if extenions is .epoc rename it to .epocproject
if
(
path
.
extname
(
filepath
)
===
'
.epoc
'
)
{
const
newFilepath
=
filepath
.
replace
(
'
.epoc
'
,
'
.epocproject
'
);
fs
.
renameSync
(
filepath
,
newFilepath
);
updateRecent
(
project
);
filepath
=
newFilepath
;
}
const
ellapsed
=
performance
.
now
()
-
startTime
;
if
(
ellapsed
<
500
)
await
wait
(
500
-
ellapsed
);
const
project
=
{
name
:
path
.
basename
(
filepath
),
modified
:
fs
.
statSync
(
filepath
).
mtime
,
filepath
,
workdir
,
};
return
{
project
,
imported
:
false
,
};
updateRecent
(
project
);
const
ellapsed
=
performance
.
now
()
-
startTime
;
if
(
ellapsed
<
500
)
await
wait
(
500
-
ellapsed
);
return
{
project
,
imported
:
false
,
};
}
catch
(
e
)
{
return
null
;
}
};
/**
...
...
@@ -316,7 +332,7 @@ const updateRecent = function (project) {
}
else
{
recentFiles
.
unshift
(
project
);
}
s
tore
.
set
(
'
recentFiles
'
,
recentFiles
);
electronS
tore
.
set
(
'
recentFiles
'
,
recentFiles
);
};
/**
...
...
This diff is collapsed.
Click to expand it.
src/shared/services/editor.service.ts
+
1
−
2
View file @
db35e23e
...
...
@@ -4,9 +4,8 @@ import { useEditorStore, useGraphStore, useUndoRedoStore } from '@/src/shared/st
import
{
ePocProject
}
from
'
@/src/shared/interfaces
'
;
import
{
createToaster
}
from
'
@meforma/vue-toaster
'
;
import
{
closeFormPanel
,
graphService
}
from
'
.
'
;
import
{
createGraphEpocFromData
,
createGraphFromImport
}
from
'
@/src/shared/services/import.service
'
;
import
{
createGraphFromImport
}
from
'
@/src/shared/services/import.service
'
;
import
{
useVueFlow
}
from
'
@vue-flow/core
'
;
import
{
saveState
}
from
'
@/src/shared/services/undoRedo.service
'
;
import
{
applyBackwardCompatibility
}
from
'
@/src/shared/utils/backwardCompability
'
;
const
{
findNode
}
=
useVueFlow
({
id
:
'
main
'
});
...
...
This diff is collapsed.
Click to expand it.
src/views/LandingPage.vue
+
1
−
1
View file @
db35e23e
...
...
@@ -44,7 +44,7 @@ function importProject() {
@
accept=
"importProject"
@
cancel=
"cancelImport"
>
<h3>
Cet ePoc est une
publication
, vous devez l'importer avant de pouvoir l'éditer ici
</h3>
<h3>
Cet ePoc est une
version publiée
, vous devez l'importer avant de pouvoir l'éditer ici
</h3>
</ChoiceModal>
<div
v-if=
"editorStore.loading"
class=
"loading"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment