diff --git a/react-app/css/style.css b/react-app/css/style.css index d678c8d0d2..211fcb8c95 100644 --- a/react-app/css/style.css +++ b/react-app/css/style.css @@ -41,4 +41,41 @@ float: right; } +#login { + width: 400px; + height: 340px; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + background: white; + padding: 10px; + border: 1px gray; + box-shadow: 0px 12px 12px -10px rgba(0, 0, 0, 0.3); +} +#login .logo { + background: url('../img/logo_dark.svg') no-repeat; + width: 196px; + height: 45px; + margin: 20px auto; +} + +#login form > div { + margin: 10px 0; +} + +#login label { + margin-top: 5px; + display: block; +} + +#login input { + width: 100%; +} + +#login .error { + color: red; +} \ No newline at end of file diff --git a/react-app/img/logo_dark.svg b/react-app/img/logo_dark.svg new file mode 100644 index 0000000000..55e67e5a12 --- /dev/null +++ b/react-app/img/logo_dark.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/react-app/index.html b/react-app/index.html index a56e0a9317..a9c2fef4b0 100644 --- a/react-app/index.html +++ b/react-app/index.html @@ -52,6 +52,9 @@ Share Settings Help + + Logout + diff --git a/react-app/login.html b/react-app/login.html new file mode 100644 index 0000000000..e63f7436b3 --- /dev/null +++ b/react-app/login.html @@ -0,0 +1,152 @@ + + + + + SFS - React + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+ + +
+ + + + + \ No newline at end of file diff --git a/react-app/src/auth.js b/react-app/src/auth.js new file mode 100644 index 0000000000..3e9f68c150 --- /dev/null +++ b/react-app/src/auth.js @@ -0,0 +1,57 @@ +var alfUrl = 'http://192.168.99.100:8080/alfresco', loginUrl = '/service/api/login', + logoutUrl = '/service/api/login/ticket'; + +function sendXhr(options) { + if (!options.url) { + throw 'URL must be specified'; + } + return new Promise(function(resolve, reject) { + var xhr = new XMLHttpRequest(), url = alfUrl + options.url, ticket = getTicket(), defaultMethod, requestBody = null; + if (ticket && url != loginUrl) { + console.log('Adding ticket ' + ticket); + url += (url.indexOf('?') == -1 ? '?' : '&') + 'alf_ticket=' + ticket; + } + if (options.data) { + requestBody = options.data; + } else if (options.jsonData) { + requestBody = JSON.stringify(options.jsonData); + } + defaultMethod = requestBody === null ? 'GET' : 'POST'; + xhr.addEventListener('load', function reqListener () { + var status = this.status, + json = this.responseText !== null && this.responseText.indexOf('{') == 0 ? + JSON.parse(this.responseText) : null; + this.json = json; + if (status >= 200 && status < 300) { + resolve(this); + } else { + reject(this); + } + }); + xhr.addEventListener('error', function reqListener () { + reject(this); + }); + xhr.open(options.method || defaultMethod, url); + if (options.acceptType) { + xhr.setRequestHeader('Accept', options.acceptType); + } + if (requestBody) { + xhr.setRequestHeader('Content-Type', options.contentType || 'application/json'); + xhr.send(requestBody); + } else { + xhr.send(); + } + }); +} + +function getTicket() { + return sessionStorage.getItem('loginTicket'); +} + +function setTicket(ticket) { + sessionStorage.setItem('loginTicket', ticket); +} + +function deleteTicket() { + sessionStorage.removeItem('loginTicket'); +} \ No newline at end of file diff --git a/react-app/webcomponents/alfresco-file-list/index.html b/react-app/webcomponents/alfresco-file-list/index.html index 0df04e8322..fb6115b38f 100644 --- a/react-app/webcomponents/alfresco-file-list/index.html +++ b/react-app/webcomponents/alfresco-file-list/index.html @@ -6,6 +6,7 @@ + diff --git a/react-app/webcomponents/alfresco-file-list/src/alfresco-file-list.html b/react-app/webcomponents/alfresco-file-list/src/alfresco-file-list.html index a29ba75423..af7a7826f7 100644 --- a/react-app/webcomponents/alfresco-file-list/src/alfresco-file-list.html +++ b/react-app/webcomponents/alfresco-file-list/src/alfresco-file-list.html @@ -135,6 +135,15 @@ }; } + .paper-toolbar-0 { + color: black; + } + + paper-item a { + color: black; + text-decoration: none; + } + @@ -198,6 +207,65 @@