Skip to content
Snippets Groups Projects
Project_detail.vue 40.5 KiB
Newer Older
Timothee P's avatar
Timothee P committed
      v-if="permissions && permissions.can_view_project && project"
      v-frag
    >
      <div
        id="message"
        class="fullwidth"
      >
        <div
          v-if="tempMessage"
          class="ui positive message"
        >
          <p><i class="check icon" /> {{ tempMessage }}</p>
      <div
        id="message_info"
        class="fullwidth"
      >
        <div
          v-if="infoMessage"
          class="ui info message"
          style="text-align: left"
        >
          <div class="header">
            <i class="info circle icon" /> Informations
leandro's avatar
leandro committed
          </div>
          <ul class="list">
            {{
              infoMessage
            }}
          </ul>
        </div>
leandro's avatar
leandro committed
      </div>

      <div class="row">
        <div class="four wide middle aligned column">
          <img
            class="ui small spaced image"
            :src="
              project.thumbnail.includes('default')
                ? require('@/assets/img/default.png')
                : DJANGO_BASE_URL + project.thumbnail + refreshId()
            "
          >
          <div class="ui hidden divider" />
          <div
            class="ui basic teal label"
            data-tooltip="Membres"
          >
            <i class="user icon" />{{ project.nb_contributors }}
          <div
            class="ui basic teal label"
            data-tooltip="Signalements publiés"
          >
            <i class="map marker icon" />{{ project.nb_published_features }}
          <div
            class="ui basic teal label"
            data-tooltip="Commentaires"
          >
Timothee P's avatar
Timothee P committed
            <i class="comment icon" />{{
              project.nb_published_features_comments
            }}
        <div class="ten wide column important-flex space-between">
          <div>
            <h1 class="ui header">
Timothee P's avatar
Timothee P committed
              {{ project.title }}
Timothee P's avatar
Timothee P committed
            <div class="ui hidden divider" />
            <div class="sub header">
              {{ project.description }}
            </div>
          </div>

          <div class="content flex flex-column-right">
            <div class="flex flex-column-right">
              <div class="ui icon right compact buttons flex-column-right">
                <div>
                  <a
                    v-if="
                      user &&
Timothee P's avatar
Timothee P committed
                        permissions &&
                        permissions.can_view_project &&
                        isOffline() !== true
                    "
                    id="subscribe-button"
                    class="ui button button-hover-green"
                    data-tooltip="S'abonner au projet"
                    data-position="top center"
                    data-variation="mini"
                    @click="modalType = 'subscribe'"
Timothee P's avatar
Timothee P committed
                    <i class="inverted grey envelope icon" />
                  </a>
                  <router-link
                    v-if="
                      permissions &&
Timothee P's avatar
Timothee P committed
                        permissions.can_update_project &&
                        isOffline() !== true
                    :to="{ name: 'project_edit', params: { slug } }"
                    class="ui button button-hover-orange"
                    data-tooltip="Modifier le projet"
                    data-position="top center"
                    data-variation="mini"
                  >
Timothee P's avatar
Timothee P committed
                    <i class="inverted grey pencil alternate icon" />
                    v-if="isProjectAdmin && isOffline() !== true"
                    id="delete-button"
                    class="ui button button-hover-red"
                    data-tooltip="Supprimer le projet"
                    data-position="top center"
                    data-variation="mini"
                    @click="modalType = 'deleteProject'"
                  >
Timothee P's avatar
Timothee P committed
                    <i class="inverted grey trash icon" />
DESPRES Damien's avatar
DESPRES Damien committed
                <button
                  v-if="isProjectAdmin &&
                    !isSharedProject && project.generate_share_link"
                  class="ui teal left labeled icon button"
                  @click="copyLink"
Timothee P's avatar
Timothee P committed
                  <i class="left icon share square" />
                  Copier le lien de partage
DESPRES Damien's avatar
DESPRES Damien committed
              </div>
              <div v-if="confirmMsg">
                <div class="ui positive tiny-margin message">
                  <span>
                    Le lien a été copié dans le presse-papier
                  </span>
                  &nbsp;
Timothee P's avatar
Timothee P committed
                  <i
                    class="close icon"
                    @click="confirmMsg = ''"
                  />
          </div>
        </div>
        <div v-if="arraysOffline.length > 0">
          {{ arraysOffline.length }} modification<span v-if="arraysOffline.length>1">s</span> en attente
          <button
            :disabled="isOffline()"
            class="ui fluid labeled teal icon button"
Timothee P's avatar
Timothee P committed
            @click="sendOfflineFeatures()"
Timothee P's avatar
Timothee P committed
            <i class="upload icon" />
            Envoyer au serveur
          </button>
        </div>
      </div>

      <div class="row">
        <div class="seven wide column">
          <h3 class="ui header">
            Types de signalements
          </h3>
Timothee P's avatar
Timothee P committed
              :class="{ active: projectInfoLoading }"
              class="ui inverted dimmer"
            >
              <div class="ui text loader">
                Récupération des types de signalements en cours...
              </div>
            </div>
            <div
              :class="{ active: featureTypeImporting }"
              class="ui inverted dimmer"
            >
              <div class="ui text loader">
                Traitement du fichier en cours ...
              </div>
            </div>
leandro's avatar
leandro committed
              :key="type.title + '-' + index"
Timothee P's avatar
Timothee P committed
                <router-link
leandro's avatar
leandro committed
                  :to="{
                    name: 'details-type-signalement',
                    params: { feature_type_slug: type.slug },
                  }"
leandro's avatar
leandro committed
                >
                  <img
Timothee P's avatar
Timothee P committed
                    v-if="type.geom_type === 'point'"
leandro's avatar
leandro committed
                    class="list-image-type"
                    src="@/assets/img/marker.png"
leandro's avatar
leandro committed
                  <img
Timothee P's avatar
Timothee P committed
                    v-if="type.geom_type === 'linestring'"
leandro's avatar
leandro committed
                    class="list-image-type"
                    src="@/assets/img/line.png"
leandro's avatar
leandro committed
                  <img
Timothee P's avatar
Timothee P committed
                    v-if="type.geom_type === 'polygon'"
leandro's avatar
leandro committed
                    class="list-image-type"
                    src="@/assets/img/polygon.png"
leandro's avatar
leandro committed
                  {{ type.title }}
                </router-link>
                  <router-link
                    v-if="
                      project && permissions && permissions.can_create_feature
                    "
                    :to="{
                      name: 'ajouter-signalement',
                      params: { slug_type_signal: type.slug },
                    }"
                    class="
                      ui
                      compact
                      small
                      icon
                      right
                      floated
                      button button-hover-green
                    "
                    data-tooltip="Ajouter un signalement"
Timothee P's avatar
Timothee P committed
                    data-position="top right"
                    <i class="ui plus icon" />
                    v-if="
                      project &&
                        permissions &&
                        permissions.can_create_feature_type &&
                        isOffline() !== true
                    "
                    :to="{
                      name: 'dupliquer-type-signalement',
                      params: { slug_type_signal: type.slug },
                    }"
                    class="
                      ui
                      compact
                      small
                      icon
                      right
                      floated
                      button button-hover-green
                    "
                    data-tooltip="Dupliquer un type de signalement"
Timothee P's avatar
Timothee P committed
                    data-position="top right"
                    <i class="inverted grey copy alternate icon" />
                  <div
                    v-if="isImporting(type)"
                    class="import-message"
                  >
                    <i class="info circle icon" />
                    Import en cours
                  </div>
Timothee P's avatar
Timothee P committed
                  <div
                    v-else
                    v-frag
Timothee P's avatar
Timothee P committed
                    <a
                      v-if="isProjectAdmin && isOffline() !== true"
Timothee P's avatar
Timothee P committed
                      class="
                        ui
                        compact
                        small
                        icon
                        right
                        floated
                        button button-hover-red
Timothee P's avatar
Timothee P committed
                      data-tooltip="Supprimer le type de signalement"
                      data-position="top center"
                      data-variation="mini"
Timothee P's avatar
Timothee P committed
                      @click="toggleDeleteFeatureType(type)"
Timothee P's avatar
Timothee P committed
                    >
Timothee P's avatar
Timothee P committed
                      <i class="inverted grey trash alternate icon" />
Timothee P's avatar
Timothee P committed
                    </a>
                    <router-link
Timothee P's avatar
Timothee P committed
                      v-if="
                        project &&
                          permissions &&
                          permissions.can_create_feature_type &&
Timothee P's avatar
Timothee P committed
                          isOffline() !== true
Timothee P's avatar
Timothee P committed
                      "
                      :to="{
                        name: 'editer-symbologie-signalement',
                        params: { slug_type_signal: type.slug },
                      }"
                      class="
Timothee P's avatar
Timothee P committed
                        ui
                        compact
                        small
                        icon
                        right
                        floated
Timothee P's avatar
Timothee P committed
                        button button-hover-orange
Timothee P's avatar
Timothee P committed
                      "
                      data-tooltip="Éditer la symbologie du type de signalement"
Timothee P's avatar
Timothee P committed
                      data-position="top center"
                      data-variation="mini"
                    >
Timothee P's avatar
Timothee P committed
                      <i class="inverted grey paint brush alternate icon" />
                    </router-link>
                    <router-link
Timothee P's avatar
Timothee P committed
                      v-if="
                        project &&
                          type.is_editable &&
                          permissions &&
                          permissions.can_create_feature_type &&
                          isOffline() !== true
                      "
                      :to="{
                        name: 'editer-type-signalement',
                        params: { slug_type_signal: type.slug },
                      }"
                      class="
Timothee P's avatar
Timothee P committed
                        ui
                        compact
                        small
                        icon
                        right
                        floated
Timothee P's avatar
Timothee P committed
                        button button-hover-orange
Timothee P's avatar
Timothee P committed
                      "
                      data-tooltip="Éditer le type de signalement"
Timothee P's avatar
Timothee P committed
                      data-position="top center"
                      data-variation="mini"
                    >
                      <i class="inverted grey pencil alternate icon" />
                    </router-link>
              </div>
            </div>
            <div v-if="feature_types.length === 0">
              <i> Le projet ne contient pas encore de type de signalements. </i>
            </div>
          </div>
Timothee P's avatar
Timothee P committed

          <div id="nouveau-type-signalement">
              v-if="
                permissions &&
                  permissions.can_update_project &&
                  isOffline() !== true
              <i class="ui plus icon" />Créer un nouveau type de signalement
            </router-link>
          </div>
          <div class="nouveau-type-signalement">
              v-if="
                permissions &&
                  permissions.can_update_project &&
                  isOffline() !== true
Timothee P's avatar
Timothee P committed
              class="
                ui
                compact
                basic
                button-align-left
Timothee P's avatar
Timothee P committed
              "
            >
              <i class="ui plus icon" />
              <label
                class="ui"
                for="json_file"
              >
                <span
                  class="label"
                >Créer un nouveau type de signalement à partir d'un
                  GeoJSON</span>
Timothee P's avatar
Timothee P committed
              </label>
              <input
                id="json_file"
Timothee P's avatar
Timothee P committed
                type="file"
                accept="application/json, .json, .geojson"
                style="display: none"
                name="json_file"
                @change="onFileChange"
Timothee P's avatar
Timothee P committed
              >

          <div class="nouveau-type-signalement">
            <router-link
              v-if="
Timothee P's avatar
Timothee P committed
                  permissions &&
                  permissions.can_update_project &&
                  isOffline() !== true
              "
              :to="{
                name: 'catalog-import',
                  feature_type_slug: 'create'
                },
              class="ui compact basic button button-align-left"
Timothee P's avatar
Timothee P committed
              <i class="ui plus icon" />
              Créer un nouveau type de signalement à partir du catalogue {{ CATALOG_NAME|| 'IDGO' }}
            </router-link>
          </div>

Timothee P's avatar
Timothee P committed
          <div
            v-if="fileToImport.size > 0"
            id="button-import"
          >
            <button
              :disabled="fileToImport.size === 0"
              class="ui fluid teal icon button"
Timothee P's avatar
Timothee P committed
              @click="toNewFeatureType"
Timothee P's avatar
Timothee P committed
              <i class="upload icon" /> Lancer l'import avec le fichier
              {{ fileToImport.name }}
            </button>
          </div>
Florent Lavelle's avatar
Florent Lavelle committed
          <div
Timothee P's avatar
Timothee P committed
            :class="{ active: mapLoading }"
Florent Lavelle's avatar
Florent Lavelle committed
            class="ui inverted dimmer"
          >
            <div class="ui text loader">
              Chargement de la carte...
            </div>
          </div>
          <div
            id="map"
            ref="map"
          />
        </div>
      </div>

      <div class="row">
        <div class="fourteen wide column">
          <div class="ui two stackable cards">
            <div class="red card">
              <div class="content">
                <div class="center aligned header">
                  Derniers signalements
                </div>
Florent's avatar
Florent committed
                  <div
                    :class="{ active: featuresLoading }"
                    class="ui inverted dimmer"
                  >
                    <div class="ui text loader">
                      Récupération des signalements en cours...
                    </div>
                  </div>
Florent Lavelle's avatar
Florent Lavelle committed
                      v-for="(item, index) in features.slice(-5)"
                      :key="item.properties.title + index"
                      class="item"
                    >
                      <div class="content">
                        <div>
                          <router-link
                            :to="{
                              name: 'details-signalement',
                              params: {
Timothee P's avatar
Timothee P committed
                                slug_type_signal:
                                  item.properties.feature_type.slug,
                                slug_signal: item.id,
                            {{ item.properties.title || item.id }}
                          </router-link>
                            [{{ item.properties.created_on }}
Timothee P's avatar
Timothee P committed
                            <span v-if="user && item.properties.creator">
                              , par
                              {{
                                item.properties.creator.full_name
                                  ? item.properties.creator.full_name
                                  : item.properties.creator.username
                    <i
                      v-if="features.length === 0"
                    >Aucun signalement pour le moment.</i>
                  </div>
                </div>
              </div>
            </div>
            <div class="orange card">
              <div class="content">
                <div class="center aligned header">
                  Derniers commentaires
                </div>
Timothee P's avatar
Timothee P committed
                  <div
                    :class="{ active: projectInfoLoading }"
                    class="ui inverted dimmer"
                  >
                    <div class="ui text loader">
                      Récupération des commentaires en cours...
Timothee P's avatar
Timothee P committed
                    </div>
                  </div>
                  <div class="ui relaxed list">
                    <div
                      v-for="(item, index) in last_comments"
                      :key="'comment ' + index"
                      class="item"
                    >
                      <div class="content">
                        <div>
                          <router-link
                            :to="getRouteUrl(item.related_feature.feature_url)"
                            "{{ item.comment }}"
                          </router-link>
                          <i>[ {{ item.created_on
                          }}<span
                            v-if="user && item.display_author"
                          >, par {{ item.display_author }}
                          </span>
                            ]</i>
                    <i
                      v-if="!last_comments || last_comments.length === 0"
                    >Aucun commentaire pour le moment.</i>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="row">
        <div class="fourteen wide column">
          <div class="ui grey segment">
            <h3 class="ui header">
              Paramètres du projet
            </h3>
            <div class="ui five stackable cards">
              <div class="card">
                <div class="center aligned content">
                  <h4 class="ui center aligned icon header">
                    <i class="disabled grey archive icon" />
                    <div class="content">
                      Délai avant archivage automatique
                    </div>
                  </h4>
                </div>
                <div class="center aligned extra content">
                  {{ project.archive_feature }} jours
                </div>
              </div>
              <div class="card">
                <div class="content">
                  <h4 class="ui center aligned icon header">
                    <i class="disabled grey trash alternate icon" />
                    <div class="content">
                      Délai avant suppression automatique
                    </div>
                  </h4>
                </div>
                <div class="center aligned extra content">
                  {{ project.delete_feature }} jours
                </div>
              </div>
              <div class="card">
                <div class="content">
                  <h4 class="ui center aligned icon header">
                    <i class="disabled grey eye icon" />
                    <div class="content">
                      Visibilité des signalements publiés
                    </div>
                  </h4>
                </div>
                <div class="center aligned extra content">
                  {{ project.access_level_pub_feature }}
                </div>
              </div>
              <div class="card">
                <div class="content">
                  <h4 class="ui center aligned icon header">
                    <i class="disabled grey eye icon" />
                    <div class="content">
                      Visibilité des signalements archivés
                    </div>
                  </h4>
                </div>
                <div class="center aligned extra content">
                  {{ project.access_level_arch_feature }}
                </div>
              </div>
              <div class="card">
                <div class="content">
                  <h4 class="ui center aligned icon header">
                    <i class="disabled grey cogs icon" />
                    <div class="content">
                      Modération
                    </div>
                  </h4>
                </div>
                <div class="center aligned extra content">
                  {{ project.moderation ? "Oui" : "Non" }}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
Timothee P's avatar
Timothee P committed
    <span v-else>
      <i class="icon exclamation triangle" />
      <span>Vous ne disposez pas des droits nécessaires pour consulter ce
        projet.</span>
      v-if="modalType"
      class="ui dimmer modals page transition visible active"
      style="display: flex !important"
    >
      <div
        :class="[
          'ui mini modal subscription',
          { 'transition visible active': modalType },
Timothee P's avatar
Timothee P committed
        <i
          class="close icon"
          @click="modalType = false"
        />
Timothee P's avatar
Timothee P committed
          <i :class="[modalType === 'subscribe' ? 'envelope' : 'trash', 'icon']" />
          {{
            modalType === 'subscribe' ? 'Notifications' : 'Suppression'
          }} du {{
            modalType === 'deleteFeatureType' ? 'type de signalement ' + featureTypeToDelete.title : 'projet'
          }}
Timothee P's avatar
Timothee P committed
          <div v-if="modalType !== 'subscribe'">
            <p class="centered-text">
              Confirmez vous la suppression du {{
                modalType === 'deleteProject' ?
                  'projet, ainsi que les types de signalements' :
                  'type de signalement'
              }} et tous les signalements associés&nbsp;?
            </p>
            <p class="centered-text alert">
              Attention cette action est irreversible !
            </p>
Timothee P's avatar
Timothee P committed
          </div>
            :class="['ui compact fluid button', modalType === 'subscribe' && !is_suscriber ? 'green' : 'red']"
Timothee P's avatar
Timothee P committed
            @click="handleModalClick"
Timothee P's avatar
Timothee P committed
            <span v-if="modalType === 'subscribe'">
              {{
                is_suscriber
                  ? "Se désabonner de ce projet"
                  : "S'abonner à ce projet"
              }}
            </span>
            <span v-else>
              Supprimer le 
              {{
                modalType === 'deleteProject'
                  ? 'projet'
                  : 'type de signalement'
              }}
            </span>
    <div
      :class="isFileSizeModalOpen ? 'active' : ''"
      class="ui dimmer"
    >
      <div
        :class="isFileSizeModalOpen ? 'active' : ''"
        class="ui modal tiny"
        style="top: 20%"
      >
        <div class="header">
          Fichier trop grand!
        </div>
        <div class="content">
          <p>
Timothee P's avatar
Timothee P committed
            Impossible de créer un type de signalement à partir d'un fichier
            GeoJSON de plus de 10Mo (celui importé fait {{ fileSize }} Mo).
          </p>
        </div>
        <div class="actions">
          <div
            class="ui button teal"
            @click="closeFileSizeModal"
          >
            Fermer
          </div>
        </div>
      </div>
    </div>
Timothee P's avatar
Timothee P committed
import frag from 'vue-frag';
import { mapUtil } from '@/assets/js/map-util.js';
import { mapGetters, mapState, mapActions, mapMutations } from 'vuex';
import projectAPI from '@/services/project-api';
import featureTypeAPI from '@/services/featureType-api';
import featureAPI from '@/services/feature-api';
import axios from '@/axios-client.js';
import { fileConvertSizeToMo } from '@/assets/js/utils';

  name: 'ProjectDetails',
    setDate(value) {
      const date = new Date(value);
      const d = date.toLocaleDateString('fr', {
        year: '2-digit',
        month: 'numeric',
        day: 'numeric',
Timothee P's avatar
Timothee P committed
  props: {
    message: {
      type: String,
      default: ''
    }
  },
      infoMessage: '',
DESPRES Damien's avatar
DESPRES Damien committed
      arraysOffline: [],
DESPRES Damien's avatar
DESPRES Damien committed
      arraysOfflineErrors: [],
      fileToImport: { name: '', size: 0 },
      modalType: false,
Timothee P's avatar
Timothee P committed
      projectInfoLoading: true,
      featureTypeToDelete: null,
      isFileSizeModalOpen: false,
      mapLoading: true,
    ...mapState([
      'configuration',
    ]),
    ...mapState('feature_type', [
      'feature_types',
      'importFeatureTypeData'
    ]),
    ...mapState('feature', [
      'features'
    ]),
    ...mapState([
      'last_comments',
      'user',
      'user_permissions',
      'reloadIntervalId',
    ...mapState('map', [
      'map'
    ]),
    DJANGO_BASE_URL() {
      return this.configuration.VUE_APP_DJANGO_BASE;
Timothee P's avatar
Timothee P committed
    API_BASE_URL() {
      return this.configuration.VUE_APP_DJANGO_API_BASE;
    },
    CATALOG_NAME() {
      return this.configuration.VUE_APP_CATALOG_NAME;
    IDGO() {
      return this.$store.state.configuration.VUE_APP_IDGO;
    },
    fileSize() {
      return fileConvertSizeToMo(this.fileToImport.size);
    },
    isSharedProject() {
      return this.$route.path.includes('projet-partage');
    },
    isProjectAdmin() {
      return this.user_permissions && this.user_permissions[this.slug] &&
        this.user_permissions[this.slug].is_project_administrator;
    },
  watch: {
    feature_types: {
      deep: true,
      handler(newValue, oldValue) {
        if (newValue && newValue !== oldValue) {
          this.GET_IMPORTS({
Timothee P's avatar
Timothee P committed
            project_slug: this.$route.params.slug,
Timothee P's avatar
Timothee P committed
      },
    },

    importFeatureTypeData: {
      deep: true,
      handler(newValue) {
Timothee P's avatar
Timothee P committed
        if (
          newValue &&
          newValue.some((el) => el.status === 'pending') &&
          !this.reloadIntervalId
        ) {
          this.SET_RELOAD_INTERVAL_ID(
            setInterval(() => {
              this.GET_IMPORTS({
                project_slug: this.$route.params.slug,
              });
            }, this.$store.state.configuration.VUE_APP_RELOAD_INTERVAL)
          );
        } else if (
          newValue &&
          !newValue.some((el) => el.status === 'pending') &&
          this.reloadIntervalId
        ) {
          this.GET_PROJECT_FEATURE_TYPES(this.slug);
Timothee P's avatar
Timothee P committed
      },
Florent Lavelle's avatar
Florent Lavelle committed
    },
  created() {
    if (this.user) {
      projectAPI
        .getProjectSubscription({
          baseUrl: this.$store.state.configuration.VUE_APP_DJANGO_API_BASE,
          projectSlug: this.$route.params.slug
        })
Timothee P's avatar
Timothee P committed
        .then((data) => (this.is_suscriber = data.is_suscriber));
    this.$store.commit('feature/SET_FEATURES', []); //* empty features remaining in case they were in geojson format and will be fetch after map initialization anyway
    this.$store.commit('feature_type/SET_FEATURE_TYPES', []); //* empty feature_types remaining from previous project
    this.retrieveProjectInfo();

    if (this.message) {
      this.tempMessage = this.message;
      document
        .getElementById('message')
        .scrollIntoView({ block: 'end', inline: 'nearest' });
      setTimeout(() => (this.tempMessage = null), 5000); //* hide message after 5 seconds
    }
  },

  destroyed() {
    this.CLEAR_RELOAD_INTERVAL_ID();
    ...mapMutations([
      'SET_RELOAD_INTERVAL_ID',
Timothee P's avatar
Timothee P committed
      'CLEAR_RELOAD_INTERVAL_ID',
      'DISPLAY_MESSAGE',
Timothee P's avatar
Timothee P committed
      'GET_PROJECT_INFO',
Florent Lavelle's avatar
Florent Lavelle committed
    ...mapActions('map', [
      'INITIATE_MAP'
    ]),
    ...mapActions('feature_type', [
      'GET_IMPORTS'
    ]),
    ...mapActions('feature', [
      'GET_PROJECT_FEATURES'
    ]),
    ...mapActions('feature_type', [
      'GET_PROJECT_FEATURE_TYPES'
    ]),
      return '?ver=' + Math.random();
    getRouteUrl(url) {
      if (this.isSharedProject) {
Timothee P's avatar
Timothee P committed
        url = url.replace('projet', 'projet-partage');
Timothee P's avatar
Timothee P committed
      return url.replace(this.$store.state.configuration.BASE_URL, ''); //* remove duplicate /geocontrib
DESPRES Damien's avatar
DESPRES Damien committed
    },
      return navigator.onLine === false;
DESPRES Damien's avatar
DESPRES Damien committed
    },
    isImporting(type) {
      if (this.importFeatureTypeData) {
Timothee P's avatar
Timothee P committed
        const singleImportData = this.importFeatureTypeData.find(
          (el) => el.feature_type_title === type.slug
        );
        return singleImportData && singleImportData.status === 'pending';
Timothee P's avatar
Timothee P committed

Timothee P's avatar
Timothee P committed
      const sharedLink = window.location.href.replace('projet', 'projet-partage');
      navigator.clipboard.writeText(sharedLink).then(()=> {
Timothee P's avatar
Timothee P committed
        console.log('success');
        this.confirmMsg = true;
      }, () => {
        console.log('failed');
      }
      );
    retrieveProjectInfo() {
Timothee P's avatar
Timothee P committed
      this.$store.commit('DISPLAY_LOADER', 'Projet en cours de chargement.');
      Promise.all([
        this.GET_PROJECT(this.slug),
        this.GET_PROJECT_INFO(this.slug)
      ])
        .then(() => {
Timothee P's avatar
Timothee P committed
          this.$store.commit('DISCARD_LOADER');
          this.projectInfoLoading = false;
          setTimeout(() => {
            let map = mapUtil.getMap();
            if (map) map.remove();
            this.initMap();
          }, 1000);
        })
        .catch((err) => {
Timothee P's avatar
Timothee P committed
          console.error(err);
Timothee P's avatar
Timothee P committed
          this.$store.commit('DISCARD_LOADER');
          this.projectInfoLoading = false;
        });
    },