mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-13 20:49:09 +00:00
Compare commits
11
Commits
ci/dockerhub
...
v1.53.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f46b1b62db | ||
|
|
8b6cd8a88e | ||
|
|
0c333b476a | ||
|
|
c416a2cb97 | ||
|
|
d03021fc9d | ||
|
|
574cf48726 | ||
|
|
7cef404acf | ||
|
|
3c32c3c7d4 | ||
|
|
d44531b963 | ||
|
|
36c80b480e | ||
|
|
eeef97679c |
+1
-1
@@ -8,7 +8,7 @@ module.exports = {
|
|||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:@typescript-eslint/recommended',
|
'plugin:@typescript-eslint/recommended',
|
||||||
'plugin:prettier/recommended',
|
'prettier',
|
||||||
],
|
],
|
||||||
root: true,
|
root: true,
|
||||||
env: {
|
env: {
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ on:
|
|||||||
- stg
|
- stg
|
||||||
- stg2
|
- stg2
|
||||||
- prd
|
- prd
|
||||||
|
push_to_dockerhub:
|
||||||
|
description: "Push image to Dockerhub?"
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
extract_environment:
|
extract_environment:
|
||||||
@@ -39,11 +44,11 @@ jobs:
|
|||||||
new_release_version: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }}
|
new_release_version: ${{ (steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version) || (github.event_name == 'workflow_dispatch' && '0.0.0') }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- if: github.event_name != 'workflow_dispatch'
|
- if: github.event_name != 'workflow_dispatch'
|
||||||
name: Semantic Release
|
name: Semantic Release
|
||||||
uses: cycjimmy/semantic-release-action@v3
|
uses: cycjimmy/semantic-release-action@v4
|
||||||
id: semantic
|
id: semantic
|
||||||
with:
|
with:
|
||||||
extra_plugins: |
|
extra_plugins: |
|
||||||
@@ -76,7 +81,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update Pip
|
- name: Update Pip
|
||||||
run: |
|
run: |
|
||||||
@@ -95,14 +100,14 @@ jobs:
|
|||||||
python3 -m pip install awsebcli --upgrade
|
python3 -m pip install awsebcli --upgrade
|
||||||
|
|
||||||
- name: Configure AWS Region
|
- name: Configure AWS Region
|
||||||
uses: aws-actions/configure-aws-credentials@v1-node16
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
id: aws
|
id: aws
|
||||||
with:
|
with:
|
||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
- name: Login to AWS ECR
|
- name: Login to AWS ECR
|
||||||
id: login_ecr
|
id: login_ecr
|
||||||
uses: aws-actions/amazon-ecr-login@v1
|
uses: aws-actions/amazon-ecr-login@v2
|
||||||
|
|
||||||
- name: Build, Tag, and Push Image to AWS ECR
|
- name: Build, Tag, and Push Image to AWS ECR
|
||||||
env:
|
env:
|
||||||
@@ -114,20 +119,21 @@ jobs:
|
|||||||
docker-compose -f build.docker-compose.yml push
|
docker-compose -f build.docker-compose.yml push
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
if: ${{inputs.push_to_dockerhub}}
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: dadosfera
|
username: dadosfera
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
- name: Build, Tag, and Push Image to Dockerhub
|
- name: Build, Tag, and Push Image to Dockerhub
|
||||||
|
if: ${{inputs.push_to_dockerhub}}
|
||||||
env:
|
env:
|
||||||
ENV: ${{ needs.extract_environment.outputs.environment }}
|
ENV: ${{ needs.extract_environment.outputs.environment }}
|
||||||
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
||||||
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f build.docker-compose.dockerhub.yml build
|
docker-compose -f build.docker-compose.dockerhub.yml build
|
||||||
docker-compose -f build.docker-compose.dockerhub.yml push
|
docker-compose -f build.docker-compose.dockerhub.yml push
|
||||||
|
|
||||||
|
|
||||||
- name: Create ZIP file to Deploy AWS Beanstalk
|
- name: Create ZIP file to Deploy AWS Beanstalk
|
||||||
env:
|
env:
|
||||||
@@ -162,7 +168,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Extract Docs BlockId and PageId
|
- name: Extract Docs BlockId and PageId
|
||||||
env:
|
env:
|
||||||
|
|||||||
Vendored
+1
@@ -12,6 +12,7 @@
|
|||||||
"start:debug"
|
"start:debug"
|
||||||
],
|
],
|
||||||
"runtimeExecutable": "npm",
|
"runtimeExecutable": "npm",
|
||||||
|
"runtimeVersion": "18.10.0",
|
||||||
"skipFiles": [
|
"skipFiles": [
|
||||||
"<node_internals>/**"
|
"<node_internals>/**"
|
||||||
],
|
],
|
||||||
|
|||||||
+40
-1
@@ -490,6 +490,45 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/pipelinesV2/monitoring-dashboard": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "PipelinesController_getMonitoringDashboard",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "dadosfera-lang",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"enum": [
|
||||||
|
"pt-br",
|
||||||
|
"en-us"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PipelinesV2"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/pipelinesV2": {
|
"/pipelinesV2": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "PipelinesController_create",
|
"operationId": "PipelinesController_create",
|
||||||
@@ -1752,7 +1791,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Maestro - feat/generate-token",
|
"title": "Maestro - feat/new-customer-monitoring",
|
||||||
"description": "This is the Maestro API",
|
"description": "This is the Maestro API",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"contact": {}
|
"contact": {}
|
||||||
|
|||||||
+62
-1
@@ -2663,6 +2663,45 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/pipelinesV2/monitoring-dashboard": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "PipelinesController_getMonitoringDashboard",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "dadosfera-lang",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"enum": [
|
||||||
|
"pt-br",
|
||||||
|
"en-us"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PipelinesV2"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/pipelinesV2": {
|
"/pipelinesV2": {
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "PipelinesController_create",
|
"operationId": "PipelinesController_create",
|
||||||
@@ -5060,6 +5099,28 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/customers/monitoring-dashboard": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "CustomersController_getCustomerMonitoringDashboard",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"Customers"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/health": {
|
"/health": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "HealthController_check",
|
"operationId": "HealthController_check",
|
||||||
@@ -5076,7 +5137,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Maestro - feat/generate-token",
|
"title": "Maestro - feat/new-customer-monitoring",
|
||||||
"description": "This is the Maestro API",
|
"description": "This is the Maestro API",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"contact": {}
|
"contact": {}
|
||||||
|
|||||||
Generated
+2290
-1764
File diff suppressed because it is too large
Load Diff
+3
-4
@@ -29,7 +29,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack-v2": "3.31.0",
|
"@dadosfera/protospack-v2": "3.33.0",
|
||||||
"@grpc/grpc-js": "^1.6.7",
|
"@grpc/grpc-js": "^1.6.7",
|
||||||
"@grpc/proto-loader": "^0.6.13",
|
"@grpc/proto-loader": "^0.6.13",
|
||||||
"@nestjs/cli": "^9.4.2",
|
"@nestjs/cli": "^9.4.2",
|
||||||
@@ -80,11 +80,10 @@
|
|||||||
"@types/passport-google-oauth20": "^2.0.11",
|
"@types/passport-google-oauth20": "^2.0.11",
|
||||||
"@types/passport-oauth2": "^1.4.11",
|
"@types/passport-oauth2": "^1.4.11",
|
||||||
"@types/supertest": "^2.0.12",
|
"@types/supertest": "^2.0.12",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||||
"@typescript-eslint/parser": "^5.29.0",
|
"@typescript-eslint/parser": "^5.62.0",
|
||||||
"eslint": "^8.18.0",
|
"eslint": "^8.18.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"nock": "^13.2.7",
|
"nock": "^13.2.7",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
PIPELINE: {
|
PIPELINE: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Coletar | Pipelines',
|
'pt-br': 'Coletar | Pipelines',
|
||||||
@@ -117,7 +116,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
CONNECTION: {
|
CONNECTION: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Coletar | Fontes de dados',
|
'pt-br': 'Coletar | Fontes de dados',
|
||||||
@@ -157,7 +155,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
NETWORK_CONFIG: {
|
NETWORK_CONFIG: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Coletar | Redes',
|
'pt-br': 'Coletar | Redes',
|
||||||
@@ -187,7 +184,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
// },
|
// },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
OUTPUT: {
|
OUTPUT: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Output',
|
'pt-br': 'Output',
|
||||||
@@ -237,7 +233,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
TRANSFORMATIONS: {
|
TRANSFORMATIONS: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Micro-transformações',
|
'pt-br': 'Micro-transformações',
|
||||||
@@ -287,7 +282,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
CATALOG: {
|
CATALOG: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Explorar | Catálogo',
|
'pt-br': 'Explorar | Catálogo',
|
||||||
@@ -368,7 +362,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
CONNECTORS: {
|
CONNECTORS: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Conectores',
|
'pt-br': 'Conectores',
|
||||||
@@ -418,7 +411,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
SNOWFLAKE: {
|
SNOWFLAKE: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Explorar | Consolidar',
|
'pt-br': 'Explorar | Consolidar',
|
||||||
@@ -438,7 +430,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
ZENDESK: {
|
ZENDESK: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Zendesk',
|
'pt-br': 'Zendesk',
|
||||||
@@ -458,7 +449,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
DATAVIZ: {
|
DATAVIZ: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Analisar | Visualização',
|
'pt-br': 'Analisar | Visualização',
|
||||||
@@ -497,7 +487,6 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
MODULES: {
|
MODULES: {
|
||||||
title: {
|
title: {
|
||||||
'pt-br': 'Módulos da Dadosfera',
|
'pt-br': 'Módulos da Dadosfera',
|
||||||
@@ -594,6 +583,25 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
CUSTOMER: {
|
||||||
|
title: {
|
||||||
|
'pt-br': 'Organização',
|
||||||
|
'en-us': 'Organization',
|
||||||
|
'es-es': 'Organización',
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
MONITORING_DASHBOARD: {
|
||||||
|
seqid: 47,
|
||||||
|
claim: 'customer:monitoring-dashboard',
|
||||||
|
usage: PermissionUsages.PUBLIC,
|
||||||
|
name: {
|
||||||
|
'pt-br': 'Ver o dashboard de monitoramento',
|
||||||
|
'en-us': 'View the monitoring dashboard',
|
||||||
|
'es-es': 'Ver el dashboard de monitoreo',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
export interface DadosferaModule {
|
export interface DadosferaModule {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ export class AuthClientService implements OnModuleInit {
|
|||||||
|
|
||||||
async oauthSignIn(data: { username: string; token: string }) {
|
async oauthSignIn(data: { username: string; token: string }) {
|
||||||
const { username, token } = data;
|
const { username, token } = data;
|
||||||
return lastValueFrom(this.authService.AuthOauthSignIn({ token, username }));
|
return lastValueFrom(
|
||||||
|
this.authService.AuthOauthSignIn({ token, username, refreshToken: '' }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { CustomersService } from './customers.service';
|
|||||||
import { CustomerDto, CustomerLinksResponse } from './dtos/customers';
|
import { CustomerDto, CustomerLinksResponse } from './dtos/customers';
|
||||||
import { RequestUser, User } from 'src/decorators/user.decorator';
|
import { RequestUser, User } from 'src/decorators/user.decorator';
|
||||||
import type { StringValue } from 'ms';
|
import type { StringValue } from 'ms';
|
||||||
|
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
|
||||||
|
|
||||||
@ApiInternalOnlyController()
|
@ApiInternalOnlyController()
|
||||||
@ApiTags('Customers')
|
@ApiTags('Customers')
|
||||||
@@ -71,4 +72,17 @@ export class CustomersController {
|
|||||||
};
|
};
|
||||||
return this.customersService.generateToken(exp, data);
|
return this.customersService.generateToken(exp, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('monitoring-dashboard')
|
||||||
|
@RequireAllPermissions(
|
||||||
|
PERMISSIONS_GROUPS.CUSTOMER.permissions.MONITORING_DASHBOARD,
|
||||||
|
)
|
||||||
|
async getCustomerMonitoringDashboard(
|
||||||
|
@User() user: RequestUser,
|
||||||
|
): Promise<{ url: string }> {
|
||||||
|
this.logger.info('getCustomerMonitoringDashboard');
|
||||||
|
|
||||||
|
const metadata = PackTheMetadata(user);
|
||||||
|
return this.customersService.getMonitoringDashboardUrl(metadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,18 @@ import { ClientsModule } from '@nestjs/microservices';
|
|||||||
import { DucClient } from '../duc/client.config';
|
import { DucClient } from '../duc/client.config';
|
||||||
import { CustomersController } from './customers.controller';
|
import { CustomersController } from './customers.controller';
|
||||||
import { CustomersService } from './customers.service';
|
import { CustomersService } from './customers.service';
|
||||||
|
import { PipelinesClientConfiguration } from '../pipelinesV2/pipelines-client';
|
||||||
|
|
||||||
const client = new DucClient();
|
const ducClient = new DucClient();
|
||||||
|
const piFactoryClient = new PipelinesClientConfiguration();
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [ClientsModule.register([client.providerOptions])],
|
imports: [
|
||||||
|
ClientsModule.register([
|
||||||
|
ducClient.providerOptions,
|
||||||
|
piFactoryClient.providerOptions,
|
||||||
|
]),
|
||||||
|
],
|
||||||
controllers: [CustomersController],
|
controllers: [CustomersController],
|
||||||
providers: [CustomersService, DadosferaLogger],
|
providers: [CustomersService, DadosferaLogger],
|
||||||
exports: [CustomersService],
|
exports: [CustomersService],
|
||||||
|
|||||||
@@ -22,20 +22,34 @@ import {
|
|||||||
} from '@aws-sdk/client-secrets-manager';
|
} from '@aws-sdk/client-secrets-manager';
|
||||||
import getEnv from 'src/utils/getEnv';
|
import getEnv from 'src/utils/getEnv';
|
||||||
import { logger } from 'elastic-apm-node';
|
import { logger } from 'elastic-apm-node';
|
||||||
|
import {
|
||||||
|
ReadService,
|
||||||
|
ProtoServices as PipelineProtoServices,
|
||||||
|
} from '@dadosfera/protospack-v2/dist/lib/PipelineV2';
|
||||||
|
import { Metadata } from '@grpc/grpc-js';
|
||||||
|
import { PipelinesClientConfiguration } from '../pipelinesV2/pipelines-client';
|
||||||
|
|
||||||
// This function will accept any string, which may result in a bug.
|
// This function will accept any string, which may result in a bug.
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CustomersService implements OnModuleInit {
|
export class CustomersService implements OnModuleInit {
|
||||||
private customerService: CustomersProtoService;
|
private customerService: CustomersProtoService;
|
||||||
|
|
||||||
|
private pipelineReadService: ReadService.PipelineV2ReadService;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DucClient.name) private readonly grpcClient: ClientGrpc,
|
@Inject(DucClient.name) private readonly grpcClient: ClientGrpc,
|
||||||
|
@Inject(PipelinesClientConfiguration.name)
|
||||||
|
private readonly pipelinesGrpcClient: ClientGrpc,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
onModuleInit() {
|
onModuleInit() {
|
||||||
this.customerService = this.grpcClient.getService<CustomersProtoService>(
|
this.customerService = this.grpcClient.getService<CustomersProtoService>(
|
||||||
ProtoServices.CustomersProtoService,
|
ProtoServices.CustomersProtoService,
|
||||||
);
|
);
|
||||||
|
this.pipelineReadService =
|
||||||
|
this.pipelinesGrpcClient.getService<ReadService.PipelineV2ReadService>(
|
||||||
|
PipelineProtoServices.PipelineV2ReadService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLinks(customerId: string) {
|
async getLinks(customerId: string) {
|
||||||
@@ -120,4 +134,21 @@ export class CustomersService implements OnModuleInit {
|
|||||||
// const decoded = jwt.decode(jwt_token, { complete: true });
|
// const decoded = jwt.decode(jwt_token, { complete: true });
|
||||||
return jwt_token;
|
return jwt_token;
|
||||||
}
|
}
|
||||||
|
async getMonitoringDashboardUrl(metadata: Metadata) {
|
||||||
|
logger.info('CustomersService - getMonitoringDashboardUrl');
|
||||||
|
|
||||||
|
const res = await lastValueFrom(
|
||||||
|
this.pipelineReadService.PipelineV2GetDashboardUrl(
|
||||||
|
{
|
||||||
|
dashboard_id: '45',
|
||||||
|
exp: '15m',
|
||||||
|
metabase_customer_name: 'dadosferatech',
|
||||||
|
},
|
||||||
|
metadata,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
logger.info('Done');
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
Patch,
|
Patch,
|
||||||
HttpException,
|
HttpException,
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
|
CacheTTL,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
ApiCreatedResponse,
|
ApiCreatedResponse,
|
||||||
@@ -86,6 +87,18 @@ export class PipelinesController {
|
|||||||
this.logger = dadosferaLogger.logger;
|
this.logger = dadosferaLogger.logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('monitoring-dashboard')
|
||||||
|
async getMonitoringDashboard(@User() user: RequestUser) {
|
||||||
|
this.logger.info('PipelinesController - getMonitoringDashboard', { user });
|
||||||
|
|
||||||
|
const metadata = PackTheMetadata(user);
|
||||||
|
|
||||||
|
const response =
|
||||||
|
await this.pipelinesClientService.getMonitoringDashboardUrl(metadata);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@ApiCreatedResponse({ type: IPipelineV2 })
|
@ApiCreatedResponse({ type: IPipelineV2 })
|
||||||
async create(
|
async create(
|
||||||
|
|||||||
@@ -321,4 +321,22 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getMonitoringDashboardUrl(metadata: Metadata) {
|
||||||
|
this.logger.info('PipelinesClientService - getMonitoringDashboardUrl');
|
||||||
|
|
||||||
|
const res = await lastValueFrom(
|
||||||
|
this.pipelineReadService.PipelineV2GetDashboardUrl(
|
||||||
|
{
|
||||||
|
dashboard_id: '83',
|
||||||
|
exp: '15m',
|
||||||
|
metabase_customer_name: 'dadosferatech',
|
||||||
|
},
|
||||||
|
metadata,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
this.logger.info('Done');
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user