Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
Prevent creating a project when no system is installed, closes #147 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw authored and elisee committed Aug 11, 2016
1 parent cc42814 commit e6b7821
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
16 changes: 10 additions & 6 deletions client/src/hub/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ function onProjectActivate() {

let autoOpenProject = true;
function onNewProjectClick() {
new CreateOrEditProjectDialog(data.systemsById, { autoOpen: autoOpenProject }, (result) => {
if (result == null) return;
autoOpenProject = result.open;

socket.emit("add:projects", result.project, onProjectAddedAck);
});
if (Object.keys(data.systemsById).length === 0) {
new SupClient.Dialogs.InfoDialog(SupClient.i18n.t("hub:newProject.noSystemError.message"), { header: SupClient.i18n.t("hub:newProject.noSystemError.header") });
} else {
new CreateOrEditProjectDialog(data.systemsById, { autoOpen: autoOpenProject }, (result) => {
if (result == null) return;
autoOpenProject = result.open;

socket.emit("add:projects", result.project, onProjectAddedAck);
});
}
}

function onProjectAddedAck(err: string, id: string) {
Expand Down
6 changes: 5 additions & 1 deletion public/locales/en/hub.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"title": "Hub",
"serverAddress": "${hostname} on port ${port}",
"newProject": {
"noSystemError": {
"header": "Can't create a project",
"message": "This server doesn't have any systems installed yet. Please install one from the Server Settings tab first."
},
"title": "New project",
"prompt": "Enter a name and select a type for the new project.",
"namePlaceholder": "Project name",
Expand All @@ -18,4 +22,4 @@
},
"openProject": "Open project",
"language": "Language"
}
}
4 changes: 4 additions & 0 deletions public/locales/fr/hub.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"serverAddress": "${hostname} sur le port ${port}",
"newProject": {
"noSystemError": {
"header": "Impossible de créer un projet",
"message": "Ce serveur n'a aucun système installé. Veuillez d'abord en installer un depuis l'onglet de paramètrage du serveur."
},
"title": "Nouveau projet",
"prompt": "Entrez le nom et choisissez le type du nouveau projet.",
"namePlaceholder": "Nom du projet",
Expand Down

0 comments on commit e6b7821

Please sign in to comment.