-
+
-
-
-
+
+
+
+
+
+

+
+
-
-

+
+
+
+
-
-
-
-
+
+
+
+
1
+
ORGANIZATIONS
+
MEMBERS
+
TOTAL
+
-
-
-
diff --git a/api-sandbox/components/Utils.js b/api-sandbox/components/Utils.js
index fb40a9c..1a0280d 100644
--- a/api-sandbox/components/Utils.js
+++ b/api-sandbox/components/Utils.js
@@ -32,4 +32,4 @@ function getJSON(url, callback) {
}
};
xhr.send();
-};
\ No newline at end of file
+};
diff --git a/api-sandbox/components/account/account.css b/api-sandbox/components/account/account.css
new file mode 100644
index 0000000..74f7b8d
--- /dev/null
+++ b/api-sandbox/components/account/account.css
@@ -0,0 +1,61 @@
+
+.mini-photo-wrapper {
+ display: block;
+}
+
+.mini-photo {
+ border-radius: 50%;
+}
+.account-user-menu-wrap {
+ position: relative;
+ overflow: visible;
+ background: #2C2C2C;
+}
+
+.account-menu-container {
+ opacity: 0;
+ position: fixed; /* Stay in place */
+ z-index: 1; /* Sit on top */
+ background-color: #2C2C2C;
+}
+.account-menu-container.active {
+ overflow: visible;
+ visibility: visible;
+ opacity: 1;
+ transition: all 0.3s ease-in-out;
+}
+
+.account-user-menu {
+ position: absolute;
+ right: -22px;
+ color: #fff;
+ background-color: #2C2C2C;
+ width: 240px;
+ border-radius: 4px;
+ border: 1px solid rgba(0, 0, 0, 0.15);
+ padding-top: 5px;
+ padding-bottom: 5px;
+ margin-top: 10px;
+}
+.account-user-menu .account-user-menu-link {
+ display: block;
+ text-decoration: none;
+ background-color: #2C2C2C;
+ color: #fff;
+ font-size: 14px;
+ padding: 5px 10px;
+}
+.account-user-menu .account-user-menu-link:hover {
+ background-color: #4183c4;
+ color: #fff;
+}
+
+.account-user-menu:after {
+ position: absolute;
+ top: -22px;
+ right: -3px;
+ display: inline-block;
+ content: "";
+ border: 14px solid transparent;
+ border-bottom-color: #2C2C2C;
+}
diff --git a/api-sandbox/components/account/account.html b/api-sandbox/components/account/account.html
new file mode 100644
index 0000000..4e8e59c
--- /dev/null
+++ b/api-sandbox/components/account/account.html
@@ -0,0 +1,31 @@
+
+
+
+
+
Title
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/api-sandbox/components/account/account.js b/api-sandbox/components/account/account.js
new file mode 100644
index 0000000..98d38ec
--- /dev/null
+++ b/api-sandbox/components/account/account.js
@@ -0,0 +1,44 @@
+
+var account;
+function accountEventPublish(id){
+ account.callbacks.forEach((call) => call(id));
+}
+
+class Account {
+
+ constructor(containerId, profile, logout) {
+ this.profile = profile;
+ this.callbacks = new Array();
+ appendHtmlElement(containerId, this.view(profile.picture, profile.name));
+
+ document.querySelector('.mini-photo-wrapper').addEventListener('click', function() {
+ document.querySelector('.account-menu-container').classList.toggle('active');
+ });
+
+ this.logoutBtn = document.getElementById('qsLogoutBtn');
+ this.logoutBtn.addEventListener('click', logout);
+
+ account = this;
+
+ }
+
+ listen(callback) {
+ this.callbacks.push(callback);
+ }
+
+
+ view(img , name) {
+ return ""
+ }
+}
\ No newline at end of file
diff --git a/api-sandbox/components/auth/assets/loading.svg b/api-sandbox/components/auth/assets/loading.svg
new file mode 100644
index 0000000..74311d8
--- /dev/null
+++ b/api-sandbox/components/auth/assets/loading.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/api-sandbox/components/auth/auth0-variables.js b/api-sandbox/components/auth/auth0-variables.js
new file mode 100644
index 0000000..d130b71
--- /dev/null
+++ b/api-sandbox/components/auth/auth0-variables.js
@@ -0,0 +1,4 @@
+var AUTH0_CLIENT_ID='BkdC1Jkv8gTX_iJL9CCvtpshOXeDpFPG';
+var AUTH0_DOMAIN='scalecube-admin.eu.auth0.com';
+var AUTH0_CALLBACK_URL=location.href;
+
diff --git a/api-sandbox/components/auth/login.css b/api-sandbox/components/auth/login.css
new file mode 100644
index 0000000..6d33d73
--- /dev/null
+++ b/api-sandbox/components/auth/login.css
@@ -0,0 +1,61 @@
+.myButton {
+ -moz-box-shadow: 0px 1px 0px 0px #f0f7fa;
+ -webkit-box-shadow: 0px 1px 0px 0px #f0f7fa;
+ box-shadow: 0px 1px 0px 0px #f0f7fa;
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #33bdef), color-stop(1, #019ad2));
+ background:-moz-linear-gradient(top, #33bdef 5%, #019ad2 100%);
+ background:-webkit-linear-gradient(top, #33bdef 5%, #019ad2 100%);
+ background:-o-linear-gradient(top, #33bdef 5%, #019ad2 100%);
+ background:-ms-linear-gradient(top, #33bdef 5%, #019ad2 100%);
+ background:linear-gradient(to bottom, #33bdef 5%, #019ad2 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#33bdef', endColorstr='#019ad2',GradientType=0);
+ background-color:#33bdef;
+ -moz-border-radius:6px;
+ -webkit-border-radius:6px;
+ border-radius:6px;
+ border:1px solid #057fd0;
+ display:inline-block;
+ cursor:pointer;
+ color:#ffffff;
+ font-family:Arial;
+ font-size:13px;
+ font-weight:bold;
+ padding:6px 24px;
+ text-decoration:none;
+ text-shadow:0px -1px 0px #5b6178;
+}
+.myButton:hover {
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #019ad2), color-stop(1, #33bdef));
+ background:-moz-linear-gradient(top, #019ad2 5%, #33bdef 100%);
+ background:-webkit-linear-gradient(top, #019ad2 5%, #33bdef 100%);
+ background:-o-linear-gradient(top, #019ad2 5%, #33bdef 100%);
+ background:-ms-linear-gradient(top, #019ad2 5%, #33bdef 100%);
+ background:linear-gradient(to bottom, #019ad2 5%, #33bdef 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#019ad2', endColorstr='#33bdef',GradientType=0);
+ background-color:#019ad2;
+}
+.myButton:active {
+ position:relative;
+ top:1px;
+}
+
+.btn-margin {
+ margin-top: 7px
+}
+
+#login-view {
+ display: none;
+}
+
+#loading {
+ position: absolute;
+ display: flex;
+ justify-content: center;
+ height: 100vh;
+ width: 100vw;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background-color: #fff;
+}
\ No newline at end of file
diff --git a/api-sandbox/components/auth/login.html b/api-sandbox/components/auth/login.html
new file mode 100644
index 0000000..3cc2dae
--- /dev/null
+++ b/api-sandbox/components/auth/login.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
hello
+

+
+
+
+
+
+
+
diff --git a/api-sandbox/components/auth/login.js b/api-sandbox/components/auth/login.js
new file mode 100644
index 0000000..68f5861
--- /dev/null
+++ b/api-sandbox/components/auth/login.js
@@ -0,0 +1,157 @@
+function displayButtons() {
+ let loginBtn = document.getElementById('qsLoginBtn');
+ let logoutBtn = document.getElementById('qsLogoutBtn');
+
+ if (isAuthenticated()) {
+ loginBtn.style.display = 'none';
+ if(logoutBtn) {
+ logoutBtn.style.display = 'inline-block';
+ }
+ } else {
+ loginBtn.style.display = 'inline-block';
+ if(logoutBtn) {
+ logoutBtn.style.display = 'none';
+ }
+ }
+}
+
+function isAuthenticated() {
+ // Check whether the current time is past the
+ // access token's expiry time
+ let expiresAt = localStorage.getItem('expiresAt');
+ return localStorage.getItem('isLoggedIn') === 'true' && new Date().getTime() < ( parseInt(expiresAt) || 0 );
+}
+function token() {
+ return localStorage.getItem('idToken');
+}
+function accessToken() {
+ return localStorage.getItem('accessToken');
+}
+
+class Login {
+
+ constructor(elementId) {
+ this.listeners = new Array();
+ let html = "
"
+ + ""
+ + "
"
+
+ appendHtmlElement(elementId, html);
+ this.entries = document.getElementById(this.id);
+
+ this.idToken;
+ this.accessToken;
+
+ window.webAuth = new auth0.WebAuth({
+ domain: AUTH0_DOMAIN,
+ clientID: AUTH0_CLIENT_ID,
+ redirectUri: AUTH0_CALLBACK_URL,
+ responseType: 'token id_token',
+ scope: 'openid profile',
+ leeway: 60
+ });
+
+ // buttons and event listeners
+ this.loginBtn = document.getElementById('qsLoginBtn');
+ this.logoutBtn = document.getElementById('qsLogoutBtn');
+
+ this.loginBtn.addEventListener('click', function(e) {
+ e.preventDefault();
+ window.webAuth.authorize();
+ });
+
+ if (localStorage.getItem('isLoggedIn') === 'true') {
+ this.renewTokens();
+ } else {
+ this.handleAuthentication();
+ }
+ }
+ getProfile() {
+ return new Promise((resolve ,reject) => {
+ window.webAuth.client.userInfo(accessToken(), (err, profile) => {
+ if (err) {
+ reject(err);
+ return;
+ } else {
+ resolve(profile);
+ }
+ });
+ });
+ }
+ localLogin(authResult) {
+ // Set isLoggedIn flag in localStorage
+ localStorage.setItem('isLoggedIn', 'true');
+ // Set the time that the access token will expire at
+ let expiresAt = JSON.stringify(
+ authResult.expiresIn * 1000 + new Date().getTime()
+ );
+
+ this.accessToken = authResult.accessToken;
+ this.idToken = authResult.idToken;
+
+ localStorage.setItem('expiresAt',expiresAt);
+ localStorage.setItem('idToken', authResult.idToken);
+ localStorage.setItem('accessToken', authResult.accessToken);
+ this._notify(this.idToken);
+ displayButtons();
+ }
+ _notify(token) {
+ this.listeners.forEach(callback=>{
+ callback(token);
+ });
+ }
+ renewTokens() {
+ const self = this;
+ window.webAuth.checkSession({}, (err, authResult) => {
+ if (authResult && authResult.accessToken && authResult.idToken) {
+ self.localLogin(authResult);
+ } else if (err) {
+ alert(
+ 'Could not get a new token ' + err.error + ':' + err.error_description + '.'
+ );
+ self.logout();
+ }
+ displayButtons();
+ });
+ }
+
+ logout() {
+ const self = this;
+ // Remove isLoggedIn flag from localStorage
+ localStorage.removeItem('isLoggedIn');
+ // Remove tokens and expiry time
+ self.accessToken = '';
+ self.idToken = '';
+
+ localStorage.setItem('expiresAt',0);
+ window.webAuth.logout({
+ return_to: window.location.origin
+ });
+
+ displayButtons();
+ }
+
+
+
+ handleAuthentication() {
+ const self = this;
+ window.webAuth.parseHash(function(err, authResult) {
+ if (authResult && authResult.accessToken && authResult.idToken) {
+ window.location.hash = '';
+ self.localLogin(authResult);
+ self.loginBtn.style.display = 'none';
+ } else if (err) {
+ console.log(err);
+ alert(
+ 'Error: ' + err.error + '. Check the console for further details.'
+ );
+ }
+ displayButtons();
+ });
+ }
+
+
+ onAuthenticated(callback) {
+ this.listeners.push(callback);
+ }
+}
\ No newline at end of file
diff --git a/api-sandbox/components/console/console.css b/api-sandbox/components/console/console.css
index 53e3761..ebafcd1 100644
--- a/api-sandbox/components/console/console.css
+++ b/api-sandbox/components/console/console.css
@@ -42,9 +42,9 @@
svg.icon {
padding-top: 0px;
- padding-right: 4px;
+ padding-right: 0px;
stroke: #9d9d9d;
- height: 18px;
+ height: 11px;
vertical-align: middle;
}
@@ -75,15 +75,26 @@ svg.icon {
color: #bfbfb5;
}
-.log-line:hover {
- background-color: #323232;
+.log-line-copy {
+ width: 14px;
+ height: 14px;
+ position:relative; /*or absolute*/
+ left: -14px;
+ top: 14px;
+ display: none;
}
-a::before {
- content: counter(line-numbering);
- counter-increment: line-numbering;
- padding-right: 1em;
- color: white;
+.log-line:hover .log-line-copy {
+ background-color: rgba(99, 99, 99, 0.81);
+ display: block;
+}
+
+.btn {
+ position: relative;
+ size: inherit;
+ border: none; /* Remove borders */
+ color: white; /* White text */
+ cursor: pointer; /* Mouse pointer on hover */
}
body {
diff --git a/api-sandbox/components/console/console.html b/api-sandbox/components/console/console.html
index 4f98fe2..118ea76 100644
--- a/api-sandbox/components/console/console.html
+++ b/api-sandbox/components/console/console.html
@@ -7,6 +7,7 @@
+
diff --git a/api-sandbox/components/console/console.js b/api-sandbox/components/console/console.js
index 5f6feff..91daf10 100644
--- a/api-sandbox/components/console/console.js
+++ b/api-sandbox/components/console/console.js
@@ -1,8 +1,14 @@
+var _consoles = new Map();
+
+function copyOnClick(msg, id) {
+ _consoles.get(id).callbacks.forEach(callback=>callback(msg));
+}
class Console {
constructor(elementId) {
this.id = "log-entries" + window.performance.now();
+ _consoles.set(this.id, this);
let html = "
"
+ "