Commit d9e8fd00 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Search functionality

parent b9d62a20
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -19,3 +19,21 @@ To build the image:
To run:
To run:


    docker run --env-file docker-env -d -p 8081:8081 -i -t gms:latest
    docker run --env-file docker-env -d -p 8081:8081 -i -t gms:latest

## Developer notes

Backend and frontend are 2 separate applications:

* the backend is the Maven application in the gms folder, based on Java and Spring Boot;
* the frontend is the npm application is the gms-ui folder, based on Vue.js.

The Maven application automatically packs the Vue.js products inside the final jar, however the frontend application can be tested isolatedly running `npm run serve` in order to take advantage of the npm autoreload functionalities.

By default http calls are mocked inside the Vue.js application.
In order to rely on real server calls edit the .env.development file in this way:

    VUE_APP_API_CLIENT = 'server'
    VUE_APP_API_BASE_URL = 'http://localhost:8081/gms/'

This assumes that your backend runs on 8081 port (with dev profile active, in order to enable the CORS policy) and the frontend runs on 8080 port.
First, do the login using the application running on the 8081 port, then you can access the frontend on the 8080.
+23 −14
Original line number Original line Diff line number Diff line
@@ -2,7 +2,9 @@
<div id="app" v-if="model">
<div id="app" v-if="model">
  <TopMenu v-bind:user="model.user" />
  <TopMenu v-bind:user="model.user" />
  <div class="container">
  <div class="container">
      <Main />
    <Main v-if="page === 'main'" />
    <GenericSearchResults v-if="page === 'search'" />
    <UserSearchResult v-if="page === 'userSearch'" />
  </div>
  </div>
  <div id="loading" v-if="loading">
  <div id="loading" v-if="loading">
    <div id="spinner-wrapper">
    <div id="spinner-wrapper">
@@ -15,19 +17,26 @@
<script>
<script>
import TopMenu from './components/TopMenu.vue';
import TopMenu from './components/TopMenu.vue';
import Main from './components/Main.vue';
import Main from './components/Main.vue';
import { mapState } from 'vuex';
import GenericSearchResults from './components/GenericSearchResults.vue';
import UserSearchResult from './components/UserSearchResult.vue';
import {
  mapState
} from 'vuex';
import client from 'api-client';
import client from 'api-client';


export default {
export default {
  name: 'app',
  name: 'app',
  components: {
  components: {
    TopMenu,
    TopMenu,
    Main
    Main,
    GenericSearchResults,
    UserSearchResult
  },
  },
  computed: mapState({
  computed: mapState({
    model: state => state.model,
    model: state => state.model,
    input: state => state.input,
    input: state => state.input,
    loading: state => state.loading
    loading: state => state.loading,
    page: state => state.page
  }),
  }),
  mounted: function() {
  mounted: function() {
    var self = this;
    var self = this;
+13 −0
Original line number Original line Diff line number Diff line
{
  "groups": [{
    "id": "744e38e8f6d04e4e9418ae5f131c9b6b",
    "name": "LBT",
    "path": "744e38e8f6d04e4e9418ae5f131c9b6b"
  }],
  "permissions": [{
    "userId": "4",
    "groupId": "744e38e8f6d04e4e9418ae5f131c9b6b",
    "permission": "VIEW_MEMBERS",
    "groupPath": "744e38e8f6d04e4e9418ae5f131c9b6b"
  }]
}
+20 −0
Original line number Original line Diff line number Diff line
{
  "items": [{
      "id": "4",
      "type": "USER",
      "label": "Name Surname"
    },
    {
      "id": "group_id",
      "type": "GROUP",
      "label": "Group 1"
    }
  ],
  "currentPage": 1,
  "links": [1],
  "totalItems": 2,
  "pageSize": 20,
  "totalPages": 1,
  "hasPreviousPages": false,
  "hasFollowingPages": false
}
+8 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,8 @@ import membersPanel from './data/membersPanel';
import permissionsPanel from './data/permissionsPanel';
import permissionsPanel from './data/permissionsPanel';
import searchUser from './data/searchUser';
import searchUser from './data/searchUser';
import permission from './data/permission';
import permission from './data/permission';
import search from './data/search';
import openUserSearchResult from './data/openUserSearchResult';


const fetch = (mockData, time = 0) => {
const fetch = (mockData, time = 0) => {
  return new Promise((resolve) => {
  return new Promise((resolve) => {
@@ -56,5 +58,11 @@ export default {
  },
  },
  removeMember() {
  removeMember() {
    return fetch(membersPanel, 500);
    return fetch(membersPanel, 500);
  },
  search() {
    return fetch(search, 500);
  },
  openUserSearchResult() {
    return fetch(openUserSearchResult, 500);
  }
  }
}
}
Loading