Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/core/cloud/github/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ export class GithubProvider implements CloudProvider {
if (
file &&
file.filename &&
(checkFilenameExtension(file.filename, "gexf") || checkFilenameExtension(file.filename, "graphml"))
(checkFilenameExtension(file.filename, "gexf") ||
checkFilenameExtension(file.filename, "graphml") ||
checkFilenameExtension(file.filename, "json"))
) {
result = {
filename: file.filename || "Untitled",
Expand Down
3 changes: 3 additions & 0 deletions src/core/graph/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const importFile = asyncAction(async (file: NonNullable<GraphOrigin>) =>
case "graphml":
graph = graphml.parse(Graph, content, { addMissingNodes: true });
break;
case "json":
graph = Graph.from(JSON.parse(content));
break;
default:
graph = null;
break;
Expand Down
6 changes: 3 additions & 3 deletions src/locales/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,19 @@
"title": "Open a graph file",
"local": {
"title": "Open a local file",
"dragndrop_text": "Drag'n'drop a GEXF or GRAPHML file",
"dragndrop_text": "Drag'n'drop a GEXF, GRAPHML or Graphology JSON file",
"success": "File {{filename}} has been successfully loaded",
"error": "An error occurred while opening the file. Please check that the file is a valid."
},
"remote": {
"title": "Open an url",
"url-field": "URL of a GEXF or GRAPHML file",
"url-field": "URL of a GEXF, GRAPHML or Graphology JSON file",
"success": "File {{filename}} has been successfully loaded",
"error": "An error occurred while opening the file. Please check your connectivity and that the file is a valid."
},
"cloud": {
"title": "Open a file from {{provider}}",
"no-data": "You have no GEXF or GRAPHML file saved on {{provider}}",
"no-data": "You have no GEXF, GRAPHML or Graphology JSON file saved on {{provider}}",
"file-open-external": "Open {{filename}} on {{provider}}",
"select-file": "Select a file",
"success": "File {{filename}} has been successfully loaded",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,19 +298,19 @@
"title": "Open a graph file",
"local": {
"title": "Open a local file",
"dragndrop_text": "Drag'n'drop a GEXF or GRAPHML file",
"dragndrop_text": "Drag'n'drop a GEXF, GRAPHML or Graphology JSON file ",
"success": "File {{filename}} has been successfully loaded",
"error": "An error occurred while opening the file. Please check that the file is a valid."
},
"remote": {
"title": "Open an url",
"url-field": "URL of a GEXF or GRAPHML file",
"url-field": "URL of a GEXF, GRAPHML or Graphology JSON file",
"success": "File {{filename}} has been successfully loaded",
"error": "An error occurred while opening the file. Please check your connectivity and that the file is a valid."
},
"cloud": {
"title": "Open a file from {{provider}}",
"no-data": "You have no GEXF or GRAPHML file saved on {{provider}}",
"no-data": "You have no GEXF, GRAPHML or Graphology JSON file saved on {{provider}}",
"file-open-external": "Open {{filename}} on {{provider}}",
"select-file": "Select a file",
"success": "File {{filename}} has been successfully loaded",
Expand Down
6 changes: 3 additions & 3 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,19 @@
"title": "Ouvrir un fichier de graphe",
"local": {
"title": "Ouvrir un fichier local",
"dragndrop_text": "Faites glisser-déposer un fichier GEXF ou GRAPHML",
"dragndrop_text": "Faites glisser-déposer un fichier GEXF, GRAPHML ou JSON au format Graphology",
"success": "Le fichier {{filename}} a bien été ouvert",
"error": "Une erreur s'est produite lors de l'ouverture du fichier. Veuillez vérifier que le fichier est valide."
},
"remote": {
"title": "Ouvrir une URL",
"url-field": "URL d'un fichier GEXF ou GRAPHML",
"url-field": "URL d'un fichier GEXF, GRAPHML ou JSON au format Graphology",
"success": "Le fichier {{filename}} a bien été ouvert",
"error": "Une erreur s'est produite lors de l'ouverture du fichier. Veuillez vérifier votre connexion et vous assurer que le fichier est valide."
},
"cloud": {
"title": "Ouvrir un fichier depuis {{provider}}",
"no-data": "Vous n'avez aucun fichier GEXF ou GRAPHML d'enregistré sur {{provider}}",
"no-data": "Vous n'avez aucun fichier GEXF, GRAPHML ou JSON au format Graphology d'enregistré sur {{provider}}",
"file-open-external": "Ouvrir {{filename}} sur {{provider}}",
"select-file": "Sélectionner un fichier",
"success": "Le fichier {{filename}} a bien été ouvert",
Expand Down
2 changes: 1 addition & 1 deletion src/views/graphPage/modals/open/LocalFileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const LocalFileModal: FC<ModalProps<unknown>> = ({ cancel }) => {
value={file}
onChange={(file) => setFile(file)}
helpText={t("graph.open.local.dragndrop_text").toString()}
accept={{ "application/graph": [".gexf", ".graphml"] }}
accept={{ "application/graph": [".gexf", ".graphml"], "application/json": [".json"] }}
/>
{importStateType === "loading" && <Loader />}
</>
Expand Down
Loading