Skip to content
Snippets Groups Projects
Commit be8c4b6b authored by Alexey Lunin's avatar Alexey Lunin Committed by Zdravko Iliev
Browse files

feat: dashboard ui

parent 5f43dac0
No related branches found
No related tags found
1 merge request!47feat: dashboard ui
Pipeline #68932 waiting for manual action
Showing
with 614 additions and 17 deletions
......@@ -2,5 +2,6 @@ node_modules
tmp
tools
compose
.*
.env
.env.example
dist
......@@ -4,22 +4,7 @@
"plugins": ["@nrwl/nx", "@typescript-eslint/eslint-plugin"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"]
},
{
"files": ["*.ts", "*.tsx"],
......
......@@ -19,6 +19,10 @@ lint-agent:
extends: .lint-agent
stage: lint
# lint-dashboard:
# extends: .lint-dashboard
# stage: lint
# lint-attestation-manager:
# extends: .lint-attestation-manager
# stage: lint
......@@ -41,6 +45,10 @@ test-agent:
extends: .test-agent
stage: test
# test-dashboard:
# extends: .test-dashboard
# stage: test
# test-attestation-manager:
# extends: .test-attestation-manager
# stage: test
......@@ -63,6 +71,10 @@ build-agent:
extends: .build-agent
stage: build
build-dashboard:
extends: .build-dashboard
stage: build
# build-attestation-manager:
# extends: .build-attestation-manager
# stage: build
......@@ -85,6 +97,10 @@ docker-agent:
extends: .docker-agent
stage: docker
docker-dashboard:
extends: .docker-dashboard
stage: docker
# docker-attestation-manager:
# extends: .docker-attestation-manager
# stage: docker
......@@ -107,6 +123,10 @@ registry-agent:
extends: .registry-agent
stage: registries
registry-dashboard:
extends: .registry-dashboard
stage: registries
# registry-attestation-manager:
# extends: .registry-attestation-manager
# stage: registries
......@@ -129,6 +149,10 @@ helm-agent:
extends: .helm-agent
stage: helm
helm-dashboard:
extends: .helm-dashboard
stage: helm
# helm-attestation-manager:
# extends: .helm-attestation-manager
# stage: helm
......@@ -169,6 +193,22 @@ deploy agent ocm test tagged:
extends: .deploy-agent-ocm-test-tag
stage: deploy-test
deploy dashboard ocm:
extends: .deploy-dashboard-ocm-main
stage: deploy-test
deploy dashboard ocm tagged:
extends: .deploy-dashboard-ocm-main-tag
stage: deploy-test
deploy dashboard ocm test:
extends: .deploy-dashboard-ocm-test
stage: deploy-test
deploy dashboard ocm test tagged:
extends: .deploy-dashboard-ocm-test-tag
stage: deploy-test
# deploy attestation ocm:
# extends: .deploy-attestation-manager-ocm-main
# stage: deploy-test
......
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic"
}
]
],
"plugins": []
}
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
src/assets/config.js
# OCM ENGINE - Dashboard
Used for Administration of OCM
#### Install dependencies
```
yarn install
```
#### Copy config.js.example to config.js in assets directory
```
cp .config.js.example config.js
```
#### Start the agent locally:
```
yarn serve:dashboard
```
declare module "*.module.css" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module "*.module.scss" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module "*.module.sass" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module "*.module.less" {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module "*.module.styl" {
const classes: { readonly [key: string]: string };
export default classes;
}
FROM nginx:1.25.3-bookworm
RUN apt update -y && apt install npm nodejs python3 git make build-essential wget unzip -y
RUN npm i -g yarn
# Copy the built React app files into the NGINX web server directory
ARG API_TOKEN
ARG JOB_ID
# Set the ENV variables
ENV GITLAB_BASE_URL=https://code.vereign.com/api/v4
ENV GITLAB_PROJECT_ID=662
ENV TOKEN=$API_TOKEN
ENV ID=$JOB_ID
# Download the artifacts from the GitLab API
RUN wget --header "PRIVATE-TOKEN: $TOKEN" -O artifacts.zip "${GITLAB_BASE_URL}/projects/${GITLAB_PROJECT_ID}/jobs/${ID}/artifacts"
# Unzip the artifacts (if needed) - adjust this command based on your artifact type
RUN unzip -q artifacts.zip && rm artifacts.zip
RUN yarn install
RUN mkdir -p /usr/share/nginx/html/ocm-test/dashboard
RUN mkdir -p /usr/share/nginx/html/ocm/dashboard
RUN cp -r dist/apps/ocm-test-dashboard/* /usr/share/nginx/html/ocm-test/dashboard
RUN cp -r dist/apps/dashboard/* /usr/share/nginx/html/ocm/dashboard
RUN cp -r dist/libs /usr/share/nginx/html/ocm-test/dashboard
RUN cp -r dist/libs /usr/share/nginx/html/ocm/dashboard
RUN cp -r node_modules /usr/share/nginx/html/ocm-test/dashboard
RUN cp -r node_modules /usr/share/nginx/html/ocm/dashboard
# Expose the port that NGINX will run on
EXPOSE 8080
# Command / Entrypoint
CMD ["nginx", "-g", "daemon off;"]
apiVersion: v1
appVersion: build-654
description: dashboard deployment
name: dashboard
version: 0.0.2
icon: "https://www.vereign.com/wp-content/themes/vereign2020/images/vereign-logo.svg"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "app.name" . }}-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "app.labels" . | nindent 4 }}
data:
config.js: |
{{- if eq .Release.Namespace "ocm" }}
window.OCMENGINE_HTTP_URL="{{ .Values.ocm.dashboard.agent.http }}";
window.OCMENGINE_WS_URL="{{ .Values.ocm.dashboard.agent.wss }}";
window.TSA_URL="{{ .Values.ocm.dashboard.tsa }}";
window.BASE_PATH="{{ .Values.ocm.dashboard.basepath }}";
{{- else if eq .Release.Namespace "ocm-test" }}
window.OCMENGINE_HTTP_URL="{{ .Values.ocmtest.dashboard.agent.http }}";
window.OCMENGINE_WS_URL="{{ .Values.ocmtest.dashboard.agent.wss }}";
window.TSA_URL="{{ .Values.ocmtest.dashboard.tsa }}";
window.BASE_PATH="{{ .Values.ocmtest.dashboard.basepath }}";
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "app.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "app.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" $name .Release.Namespace | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create instance name based on app version and short image sha.
*/}}
{{- define "app.revision" -}}
{{- default .Release.Name .Values.appRel | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "app.labels" -}}
helm.sh/chart: {{ include "app.chart" . }}
{{ include "app.selectorLabels" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "app.selectorLabels" -}}
app.kubernetes.io/name: {{ include "app.name" . }}
app.kubernetes.io/component: {{ include "app.fullname" . }}
{{- end -}}
{{/*
Metrics Annotations
*/}}
{{- define "app.metricsAnnotations" -}}
{{- if .Values.metrics.enabled -}}
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.metrics.port }}"
prometheus.io/path: {{ .Values.metrics.path | default "/metrics" | quote }}
{{- end -}}
{{- end -}}
{{/*
Image string
*/}}
{{- define "app.image" -}}
{{- if .Values.image.sha -}}
{{ .Values.image.repository }}/{{ .Values.image.name }}@{{ .Values.image.sha }}
{{- else -}}
{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ default .Chart.AppVersion .Values.image.tag }}
{{- end -}}
{{- end -}}
{{/*
Security context
*/}}
{{- define "app.securitycontext" -}}
runAsNonRoot: {{ .Values.security.runAsNonRoot | default false }}
runAsGroup: {{ .Values.security.runAsGid | default 0 }}
runAsUser: {{ .Values.security.runAsUid | default 0 }}
fsGroup: {{ .Values.security.runAsGid | default 0 }}
{{- end -}}
{{/*
PostgreSQL Connection string URI
*/}}
{{- define "app.postgresql.connectionstring" -}}
postgresql://{{ .Values.attestationManager.database.user }}:{{ .Values.attestationManager.database.password }}@{{ .Values.attestationManager.database.host }}:{{ .Values.attestationManager.database.port }}/{{ .Release.Namespace }}_{{ include "app.name" . | replace "-" "_" }}?schema={{ .Values.attestationManager.database.schema }}
{{- end -}}
{{/*
Ingress custom path.
*/}}
{{- define "app.path" -}}
{{- default .Chart.Name .Values.ingress.pathOverride | replace "-manager" "" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ template "app.name" . }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "app.labels" . | nindent 4 }}
app.kubernetes.io/instance: {{ include "app.revision" . }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
{{- include "app.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "app.labels" . | nindent 8 }}
annotations:
{{- include "app.metricsAnnotations" . | nindent 8 }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
securityContext:
{{- include "app.securitycontext" . | nindent 8 }}
imagePullSecrets:
- name: {{ .Values.image.pullSecrets }}
containers:
- name: {{ template "app.name" . }}
image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ default .Chart.AppVersion .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
{{- if .Values.extraVars }}
{{ toYaml .Values.extraVars | indent 8 }}
{{- end }}
ports:
{{- if .Values.metrics.enabled }}
- name: monitoring
containerPort: {{ .Values.metrics.port }}
{{- end }}
- name: http
containerPort: {{ .Values.service.port }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
{{- if eq .Release.Namespace "ocm" }}
- name: {{ template "app.name" . }}-config
mountPath: /usr/share/nginx/html/ocm/dashboard/assets/config.js
subPath: config.js
{{- else if eq .Release.Namespace "ocm-test" }}
- name: {{ template "app.name" . }}-config
mountPath: /usr/share/nginx/html/ocm-test/dashboard/assets/config.js
subPath: config.js
{{- end }}
volumes:
- name: {{ template "app.name" . }}-config
configMap:
name: {{ template "app.name" . }}-config
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ template "app.name" . }}
namespace: {{ .Release.Namespace }}
{{- if eq .Release.Namespace "ocm" }}
annotations:
{{ toYaml .Values.ingress.ocm.annotations | indent 4 }}
{{- else if eq .Release.Namespace "ocm-test" }}
annotations:
{{ toYaml .Values.ingress.ocmtest.annotations | indent 4 }}
{{- end }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
{{- if .Values.ingress.tlsEnabled }}
tls:
- hosts:
- {{ .Values.ingress.frontendDomain }}
secretName: {{ .Values.ingress.frontendTlsSecretName }}
{{- end }}
rules:
{{- if eq .Release.Namespace "ocm" }}
- host: {{ .Values.ingress.frontendDomain }}
http:
paths:
- path: /ocm/dashboard(/|$)(.*)
pathType: Prefix
backend:
service:
name: {{ template "app.name" . }}
port:
number: {{ .Values.service.port }}
{{- else if eq .Release.Namespace "ocm-test" }}
- host: {{ .Values.ingress.frontendDomain }}
http:
paths:
- path: /ocm-test/dashboard(/|$)(.*)
pathType: Prefix
backend:
service:
name: {{ template "app.name" . }}
port:
number: {{ .Values.service.port }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "app.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- name: http
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
selector:
{{- include "app.selectorLabels" . | nindent 4 }}
# -- Default number of instances to start .....
replicaCount: 1
# -- Application name ...
name: dashboard
# -- Ovverwrites application name ...
nameOverride: ""
image:
repository: eu.gcr.io/vrgn-infra-prj
# -- Image name ..
name: gaiax/ocm/ocm-engine/dashboard
# -- Image tag ..
# Uses .Chart.AppVersion if empty .
tag: ""
# -- Image sha, usually generated by the CI .
# Uses image.tag if empty .
sha: ""
# -- Image pull policy .
pullPolicy: Always
# -- Image pull secret when internal image is used .
pullSecrets: deployment-key-light
resources:
requests:
cpu: 250m
autoscaling:
# -- Enable autoscaling .
enabled: false
# -- Minimum replicas .
minReplicas: 1
# -- Maximum replicas .
maxReplicas: 3
# -- CPU target for autoscaling trigger .
targetCPUUtilizationPercentage: 70
# -- Memory target for autoscaling trigger .
targetMemoryUtilizationPercentage: 70
##
## Prometheus Exporter / Metrics .
##
metrics:
# -- Enable prometheus metrics .
enabled: true
# -- Port for prometheus metrics .
port: 2112
##
## Kubernetes [SecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) object.
##
security:
# -- by default, apps run as non-root .
runAsNonRoot: false
# -- User used by the apps .
runAsUid: 0
# -- Group used by the apps .
runAsGid: 0
ocm:
dashboard:
agent:
ws: "wss://ssi-dev.vereign.com/api-issuer"
http: "https://ssi-dev.vereign.com/api-issuer"
tsa: "https://tsa.vereign.com"
basepath: "/ocm/dashboard"
ocmtest:
dashboard:
agent:
ws: "wss://ssi-dev.vereign.com/api-holder"
http: "https://ssi-dev.vereign.com/api-holder"
tsa: "https://tsa.vereign.com"
basepath: "/ocm-test/dashboard"
service:
port: 8080
ingress:
enabled: true
tlsEnabled: true
frontendDomain: ssi-dev.vereign.com
frontendTlsSecretName: cert-manager-tls
ocm:
annotations: {
kubernetes.io/ingress.class: "nginx",
cert-manager.io/cluster-issuer: letsencrypt-production-http,
kubernetes.io/ingress.global-static-ip-name: ssi-dev,
nginx.ingress.kubernetes.io/rewrite-target: /ocm/dashboard/$2
}
ocmtest:
annotations: {
kubernetes.io/ingress.class: "nginx",
cert-manager.io/cluster-issuer: letsencrypt-production-http,
kubernetes.io/ingress.global-static-ip-name: ssi-dev,
nginx.ingress.kubernetes.io/rewrite-target: /ocm-test/dashboard/$2
}
FROM node:18.16.0-buster-slim
RUN apt update -y && apt install python3 git make build-essential -y
WORKDIR /app
COPY ./dist/apps/dashboard ./
COPY package.json yarn.lock ./
RUN yarn install
EXPOSE 4200
CMD ["yarn", "nx", "serve", "dashboard"]
/* eslint-disable */
export default {
displayName: "dashboard",
preset: "../../jest.preset.js",
transform: {
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nx/react/plugins/jest",
"^.+\\.[tj]sx?$": ["babel-jest", { presets: ["@nx/react/babel"] }],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/apps/dashboard",
};
{
"name": "dashboard",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/dashboard/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"compiler": "babel",
"outputPath": "dist/apps/dashboard",
"index": "apps/dashboard/src/index.html",
"baseHref": "/",
"main": "apps/dashboard/src/main.tsx",
"tsConfig": "apps/dashboard/tsconfig.app.json",
"assets": [
"apps/dashboard/src/favicon.ico",
"apps/dashboard/src/assets"
],
"styles": ["apps/dashboard/src/styles.scss"],
"scripts": [],
"isolatedConfig": true,
"webpackConfig": "apps/dashboard/webpack.config.js"
},
"configurations": {
"development": {
"extractLicenses": false,
"optimization": false,
"sourceMap": true,
"vendorChunk": true
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false
}
}
},
"serve": {
"executor": "@nx/webpack:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "dashboard:build",
"hmr": true,
"host": "0.0.0.0"
},
"configurations": {
"development": {
"buildTarget": "dashboard:build:development"
},
"production": {
"buildTarget": "dashboard:build:production",
"hmr": false
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/dashboard/**/*.{ts,tsx,js,jsx}"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/dashboard/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}
apps/dashboard/src/assets/Vereign_Logo_ICON_BLACK.png

56.3 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment