Skip to content

Commit

Permalink
Merge pull request #1327 from swisstopo/GSNGM-1208_move_add_view_btn
Browse files Browse the repository at this point in the history
Move add view button
  • Loading branch information
vladyslav-tk authored Aug 15, 2024
2 parents 3bba547 + 4404147 commit 5bbf705
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 399 deletions.
4 changes: 2 additions & 2 deletions api/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ APP_PORT=3000

# Cognito
COGNITO_AWS_REGION=eu-west-1
COGNITO_CLIENT_ID=6brvjsufv7fdubr12r9u0gajnj
COGNITO_POOL_ID=eu-west-1_1NcmOhPt4
COGNITO_CLIENT_ID=10h1tga4i933buv25lelalmtrn
COGNITO_POOL_ID=eu-west-1_dbfEb2FuH

# S3
S3_AWS_REGION=eu-west-1
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ services:
PROJECTS_S3_BUCKET: ngmpub-project-files-local
S3_ENDPOINT: http://minio:9000
# Cognito
COGNITO_CLIENT_ID: 6brvjsufv7fdubr12r9u0gajnj
COGNITO_POOL_ID: eu-west-1_1NcmOhPt4
COGNITO_CLIENT_ID: 10h1tga4i933buv25lelalmtrn
COGNITO_POOL_ID: eu-west-1_dbfEb2FuH
# Postgres
PGUSER: &db_user www-data
PGPASSWORD: &db_pass www-data
Expand Down
17 changes: 1 addition & 16 deletions ui/locales/app.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"cancel": "Abbrechen",
"contact_mailto_text": "Kontakt",
"created_on": "Erstellt am",
"dashboard_add_view": "",
"dashboard_back_to_topics": "Zurück zu den Themen",
"dashboard_by_swisstopo_title": "von swisstopo",
"dashboard_delete_warning_description": "Das Projekt und seine Bestandteile werden dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",
Expand Down Expand Up @@ -90,20 +91,12 @@
"duplicate_to_project": "Zu Projekt duplizieren",
"edit_project": "Projekt bearbeiten",
"header_search_placeholder": "Suche...",
"header_show_minimap": "Übersichtskarte anzeigen",
"lsb_cesium_toolbar_label": "Cesium-Toolbar",
"lsb_close": "Schliessen",
"lsb_dashboard": "Dashboard",
"lsb_data": "Daten",
"lsb_debug_tools": "Debugtools",
"lsb_help": "Hilfe",
"lsb_langs": "Sprache wählen",
"lsb_login": "Login",
"lsb_logout": "Logout",
"lsb_settings": "Einstellungen",
"lsb_share": "Teilen",
"lsb_tools": "Werkzeuge",
"lsb_view_all": "Alle anzeigen",
"lyr_3d_model_berne_label": "3D-Modell Stadt Bern",
"lyr_3d_model_label": "3D-Modelle",
"lyr_background_label": "Hintergrunddaten",
Expand Down Expand Up @@ -180,7 +173,6 @@
"map_elevation_label": "Höhe (m ü. M.)",
"map_position_label": "Position",
"map_terrain_distance_label": "Entfernung zum Terrain",
"minimap_orientation": "Ausrichtung",
"modified_on": "bearbeitet am",
"move_down": "nach oben verschieben",
"move_up": "nach unten verschieben",
Expand Down Expand Up @@ -227,12 +219,7 @@
"project_member_surname": "Nachname",
"project_title": "Projekttitel",
"project_view": "Projektansicht",
"save": "Speichern",
"save_project": "Projekt speichern",
"save_to_project": "Projekt speichern unter ...",
"save_view_in_project": "Ansicht unter Projekt speichern",
"select_project": "Projekt auswählen",
"share_view": "Ansicht teilen",
"shortlink_copied": "Link kopiert",
"shortlink_copy_btn_label": "Link kopieren",
"shortlink_link_label": "Link",
Expand Down Expand Up @@ -308,13 +295,11 @@
"tbx_show_all_btn": "Alle Geometrien der Liste anzeigen",
"tbx_slice_box": "3D-Szene aufschneiden (Box)",
"tbx_slice_draw_hint": "Zum Zeichnen und Aufschneiden auf 3D Viewer klicken.",
"tbx_slice_geom_transform_hint": "Aktuelle Ansicht zu den Geometrien hinzufügen?",
"tbx_slice_inside_label": "Innen",
"tbx_slice_left_label": "Links",
"tbx_slice_line": "3D-Szene aufschneiden (Linie)",
"tbx_slice_outside_label": "Aussen",
"tbx_slice_right_label": "Rechts",
"tbx_slice_transform_btn": "Hinzufügen",
"tbx_slicing": "Aufschneiden",
"tbx_slicing_type": "Schnitttyp",
"tbx_styles_title": "Farbe und Form ändern",
Expand Down
17 changes: 1 addition & 16 deletions ui/locales/app.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"cancel": "Cancel",
"contact_mailto_text": "Contact",
"created_on": "Created on",
"dashboard_add_view": "Add view",
"dashboard_back_to_topics": "Back to overview topics",
"dashboard_by_swisstopo_title": "by swisstopo",
"dashboard_delete_warning_description": "The project and its assests will be permanently deleted. This action cannot be undone.",
Expand Down Expand Up @@ -90,20 +91,12 @@
"duplicate_to_project": "Duplicate to my projects",
"edit_project": "Edit project",
"header_search_placeholder": "Search...",
"header_show_minimap": "Show minimap",
"lsb_cesium_toolbar_label": "Cesium Toolbar",
"lsb_close": "Close",
"lsb_dashboard": "Dashboard",
"lsb_data": "Data",
"lsb_debug_tools": "Debug tools",
"lsb_help": "Help",
"lsb_langs": "Choose language",
"lsb_login": "Login",
"lsb_logout": "Logout",
"lsb_settings": "Settings",
"lsb_share": "Share",
"lsb_tools": "Tools",
"lsb_view_all": "View All",
"lyr_3d_model_berne_label": "City of Bern",
"lyr_3d_model_label": "Local models",
"lyr_background_label": "Background data",
Expand Down Expand Up @@ -180,7 +173,6 @@
"map_elevation_label": "Elevation (m AMSL)",
"map_position_label": "Position",
"map_terrain_distance_label": "Distance to terrain",
"minimap_orientation": "Orientation",
"modified_on": "Modified on",
"move_down": "Move down",
"move_up": "Move up",
Expand Down Expand Up @@ -227,12 +219,7 @@
"project_member_surname": "Surname",
"project_title": "Project title",
"project_view": "Project view",
"save": "Save",
"save_project": "Save project",
"save_to_project": "Save to project",
"save_view_in_project": "Save view in project",
"select_project": "Select project",
"share_view": "Share view",
"shortlink_copied": "Link copied",
"shortlink_copy_btn_label": "Copy the link",
"shortlink_link_label": "Link",
Expand Down Expand Up @@ -308,13 +295,11 @@
"tbx_show_all_btn": "Show all geometries in the list",
"tbx_slice_box": "Slice 3D-scene (Box)",
"tbx_slice_draw_hint": "Click on 3D viewer to draw geometry and slice.",
"tbx_slice_geom_transform_hint": "Add current view to My Geometries?",
"tbx_slice_inside_label": "Inside",
"tbx_slice_left_label": "Left",
"tbx_slice_line": "Slice 3D-scene (Line)",
"tbx_slice_outside_label": "Outside",
"tbx_slice_right_label": "Right",
"tbx_slice_transform_btn": "Add",
"tbx_slicing": "Slice",
"tbx_slicing_type": "Slice type",
"tbx_styles_title": "Adapt the style",
Expand Down
17 changes: 1 addition & 16 deletions ui/locales/app.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"cancel": "Annuler",
"contact_mailto_text": "Contact",
"created_on": "Créé le",
"dashboard_add_view": "",
"dashboard_back_to_topics": "Retour aux thèmes",
"dashboard_by_swisstopo_title": "par swisstopo",
"dashboard_delete_warning_description": "Le projet et ses biens seront définitivement supprimés. Cette action ne peut être annulée.",
Expand Down Expand Up @@ -90,20 +91,12 @@
"duplicate_to_project": "Dupliquer comme projet",
"edit_project": "Editer projet",
"header_search_placeholder": "Recherche...",
"header_show_minimap": "Afficher carte miniature",
"lsb_cesium_toolbar_label": "Cesium Toolbar",
"lsb_close": "Fermer",
"lsb_dashboard": "Tableau de bord",
"lsb_data": "Données",
"lsb_debug_tools": "Debug tools",
"lsb_help": "Aide",
"lsb_langs": "Choisir langues",
"lsb_login": "Connexion",
"lsb_logout": "Déconnexion",
"lsb_settings": "Paramètres",
"lsb_share": "Partager",
"lsb_tools": "Outils",
"lsb_view_all": "Montrer tout",
"lyr_3d_model_berne_label": "Modèle 3D Ville de Berne",
"lyr_3d_model_label": "Modèles 3D",
"lyr_background_label": "Données d'arrière-plan",
Expand Down Expand Up @@ -180,7 +173,6 @@
"map_elevation_label": "Altitude (m AMSL)",
"map_position_label": "Position",
"map_terrain_distance_label": "Distance au terrain",
"minimap_orientation": "Orientation",
"modified_on": "modifié le",
"move_down": "décaler en bas",
"move_up": "décaler en haut",
Expand Down Expand Up @@ -227,12 +219,7 @@
"project_member_surname": "Nom",
"project_title": "Titre du projet",
"project_view": "Vue de projet",
"save": "Enregistrer",
"save_project": "Enregistrer le projet",
"save_to_project": "Enregistrer projet sours...",
"save_view_in_project": "Enregistrer vue sous le projet...",
"select_project": "Selectionner projet",
"share_view": "Partager la vue",
"shortlink_copied": "Lien copié",
"shortlink_copy_btn_label": "Copier le lien",
"shortlink_link_label": "Lien",
Expand Down Expand Up @@ -308,13 +295,11 @@
"tbx_show_all_btn": "Afficher toutes les géométries de la liste",
"tbx_slice_box": "Coupez la scène 3D (box)",
"tbx_slice_draw_hint": "Pour dessiner ou couper, cliquez sur le 3D viewer.",
"tbx_slice_geom_transform_hint": "Ajouter la vue actuelle aux géométries?",
"tbx_slice_inside_label": "Intérieur",
"tbx_slice_left_label": "Gauche",
"tbx_slice_line": "Coupez la scène 3D",
"tbx_slice_outside_label": "Extérieur",
"tbx_slice_right_label": "Droite",
"tbx_slice_transform_btn": "Ajouter",
"tbx_slicing": "Couper",
"tbx_slicing_type": "Type de coupe",
"tbx_styles_title": "Adapter le style",
Expand Down
17 changes: 1 addition & 16 deletions ui/locales/app.it.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"cancel": "Annullare",
"contact_mailto_text": "Contatto",
"created_on": "Creato lo",
"dashboard_add_view": "",
"dashboard_back_to_topics": "Tornare a temi",
"dashboard_by_swisstopo_title": "da swisstopo",
"dashboard_delete_warning_description": "Il progetto e i suoi beni saranno eliminati in modo permanente. Questa azione non può essere annullata.",
Expand Down Expand Up @@ -90,20 +91,12 @@
"duplicate_to_project": "Duplicare nei progetti",
"edit_project": "Editare progetto",
"header_search_placeholder": "Ricercare...",
"header_show_minimap": "Mostrare mappa panoramica",
"lsb_cesium_toolbar_label": "Cesium Toolbar",
"lsb_close": "Chiudere",
"lsb_dashboard": "Dashboard",
"lsb_data": "Dati",
"lsb_debug_tools": "Debug tools",
"lsb_help": "Aiuto",
"lsb_langs": "Selezionare la lingua",
"lsb_login": "Connessione",
"lsb_logout": "Diconnessione",
"lsb_settings": "Impostazioni",
"lsb_share": "Condividere",
"lsb_tools": "Strumenti",
"lsb_view_all": "Mostrare tutto",
"lyr_3d_model_berne_label": "Modello 3D Città di Berna",
"lyr_3d_model_label": "Modelli 3D",
"lyr_background_label": "Dati di sfondo",
Expand Down Expand Up @@ -180,7 +173,6 @@
"map_elevation_label": "Altitudine (m AMSL)",
"map_position_label": "Positione",
"map_terrain_distance_label": "Distanza dal terreno",
"minimap_orientation": "Orientamento",
"modified_on": "Modificare",
"move_down": "Spostare verso l'alto",
"move_up": "Spostare verso il basso",
Expand Down Expand Up @@ -227,12 +219,7 @@
"project_member_surname": "Cognome",
"project_title": "Titolo di progetto",
"project_view": "Vista di progetto",
"save": "Salvare",
"save_project": "Salvare progetto",
"save_to_project": "Salvare nel progetto...",
"save_view_in_project": "Salvare vista sotto progetto",
"select_project": "Selezionare progetto",
"share_view": "Compartire vista",
"shortlink_copied": "Link copiato",
"shortlink_copy_btn_label": "Copiare il link",
"shortlink_link_label": "Link",
Expand Down Expand Up @@ -308,13 +295,11 @@
"tbx_show_all_btn": "Mostrare tutte le geometrie nella lista",
"tbx_slice_box": "Tagliare la scena 3D (box)",
"tbx_slice_draw_hint": "Per disegnare e sezionare, cliccare sul viewer 3D.",
"tbx_slice_geom_transform_hint": "Aggiungere la vista corrente alle geometrie?",
"tbx_slice_inside_label": "Interno",
"tbx_slice_left_label": "Sinistro",
"tbx_slice_line": "Sezionare la scena 3D",
"tbx_slice_outside_label": "Esterno",
"tbx_slice_right_label": "Destro",
"tbx_slice_transform_btn": "Aggiungere",
"tbx_slicing": "Sezionare",
"tbx_slicing_type": "Tipo di sezione",
"tbx_styles_title": "Stylo di titulo",
Expand Down
36 changes: 31 additions & 5 deletions ui/src/elements/dashboard/ngm-project-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import i18next from 'i18next';
import {classMap} from 'lit/directives/class-map.js';
import {styleMap} from 'lit/directives/style-map.js';
import {COLORS_WITH_BLACK_TICK, PROJECT_COLORS} from '../../constants';
import {Asset, CreateProject, Member, Project} from './ngm-dashboard';
import {Asset, CreateProject, Member, Project, type View} from './ngm-dashboard';
import {customElement, property, query} from 'lit/decorators.js';
import $ from '../../jquery';
import '../../toolbox/ngm-geometries-list';
Expand All @@ -18,6 +18,7 @@ import DashboardStore from '../../store/dashboard';
import {CustomDataSource} from 'cesium';
import MainStore from '../../store/main';
import {parseKml} from '../../cesiumutils';
import {getPermalink} from '../../permalink';

@customElement('ngm-project-edit')
export class NgmProjectEdit extends LitElementI18n {
Expand Down Expand Up @@ -99,7 +100,12 @@ export class NgmProjectEdit extends LitElementI18n {
}

updated(changedProperties) {
if (changedProperties.has('saveOrCancelWarning') && this.saveOrCancelWarning === true) this.showSaveOrCancelWarning();
if (changedProperties.has('saveOrCancelWarning') && this.saveOrCancelWarning) {
this.showSaveOrCancelWarning();
}
if (changedProperties.has('project')) {
this.querySelectorAll('.ui.dropdown').forEach(elem => $(elem).dropdown());
}
}

firstUpdated(_changedProperties: PropertyValues) {
Expand Down Expand Up @@ -164,9 +170,17 @@ export class NgmProjectEdit extends LitElementI18n {
</div>
</div>
<div class="ngm-divider"></div>
<div class="ngm-proj-title-icon">
<div class="ngm-screenshot-icon"></div>
<div>${i18next.t('dashboard_views')}</div>
<div class="ngm-proj-views-header">
<div class="ngm-proj-title-icon">
<div class="ngm-screenshot-icon"></div>
<div>${i18next.t('dashboard_views')}</div>
</div>
<button class="ngm-save-view-btn"
.hidden="${!this.userEmail || !project?.owner}"
@click=${() => this.saveViewToProject()}>
<div>${i18next.t('dashboard_add_view')}</div>
<div class="ngm-save-icon icon"></div>
</button>
</div>
<div class="project-edit-fields">
${project.views.map((view, index) => html`
Expand Down Expand Up @@ -244,6 +258,18 @@ export class NgmProjectEdit extends LitElementI18n {
`;
}

async saveViewToProject() {
if (!this.project) return;
const project = {...this.project};
const view: View = {
id: crypto.randomUUID(),
title: `${i18next.t('view')} ${project.views.length + 1}`,
permalink: getPermalink(),
};
project.views.push(view);
this.project = project;
}

createRenderRoot() {
return this;
}
Expand Down
Loading

0 comments on commit 5bbf705

Please sign in to comment.