Merge branch 'develop' into dist/ubuntu/bionic/develop

This commit is contained in:
wpetit 2020-10-05 16:04:30 +02:00
commit 1a0456ee84
9 changed files with 109 additions and 18 deletions

View File

@ -18,18 +18,31 @@ export function Dashboard() {
return ( return (
<div className="columns"> <div className="columns">
<div className="column is-5">
<div className="box">
<h3 className="is-size-3 mb-3">Ces 7 derniers jours</h3>
<Timeline events={events} />
</div>
</div>
<div className="column is-4"> <div className="column is-4">
<DecisionSupportFilePanel /> <DecisionSupportFilePanel />
</div> </div>
<div className="column is-3"> <div className="column is-4">
<WorkgroupsPanel /> <WorkgroupsPanel />
</div> </div>
<div className="column is-4">
<div className="panel is-info">
<p className="level panel-heading mb-0">
<div className="level-left">
<div className="level-item">
Ces 7 derniers jours
</div>
</div>
<div className="level-right">
<button disabled={true} className="button level-item is-outlined is-info is-inverted">
<i className="icon fa fa-sliders-h"></i>
</button>
</div>
</p>
<div className="panel-block">
<Timeline events={events} />
</div>
</div>
</div>
</div> </div>
); );
} }

View File

@ -88,7 +88,7 @@ export const ItemPanel: FunctionComponent<ItemPanelProps> = (props) => {
</div> </div>
<div className="panel-block"> <div className="panel-block">
<p className="control has-icons-left"> <p className="control has-icons-left">
<input className="input" type="text" placeholder="Filtrer..." /> <input disabled={true} className="input" type="text" placeholder="Filtrer..." />
<span className="icon is-left"> <span className="icon is-left">
<i className="fas fa-search" aria-hidden="true"></i> <i className="fas fa-search" aria-hidden="true"></i>
</span> </span>

View File

@ -9,6 +9,7 @@ import { useDecisionSupportFiles } from '../../gql/queries/dsf';
import { useCreateDecisionSupportFileMutation, useUpdateDecisionSupportFileMutation } from '../../gql/mutations/dsf'; import { useCreateDecisionSupportFileMutation, useUpdateDecisionSupportFileMutation } from '../../gql/mutations/dsf';
import { OptionsSection } from './OptionsSection'; import { OptionsSection } from './OptionsSection';
import { useIsAuthorized } from '../../gql/queries/authorization'; import { useIsAuthorized } from '../../gql/queries/authorization';
import { TimelinePanel } from './TimelinePanel';
export interface DecisionSupportFilePageProps { export interface DecisionSupportFilePageProps {
@ -127,7 +128,7 @@ export const DecisionSupportFilePage: FunctionComponent<DecisionSupportFilePageP
</div> </div>
</section> </section>
<div className="columns mt-3"> <div className="columns mt-3">
<div className="column is-9"> <div className="column is-8">
<div className="tabs is-medium is-toggle"> <div className="tabs is-medium is-toggle">
<ul> <ul>
<li className={`has-background-white ${state.selectedTabIndex === 0 ? 'is-active': ''}`} <li className={`has-background-white ${state.selectedTabIndex === 0 ? 'is-active': ''}`}
@ -164,9 +165,10 @@ export const DecisionSupportFilePage: FunctionComponent<DecisionSupportFilePageP
null null
} }
</div> </div>
<div className="column is-3"> <div className="column is-4">
<MetadataPanel readOnly={!isAuthorized} dsf={state.dsf} updateDSF={updateDSF} /> <MetadataPanel readOnly={!isAuthorized} dsf={state.dsf} updateDSF={updateDSF} />
<AppendixPanel dsf={state.dsf} /> <AppendixPanel dsf={state.dsf} />
<TimelinePanel dsf={state.dsf} />
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,36 @@
import React, { FunctionComponent, useState } from 'react';
import { DecisionSupportFile } from '../../types/decision';
import { Timeline } from '../Timeline';
import { useEvents } from '../../gql/queries/event';
export interface TimelinePanelProps {
dsf: DecisionSupportFile,
};
export const TimelinePanel: FunctionComponent<TimelinePanelProps> = ({ dsf }) => {
const { events } = useEvents({
variables: {
filter: {
objectType: 'dsf',
objectId: dsf.id
}
}
});
return (
<div className="panel">
<p className="level panel-heading mb-0">
<div className="level-left">
<div className="level-item">
Suivi des opérations
</div>
</div>
<div className="level-right">
</div>
</p>
<div className="panel-block">
<Timeline events={events} />
</div>
</div>
);
};

View File

@ -13,7 +13,7 @@ export const Timeline: FunctionComponent<TimelineProps> = ({ events }) => {
events = debounceEvents(events) || []; events = debounceEvents(events) || [];
return ( return (
<React.Fragment> <React.Fragment>
<div className="timeline"> <div className="timeline" style={{width: '100%'}}>
{ {
events.map(evt => { events.map(evt => {
return ( return (
@ -29,7 +29,7 @@ export const Timeline: FunctionComponent<TimelineProps> = ({ events }) => {
} }
{ {
events.length === 0 ? events.length === 0 ?
<p className="has-text-centered is-italic">Aucun évènement.</p> : <p className="has-text-centered is-italic mb-1 mt-1">Aucun évènement.</p> :
null null
} }
</div> </div>

View File

@ -0,0 +1,37 @@
import React, { FunctionComponent, useState } from 'react';
import { DecisionSupportFile } from '../../types/decision';
import { Timeline } from '../Timeline';
import { useEvents } from '../../gql/queries/event';
import { Workgroup } from '../../types/workgroup';
export interface TimelinePanelProps {
workgroup: Workgroup,
};
export const TimelinePanel: FunctionComponent<TimelinePanelProps> = ({ workgroup }) => {
const { events } = useEvents({
variables: {
filter: {
objectType: 'workgroup',
objectId: workgroup.id
}
}
});
return (
<div className="panel">
<p className="level panel-heading mb-0">
<div className="level-left">
<div className="level-item">
Suivi des opérations
</div>
</div>
<div className="level-right">
</div>
</p>
<div className="panel-block">
<Timeline events={events} />
</div>
</div>
);
};

View File

@ -9,6 +9,7 @@ import { User } from '../../types/user';
import { InfoPanel } from './InfoPanel'; import { InfoPanel } from './InfoPanel';
import { Workgroup } from '../../types/workgroup'; import { Workgroup } from '../../types/workgroup';
import { useJoinWorkgroupMutation, useLeaveWorkgroupMutation, useCloseWorkgroupMutation } from '../../gql/mutations/workgroups'; import { useJoinWorkgroupMutation, useLeaveWorkgroupMutation, useCloseWorkgroupMutation } from '../../gql/mutations/workgroups';
import { TimelinePanel } from './TimelinePanel';
export function WorkgroupPage() { export function WorkgroupPage() {
const { id } = useParams(); const { id } = useParams();
@ -134,12 +135,15 @@ export function WorkgroupPage() {
</div> </div>
</div> </div>
<div className="columns"> <div className="columns">
<div className="column"> <div className="column is-4">
<InfoPanel workgroup={state.workgroup as Workgroup} /> <InfoPanel workgroup={state.workgroup as Workgroup} />
</div> </div>
<div className="column"> <div className="column is-4">
<MembersPanel users={state.workgroup.members as User[]} /> <MembersPanel users={state.workgroup.members as User[]} />
</div> </div>
<div className="column is-4">
<TimelinePanel workgroup={state.workgroup} />
</div>
</div> </div>
</section> </section>
</div> </div>

View File

@ -9,13 +9,12 @@ export const useLoggedIn = () => {
}; };
export function saveLoggedIn(loggedIn: boolean) { export function saveLoggedIn(loggedIn: boolean) {
console.log("saveLoggedIn", JSON.stringify(loggedIn)) window.localStorage.setItem(LOGGED_IN_KEY, JSON.stringify(loggedIn));
window.sessionStorage.setItem(LOGGED_IN_KEY, JSON.stringify(loggedIn));
} }
export function getSavedLoggedIn(): boolean { export function getSavedLoggedIn(): boolean {
try { try {
const loggedIn = JSON.parse(window.sessionStorage.getItem(LOGGED_IN_KEY)); const loggedIn = JSON.parse(window.localStorage.getItem(LOGGED_IN_KEY));
return !!loggedIn; return !!loggedIn;
} catch(err) { } catch(err) {
return false; return false;

View File

@ -154,7 +154,7 @@ func NewDefault() *Config {
BaseURL: "http://localhost:8080", BaseURL: "http://localhost:8080",
ContentTemplate: dedent.Dedent(` ContentTemplate: dedent.Dedent(`
{{- $root := . -}} {{- $root := . -}}
Bonjour {{ .User.Name }}, Bonjour{{if .User.Name}} {{ .User.Name }}{{end}},
{{ if not .HasEvents -}} {{ if not .HasEvents -}}
Aucun évènement notoire ces derniers jours. Aucun évènement notoire ces derniers jours.