1518 extensibility front add an application section in settings (#15056)
Protected by IS_APPLICATION_ENABLED featureFlag Add `Application` section in settings <img width="301" height="137" alt="image" src="https://github.com/user-attachments/assets/ee53bdd2-36f6-45c6-8646-17b1e08abf00" /> A `settings/applications` route listing all installed applications <img width="661" height="428" alt="image" src="https://github.com/user-attachments/assets/69d534c4-4e9e-452a-a3d9-ded0223bb457" /> Introduce a new Tag for application managed items <img width="885" height="759" alt="image" src="https://github.com/user-attachments/assets/19767be5-61e5-4bd2-a51d-54ed9bfb1923" /> A `settings/applications/<application_id>` details setting page listing all objects, serverlessFunctions and agents created by the application: <img width="917" height="778" alt="image" src="https://github.com/user-attachments/assets/7fc056a6-1d73-4242-b2eb-6f8955d8597d" /> A `settings/applications/<application_id>/<serverless_function_id>` <img width="905" height="652" alt="image" src="https://github.com/user-attachments/assets/56ca0021-26bf-42cb-9abf-34879f16050a" /> Add trigger tab in serverless function details (readonly for now) <img width="899" height="724" alt="image" src="https://github.com/user-attachments/assets/5eeefa35-f2a4-4fd8-a640-7b5c5891f226" /> Set object, serverless and agent setting detail pages readonly for managed items <img width="1075" height="859" alt="image" src="https://github.com/user-attachments/assets/57c73d69-4980-47a2-b752-8dc5ab494530" /> <img width="648" height="582" alt="image" src="https://github.com/user-attachments/assets/5ad5f3f7-3bc3-4e40-870a-4981c6492524" /> <img width="982" height="692" alt="image" src="https://github.com/user-attachments/assets/7ad756c4-5d33-4a0a-9eb8-416c040362b9" /> <img width="1077" height="647" alt="image" src="https://github.com/user-attachments/assets/e086b9f5-4062-4d10-82a9-4023de3cad3f" />
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import { UseGuards } from '@nestjs/common';
|
||||
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
@@ -16,7 +13,6 @@ import { CreateAgentHandoffInput } from 'src/engine/metadata-modules/agent/dtos/
|
||||
import { RemoveAgentHandoffInput } from 'src/engine/metadata-modules/agent/dtos/remove-agent-handoff.input';
|
||||
|
||||
import { AgentHandoffService } from './agent-handoff.service';
|
||||
import { AgentEntity } from './agent.entity';
|
||||
import { AgentService } from './agent.service';
|
||||
|
||||
import { AgentHandoffDTO } from './dtos/agent-handoff.dto';
|
||||
@@ -29,8 +25,6 @@ import { UpdateAgentInput } from './dtos/update-agent.input';
|
||||
@Resolver()
|
||||
export class AgentResolver {
|
||||
constructor(
|
||||
@InjectRepository(AgentEntity)
|
||||
private readonly agentRepository: Repository<AgentEntity>,
|
||||
private readonly agentService: AgentService,
|
||||
private readonly agentHandoffService: AgentHandoffService,
|
||||
) {}
|
||||
|
||||
@@ -60,6 +60,9 @@ export class AgentDTO {
|
||||
@HideField()
|
||||
workspaceId: string;
|
||||
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
applicationId?: string;
|
||||
|
||||
@IsDateString()
|
||||
@Field()
|
||||
createdAt: Date;
|
||||
|
||||
+1
-8
@@ -1,4 +1,4 @@
|
||||
import { Field, HideField, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
import { IsDateString, IsNotEmpty, IsObject, IsUUID } from 'class-validator';
|
||||
@@ -18,13 +18,6 @@ export class CronTriggerDTO {
|
||||
@Field(() => GraphQLJSON)
|
||||
settings: CronTriggerSettings;
|
||||
|
||||
@HideField()
|
||||
workspaceId: string;
|
||||
|
||||
@IsUUID()
|
||||
@Field()
|
||||
serverlessFunctionId: string;
|
||||
|
||||
@IsDateString()
|
||||
@Field()
|
||||
createdAt: Date;
|
||||
|
||||
+1
-8
@@ -1,4 +1,4 @@
|
||||
import { Field, HideField, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
import { IsDateString, IsNotEmpty, IsObject, IsUUID } from 'class-validator';
|
||||
@@ -18,13 +18,6 @@ export class DatabaseEventTriggerDTO {
|
||||
@Field(() => GraphQLJSON)
|
||||
settings: DatabaseEventTriggerSettings;
|
||||
|
||||
@HideField()
|
||||
workspaceId: string;
|
||||
|
||||
@IsUUID()
|
||||
@Field()
|
||||
serverlessFunctionId: string;
|
||||
|
||||
@IsDateString()
|
||||
@Field()
|
||||
createdAt: Date;
|
||||
|
||||
+2
@@ -12,6 +12,7 @@ export const fromObjectMetadataEntityToObjectMetadataDto = (
|
||||
standardOverrides,
|
||||
shortcut,
|
||||
duplicateCriteria,
|
||||
applicationId,
|
||||
...rest
|
||||
} = objectMetadataEntity;
|
||||
|
||||
@@ -24,5 +25,6 @@ export const fromObjectMetadataEntityToObjectMetadataDto = (
|
||||
standardOverrides: standardOverrides ?? undefined,
|
||||
shortcut: shortcut ?? undefined,
|
||||
duplicateCriteria: duplicateCriteria ?? undefined,
|
||||
applicationId: applicationId ?? undefined,
|
||||
};
|
||||
};
|
||||
|
||||
+3
-1
@@ -66,7 +66,9 @@ export const ALL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY = {
|
||||
},
|
||||
serverlessFunction: {
|
||||
propertiesToCompare: [
|
||||
...FLAT_SERVERLESS_FUNCTION_EDITABLE_PROPERTIES,
|
||||
...FLAT_SERVERLESS_FUNCTION_EDITABLE_PROPERTIES.filter(
|
||||
(property) => property !== 'code',
|
||||
),
|
||||
'deletedAt',
|
||||
],
|
||||
propertiesToStringify: [],
|
||||
|
||||
+3
@@ -80,6 +80,9 @@ export class ObjectMetadataDTO {
|
||||
@HideField()
|
||||
workspaceId: string;
|
||||
|
||||
@Field(() => UUIDScalarType, { nullable: true })
|
||||
applicationId?: string;
|
||||
|
||||
@Field()
|
||||
createdAt: Date;
|
||||
|
||||
|
||||
@@ -261,7 +261,10 @@ export class RoleResolver {
|
||||
workspace.id,
|
||||
);
|
||||
|
||||
return agents;
|
||||
return agents.map((agent) => ({
|
||||
...agent,
|
||||
applicationId: agent.applicationId ?? undefined,
|
||||
}));
|
||||
}
|
||||
|
||||
@ResolveField('apiKeys', () => [ApiKeyForRoleDTO])
|
||||
|
||||
-6
@@ -18,12 +18,6 @@ export class RouteTriggerDTO {
|
||||
@Field(() => HTTPMethod)
|
||||
httpMethod: HTTPMethod;
|
||||
|
||||
@Field()
|
||||
serverlessFunctionId: string;
|
||||
|
||||
@Field()
|
||||
workspaceId: string;
|
||||
|
||||
@Field()
|
||||
createdAt: Date;
|
||||
|
||||
|
||||
+14
-2
@@ -15,6 +15,9 @@ import {
|
||||
} from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { CronTriggerDTO } from 'src/engine/metadata-modules/cron-trigger/dtos/cron-trigger.dto';
|
||||
import { DatabaseEventTriggerDTO } from 'src/engine/metadata-modules/database-event-trigger/dtos/database-event-trigger.dto';
|
||||
import { RouteTriggerDTO } from 'src/engine/metadata-modules/route-trigger/dtos/route-trigger.dto';
|
||||
|
||||
@ObjectType('ServerlessFunction')
|
||||
@Authorize({
|
||||
@@ -39,7 +42,7 @@ export class ServerlessFunctionDTO {
|
||||
|
||||
@IsString()
|
||||
@Field({ nullable: true })
|
||||
description: string;
|
||||
description?: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@@ -52,12 +55,21 @@ export class ServerlessFunctionDTO {
|
||||
|
||||
@IsString()
|
||||
@Field({ nullable: true })
|
||||
latestVersion: string;
|
||||
latestVersion?: string;
|
||||
|
||||
@IsArray()
|
||||
@Field(() => [String], { nullable: false })
|
||||
publishedVersions: string[];
|
||||
|
||||
@Field(() => [CronTriggerDTO], { nullable: true })
|
||||
cronTriggers?: CronTriggerDTO[];
|
||||
|
||||
@Field(() => [DatabaseEventTriggerDTO], { nullable: true })
|
||||
databaseEventTriggers?: DatabaseEventTriggerDTO[];
|
||||
|
||||
@Field(() => [RouteTriggerDTO], { nullable: true })
|
||||
routeTriggers?: RouteTriggerDTO[];
|
||||
|
||||
@HideField()
|
||||
workspaceId: string;
|
||||
|
||||
|
||||
+4
-2
@@ -45,6 +45,7 @@ export class ServerlessFunctionResolver {
|
||||
id,
|
||||
workspaceId,
|
||||
},
|
||||
relations: ['cronTriggers', 'databaseEventTriggers', 'routeTriggers'],
|
||||
});
|
||||
} catch (error) {
|
||||
serverlessFunctionGraphQLApiExceptionHandler(error);
|
||||
@@ -56,8 +57,9 @@ export class ServerlessFunctionResolver {
|
||||
@AuthWorkspace() { id: workspaceId }: Workspace,
|
||||
) {
|
||||
try {
|
||||
return await this.serverlessFunctionService.findManyServerlessFunctions({
|
||||
workspaceId,
|
||||
return this.serverlessFunctionRepository.find({
|
||||
where: { workspaceId },
|
||||
relations: ['cronTriggers', 'databaseEventTriggers', 'routeTriggers'],
|
||||
});
|
||||
} catch (error) {
|
||||
serverlessFunctionGraphQLApiExceptionHandler(error);
|
||||
|
||||
-5
@@ -45,11 +45,6 @@ export class ServerlessFunctionService {
|
||||
private readonly auditService: AuditService,
|
||||
) {}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
async findManyServerlessFunctions(where) {
|
||||
return this.serverlessFunctionRepository.findBy(where);
|
||||
}
|
||||
|
||||
async hasServerlessFunctionPublishedVersion(serverlessFunctionId: string) {
|
||||
return await this.serverlessFunctionRepository.exists({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user