Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • xeruf/dashboard
  • stackspin/dashboard
2 results
Show changes
import { Resources } from './types';
export const transformResources = (response: any): Resources | null => {
if (!response.success) {
return null;
}
return {
cpu: (response.cpu / response.cpu_total) * 100,
memory_used: (response.memory_total - response.memory_available) / 1e9,
memory_total: response.memory_total / 1e9,
disk_used: (response.disk_total - response.disk_free) / 1e9,
disk_total: response.disk_total / 1e9,
};
};
export interface Resources {
cpu: number;
memory_used: number;
memory_total: number;
disk_used: number;
disk_total: number;
}
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
createBatchUsers, createBatchUsers,
fetchRecoveryLink, fetchRecoveryLink,
resetTotpById, resetTotpById,
resetWebAuthnById,
} from '../redux'; } from '../redux';
import { getUserById, getRecoveryLink, getUserModalLoading, getUserslLoading } from '../redux/selectors'; import { getUserById, getRecoveryLink, getUserModalLoading, getUserslLoading } from '../redux/selectors';
...@@ -63,6 +64,7 @@ export function useUsers() { ...@@ -63,6 +64,7 @@ export function useUsers() {
function deleteUserById(id: string) { function deleteUserById(id: string) {
return dispatch(deleteUser(id)); return dispatch(deleteUser(id));
} }
function getRecoveryLinkUserById(id: string) { function getRecoveryLinkUserById(id: string) {
return dispatch(fetchRecoveryLink(id)); return dispatch(fetchRecoveryLink(id));
} }
...@@ -71,6 +73,10 @@ export function useUsers() { ...@@ -71,6 +73,10 @@ export function useUsers() {
return dispatch(resetTotpById(id)); return dispatch(resetTotpById(id));
} }
function resetWebAuthn(id: string) {
return dispatch(resetWebAuthnById(id));
}
return { return {
users, users,
user, user,
...@@ -89,5 +95,6 @@ export function useUsers() { ...@@ -89,5 +95,6 @@ export function useUsers() {
clearSelectedUser, clearSelectedUser,
createUsers, createUsers,
resetTotp, resetTotp,
resetWebAuthn,
}; };
} }
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
transformUpdateMultipleUsers, transformUpdateMultipleUsers,
transformRecoveryLink, transformRecoveryLink,
transformTotp, transformTotp,
transformWebAuthn,
} from '../transformations'; } from '../transformations';
export enum UserActionTypes { export enum UserActionTypes {
...@@ -27,6 +28,7 @@ export enum UserActionTypes { ...@@ -27,6 +28,7 @@ export enum UserActionTypes {
CREATE_BATCH_USERS = 'users/create_batch_users', CREATE_BATCH_USERS = 'users/create_batch_users',
UPDATE_MULTIPLE_USERS = '/users/multi-edit', UPDATE_MULTIPLE_USERS = '/users/multi-edit',
RESET_TOTP = 'users/reset-totp-user', RESET_TOTP = 'users/reset-totp-user',
RESET_WEBAUTHN = 'users/reset-webauthn-user',
} }
export const setUsersLoading = (isLoading: boolean) => (dispatch: Dispatch<any>) => { export const setUsersLoading = (isLoading: boolean) => (dispatch: Dispatch<any>) => {
...@@ -240,7 +242,7 @@ export const fetchRecoveryLink = (id: string) => async (dispatch: Dispatch<any>) ...@@ -240,7 +242,7 @@ export const fetchRecoveryLink = (id: string) => async (dispatch: Dispatch<any>)
export const resetTotpById = (id: string) => async (dispatch: Dispatch<any>) => { export const resetTotpById = (id: string) => async (dispatch: Dispatch<any>) => {
try { try {
const { data } = await performApiCall({ const { data } = await performApiCall({
path: `/users/${id}/reset_2fa`, path: `/users/${id}/reset_totp`,
method: 'POST', method: 'POST',
}); });
...@@ -253,6 +255,22 @@ export const resetTotpById = (id: string) => async (dispatch: Dispatch<any>) => ...@@ -253,6 +255,22 @@ export const resetTotpById = (id: string) => async (dispatch: Dispatch<any>) =>
} }
}; };
export const resetWebAuthnById = (id: string) => async (dispatch: Dispatch<any>) => {
try {
const { data } = await performApiCall({
path: `/users/${id}/reset_webauthn`,
method: 'POST',
});
dispatch({
type: UserActionTypes.RESET_WEBAUTHN,
payload: transformWebAuthn(data),
});
} catch (err) {
console.error(err);
}
};
export const deleteUser = (id: string) => async (dispatch: Dispatch<any>) => { export const deleteUser = (id: string) => async (dispatch: Dispatch<any>) => {
dispatch(setUserModalLoading(true)); dispatch(setUserModalLoading(true));
......
...@@ -52,6 +52,13 @@ export const transformTotp = (data: any) => { ...@@ -52,6 +52,13 @@ export const transformTotp = (data: any) => {
return undefined; return undefined;
}; };
export const transformWebAuthn = (data: any) => {
if (data.credentials !== undefined) {
return data.credentials.webauthn !== undefined;
}
return undefined;
};
export const transformUser = (response: any): User => { export const transformUser = (response: any): User => {
return { return {
id: response.id ?? '', id: response.id ?? '',
...@@ -61,6 +68,10 @@ export const transformUser = (response: any): User => { ...@@ -61,6 +68,10 @@ export const transformUser = (response: any): User => {
preferredUsername: response.preferredUsername ?? '', preferredUsername: response.preferredUsername ?? '',
status: response.state ?? '', status: response.state ?? '',
totp: transformTotp(response), totp: transformTotp(response),
webauthn: transformWebAuthn(response),
tags: response.stackspin_data.tags ?? '',
admin: response.stackspin_data.stackspin_admin ?? '',
meta: response.metadata_admin ?? '',
}; };
}; };
......
...@@ -6,6 +6,10 @@ export interface User { ...@@ -6,6 +6,10 @@ export interface User {
preferredUsername: string; preferredUsername: string;
status: string; status: string;
totp?: boolean; totp?: boolean;
webauthn?: boolean;
tags?: [];
admin?: boolean;
meta?: [];
} }
export interface FormUser extends User { export interface FormUser extends User {
......
module.exports = { module.exports = {
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'], content: [
'./src/**/*.{js,jsx,ts,tsx}',
'./public/index.html',
],
theme: { theme: {
extend: { extend: {
colors: { colors: {
primary: { primary: {
50: '#F2FFFF', 50: 'var(--colour-primary-50)',
100: '#D6FDFF', 100: 'var(--colour-primary-100)',
200: '#B6F7FB', 200: 'var(--colour-primary-200)',
300: '#7AE5EA', 300: 'var(--colour-primary-300)',
400: '#55C6CC', 400: 'var(--colour-primary-400)',
500: '#39A9B1', 500: 'var(--colour-primary-500)',
600: '#24929C', 600: 'var(--colour-primary-600)',
700: '#157983', 700: 'var(--colour-primary-700)',
800: '#135D66', 800: 'var(--colour-primary-800)',
900: '#0F4F57', 900: 'var(--colour-primary-900)',
light: '#54C6CC', 950: 'var(--colour-primary-950)',
DEFAULT: '#54C6CC', light: 'var(--colour-primary-light)',
dark: '#1E8290', DEFAULT: 'var(--colour-primary-default)',
dark: 'var(--colour-primary-dark)',
}, },
}, },
}, },
}, },
variants: {
extend: {
tableLayout: ['hover', 'focus'],
},
},
plugins: [ plugins: [
require('@tailwindcss/forms'), // eslint-disable-line require('@tailwindcss/forms'), // eslint-disable-line
require('@tailwindcss/typography'), // eslint-disable-line require('@tailwindcss/typography'), // eslint-disable-line
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -9,8 +9,13 @@ ...@@ -9,8 +9,13 @@
"packageRules": [ "packageRules": [
{ {
"matchDepNames": ["node"], "matchDepNames": ["node"],
"matchFiles": ["frontend/Dockerfile", ".gitlab-ci.yml"], "matchFileNames": ["frontend/Dockerfile", ".gitlab-ci.yml"],
"allowedVersions": "!/^\d*[13579](-.*)?$/" "allowedVersions": "!/^\\d*[13579](-.*)?$/"
},
{
"matchPackageNames": ["ory-hydra-client"],
"matchFileNames": ["backend/requirements.in"],
"allowedVersions": "<2.0.0"
} }
] ]
} }
#!/usr/bin/env bash
if [ -f "./backend/kubeconfig/kube_config_cluster.yml" ]; then
echo "Local KUBECONFIG configuration file found, applying custom configuration."
export KUBECONFIG=./backend/kubeconfig/kube_config_cluster.yml
else
echo "no Local KUBECONFIG configuration file found, skipping custom configuration."
fi
set -euo pipefail
dockerComposeArgs=$@
export DATABASE_PASSWORD=$(kubectl get secret -n flux-system stackspin-single-sign-on-variables -o jsonpath --template '{.data.dashboard_database_password}' | base64 -d)
export DOMAIN=$(kubectl get secret -n flux-system stackspin-cluster-variables -o jsonpath --template '{.data.domain}' | base64 -d)
export HYDRA_CLIENT_SECRET=$(kubectl get secret -n flux-system stackspin-dashboard-local-oauth-variables -o jsonpath --template '{.data.client_secret}' | base64 -d)
export FLASK_SECRET_KEY=$(kubectl get secret -n flux-system stackspin-dashboard-variables -o jsonpath --template '{.data.backend_secret_key}' | base64 -d)
if [[ -z "$DATABASE_PASSWORD" ]]; then
echo "Could not find database password in stackspin-single-sign-on-variables secret"
exit 1
fi
if [[ -z "$DOMAIN" ]]; then
echo "Could not find domain name in stackspin-cluster-variables secret"
exit 1
fi
if [[ -z "$FLASK_SECRET_KEY" ]]; then
echo "Could not find backend_secret_key in stackspin-dashboard-variables secret"
exit 1
fi
if [[ -z "$HYDRA_CLIENT_SECRET" ]]; then
echo "Could not find client_secret in stackspin-dashboard-local-oauth-variables secret"
echo "make sure you add this secret following instructions in the dashboard-dev-overrides repository"
exit 1
fi
KUBECTL_UID=${UID:-1001} KUBECTL_GID=${GID:-0} docker compose up $dockerComposeArgs