fix (build): broken build

This commit is contained in:
Mickael KERJEAN
2019-01-28 01:09:45 +11:00
parent e1b0eab5e1
commit 83de5ad620
18 changed files with 66 additions and 56 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ steps:
CGO_LDFLAGS_ALLOW: '-fopenmp'
commands:
- cd server
- rm -rf plugin
- rm -rf plugin/plg_*
- go get -t ./...
- go build
- go test -v ./...
+38
View File
@@ -14,3 +14,41 @@ export const FormObjToJSON = function(o, fn){
});
return obj
};
export function createFormBackend(backend_available, backend_data){
if(!backend_available) return {};
let template = JSON.parse(JSON.stringify(backend_available[backend_data.type]));
for(let key in backend_data){
if(key in template){
template[key].value = backend_data[key];
template[key].enabled = true;
} else {
// create a form object if data isn't available in the template
let obj = {};
obj[key] = {
label: key,
type: "text",
value: null,
default: backend_data[key]
};
template = Object.assign(obj, template);
}
if(key === "label"){
template[key].placeholder = "Name as shown on the login screen.";
template[key].value = backend_data[key];
template[key].enabled = true;
} else if(key === "type"){
template[key].enabled = true;
} else if(key === "advanced"){
template[key].enabled = true;
}
}
let obj = {};
obj[backend_data.type] = template;
return obj;
}
+1 -1
View File
@@ -14,5 +14,5 @@ export { gid, randomString } from './random';
export { leftPad, copyToClipboard } from './common';
export { getMimeType } from './mimetype';
export { settings_get, settings_put } from './settings';
export { FormObjToJSON } from './form';
export { FormObjToJSON, createFormBackend } from './form';
export { format } from './text';
+1 -1
View File
@@ -52,7 +52,7 @@ class BackendModel {
constructor(){}
all(){
return http_get("/admin/api/backend").then((r) => r.result);
return http_get("/api/backend").then((r) => r.result);
}
}
+1 -38
View File
@@ -1,7 +1,7 @@
import React from 'react';
import { FormBuilder, Icon, Input } from "../../components/";
import { Backend, Config } from "../../model/";
import { FormObjToJSON, notify, format } from "../../helpers/";
import { FormObjToJSON, notify, format, createFormBackend } from "../../helpers/";
import "./dashboard.scss";
@@ -158,40 +158,3 @@ export class DashboardPage extends React.Component {
);
}
}
function createFormBackend(backend_available, backend_data){
let template = JSON.parse(JSON.stringify(backend_available[backend_data.type]));
for(let key in backend_data){
if(key in template){
template[key].value = backend_data[key];
template[key].enabled = true;
} else {
// create a form object if data isn't available in the template
let obj = {};
obj[key] = {
label: key,
type: "text",
value: null,
default: backend_data[key]
};
template = Object.assign(obj, template);
}
if(key === "label"){
template[key].placeholder = "Name as shown on the login screen.";
template[key].value = backend_data[key];
template[key].enabled = true;
} else if(key === "type"){
template[key].enabled = true;
} else if(key === "advanced"){
template[key].enabled = true;
}
}
let obj = {};
obj[backend_data.type] = template;
return obj;
}
+13 -6
View File
@@ -1,7 +1,7 @@
import React from "react";
import { Container, Card, NgIf, Input, Button, Textarea, Loader, Notification, Prompt } from "../../components/";
import { invalidate, encrypt, decrypt, gid, settings_get, settings_put } from "../../helpers/";
import { Session } from "../../model/";
import { Container, Card, NgIf, Input, Button, Textarea, FormBuilder } from "../../components/";
import { gid, settings_get, settings_put, createFormBackend } from "../../helpers/";
import { Session, Backend } from "../../model/";
import "./form.scss";
import img_drive from "../../assets/img/google-drive.png";
import img_dropbox from "../../assets/img/dropbox.png";
@@ -10,19 +10,26 @@ export class Form extends React.Component {
constructor(props){
super(props);
this.state = {
select: CONFIG["connections"].length > 2 ? 2 : 0,
backends: JSON.parse(JSON.stringify(CONFIG["connections"])),
select: window.CONFIG["connections"].length > 2 ? 2 : 0,
backends: JSON.parse(JSON.stringify(window.CONFIG["connections"])).map((backend) => {
return backend;
}),
dummy: null
};
const select = settings_get("login_tab");
if(select !== null && select < CONFIG["connections"].length){ this.state.select = select; }
if(select !== null && select < window.CONFIG["connections"].length){ this.state.select = select; }
this.rerender = this.rerender.bind(this);
}
componentDidMount(){
window.addEventListener("resize", this.rerender);
this.publishState(this.props);
Backend.all().then((b) => {
this.setState({
backend_available: b
});
});
}
componentWillUnmount(){
+6 -3
View File
@@ -7,8 +7,10 @@ ENV CGO_LDFLAGS_ALLOW='-fopenmp'
RUN mkdir -p $GOPATH/src/github.com/mickael-kerjean/ && \
#################
# Dependencies
apk --no-cache --virtual .build-deps add make gcc g++ curl nodejs git go npm && \
apk --no-cache --virtual .build-deps add make gcc g++ curl nodejs git npm && \
apk --no-cache --virtual .go add go --repository http://dl-3.alpinelinux.org/alpine/edge/community && \
mkdir /tmp/deps && \
cd /tmp/deps && \
# libvips #######
cd /tmp/deps && \
curl -L -X GET https://github.com/libvips/libvips/releases/download/v8.7.0/vips-8.7.0.tar.gz > libvips.tar.gz && \
@@ -45,7 +47,7 @@ RUN mkdir -p $GOPATH/src/github.com/mickael-kerjean/ && \
#################
# Compile Plugins
mkdir -p ./dist/data/plugin && \
go build -buildmode=plugin -o ./dist/data/plugin/image.so server/plugin/image_light/index.go && \
go build -buildmode=plugin -o ./dist/data/plugin/image.so server/plugin/plg_image_light/index.go && \
#################
# Finalise the build
cd $GOPATH/src/github.com/mickael-kerjean/nuage/ && \
@@ -54,7 +56,8 @@ RUN mkdir -p $GOPATH/src/github.com/mickael-kerjean/ && \
cd /app && \
rm -rf $GOPATH && \
rm -rf /tmp/* && \
apk del .build-deps
apk del .build-deps && \
apk del .go
EXPOSE 8334
VOLUME ["/app/data/config/"]
+2 -2
View File
@@ -67,14 +67,14 @@ func Init(a *App) {
admin := r.PathPrefix("/admin/api").Subrouter()
admin.HandleFunc("/session", CtxInjector(AdminSessionGet, *a)).Methods("GET")
admin.HandleFunc("/session", CtxInjector(AdminSessionAuthenticate, *a)).Methods("POST")
admin.HandleFunc("/backend", CtxInjector(AdminBackend, *a)).Methods("GET")
admin.HandleFunc("/plugin", CtxInjector(AdminOnly(FetchPluginsHandler), *a)).Methods("GET")
admin.HandleFunc("/log", CtxInjector(AdminOnly(FetchLogHandler), *a)).Methods("GET")
admin.HandleFunc("/config", CtxInjector(AdminOnly(PrivateConfigHandler), *a)).Methods("GET")
admin.HandleFunc("/config", CtxInjector(AdminOnly(PrivateConfigUpdateHandler), *a)).Methods("POST")
// APP
r.HandleFunc("/api/config", CtxInjector(PublicConfigHandler, *a)).Methods("GET")
r.HandleFunc("/api/config", CtxInjector(PublicConfigHandler, *a)).Methods("GET")
r.HandleFunc("/api/backend", CtxInjector(AdminBackend, *a)).Methods("GET")
r.HandleFunc("/favicon.ico", func(res http.ResponseWriter, req *http.Request) {
http.Redirect(res, req, "/assets/logo/favicon.ico", http.StatusPermanentRedirect)
})
-1
View File
@@ -11,7 +11,6 @@ var app *App
func init() {
app = &App{}
app.Config = &Config{}
}
// func TestWebdav(t *testing.T) {
@@ -9,7 +9,7 @@ import (
"net/http"
)
func Init(config *Config) {
func Init(config *Configuration) {
plugin_enable := config.Get("transcoder.image.enable").Default(true).Bool()
plugin_thumbsize := uint(config.Get("transcoder.image.thumbnail_size").Default(300).Int())
@@ -2,7 +2,7 @@ package main
import (
. "github.com/mickael-kerjean/nuage/server/common"
"github.com/mickael-kerjean/nuage/server/plugin/image_light/lib"
"github.com/mickael-kerjean/nuage/server/plugin/plg_image_light/lib"
"io"
"net/http"
"os"
@@ -15,7 +15,7 @@ const (
ImageCachePath = "data/cache/image/"
)
func Init(conf *Config) {
func Init(conf *Configuration) {
plugin_enable := conf.Get("transcoder.image.enable").Default(true).Bool()
cachePath := filepath.Join(GetCurrentDir(), ImageCachePath)