Compare commits
28 Commits
develop
...
pkg/dev/ub
Author | SHA1 | Date | |
---|---|---|---|
eefaa6e6b9 | |||
655b4a6e11 | |||
286603e9aa | |||
d177e2dc3f | |||
c1d7e0daab | |||
42f7ba3473 | |||
0db3539627 | |||
057a5c1fd0 | |||
e32dd866a5 | |||
3a102bde60 | |||
1a0456ee84 | |||
b6b5512471 | |||
d02ae87a55 | |||
aed0048d95 | |||
98334bafa0 | |||
8681776283 | |||
c026b33954 | |||
ac7fec9e01 | |||
bbc8f65a47 | |||
9749ede28a | |||
bd133fa9d9 | |||
ab90365c9c | |||
ec6de8a217 | |||
17cd58d68f | |||
99fb4ac6d9 | |||
2ceba1f219 | |||
7122677351 | |||
1d526a37d0 |
@ -2,8 +2,6 @@ import React, { FunctionComponent } from "react";
|
||||
|
||||
export const AppLoader:FunctionComponent = () => {
|
||||
return (
|
||||
<div className="app-loader">
|
||||
<i className="fas fa-spinner fa-spin fa-5x"></i>
|
||||
</div>
|
||||
<div className="loader"></div>
|
||||
)
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import React, { FunctionComponent, useState, useEffect } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { WithLoader } from "./WithLoader";
|
||||
|
||||
export interface Item {
|
||||
id: string
|
||||
|
@ -2,16 +2,19 @@ import React from 'react';
|
||||
import { Page } from '../Page';
|
||||
import { UserForm } from '../UserForm';
|
||||
import { User } from '../../types/user';
|
||||
import { useUserProfile } from '../../gql/queries/profile';
|
||||
import { useUserProfileQuery } from '../../gql/queries/profile';
|
||||
import { useUpdateUserProfileMutation } from '../../gql/mutations/profile';
|
||||
import { WithLoader } from '../WithLoader';
|
||||
|
||||
export function ProfilePage() {
|
||||
const { user, loading } = useUserProfile();
|
||||
const userProfileQuery = useUserProfileQuery();
|
||||
const [ updateProfile, updateUserProfileMutation ] = useUpdateUserProfileMutation();
|
||||
const isLoading = updateUserProfileMutation.loading || loading;
|
||||
const isLoading = updateUserProfileMutation.loading || userProfileQuery.loading;
|
||||
|
||||
const { userProfile } = (userProfileQuery.data || {});
|
||||
|
||||
const onUserChange = (user: User) => {
|
||||
if (user.name !== user.name) {
|
||||
if (userProfile.name !== user.name) {
|
||||
updateProfile({ variables: {changes: { name: user.name }}});
|
||||
}
|
||||
};
|
||||
@ -24,7 +27,11 @@ export function ProfilePage() {
|
||||
<div className="column is-6 is-offset-3">
|
||||
<div className="box">
|
||||
<h2 className="is-size-2 subtitle">Mon profil</h2>
|
||||
{ !isLoading ? <UserForm onChange={onUserChange} user={user} /> : null }
|
||||
<WithLoader loading={isLoading || !userProfile}>
|
||||
{
|
||||
<UserForm onChange={onUserChange} user={userProfile} />
|
||||
}
|
||||
</WithLoader>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
18
client/src/components/WithLoader.tsx
Normal file
18
client/src/components/WithLoader.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import React, { Fragment, PropsWithChildren, FunctionComponent } from 'react';
|
||||
|
||||
export interface WithLoaderProps {
|
||||
loading?: boolean|boolean[]
|
||||
}
|
||||
|
||||
export const WithLoader: FunctionComponent<WithLoaderProps> = ({ loading, children }) => {
|
||||
const isLoading = Array.isArray(loading) ? loading.some(l => l) : loading;
|
||||
return (
|
||||
<Fragment>
|
||||
{
|
||||
isLoading ?
|
||||
<div>Chargement</div> :
|
||||
children
|
||||
}
|
||||
</Fragment>
|
||||
)
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
import React, { FunctionComponent } from 'react';
|
||||
import { User } from '../../types/user';
|
||||
import { Workgroup } from '../../types/workgroup';
|
||||
import { InfoForm } from './InfoForm';
|
||||
import { WithLoader } from '../WithLoader';
|
||||
import { useUpdateWorkgroupMutation, useCreateWorkgroupMutation } from '../../gql/mutations/workgroups';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
@ -41,7 +43,9 @@ export const InfoPanel: FunctionComponent<InfoPanelProps> = ({ workgroup }) => {
|
||||
Informations
|
||||
</p>
|
||||
<div className="panel-block">
|
||||
{ !isLoading ? <InfoForm workgroup={workgroup} onChange={onWorkgroupChange} /> : null }
|
||||
<WithLoader loading={isLoading}>
|
||||
<InfoForm workgroup={workgroup} onChange={onWorkgroupChange} />
|
||||
</WithLoader>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
|
@ -1,16 +1,44 @@
|
||||
.app-loader {
|
||||
@extend body;
|
||||
.loader-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
position: absolute;
|
||||
z-index: 10000;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.lds-ripple {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
transform: scale(2);
|
||||
}
|
||||
|
||||
.lds-ripple div {
|
||||
position: absolute;
|
||||
border: 4px solid $grey;
|
||||
opacity: 1;
|
||||
border-radius: 50%;
|
||||
animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
|
||||
}
|
||||
|
||||
.lds-ripple div:nth-child(2) {
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
|
||||
@keyframes lds-ripple {
|
||||
0% {
|
||||
top: 36px;
|
||||
left: 36px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
@ -79,9 +79,8 @@ func getServiceContainer(ctx context.Context, conf *config.Config) (*service.Con
|
||||
// Define default cookie options
|
||||
sessionStore.SessionOpts.Path = "/"
|
||||
sessionStore.SessionOpts.HttpOnly = true
|
||||
sessionStore.SessionOpts.Secure = conf.HTTP.CookieSecure
|
||||
sessionStore.SessionOpts.MaxAge = conf.HTTP.CookieMaxAge
|
||||
sessionStore.SessionOpts.SameSite = http.SameSiteLaxMode
|
||||
sessionStore.SessionOpts.SameSite = http.SameSiteStrictMode
|
||||
|
||||
ctn.Provide(
|
||||
session.ServiceName,
|
||||
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
9
|
14
debian/control
vendored
Normal file
14
debian/control
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
Source: daddy
|
||||
Section: unknown
|
||||
Priority: optional
|
||||
Maintainer: Cadoles <contact@cadoles.com>
|
||||
Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar
|
||||
Standards-Version: 3.9.4
|
||||
Homepage: http://forge.cadoles.com/Cadoles/daddy
|
||||
Vcs-Git: http://forge.cadoles.com/Cadoles/daddy.git
|
||||
Vcs-Browser: http://forge.cadoles.com/Cadoles/daddy
|
||||
|
||||
Package: daddy
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Daddy app
|
1
debian/daddy.links
vendored
Normal file
1
debian/daddy.links
vendored
Normal file
@ -0,0 +1 @@
|
||||
/etc/daddy/client-config.js /usr/share/daddy/public/config.js
|
11
debian/daddy.service
vendored
Normal file
11
debian/daddy.service
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Daddy app
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/daddy -workdir /usr/share/daddy -config /etc/daddy/config.yml
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
56
debian/rules
vendored
Normal file
56
debian/rules
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
export DH_VERBOSE=1
|
||||
|
||||
GO_VERSION := 1.13.5
|
||||
OS := linux
|
||||
ARCH := amd64
|
||||
GOPATH=$(HOME)/go
|
||||
|
||||
ifeq (, $(shell which go 2>/dev/null))
|
||||
override_dh_auto_build: install-go
|
||||
|
||||
override_dh_auto_clean: install-go
|
||||
endif
|
||||
|
||||
ifeq (, $(shell which node 2>/dev/null))
|
||||
override_dh_auto_build: install-nodejs
|
||||
endif
|
||||
|
||||
%:
|
||||
dh $@ --with systemd
|
||||
|
||||
override_dh_auto_build: $(GOPATH)
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" make deps
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) make release
|
||||
|
||||
$(GOPATH):
|
||||
mkdir -p $(GOPATH)
|
||||
|
||||
install-go:
|
||||
wget -nc https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
||||
tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
||||
|
||||
install-nodejs:
|
||||
wget -O- https://deb.nodesource.com/setup_12.x | bash -
|
||||
apt-get install -y nodejs
|
||||
|
||||
override_dh_auto_install:
|
||||
|
||||
mkdir -p debian/daddy/usr/share/daddy
|
||||
mkdir -p debian/daddy/etc/daddy
|
||||
mkdir -p debian/daddy/usr/bin
|
||||
|
||||
cp -r release/server-$(OS)-$(ARCH)/* debian/daddy/usr/share/daddy/
|
||||
|
||||
mv debian/daddy/usr/share/daddy/bin/server debian/daddy/usr/bin/daddy
|
||||
mv debian/daddy/usr/share/daddy/server.conf debian/daddy/etc/daddy/config.yml
|
||||
mv debian/daddy/usr/share/daddy/public/config.js debian/daddy/etc/daddy/client-config.js
|
||||
|
||||
install -d debian/daddy
|
||||
|
||||
override_dh_strip:
|
||||
|
||||
override_dh_auto_test:
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (native)
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module forge.cadoles.com/Cadoles/daddy
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013125038-8d8d1519a52d
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013085949-5d5592098f13
|
||||
forge.cadoles.com/wpetit/hydra-passwordless v0.0.0-20200908094025-38ac4422dddc // indirect
|
||||
github.com/99designs/gqlgen v0.11.3
|
||||
github.com/alecthomas/chroma v0.8.1 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -39,10 +39,6 @@ forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20200619080035-4bbf7b016032 h1:qTYaLP
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20200619080035-4bbf7b016032/go.mod h1:gkfqGyk7fCj2Z0ngEOCJ3K0FVmqft/8dFV/OnYT1vec=
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013085949-5d5592098f13 h1:gZCo9pX3I3A0xVvXkbhdTDBbW44CypCxjiP5LtNV5bo=
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013085949-5d5592098f13/go.mod h1:phGAWHUGKNZj044478BvRg0jk049uK1IiX2Amh8krAk=
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013111944-d43b43b636ed h1:7dTCXOGxvAulu9vnOjpt2cTgsuxMHX4FH795/JJgo08=
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013111944-d43b43b636ed/go.mod h1:phGAWHUGKNZj044478BvRg0jk049uK1IiX2Amh8krAk=
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013125038-8d8d1519a52d h1:o+Ppy/MyT5UgbtUYI2J1YqS3iuThxOuNFenYoPgKZKk=
|
||||
forge.cadoles.com/wpetit/goweb-oidc v0.0.0-20201013125038-8d8d1519a52d/go.mod h1:phGAWHUGKNZj044478BvRg0jk049uK1IiX2Amh8krAk=
|
||||
forge.cadoles.com/wpetit/hydra-passwordless v0.0.0-20200908094025-38ac4422dddc h1:9gc/1qizPtK6/iMVlizknWUFii75ntl2xSUV/FSC92Y=
|
||||
forge.cadoles.com/wpetit/hydra-passwordless v0.0.0-20200908094025-38ac4422dddc/go.mod h1:nANHORi270d5jDXjeJ7B3pMgK9R4J0/17p1IIc+rhOk=
|
||||
github.com/99designs/gqlgen v0.11.3 h1:oFSxl1DFS9X///uHV3y6CEfpcXWrDUxVblR4Xib2bs4=
|
||||
|
@ -47,7 +47,6 @@ type HTTPConfig struct {
|
||||
CookieAuthenticationKey string `yaml:"cookieAuthenticationKey" env:"HTTP_COOKIE_AUTHENTICATION_KEY"`
|
||||
CookieEncryptionKey string `yaml:"cookieEncryptionKey" env:"HTTP_COOKIE_ENCRYPTION_KEY"`
|
||||
CookieMaxAge int `yaml:"cookieMaxAge" env:"HTTP_COOKIE_MAX_AGE"`
|
||||
CookieSecure bool `yaml:"cookieSecure" env:"HTTP_COOKIE_SECURE"`
|
||||
TemplateDir string `yaml:"templateDir" env:"HTTP_TEMPLATE_DIR"`
|
||||
PublicDir string `yaml:"publicDir" env:"HTTP_PUBLIC_DIR"`
|
||||
FrontendURL string `yaml:"frontendURL" env:"HTTP_FRONTEND_URL"`
|
||||
|
15
misc/debian/nginx/daddy.conf
Normal file
15
misc/debian/nginx/daddy.conf
Normal file
@ -0,0 +1,15 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name daddy.local;
|
||||
|
||||
root /usr/share/daddy/client/public;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html =404;
|
||||
}
|
||||
|
||||
location /api/v1/graphql {
|
||||
proxy_pass http://127.0.0.1:8080/api/v1/graphql;
|
||||
}
|
||||
}
|
1
misc/debian/systemd/daddy.env
Normal file
1
misc/debian/systemd/daddy.env
Normal file
@ -0,0 +1 @@
|
||||
GO_ENV=prod
|
Reference in New Issue
Block a user