diff --git a/README.md b/README.md index 4b9679fab..5aaebd6cd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ If you would like to self-host Plane, please see our [deployment guide](https:// - **Unified Control:** Centralize management of multi-stage deployment pipelines across diverse environments. -- **Flexible Target Support:** Deploy to Kubernetes, cloud functions, VMs, or +- **Flexible Resource Support:** Deploy to Kubernetes, cloud functions, VMs, or custom infrastructure from a single platform. - **Advanced Workflow Orchestration:** Automate sophisticated deployment processes including testing, code analysis, security scans, and approval diff --git a/apps/docs/pages/core-concepts/deployments.mdx b/apps/docs/pages/core-concepts/deployments.mdx index aab97f878..9b6837655 100644 --- a/apps/docs/pages/core-concepts/deployments.mdx +++ b/apps/docs/pages/core-concepts/deployments.mdx @@ -84,8 +84,8 @@ Ctrlplane uses a hierarchical structure to manage deployments: 4. **Policy Enforcement**: Inter-environment policies determine when jobs can run, allowing for controlled progression through environments. -5. **Job Execution**: Jobs are executed on the identified resources, applying the - release changes. +5. **Job Execution**: Jobs are executed on the identified resources, applying + the release changes. ## Creating and Managing Deployments diff --git a/apps/docs/pages/core-concepts/deployments/releases.mdx b/apps/docs/pages/core-concepts/deployments/releases.mdx index 5eb1aeb88..583158c67 100644 --- a/apps/docs/pages/core-concepts/deployments/releases.mdx +++ b/apps/docs/pages/core-concepts/deployments/releases.mdx @@ -41,8 +41,8 @@ set of resources. ## Release Dependencies Since Ctrlplane is meant for solving the way releases are deployed across -resources, it's very common to have version dependencies on other deployments. In -the world of software, this could mean a microservice depends on a specific +resources, it's very common to have version dependencies on other deployments. +In the world of software, this could mean a microservice depends on a specific version of another microservice to ensure it has the required APIs. In the case of software and infrastructure interactions, this could require a @@ -73,13 +73,13 @@ other deployments is required. In most cases, a resource has multiple deployments associated with it, making it easy to verify if a specific version is deployed on that resource as required by another deployment. However, complexities arise when dependencies involve other -resources, where the deployment version might be present on any of these dependent -resources. +resources, where the deployment version might be present on any of these +dependent resources. -To address this, Ctrlplane uses resource metadata grouping. This mechanism allows -you to logically group resources based on their metadata attributes. By doing so, -Ctrlplane can accurately determine which resources to inspect to verify if the -software has been deployed. +To address this, Ctrlplane uses resource metadata grouping. This mechanism +allows you to logically group resources based on their metadata attributes. By +doing so, Ctrlplane can accurately determine which resources to inspect to +verify if the software has been deployed. The idea is to create logical associations between resources that share common characteristics, such as being part of the same kubernetes cluster. This is diff --git a/apps/docs/pages/core-concepts/deployments/variables.mdx b/apps/docs/pages/core-concepts/deployments/variables.mdx index 96cb8b3cd..c7bcc07e1 100644 --- a/apps/docs/pages/core-concepts/deployments/variables.mdx +++ b/apps/docs/pages/core-concepts/deployments/variables.mdx @@ -10,8 +10,8 @@ Ctrlplane offers three variable scopes: 1. **System Level**: Global variables applicable to all resources across all deployments within a system. -2. **Deployment Level (Wildcard Selector)**: Variables applicable to all resources - within a specific deployment. +2. **Deployment Level (Wildcard Selector)**: Variables applicable to all + resources within a specific deployment. 3. **Deployment Level (Custom Selector)**: Variables applicable to a subset of resources within a deployment, based on defined selectors (e.g., metadata, environment, type). @@ -56,7 +56,8 @@ Variables can be used in: endpoints, common timeouts) - Leverage deployment-level variables for environment-specific settings (e.g., staging vs. production configs) -- Utilize custom selectors for fine-grained control over specific resource groups +- Utilize custom selectors for fine-grained control over specific resource + groups - Regularly audit and rotate sensitive variables, especially secrets By mastering Ctrlplane's variable system, DevOps engineers can create flexible, diff --git a/apps/docs/pages/core-concepts/environments.mdx b/apps/docs/pages/core-concepts/environments.mdx index a63ca9916..67028490f 100644 --- a/apps/docs/pages/core-concepts/environments.mdx +++ b/apps/docs/pages/core-concepts/environments.mdx @@ -31,14 +31,14 @@ resources to the next. These policies can include: ### Resource Filters -Each environment uses resource filters to dynamically determine which resources are -associated with it. This feature allows for flexible and automatic assignment of -resources to environments based on their characteristics. +Each environment uses resource filters to dynamically determine which resources +are associated with it. This feature allows for flexible and automatic +assignment of resources to environments based on their characteristics. ## Dynamic Resource Association -The use of resource filters enables dynamic addition and removal of resources from -environments. As a result: +The use of resource filters enables dynamic addition and removal of resources +from environments. As a result: 1. Pipelines and deployments automatically run against newly added resources. 2. New software releases or upgrades are automatically applied to relevant diff --git a/apps/docs/pages/core-concepts/overview.mdx b/apps/docs/pages/core-concepts/overview.mdx index 57f27e9c3..e401ea31d 100644 --- a/apps/docs/pages/core-concepts/overview.mdx +++ b/apps/docs/pages/core-concepts/overview.mdx @@ -10,16 +10,16 @@ import Youtube from "react-youtube"; -**Resources** are entities such as Kubernetes clusters, virtual machines, or other -logical resources, that the system interacts with. These resources can be added -manually or through **Resource Providers**, which automate the process by -continuously monitoring infrastructure, updating resource statuses, and providing -real-time visibility. Resources are organized into **Environments**, which -dynamically update based on resource filters, ensuring the right infrastructure is -always in place for deployments. +**Resources** are entities such as Kubernetes clusters, virtual machines, or +other logical resources, that the system interacts with. These resources can be +added manually or through **Resource Providers**, which automate the process by +continuously monitoring infrastructure, updating resource statuses, and +providing real-time visibility. Resources are organized into **Environments**, +which dynamically update based on resource filters, ensuring the right +infrastructure is always in place for deployments. -Once resources and environments are established, **Deployments** come into play. A -deployment is the process of releasing a specific version of a system into an +Once resources and environments are established, **Deployments** come into play. +A deployment is the process of releasing a specific version of a system into an environment. Each deployment is governed by **Environment Policies**, which manage how software transitions between environments. When a release is created, it generates a **Job**, which is executed by **Job Agents** that handle tasks diff --git a/apps/docs/pages/core-concepts/resources.mdx b/apps/docs/pages/core-concepts/resources.mdx index 7f7ba6c45..fa8d28a04 100644 --- a/apps/docs/pages/core-concepts/resources.mdx +++ b/apps/docs/pages/core-concepts/resources.mdx @@ -26,8 +26,8 @@ import Youtube from "react-youtube"; 1. **Creation:** - API-driven: Programmatically create Resources with custom configurations. - - Resource Providers: Automated discovery and registration based on predefined - criteria. + - Resource Providers: Automated discovery and registration based on + predefined criteria. 2. **Registration:** Link Resources to relevant Environments in Ctrlplane. @@ -58,7 +58,8 @@ import Youtube from "react-youtube"; ## Advanced Concepts -- **Dynamic Workflows:** Customize actions based on Resource type and Environment. +- **Dynamic Workflows:** Customize actions based on Resource type and + Environment. - **Complex Filtering:** Combine labels for granular workflow control. ## Resource Registration Details diff --git a/apps/docs/pages/core-concepts/resources/managing-resources.mdx b/apps/docs/pages/core-concepts/resources/managing-resources.mdx index 439a9b501..43478ffed 100644 --- a/apps/docs/pages/core-concepts/resources/managing-resources.mdx +++ b/apps/docs/pages/core-concepts/resources/managing-resources.mdx @@ -1,27 +1,27 @@ # Managing Resources As your adoption of Ctrlplane grows, you may find yourself managing hundreds or -even thousands of resources. This scale of operation requires efficient tools and -strategies to maintain visibility, control, and agility. Ctrlplane offers +even thousands of resources. This scale of operation requires efficient tools +and strategies to maintain visibility, control, and agility. Ctrlplane offers several features to help you manage large numbers of resources effectively. ## Resource Groups -Resource Groups are a powerful feature that allow you to organize and manage your -resources based on their metadata. This grouping mechanism makes it easy to +Resource Groups are a powerful feature that allow you to organize and manage +your resources based on their metadata. This grouping mechanism makes it easy to categorize and find similar resources, providing a more efficient way to manage your infrastructure at scale. ### How Resource Groups Work -Resource Groups use the metadata assigned to your resources to automatically group -them together. Each unique combination of metadata can form a distinct group, -allowing for flexible and dynamic categorization. +Resource Groups use the metadata assigned to your resources to automatically +group them together. Each unique combination of metadata can form a distinct +group, allowing for flexible and dynamic categorization. ### Creating Resource Groups -Resource Groups are created automatically based on the metadata you assign to your -resources. To effectively use Resource Groups: +Resource Groups are created automatically based on the metadata you assign to +your resources. To effectively use Resource Groups: 1. Plan your metadata strategy to reflect meaningful categories for your infrastructure. @@ -59,8 +59,8 @@ Resource Groups can be incredibly versatile. Here are some common use cases: ### Benefits of Using Resource Groups -1. **Improved Organization**: Easily manage large numbers of resources by grouping - them logically. +1. **Improved Organization**: Easily manage large numbers of resources by + grouping them logically. 2. **Efficient Operations**: Quickly identify and work with specific subsets of your infrastructure. 3. **Consistent Management**: Apply policies, updates, or actions to entire @@ -126,16 +126,16 @@ You can edit or delete existing views as your infrastructure evolves: - To delete a view, select it and use the delete option in the view management interface. -Resource Views are a valuable tool for maintaining organization and efficiency in -your resource management workflow, especially as your infrastructure grows in size -and complexity. +Resource Views are a valuable tool for maintaining organization and efficiency +in your resource management workflow, especially as your infrastructure grows in +size and complexity. ## Locking Resources Resource locking is a crucial feature that allows you to temporarily prevent any -pipelines from running against specific resources. This is particularly useful for -maintenance, troubleshooting, or when you need to ensure that a resource remains -in a stable state. +pipelines from running against specific resources. This is particularly useful +for maintenance, troubleshooting, or when you need to ensure that a resource +remains in a stable state. ### How Resource Locking Works diff --git a/apps/docs/pages/core-concepts/resources/metadata.mdx b/apps/docs/pages/core-concepts/resources/metadata.mdx index c731d03b1..1daa178b7 100644 --- a/apps/docs/pages/core-concepts/resources/metadata.mdx +++ b/apps/docs/pages/core-concepts/resources/metadata.mdx @@ -1,9 +1,9 @@ # Resource Metadata -Resource metadata in Ctrlplane are key-value pairs that provide a flexible way to -categorize and organize your deployment resources. They play a crucial role in -defining deployment strategies, filtering resources, and applying configurations -selectively. +Resource metadata in Ctrlplane are key-value pairs that provide a flexible way +to categorize and organize your deployment resources. They play a crucial role +in defining deployment strategies, filtering resources, and applying +configurations selectively. ## Configs vs Metadata @@ -14,20 +14,20 @@ sections in Kubernetes. ### Configs -Configs are essential for interacting with the resource and should be standardized -across all types of resources. This standardization ensures that if the same -pipeline is given two different resources of the same kind, it can use the -properties in the config to interact with them consistently. +Configs are essential for interacting with the resource and should be +standardized across all types of resources. This standardization ensures that if +the same pipeline is given two different resources of the same kind, it can use +the properties in the config to interact with them consistently. In some cases, you might need additional data outside the standard context to determine how to interact with the resource. In such scenarios, it is acceptable to include this extra data in the config, but it should be limited to variants of a given resource and should not impact the primary configuration or behavior. -In Ctrlplane, configs are used within CI/CD pipelines to interact with resources. -They define how to deploy or provision the resource. It is crucial that values in -the config are used to guide these interactions and not to store arbitrary -metadata. +In Ctrlplane, configs are used within CI/CD pipelines to interact with +resources. They define how to deploy or provision the resource. It is crucial +that values in the config are used to guide these interactions and not to store +arbitrary metadata. **Examples of Configs:** @@ -48,10 +48,10 @@ authenticating with the cluster. ### Metadata -Metadata in Ctrlplane is used to provide additional information about a resource. -It consists of key-value pairs that help categorize and organize resources. -Metadata is not used to define the behavior or configuration of the resource but -rather to describe it. +Metadata in Ctrlplane is used to provide additional information about a +resource. It consists of key-value pairs that help categorize and organize +resources. Metadata is not used to define the behavior or configuration of the +resource but rather to describe it. **Examples of Metadata:** @@ -82,8 +82,8 @@ requirements. ## Understanding Resource Metadata -Metadata is attached to resources, allowing you to group and select resources based -on various criteria. They are particularly useful for: +Metadata is attached to resources, allowing you to group and select resources +based on various criteria. They are particularly useful for: - Organizing resources by environment, region, or purpose - Applying configurations to specific groups of resources @@ -94,9 +94,10 @@ on various criteria. They are particularly useful for: 1. **Definition**: Metadata are defined as key-value pairs on individual resources. -2. **Flexibility**: You can assign multiple key-value pairs to a single resource. -3. **Querying**: Ctrlplane allows you to query and filter resources based on their - metadata. +2. **Flexibility**: You can assign multiple key-value pairs to a single + resource. +3. **Querying**: Ctrlplane allows you to query and filter resources based on + their metadata. 4. **Selective Application**: Use metadata to apply configurations or run deployments on specific subsets of resources. @@ -128,21 +129,22 @@ tier: backend 5. **Regular Review**: Periodically review and update your metadata strategy as your infrastructure evolves. -By effectively using resource metadata in Ctrlplane, you can create more flexible, -manageable, and scalable deployment strategies that adapt to your organization's -evolving needs. +By effectively using resource metadata in Ctrlplane, you can create more +flexible, manageable, and scalable deployment strategies that adapt to your +organization's evolving needs. ## Special Labels -In Ctrlplane, we have special labels that can be added to resources to enhance the -user experience in the UI. These labels do not change the core functionality of -Ctrlplane but provide additional features and visual cues for better usability. - -| Label | Description | -| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| `ctrlplane/links` | Provides a set of links related to the resource. The value should be a JSON object where the keys are the link names and the values are the URLs. | -| `ctrlplane/created-by-job-id` | UUID of the Ctrlplane Job that created the resource. | -| `ctrlplane/external-id` | An external identifier for the resource, which can be used to correlate the resource with resources in other systems. | -| `ctrlplane/cloud-platform` | The cloud platform the resource is running on (e.g., AWS, GCP, Azure). | -| `ctrlplane/region` | The geographical region or data center location where the resource is deployed. | -| `ctrlplane/parent-resource-id` | The UUID of the parent resource, if the resource is a child resource of another resource. | +In Ctrlplane, we have special labels that can be added to resources to enhance +the user experience in the UI. These labels do not change the core functionality +of Ctrlplane but provide additional features and visual cues for better +usability. + +| Label | Description | +| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctrlplane/links` | Provides a set of links related to the resource. The value should be a JSON object where the keys are the link names and the values are the URLs. | +| `ctrlplane/created-by-job-id` | UUID of the Ctrlplane Job that created the resource. | +| `ctrlplane/external-id` | An external identifier for the resource, which can be used to correlate the resource with resources in other systems. | +| `ctrlplane/cloud-platform` | The cloud platform the resource is running on (e.g., AWS, GCP, Azure). | +| `ctrlplane/region` | The geographical region or data center location where the resource is deployed. | +| `ctrlplane/parent-resource-id` | The UUID of the parent resource, if the resource is a child resource of another resource. | diff --git a/apps/docs/pages/core-concepts/resources/resource-providers.mdx b/apps/docs/pages/core-concepts/resources/resource-providers.mdx index 62b46a27d..e939b7c06 100644 --- a/apps/docs/pages/core-concepts/resources/resource-providers.mdx +++ b/apps/docs/pages/core-concepts/resources/resource-providers.mdx @@ -10,8 +10,8 @@ up-to-date representation of your deployment landscape. Resource Providers offer several key advantages over manual creation and management of resources: -1. **Automation:** Resource Providers eliminate the need for manual intervention, - saving time and reducing the potential for human error. +1. **Automation:** Resource Providers eliminate the need for manual + intervention, saving time and reducing the potential for human error. 2. **Dynamic Updates:** As your infrastructure evolves, resource providers automatically detect changes (e.g., new clusters, servers, or cloud resources) and update the corresponding resources in Ctrlplane. @@ -24,9 +24,9 @@ management of resources: ## How Resource Providers Work -1. **Discovery:** Resource Providers periodically scan your defined infrastructure - and external systems, identifying potential resources based on configured - criteria. +1. **Discovery:** Resource Providers periodically scan your defined + infrastructure and external systems, identifying potential resources based on + configured criteria. 2. **Registration:** When a new resource is discovered, the resource provider registers it in Ctrlplane, including relevant metadata such as labels and associated information. @@ -40,11 +40,11 @@ Ctrlplane supports various types of resource providers, including: - **Cloud Resource Providers:** These resource providers integrate with cloud platforms like AWS, Azure, and Google Cloud, discovering and registering resources such as virtual machines, Kubernetes clusters, and databases. -- **Kubernetes Resource Providers:** These resource providers specifically resource - Kubernetes environments, detecting clusters, namespaces, and other relevant - objects. -- **Infrastructure-as-Code Resource Providers:** These resource providers parse your - infrastructure-as-code definitions (e.g., Terraform, CloudFormation) to +- **Kubernetes Resource Providers:** These resource providers specifically + resource Kubernetes environments, detecting clusters, namespaces, and other + relevant objects. +- **Infrastructure-as-Code Resource Providers:** These resource providers parse + your infrastructure-as-code definitions (e.g., Terraform, CloudFormation) to identify and register resources. - **Custom Resource Providers:** You can create custom resource providers to integrate with any system or platform that exposes information about your diff --git a/apps/docs/pages/core-concepts/resources/schemas.mdx b/apps/docs/pages/core-concepts/resources/schemas.mdx index 6f4d0dd30..c8068c696 100644 --- a/apps/docs/pages/core-concepts/resources/schemas.mdx +++ b/apps/docs/pages/core-concepts/resources/schemas.mdx @@ -25,8 +25,8 @@ of your resource. ## Pre-built Schemas -Ctrlplane comes with a set of pre-built schemas for common resource types, saving -you time and effort in defining your own. These schemas cover widely used +Ctrlplane comes with a set of pre-built schemas for common resource types, +saving you time and effort in defining your own. These schemas cover widely used configurations, ensuring consistency and ease of use across different projects. ## Why Use Schema Registration? @@ -36,7 +36,8 @@ Schema registration offers several benefits: - **Consistency:** Enforces a uniform structure for resources of the same kind, ensuring predictable configuration across your deployments. - **Validation:** Automatically validates the configuration of new or updated - resources against the registered schema, preventing errors and inconsistencies. + resources against the registered schema, preventing errors and + inconsistencies. - **Documentation:** Provides a clear and structured definition of the expected configuration, aiding collaboration and understanding among team members. - **Versioning:** Allows for gradual evolution of your schemas without breaking diff --git a/apps/docs/pages/core-concepts/systems.mdx b/apps/docs/pages/core-concepts/systems.mdx index e0688f2e8..b37a63e64 100644 --- a/apps/docs/pages/core-concepts/systems.mdx +++ b/apps/docs/pages/core-concepts/systems.mdx @@ -99,8 +99,8 @@ Focus on these two crucial aspects: 1. **Deployment Resources:** Ensure that all deployments within a system share identical deployment resources. This is crucial because deployment pipelines - are structured to perform deployments on a uniform set of resources within the - system. + are structured to perform deployments on a uniform set of resources within + the system. 2. **Environments:** Ensure that all deployments within a system operate within the same environments and adhere to the same environment policies. diff --git a/apps/docs/pages/glossary.mdx b/apps/docs/pages/glossary.mdx index a7231cc3a..340aea2bf 100644 --- a/apps/docs/pages/glossary.mdx +++ b/apps/docs/pages/glossary.mdx @@ -3,9 +3,9 @@ **Deployment:** The core process of delivering software or applications to various environments and resources. -**Resource:** A specific destination or context where actions are performed during -a deployment. This can be infrastructure like an EKS cluster or a more abstract -concept like a custom object. +**Resource:** A specific destination or context where actions are performed +during a deployment. This can be infrastructure like an EKS cluster or a more +abstract concept like a custom object. **Environment:** A logical grouping of resources representing distinct stages in the software release process (e.g., QA, Staging, Production). @@ -22,8 +22,8 @@ rollback strategies. workflows, independent of specific environments. Can be triggered manually, via API, or on a schedule. -**Resource Provider:** An automated process that discovers, registers, and updates -resources by monitoring infrastructure and external systems. +**Resource Provider:** An automated process that discovers, registers, and +updates resources by monitoring infrastructure and external systems. **System:** A high-level category for grouping deployments that share common characteristics like environments and policies. diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx index aed3d097c..6041f16f9 100644 --- a/apps/docs/pages/index.mdx +++ b/apps/docs/pages/index.mdx @@ -79,8 +79,8 @@ your deployment orchestration needs: - **Sophisticated Rollouts**: Implement complex deployment patterns like canary releases and blue-green deployments. -- **Fine-grained Control**: Use labels and resource groups for precise deployment - resourceing. +- **Fine-grained Control**: Use labels and resource groups for precise + deployment resourceing. ### Scalability and Flexibility diff --git a/apps/pty-proxy/README.md b/apps/pty-proxy/README.md index 6597e7db8..5107a4473 100644 --- a/apps/pty-proxy/README.md +++ b/apps/pty-proxy/README.md @@ -1,4 +1,4 @@ -# Target Proxy Router +# Resource Proxy Router Simple router that redirects web terminal requests to instances and vis-versa. @@ -15,7 +15,7 @@ sequenceDiagram opt Init Agent AG->>PR: Connects to Proxy - PR->>CP: Register as target + PR->>CP: Register as resource AG->>PR: Sends heartbeat end diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/JobAgentsTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/JobAgentsTable.tsx index de56f9aa5..9bfdcc5e3 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/JobAgentsTable.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/JobAgentsTable.tsx @@ -40,10 +40,10 @@ const columns: ColumnDef[] = [ ]; export const JobAgentsTable: React.FC<{ - activeTargetIds?: string[]; + activeJobAgentIds?: string[]; jobAgents: JobAgent[]; - onTableRowClick?: (target: JobAgent) => void; -}> = ({ jobAgents, onTableRowClick, activeTargetIds }) => { + onTableRowClick?: (jobAgent: JobAgent) => void; +}> = ({ jobAgents, onTableRowClick, activeJobAgentIds }) => { const table = useReactTable({ data: jobAgents, columns, @@ -73,7 +73,8 @@ export const JobAgentsTable: React.FC<{ onTableRowClick?.(row.original)} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/integrations/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/integrations/page.tsx index 8dc15ea73..e4888ca1a 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/integrations/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/job-agents/integrations/page.tsx @@ -49,7 +49,7 @@ export default function AgentPage({

Grant our account the correct permissions and we will manage - running the target provider for you. + running the resource provider for you.

@@ -65,8 +65,8 @@ export default function AgentPage({

Self-hosted Agents

- Agents that you run in your own infrastructure, these target providers - will automatically register themselves with Ctrlplane. + Agents that you run in your own infrastructure, these resource + providers will automatically register themselves with Ctrlplane.

@@ -76,7 +76,7 @@ export default function AgentPage({
Custom

- Create custom target providers to import resources. + Create custom resource providers to import resources.

diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/jobs/JobsGettingStarted.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/jobs/JobsGettingStarted.tsx index 829d62178..5e1a32685 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/jobs/JobsGettingStarted.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(job)/jobs/JobsGettingStarted.tsx @@ -19,8 +19,8 @@ export const JobsGettingStarted: React.FC = () => {

With Ctrlplane, you can define, schedule, and monitor jobs across - various environments and targets. Jobs provide a standardized way to - manage and track your operations, ensuring consistency and + various environments and resources. Jobs provide a standardized way + to manage and track your operations, ensuring consistency and reliability across your entire infrastructure.

diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/layout.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/layout.tsx similarity index 84% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/layout.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/layout.tsx index 78d811945..60849e0b1 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/layout.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/layout.tsx @@ -22,7 +22,7 @@ import { import { CreateResourceViewDialog } from "~/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceConditionDialog"; import { api } from "~/trpc/react"; -export default function TargetLayout({ +export default function ResourceLayout({ children, params, }: { @@ -32,7 +32,7 @@ export default function TargetLayout({ const pathname = usePathname(); const { workspaceSlug } = params; const workspace = api.workspace.bySlug.useQuery(workspaceSlug); - const targets = api.resource.byWorkspaceId.list.useQuery( + const resources = api.resource.byWorkspaceId.list.useQuery( { workspaceId: workspace.data?.id ?? "", limit: 0 }, { enabled: workspace.isSuccess && workspace.data?.id !== "" }, ); @@ -40,7 +40,7 @@ export default function TargetLayout({ workspace.data?.id ?? "", { enabled: workspace.isSuccess && workspace.data?.id !== "" }, ); - const targetProviders = api.resource.provider.byWorkspaceId.useQuery( + const resourceProviders = api.resource.provider.byWorkspaceId.useQuery( workspace.data?.id ?? "", { enabled: workspace.isSuccess && workspace.data?.id !== "" }, ); @@ -62,20 +62,20 @@ export default function TargetLayout({ <>
- Targets + Resources
@@ -84,7 +84,7 @@ export default function TargetLayout({ className="rounded-full border-neutral-900 text-inherit" variant="outline" > - {targets.data?.total ?? "-"} + {resources.data?.total ?? "-"} @@ -92,13 +92,13 @@ export default function TargetLayout({ @@ -107,7 +107,7 @@ export default function TargetLayout({ className="rounded-full border-neutral-900 text-inherit" variant="outline" > - {targetProviders.data?.length ?? "-"} + {resourceProviders.data?.length ?? "-"} @@ -115,13 +115,13 @@ export default function TargetLayout({ @@ -138,13 +138,13 @@ export default function TargetLayout({ @@ -162,15 +162,15 @@ export default function TargetLayout({
- {!pathname.includes(`/${params.workspaceSlug}/target-views`) && ( - + {!pathname.includes(`/${params.workspaceSlug}/resource-views`) && ( + )} - {pathname.includes(`/${params.workspaceSlug}/target-views`) && ( + {pathname.includes(`/${params.workspaceSlug}/resource-views`) && ( Group Keys - Targets + Resources @@ -49,7 +49,7 @@ export const TargetGroupsTable: React.FC<{ className="cursor-pointer border-b-neutral-800/50" onClick={() => router.push( - `/${workspace.slug}/target-metadata-groups/${metadataGroup.resourceMetadataGroup.id}`, + `/${workspace.slug}/resource-metadata-groups/${metadataGroup.resourceMetadataGroup.id}`, ) } > diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/TargetMetadataGroupsGettingStarted.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/ResourceMetadataGroupsGettingStarted.tsx similarity index 70% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/TargetMetadataGroupsGettingStarted.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/ResourceMetadataGroupsGettingStarted.tsx index d7051c02b..6317a186b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/TargetMetadataGroupsGettingStarted.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/ResourceMetadataGroupsGettingStarted.tsx @@ -7,7 +7,7 @@ import { Button } from "@ctrlplane/ui/button"; import { CreateMetadataGroupDialog } from "./CreateMetadataGroupDialog"; -export const TargetMetadataGroupsGettingStarted: React.FC<{ +export const ResourceMetadataGroupsGettingStarted: React.FC<{ workspace: Workspace; }> = ({ workspace }) => { return ( @@ -16,19 +16,19 @@ export const TargetMetadataGroupsGettingStarted: React.FC<{
-
Target Metadata Groups
+
Resource Metadata Groups

- Target metadata groups allow you to organize and categorize your - targets based on specific metadata keys. By specifying key(s), you - can group all matching targets and organize them by their + Resource metadata groups allow you to organize and categorize your + resources based on specific metadata keys. By specifying key(s), you + can group all matching resources and organize them by their corresponding values.

This feature provides a powerful way to visualize and manage your infrastructure, allowing you to quickly identify and work with - groups of related targets. For example, you could group targets by - environment, region, or any other custom metadata you've defined. + groups of related resources. For example, you could group resources + by environment, region, or any other custom metadata you've defined.

diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/[groupId]/CombincationsTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/[groupId]/CombincationsTable.tsx similarity index 95% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/[groupId]/CombincationsTable.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/[groupId]/CombincationsTable.tsx index 485df9c81..5062a0bac 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/[groupId]/CombincationsTable.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/[groupId]/CombincationsTable.tsx @@ -25,7 +25,7 @@ export const CombinationsTable: React.FC<{ Combinations - Targets + Resources @@ -54,7 +54,7 @@ export const CombinationsTable: React.FC<{ ); query.set("filter", filterHash); return router.push( - `/${workspaceSlug}/targets?${query.toString()}`, + `/${workspaceSlug}/resources?${query.toString()}`, ); }} > diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/[groupId]/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/[groupId]/page.tsx similarity index 94% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/[groupId]/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/[groupId]/page.tsx index 950a92be4..f1f7084eb 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/[groupId]/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/[groupId]/page.tsx @@ -5,7 +5,7 @@ import { Badge } from "@ctrlplane/ui/badge"; import { api } from "~/trpc/server"; import { CombinationsTable } from "./CombincationsTable"; -export default async function TargetMetadataGroupPages({ +export default async function ResourceMetadataGroupPages({ params, }: { params: { workspaceSlug: string; groupId: string }; diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/page.tsx similarity index 78% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/page.tsx index 4643cbfa3..dd842d899 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-metadata-groups/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-metadata-groups/page.tsx @@ -4,10 +4,10 @@ import { Button } from "@ctrlplane/ui/button"; import { api } from "~/trpc/server"; import { CreateMetadataGroupDialog } from "./CreateMetadataGroupDialog"; -import { TargetGroupsTable } from "./TargetGroupTable"; -import { TargetMetadataGroupsGettingStarted } from "./TargetMetadataGroupsGettingStarted"; +import { ResourceGroupsTable } from "./ResourceGroupTable"; +import { ResourceMetadataGroupsGettingStarted } from "./ResourceMetadataGroupsGettingStarted"; -export default async function TargetMetadataGroupPages({ +export default async function ResourceMetadataGroupPages({ params, }: { params: { workspaceSlug: string }; @@ -18,7 +18,7 @@ export default async function TargetMetadataGroupPages({ const metadataGroups = await api.resource.metadataGroup.groups(workspace.id); if (metadataGroups.length === 0) - return ; + return ; return (
@@ -32,7 +32,7 @@ export default async function TargetMetadataGroupPages({
- diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/ProviderActionsDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/ProviderActionsDropdown.tsx similarity index 92% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/ProviderActionsDropdown.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/ProviderActionsDropdown.tsx index fe9254060..b65a7a1a1 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/ProviderActionsDropdown.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/ProviderActionsDropdown.tsx @@ -116,14 +116,14 @@ export const ProviderActionsDropdown: React.FC<{
  1. Delete only the provider: This will set the - provider field of its targets to null. The first provider to - add a target with the same identifier will become the new - owner. + provider field of its resources to null. The first provider + to add a resource with the same identifier will become the + new owner.
  2. - Delete both the provider and its targets:{" "} + Delete both the provider and its resources:{" "} This action is irreversible and will permanently remove the - provider along with all associated targets. + provider along with all associated resources.
@@ -140,7 +140,7 @@ export const ProviderActionsDropdown: React.FC<{ className={buttonVariants({ variant: "destructive" })} onClick={() => handleDelete(true)} > - Delete Provider and Targets + Delete Provider and Resources diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/TargetProvidersGettingStarted.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/ResourceProvidersGettingStarted.tsx similarity index 76% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/TargetProvidersGettingStarted.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/ResourceProvidersGettingStarted.tsx index b27ea0ee7..a5d33312f 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/TargetProvidersGettingStarted.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/ResourceProvidersGettingStarted.tsx @@ -6,7 +6,7 @@ import { IconPlug } from "@tabler/icons-react"; import { Button } from "@ctrlplane/ui/button"; -export const TargetProvidersGettingStarted: React.FC = () => { +export const ResourceProvidersGettingStarted: React.FC = () => { const { workspaceSlug } = useParams<{ workspaceSlug: string }>(); return (
@@ -14,11 +14,11 @@ export const TargetProvidersGettingStarted: React.FC = () => {
-
Target Provider
+
Resource Provider

- Target Providers are automated processes responsible for - discovering, registering, and updating targets. They continuously + Resource Providers are automated processes responsible for + discovering, registering, and updating resources. They continuously monitor your infrastructure and external systems, ensuring that Ctrlplane has an accurate and up-to-date representation of your deployment landscape. @@ -26,7 +26,7 @@ export const TargetProvidersGettingStarted: React.FC = () => {

diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/GoogleScanerConfig.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/GoogleScanerConfig.tsx similarity index 82% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/GoogleScanerConfig.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/GoogleScanerConfig.tsx index 2ce704cfd..38fe0d69c 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/GoogleScanerConfig.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/GoogleScanerConfig.tsx @@ -7,13 +7,13 @@ import { } from "@ctrlplane/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@ctrlplane/ui/tabs"; -export const GoogleTargetProviderConfig: React.FC = () => { +export const GoogleResourceProviderConfig: React.FC = () => { return ( - Google TargetProvider + Google Resource Provider - Scan common targets found in google cloud. + Scan common resources found in google cloud. @@ -43,10 +43,10 @@ export const GoogleTargetProviderConfig: React.FC = () => { - TARGET_PROVIDER_WORKSPACE + RESOURCE_PROVIDER_WORKSPACE (required){" "} - The workspace to register the target provider + The workspace to register the resource provider diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/TargetProviderSelectCard.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/ResourceProviderSelectCard.tsx similarity index 92% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/TargetProviderSelectCard.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/ResourceProviderSelectCard.tsx index daf41356f..dcf8ffe96 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/TargetProviderSelectCard.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/ResourceProviderSelectCard.tsx @@ -20,15 +20,16 @@ import { DropdownMenuTrigger, } from "@ctrlplane/ui/dropdown-menu"; -export const TargetProviderSelectCard: React.FC<{ +export const ResourceProviderSelectCard: React.FC<{ setValue: (v: string) => void; }> = ({ setValue }) => { return ( - Choose a target provider. + Choose a resource provider. - Ctrlplane comes with builtin target providers to help you get started. + Ctrlplane comes with builtin resource providers to help you get + started. diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/page.tsx similarity index 56% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/page.tsx index a56998c8c..41f198e9c 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/add/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/add/page.tsx @@ -10,64 +10,64 @@ import { import { cn } from "@ctrlplane/ui"; -import { GoogleTargetProviderConfig } from "./GoogleScanerConfig"; -import { TargetProviderSelectCard } from "./TargetProviderSelectCard"; +import { GoogleResourceProviderConfig } from "./GoogleScanerConfig"; +import { ResourceProviderSelectCard } from "./ResourceProviderSelectCard"; -export default function AddTargetProviderPage() { - const [targetProviderType, setTargetProviderType] = useState( - null, - ); +export default function AddResourceProviderPage() { + const [resourceProviderType, setResourceProviderType] = useState< + string | null + >(null); return (

- Add TargetProvider + Add resource provider

setTargetProviderType(null)} + onClick={() => setResourceProviderType(null)} className={cn( "flex items-center gap-4", - targetProviderType != null && + resourceProviderType != null && "cursor-pointer text-muted-foreground", )} >
- {targetProviderType == null ? ( + {resourceProviderType == null ? ( ) : ( )}
-
Select target provider target provider
+
Select resource provider
-
Configure target provider
+
Configure resource provider
- {targetProviderType == null && ( - + {resourceProviderType == null && ( + )} - {targetProviderType === "google" && } + {resourceProviderType === "google" && }
); } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/AwsActionButton.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/AwsActionButton.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/AwsActionButton.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/AwsActionButton.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/GoogleActionButton.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/GoogleActionButton.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/GoogleActionButton.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/GoogleActionButton.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/aws/AwsDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/aws/AwsDialog.tsx similarity index 99% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/aws/AwsDialog.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/aws/AwsDialog.tsx index 52b8eb57b..f0d7340f4 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/aws/AwsDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/aws/AwsDialog.tsx @@ -89,7 +89,7 @@ export const AwsDialog: React.FC<{ }); await utils.resource.provider.byWorkspaceId.invalidate(); router.refresh(); - router.push(`/${workspace.slug}/target-providers`); + router.push(`/${workspace.slug}/resource-providers`); }); return ( diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/aws/UpdateAwsProviderDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/aws/UpdateAwsProviderDialog.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/aws/UpdateAwsProviderDialog.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/aws/UpdateAwsProviderDialog.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/google/GoogleDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/google/GoogleDialog.tsx similarity index 99% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/google/GoogleDialog.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/google/GoogleDialog.tsx index 82ac87c32..a06295785 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/google/GoogleDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/google/GoogleDialog.tsx @@ -90,7 +90,7 @@ export const GoogleDialog: React.FC<{ }); await utils.resource.provider.byWorkspaceId.invalidate(); router.refresh(); - router.push(`/${workspace.slug}/target-providers`); + router.push(`/${workspace.slug}/resource-providers`); }); return ( diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/google/UpdateGoogleProviderDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/google/UpdateGoogleProviderDialog.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/google/UpdateGoogleProviderDialog.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/google/UpdateGoogleProviderDialog.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/page.tsx similarity index 51% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/page.tsx index 48e5622d8..88badb5c4 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/integrations/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/integrations/page.tsx @@ -18,7 +18,7 @@ import { AwsActionButton } from "./AwsActionButton"; import { GoogleActionButton } from "./GoogleActionButton"; export const metadata: Metadata = { - title: "Target Integrations | Ctrlplane", + title: "Resource Integrations | Ctrlplane", }; const Badge: React.FC<{ className?: string; children?: React.ReactNode }> = ({ @@ -39,7 +39,7 @@ const K8sBadge: React.FC = () => ( KubernetesAPI ); -const TargetProviderCard: React.FC<{ children: React.ReactNode }> = ({ +const ResourceProviderCard: React.FC<{ children: React.ReactNode }> = ({ children, }) => ( @@ -47,11 +47,11 @@ const TargetProviderCard: React.FC<{ children: React.ReactNode }> = ({ ); -const TargetProviderContent: React.FC<{ children: React.ReactNode }> = ({ +const ResourceProviderContent: React.FC<{ children: React.ReactNode }> = ({ children, }) =>
{children}
; -const TargetProviderActionButton: React.FC<{ children: React.ReactNode }> = ({ +const ResourceProviderActionButton: React.FC<{ children: React.ReactNode }> = ({ children, }) => ( ); -const TargetProviderHeading: React.FC<{ children: React.ReactNode }> = ({ +const ResourceProviderHeading: React.FC<{ children: React.ReactNode }> = ({ children, }) =>
{children}
; -const TargetProviderBadges: React.FC<{ children: React.ReactNode }> = ({ +const ResourceProviderBadges: React.FC<{ children: React.ReactNode }> = ({ children, }) =>
{children}
; -const TargetProviders: React.FC<{ workspaceSlug: string }> = async ({ +const ResourceProviders: React.FC<{ workspaceSlug: string }> = async ({ workspaceSlug, }) => { const workspace = await api.workspace.bySlug(workspaceSlug); @@ -75,146 +75,125 @@ const TargetProviders: React.FC<{ workspaceSlug: string }> = async ({ return (
-

Managed Target Providers

+

Managed Resource Providers

- Target providers built into Ctrlplane that don't require you to run + Resource providers built into Ctrlplane that don't require you to run anything.

- - - + + +
Amazon
-
+

Grant our account the correct permissions and we will manage - running the target provider for you. + running the resource provider for you.

- + - -
+ + -
+ - - - + + +
Google
-
+

Grant our service account permissions and we will manage running - the target provider for you. + the resource provider for you.

- + - -
+ + -
- {/* - - - - -
Azure
-
-

- Grant our service account permissions and we will manage running - the target provider for you. -

- - - -
- -
- -
-
*/} +
-

Self-hosted Target Providers

+

Self-hosted Resource Providers

- Target providers that you run in your own infrastructure, these target - providers will automatically register themselves with Ctrlplane. + Resource providers that you run in your own infrastructure, these + resource providers will automatically register themselves with + Ctrlplane.

- - - + + +
Custom
-
+

- Create custom target providers to import resources. + Create custom resource providers to import resources.

- + Open API - -
+ + - + Instructions - -
- - - + + + + +
Terraform Cloud
-
+

- Target provider terraform cloud workspaces. + Resource provider terraform cloud workspaces.

- + TerraformWorkspace - -
+ + - + Instructions - -
- - - + + + + +
Kubernetes Agent
-
+

Agent running on a cluster that can be used for scanning in namespaces.

- + KubernetesAPI KubernetesNamespace - -
+ + - + Instructions - -
+ +
); }; -export default function TargetProviderIntegrationsPage({ +export default function ResourceProviderIntegrationsPage({ params, }: { params: { workspaceSlug: string }; }) { - return ; + return ; } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/page.tsx similarity index 90% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/page.tsx index 95573f93a..74c6f04df 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-providers/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-providers/page.tsx @@ -25,13 +25,13 @@ import { ResourceFilterType } from "@ctrlplane/validators/resources"; import { api } from "~/trpc/server"; import { ProviderActionsDropdown } from "./ProviderActionsDropdown"; -import { TargetProvidersGettingStarted } from "./TargetProvidersGettingStarted"; +import { ResourceProvidersGettingStarted } from "./ResourceProvidersGettingStarted"; export const metadata: Metadata = { - title: "Target Providers | Ctrlplane", + title: "Resource Providers | Ctrlplane", }; -export default async function TargetProvidersPage({ +export default async function ResourceProvidersPage({ params, }: { params: { workspaceSlug: string }; @@ -40,20 +40,21 @@ export default async function TargetProvidersPage({ const workspace = await api.workspace.bySlug(workspaceSlug); if (workspace == null) return notFound(); - const targetProviders = await api.resource.provider.byWorkspaceId( + const resourceProviders = await api.resource.provider.byWorkspaceId( workspace.id, ); - if (targetProviders.length === 0) return ; + if (resourceProviders.length === 0) + return ; - const providers = targetProviders.map((provider) => { + const providers = resourceProviders.map((provider) => { const filter: ResourceCondition = { type: ResourceFilterType.Provider, value: provider.id, operator: "equals", }; const hash = LZString.compressToEncodedURIComponent(JSON.stringify(filter)); - const filterLink = `/${workspaceSlug}/targets?filter=${hash}`; + const filterLink = `/${workspaceSlug}/resources?filter=${hash}`; return { ...provider, filterLink }; }); @@ -93,7 +94,7 @@ export default async function TargetProvidersPage({ A custom provider is when you are running your own agent instead of using managed agents built inside Ctrlplane. Your agent directly calls Ctrlplane's - API to create targets. + API to create resources. @@ -123,7 +124,7 @@ export default async function TargetProvidersPage({ )) ) : ( - No targets + No resources )} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-views/TargetViewsTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-views/ResourceViewsTable.tsx similarity index 93% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-views/TargetViewsTable.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-views/ResourceViewsTable.tsx index 84f4fff6c..02066c1eb 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-views/TargetViewsTable.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-views/ResourceViewsTable.tsx @@ -17,7 +17,7 @@ import { import { ResourceConditionBadge } from "~/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceConditionBadge"; import { ResourceViewActionsDropdown } from "~/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceViewActionsDropdown"; -export const TargetViewsTable: React.FC<{ +export const ResourceViewsTable: React.FC<{ workspace: schema.Workspace; views: (schema.ResourceView & { total: number; hash: string })[]; }> = ({ views, workspace }) => { @@ -39,7 +39,7 @@ export const TargetViewsTable: React.FC<{ key={view.id} onClick={() => router.push( - `/${workspace.slug}/targets?filter=${view.hash}&view=${view.id}`, + `/${workspace.slug}/resources?filter=${view.hash}&view=${view.id}`, ) } className="cursor-pointer" diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-views/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-views/page.tsx similarity index 71% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-views/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-views/page.tsx index caab59757..b0c0d4090 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/target-views/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resource-views/page.tsx @@ -3,13 +3,13 @@ import { notFound } from "next/navigation"; import LZString from "lz-string"; import { api } from "~/trpc/server"; -import { TargetViewsTable } from "./TargetViewsTable"; +import { ResourceViewsTable } from "./ResourceViewsTable"; export const metadata: Metadata = { - title: "Target Views | Ctrlplane", + title: "Resource Views | Ctrlplane", }; -export default async function TargetViewsPage({ +export default async function ResourceViewsPage({ params, }: { params: { workspaceSlug: string }; @@ -23,5 +23,5 @@ export default async function TargetViewsPage({ hash: LZString.compressToEncodedURIComponent(JSON.stringify(view.filter)), })); - return ; + return ; } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/TargetGettingStarted.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/ResourceGettingStarted.tsx similarity index 50% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/TargetGettingStarted.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/ResourceGettingStarted.tsx index 50f3f516b..2e7b127ff 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/TargetGettingStarted.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/ResourceGettingStarted.tsx @@ -4,9 +4,9 @@ import { IconTopologyComplex } from "@tabler/icons-react"; import { Button, buttonVariants } from "@ctrlplane/ui/button"; -import { CreateTargetDialog } from "../../_components/CreateTarget"; +import { CreateResourceDialog } from "../../_components/CreateResource"; -export const TargetGettingStarted: React.FC<{ workspace: Workspace }> = ({ +export const ResourceGettingStarted: React.FC<{ workspace: Workspace }> = ({ workspace, }) => { return ( @@ -15,27 +15,27 @@ export const TargetGettingStarted: React.FC<{ workspace: Workspace }> = ({
-
Targets
+
Resources

- Targets are the destinations where your jobs are executed. They can - represent a wide range of entities, from a traditional - infrastructure target like an EKS cluster to a more abstract target - like a Salesforce account. + Resources are the destinations where your jobs are executed. They + can represent a wide range of entities, from a traditional + infrastructure resource like an EKS cluster to a more abstract + resource like a Salesforce account.

- To keep the status of targets up-to-date, they should be created by - providers. You can then attach metadata to these targets, allowing - Environments to easily filter and include them in specific + To keep the status of resources up-to-date, they should be created + by providers. You can then attach metadata to these resources, + allowing Environments to easily filter and include them in specific workflows.

- - - + + + = ({ workspace, view }) => { @@ -110,11 +110,11 @@ export const TargetPageContent: React.FC<{ ); const workspaceId = workspace.id; - const targetsAll = api.resource.byWorkspaceId.list.useQuery({ + const resourcesAll = api.resource.byWorkspaceId.list.useQuery({ workspaceId, limit: 0, }); - const targets = api.resource.byWorkspaceId.list.useQuery( + const resources = api.resource.byWorkspaceId.list.useQuery( { workspaceId, filter: filter ?? undefined, limit: 500 }, { placeholderData: (prev) => prev }, ); @@ -125,10 +125,10 @@ export const TargetPageContent: React.FC<{ if (!isEmptyCondition(cond)) setFilter(cond); }; - const { targetId, setTargetId } = useTargetDrawer(); + const { resourceId, setResourceId } = useResourceDrawer(); - if (targetsAll.isSuccess && targetsAll.data.total === 0) - return ; + if (resourcesAll.isSuccess && resourcesAll.data.total === 0) + return ; return (
@@ -166,7 +166,7 @@ export const TargetPageContent: React.FC<{ )}
- {!targets.isLoading && targets.isFetching && ( + {!resources.isLoading && resources.isFetching && ( )}
@@ -180,22 +180,22 @@ export const TargetPageContent: React.FC<{ )} - {targets.data?.total != null && ( + {resources.data?.total != null && (
Total: - {targets.data.total} + {resources.data.total}
)} - {targets.data != null && ( + {resources.data != null && (
- {targets.isLoading && ( + {resources.isLoading && (
{range(10).map((i) => ( )} - {targets.isSuccess && targets.data.total === 0 && ( + {resources.isSuccess && resources.data.total === 0 && ( setFilter(null)} /> )} - {targets.data != null && targets.data.total > 0 && ( + {resources.data != null && resources.data.total > 0 && (
- setTargetId(r.id)} + setResourceId(r.id)} />
)} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/TargetsTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/ResourcesTable.tsx similarity index 90% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/TargetsTable.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/ResourcesTable.tsx index 1820dd3a6..f724ce58f 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/TargetsTable.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/ResourcesTable.tsx @@ -34,7 +34,7 @@ import { TableRow, } from "@ctrlplane/ui/table"; -import { TargetIcon } from "~/app/[workspaceSlug]/(app)/_components/TargetIcon"; +import { ResourceIcon } from "~/app/[workspaceSlug]/(app)/_components/ResourceIcon"; import { api } from "~/trpc/react"; const columns: ColumnDef[] = [ @@ -84,7 +84,7 @@ const columns: ColumnDef[] = [
{isLocked && } {!isLocked && ( - @@ -111,15 +111,15 @@ const columns: ColumnDef[] = [ }, ]; -export const TargetsTable: React.FC<{ - activeTargetIds?: string[]; - targets: Resource[]; - onTableRowClick?: (target: Resource) => void; -}> = ({ targets, onTableRowClick, activeTargetIds }) => { - const deleteTargetsMutation = api.resource.delete.useMutation(); +export const ResourcesTable: React.FC<{ + activeResourceIds?: string[]; + resources: Resource[]; + onTableRowClick?: (resource: Resource) => void; +}> = ({ resources, onTableRowClick, activeResourceIds }) => { + const deleteResourcesMutation = api.resource.delete.useMutation(); const table = useReactTable({ - data: targets, + data: resources, columns, defaultColumn: { minSize: 0, @@ -130,11 +130,11 @@ export const TargetsTable: React.FC<{ }); const utils = api.useUtils(); - const handleDeleteTargets = async () => { - const selectedTargets = table + const handleDeleteResources = async () => { + const selectedResources = table .getSelectedRowModel() .rows.map((row) => row.original.id); - await deleteTargetsMutation.mutateAsync(selectedTargets); + await deleteResourcesMutation.mutateAsync(selectedResources); await utils.resource.byWorkspaceId.invalidate(); table.toggleAllRowsSelected(false); }; @@ -172,7 +172,7 @@ export const TargetsTable: React.FC<{ Are you sure? This action cannot be undone. This will permanently delete - the selected targets. + the selected resources. Cancel Delete diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/ReleaseCell.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/ReleaseCell.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/ReleaseCell.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/ReleaseCell.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/layout.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/layout.tsx similarity index 90% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/layout.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/layout.tsx index 4432bee9b..6c628fc95 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/layout.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/layout.tsx @@ -11,15 +11,15 @@ import { navigationMenuTriggerStyle, } from "@ctrlplane/ui/navigation-menu"; -export default function TargetLayout({ +export default function ResourceLayout({ children, params, }: { - params: { workspaceSlug: string; targetId: string }; + params: { workspaceSlug: string; resourceId: string }; children: React.ReactNode; }) { const pathname = usePathname(); - const baseUrl = `/${params.workspaceSlug}/targets/${params.targetId}`; + const baseUrl = `/${params.workspaceSlug}/resources/${params.resourceId}`; return ( <>
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/page.tsx similarity index 75% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/page.tsx index 83fbedbb9..c300d6cf0 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/page.tsx @@ -24,10 +24,9 @@ import { api } from "~/trpc/react"; import { useMatchSorterWithSearch } from "~/utils/useMatchSorter"; import { ReleaseCell } from "./ReleaseCell"; -const DeploymentsTable: React.FC<{ targetId: string }> = ({ targetId }) => { - const resourceId = targetId; +const DeploymentsTable: React.FC<{ resourceId: string }> = ({ resourceId }) => { const jobs = api.job.byResourceId.useQuery(resourceId); - const deployments = api.deployment.byTargetId.useQuery(resourceId); + const deployments = api.deployment.byResourceId.useQuery(resourceId); return ( @@ -69,7 +68,7 @@ const DeploymentsTable: React.FC<{ targetId: string }> = ({ targetId }) => { ); }; -const TargetMetadataInfo: React.FC<{ metadata: Record }> = ( +const ResourceMetadataInfo: React.FC<{ metadata: Record }> = ( props, ) => { const metadata = Object.entries(props.metadata).sort(([keyA], [keyB]) => @@ -102,24 +101,25 @@ const TargetMetadataInfo: React.FC<{ metadata: Record }> = ( ); }; -export default function TargetPage({ +export default function ResourcePage({ params, }: { - params: { targetId: string }; + params: { resourceId: string }; }) { - const resourceId = params.targetId; - const target = api.resource.byId.useQuery(resourceId); + const resourceId = params.resourceId; + const resource = api.resource.byId.useQuery(resourceId); const jobs = api.job.byResourceId.useQuery(resourceId); - const deployments = api.deployment.byTargetId.useQuery(resourceId); + const deployments = api.deployment.byResourceId.useQuery(resourceId); - const unlockTarget = api.resource.unlock.useMutation(); - const lockTarget = api.resource.lock.useMutation(); + const unlockResource = api.resource.unlock.useMutation(); + const lockResource = api.resource.lock.useMutation(); const utils = api.useUtils(); - const isLoading = target.isLoading || jobs.isLoading || deployments.isLoading; + const isLoading = + resource.isLoading || jobs.isLoading || deployments.isLoading; - if (!target.isLoading && target.data == null) notFound(); + if (!resource.isLoading && resource.data == null) notFound(); if (isLoading) return (
@@ -131,20 +131,24 @@ export default function TargetPage({
- {target.data?.name} - {target.data != null && ( + {resource.data?.name} + {resource.data != null && (
- + - + - + - {target.isSuccess && ( + {resource.isSuccess && ( <> - {target.data?.provider != null ? ( - target.data.provider.name + {resource.data?.provider != null ? ( + resource.data.provider.name ) : ( @@ -202,9 +206,9 @@ export default function TargetPage({

- The next target provider to insert a target with - the same identifier will become the owner of this - target. + The next resource provider to insert a resource + with the same identifier will become the owner of + this resource.

@@ -217,8 +221,8 @@ export default function TargetPage({
@@ -227,7 +231,7 @@ export default function TargetPage({
Metadata
- +
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/variables/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/variables/page.tsx similarity index 88% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/variables/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/variables/page.tsx index aa5a3db2a..f86419335 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/variables/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/variables/page.tsx @@ -30,13 +30,12 @@ const VariableRow: React.FC<{ ); export default function VariablePage({ - params, + params: { resourceId }, }: { - params: { targetId: string }; + params: { resourceId: string }; }) { - const resourceId = params.targetId; - const deployments = api.deployment.byTargetId.useQuery(resourceId); - const variables = api.deployment.variable.byTargetId.useQuery(resourceId); + const deployments = api.deployment.byResourceId.useQuery(resourceId); + const variables = api.deployment.variable.byResourceId.useQuery(resourceId); return (
{deployments.data?.map((deployment) => { diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/DepEdge.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/DepEdge.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/DepEdge.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/DepEdge.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/ResourceVisualizationDiagram.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/ResourceVisualizationDiagram.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/ResourceVisualizationDiagram.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/ResourceVisualizationDiagram.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/edges.ts b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/edges.ts similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/edges.ts rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/edges.ts diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/DeploymentNode.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/DeploymentNode.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/DeploymentNode.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/DeploymentNode.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/EnvironmentNode.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/EnvironmentNode.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/EnvironmentNode.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/EnvironmentNode.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/ProviderNode.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/ProviderNode.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/ProviderNode.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/ProviderNode.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/ResourceNode.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/ResourceNode.tsx similarity index 82% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/ResourceNode.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/ResourceNode.tsx index 55a0372c3..fc1008e4b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/[targetId]/visualize/nodes/ResourceNode.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/[resourceId]/visualize/nodes/ResourceNode.tsx @@ -3,8 +3,8 @@ import { Handle, Position } from "reactflow"; import { cn } from "@ctrlplane/ui"; -import { useTargetDrawer } from "~/app/[workspaceSlug]/(app)/_components/target-drawer/useTargetDrawer"; -import { TargetIcon as ResourceIcon } from "~/app/[workspaceSlug]/(app)/_components/TargetIcon"; +import { useResourceDrawer } from "~/app/[workspaceSlug]/(app)/_components/resource-drawer/useResourceDrawer"; +import { ResourceIcon } from "~/app/[workspaceSlug]/(app)/_components/ResourceIcon"; type ResourceNodeProps = NodeProps<{ name: string; @@ -16,7 +16,7 @@ type ResourceNodeProps = NodeProps<{ }>; export const ResourceNode: React.FC = (node) => { const { data } = node; - const { setTargetId: setResourceId } = useTargetDrawer(); + const { setResourceId } = useResourceDrawer(); return ( <>
; + return ; } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/exportResources.ts b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/exportResources.ts similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/exportResources.ts rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/exportResources.ts diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/page.tsx similarity index 70% rename from apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/page.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/page.tsx index 350851a82..5e31421f2 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/(targets)/targets/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(resources)/resources/page.tsx @@ -2,13 +2,13 @@ import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { api } from "~/trpc/server"; -import { TargetPageContent } from "./TargetPageContent"; +import { ResourcePageContent } from "./ResourcePageContent"; export const metadata: Metadata = { - title: "Targets | Ctrlplane", + title: "Resources | Ctrlplane", }; -export default async function TargetsPage({ +export default async function ResourcesPage({ params, searchParams, }: { @@ -23,5 +23,5 @@ export default async function TargetsPage({ ? await api.resource.view.byId(searchParams.view) : null; - return ; + return ; } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarContent.tsx index 672a323d8..583cc468a 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarContent.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarContent.tsx @@ -41,19 +41,19 @@ const navMain = (prefix: string) => [ items: [ { title: "List", - url: `${prefix}/targets`, + url: `${prefix}/resources`, }, { title: "Providers", - url: `${prefix}/target-providers`, + url: `${prefix}/resource-providers`, }, { title: "Groups", - url: `${prefix}/target-metadata-groups`, + url: `${prefix}/resource-metadata-groups`, }, { title: "Views", - url: `${prefix}/target-views`, + url: `${prefix}/resource-views`, }, ], }, diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarCreateMenu.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarCreateMenu.tsx index 00522fc0b..94803ceaa 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarCreateMenu.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarCreateMenu.tsx @@ -19,8 +19,8 @@ import { CreateSessionDialog } from "~/app/terminal/CreateDialogSession"; import { api } from "~/trpc/react"; import { CreateDeploymentDialog } from "./_components/CreateDeployment"; import { CreateReleaseDialog } from "./_components/CreateRelease"; +import { CreateResourceDialog } from "./_components/CreateResource"; import { CreateSystemDialog } from "./_components/CreateSystem"; -import { CreateTargetDialog } from "./_components/CreateTarget"; export const AppSidebarCreateMenu: React.FC<{ workspace: Workspace; @@ -103,14 +103,14 @@ export const AppSidebarCreateMenu: React.FC<{ - setOpen(false)} > e.preventDefault()}> - Bootstrap Target + Bootstrap Resource - + diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarPopoverResources.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarPopoverResources.tsx index 77bd46598..dc11ca15d 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarPopoverResources.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/AppSidebarPopoverResources.tsx @@ -26,8 +26,8 @@ import { import { ResourceFilterType } from "@ctrlplane/validators/resources"; import { api } from "~/trpc/react"; -import { TargetIcon } from "./_components/TargetIcon"; -import { SearchInput } from "./(targets)/targets/TargetPageContent"; +import { ResourceIcon } from "./_components/ResourceIcon"; +import { SearchInput } from "./(resources)/resources/ResourcePageContent"; import { useSidebarPopover } from "./AppSidebarPopoverContext"; export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ @@ -74,7 +74,7 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ limit: filter == null ? 10 : undefined, }); - const totalTargets = + const totalResources = (recentlyAdded.data?.total ?? 0) - (recentlyAdded.data?.items.length ?? 0); return ( @@ -92,13 +92,13 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ setActiveSidebarItem(null)} > - @@ -107,16 +107,16 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ ))} - {totalTargets > 0 && ( + {totalResources > 0 && ( setActiveSidebarItem(null)} > - View {totalTargets} other targets + View {totalResources} other resources )} @@ -138,7 +138,7 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ {viewsWithHash.map(({ id, name, hash }) => ( setActiveSidebarItem(null)} > @@ -155,7 +155,7 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ Kinds {kinds.data?.map(({ version, kind, count }) => { - const url = `/${workspace.slug}/targets?filter=${LZString.compressToEncodedURIComponent( + const url = `/${workspace.slug}/resources?filter=${LZString.compressToEncodedURIComponent( JSON.stringify({ type: FilterType.Comparison, operator: ComparisonOperator.And, @@ -178,7 +178,7 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ href={url} onClick={() => setActiveSidebarItem(null)} > - + {kind} = ({ setActiveSidebarItem(null)} > - @@ -220,10 +220,10 @@ export const AppSidebarResourcesPopover: React.FC<{ workspace: Workspace }> = ({ className="pl-2 text-[0.02em] text-muted-foreground" > setActiveSidebarItem(null)} > - View {totalTargets} other targets + View {totalResources} other resources diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateRelease.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateRelease.tsx index f7aa9f278..85b19d03b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateRelease.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateRelease.tsx @@ -137,7 +137,7 @@ export const CreateReleaseDialog: React.FC<{ const numOfReleaseJobTriggers = release.releaseJobTriggers.length; toast( numOfReleaseJobTriggers === 0 - ? `No targets to deploy release too.` + ? `No resources to deploy release too.` : `Dispatching ${release.releaseJobTriggers.length} job configuration${release.releaseJobTriggers.length > 1 ? "s" : ""}.`, { dismissible: true, duration: 2_000 }, ); @@ -242,8 +242,8 @@ export const CreateReleaseDialog: React.FC<{
- Dependencies must be fulfilled for a target before this Release - can be applied to that target. Read more about release + Dependencies must be fulfilled for a resource before this + Release can be applied to that resource. Read more about release dependencies here. diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateTarget.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateResource.tsx similarity index 90% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateTarget.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateResource.tsx index 79da27222..c7bacafd7 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateTarget.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/CreateResource.tsx @@ -35,7 +35,7 @@ import { Label } from "@ctrlplane/ui/label"; import { api } from "~/trpc/react"; import { ConfigEditor } from "./ConfigEditor"; -const createTargetSchema = z.object({ +const createResourceSchema = z.object({ name: z.string(), kind: z.string(), identifier: z.string().min(4), @@ -61,7 +61,7 @@ const defaultValues = { config: "", }; -export const CreateTargetDialog: React.FC<{ +export const CreateResourceDialog: React.FC<{ children: React.ReactNode; workspace: Workspace; onSuccess?: () => void; @@ -69,7 +69,7 @@ export const CreateTargetDialog: React.FC<{ const [open, setOpen] = useState(false); const form = useForm({ - schema: createTargetSchema, + schema: createResourceSchema, defaultValues, mode: "onSubmit", }); @@ -82,7 +82,7 @@ export const CreateTargetDialog: React.FC<{ const create = api.resource.create.useMutation(); const onSubmit = form.handleSubmit(async (data) => { const config = yaml.load(data.config) as Record; - const target = await create.mutateAsync({ + const resource = await create.mutateAsync({ ...data, config, metadata: Object.fromEntries( @@ -92,7 +92,7 @@ export const CreateTargetDialog: React.FC<{ }); const query = new URLSearchParams(window.location.search); - query.set("target_id", target.id); + query.set("resource_id", resource.id); router.replace(`?${query.toString()}`); router.refresh(); setOpen(false); @@ -111,11 +111,11 @@ export const CreateTargetDialog: React.FC<{
- Bootstrap Target + Bootstrap Resource - Targets are typically created automatically through scanners - that discover and register new targets in your infrastructure. - However, you can manually bootstrap a target if needed. + Resources are typically created automatically through scanners + that discover and register new resources in your infrastructure. + However, you can manually bootstrap a resource if needed. @@ -126,7 +126,7 @@ export const CreateTargetDialog: React.FC<{ Name - + @@ -140,7 +140,7 @@ export const CreateTargetDialog: React.FC<{ Identifier - + @@ -169,7 +169,7 @@ export const CreateTargetDialog: React.FC<{ Kind - + @@ -244,7 +244,7 @@ export const CreateTargetDialog: React.FC<{ diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/EditTarget.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/EditResource.tsx similarity index 87% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/EditTarget.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/EditResource.tsx index f7034337e..36b65a0b3 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/EditTarget.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/EditResource.tsx @@ -34,11 +34,11 @@ import { Label } from "@ctrlplane/ui/label"; import { api } from "~/trpc/react"; import { ConfigEditor } from "./ConfigEditor"; -type TargetWithMetadata = Resource & { +type ResourceWithMetadata = Resource & { metadata: Record; }; -const editTargetSchema = z.object({ +const editResourceSchema = z.object({ name: z.string(), kind: z.string(), identifier: z.string().min(4), @@ -71,28 +71,25 @@ const editTargetSchema = z.object({ ), }); -const defaultValues = (target: TargetWithMetadata) => ({ - name: target.name, - kind: target.kind, - identifier: target.identifier, - version: target.version, - config: yaml.dump(target.config), - metadata: Object.entries(target.metadata).map(([key, value]) => ({ +const defaultValues = (resource: ResourceWithMetadata) => ({ + ...resource, + config: yaml.dump(resource.config), + metadata: Object.entries(resource.metadata).map(([key, value]) => ({ key, value, })), }); -export const EditTargetDialog: React.FC<{ +export const EditResourceDialog: React.FC<{ children: React.ReactNode; - target: TargetWithMetadata; + resource: ResourceWithMetadata; onSuccess?: () => void; -}> = ({ children, target, onSuccess }) => { +}> = ({ children, resource, onSuccess }) => { const [open, setOpen] = useState(false); const form = useForm({ - schema: editTargetSchema, - defaultValues: defaultValues(target), + schema: editResourceSchema, + defaultValues: defaultValues(resource), mode: "onSubmit", }); @@ -106,7 +103,7 @@ export const EditTargetDialog: React.FC<{ ); update .mutateAsync({ - id: target.id, + id: resource.id, data: { ...data, config, metadata }, }) .then(() => { @@ -116,7 +113,7 @@ export const EditTargetDialog: React.FC<{ }) .catch(() => { form.setError("root", { - message: "Failed to update target. Please check your input.", + message: "Failed to update resource. Please check your input.", }); }); }); @@ -133,10 +130,10 @@ export const EditTargetDialog: React.FC<{
- Edit Target + Edit Resource - You can edit the target details below. Fields marked as optional - may not be required. + You can edit the resource details below. Fields marked as + optional may not be required. @@ -147,7 +144,7 @@ export const EditTargetDialog: React.FC<{ Name - + @@ -161,14 +158,13 @@ export const EditTargetDialog: React.FC<{ Identifier - + )} /> - {/* {!target.providerId && ( */} <>
- {/* )} */} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/TargetIcon.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/ResourceIcon.tsx similarity index 94% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/TargetIcon.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/ResourceIcon.tsx index 9b396fc06..a848f02c1 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/TargetIcon.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/ResourceIcon.tsx @@ -12,7 +12,7 @@ import { IconUsersGroup, } from "@tabler/icons-react"; -export const TargetIcon: React.FC<{ version: string; kind?: string }> = ({ +export const ResourceIcon: React.FC<{ version: string; kind?: string }> = ({ version, kind, }) => { diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/SearchDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/SearchDialog.tsx index dd985b03f..2dd720912 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/SearchDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/SearchDialog.tsx @@ -30,7 +30,7 @@ export const SearchDialog: React.FC<{ children: React.ReactNode }> = ({ { workspaceId: workspace.data?.id ?? "" }, { enabled: workspace.isSuccess }, ); - const targets = api.resource.byWorkspaceId.list.useQuery( + const resources = api.resource.byWorkspaceId.list.useQuery( { workspaceId: workspace.data?.id ?? "", filter: @@ -85,20 +85,20 @@ export const SearchDialog: React.FC<{ children: React.ReactNode }> = ({ ))} - {targets.data?.total !== 0 && ( + {resources.data?.total !== 0 && ( <> - - {targets.data?.items.slice(0, 5).map((target) => ( + + {resources.data?.items.slice(0, 5).map((resource) => ( - {target.name} + {resource.name} ))} - {(targets.data?.total ?? 0) > 5 && ( + {(resources.data?.total ?? 0) > 5 && ( . . . )} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx index 0f8450b5d..ce12fd303 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx @@ -59,7 +59,7 @@ export const DeploymentResourceDrawer: React.FC = () => { operator: ComparisonOperator.And, conditions: [ { - type: JobFilterType.JobTarget, + type: JobFilterType.JobResource, operator: ColumnOperator.Equals, value: resourceId ?? "", }, diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/TableRow.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/TableRow.tsx index 8863993ea..41fa7a00c 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/TableRow.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/TableRow.tsx @@ -98,7 +98,7 @@ const DropdownCell: React.FC = ({ { label="Overview" /> setTab(EnvironmentDrawerTab.Targets)} + active={tab === EnvironmentDrawerTab.Resources} + onClick={() => setTab(EnvironmentDrawerTab.Resources)} icon={} - label="Targets" + label="Resources" /> { {(tab === EnvironmentDrawerTab.Overview || tab == null) && ( )} - {tab === EnvironmentDrawerTab.Targets && workspace != null && ( - - )} + {tab === EnvironmentDrawerTab.Resources && + workspace != null && ( + + )} {tab === EnvironmentDrawerTab.ReleaseChannels && deployments != null && ( void; + onChange: (resourceCondition: ResourceCondition) => void; }> = ({ workspaceId, onChange }) => { - const targetViewsQ = api.resource.view.list.useQuery(workspaceId, { + const resourceViewsQ = api.resource.view.list.useQuery(workspaceId, { enabled: workspaceId !== "", }); - const targetViews = targetViewsQ.data ?? []; + const resourceViews = resourceViewsQ.data ?? []; const [open, setOpen] = useState(false); return ( @@ -64,30 +64,30 @@ const TargetViewsCombobox: React.FC<{ className="flex items-center gap-2" > - From target view... + From resource view... - + - {targetViewsQ.isLoading && ( + {resourceViewsQ.isLoading && ( - Loading target views... + Loading resource views... )} - {targetViews.map((targetView) => ( + {resourceViews.map((resourceView) => ( { - onChange(targetView.filter); + onChange(resourceView.filter); setOpen(false); }} className="cursor-pointer" > - {targetView.name} ({targetView.total} targets) + {resourceView.name} ({resourceView.total} resources) ))} @@ -99,21 +99,21 @@ const TargetViewsCombobox: React.FC<{ }; const filterForm = z.object({ - targetFilter: resourceCondition.optional(), + resourceFilter: resourceCondition.optional(), }); const getFilter = ( - targetFilter: ResourceCondition | null, + resourceFilter: ResourceCondition | null, ): ResourceCondition | undefined => { - if (targetFilter == null) return undefined; - if (!isComparisonCondition(targetFilter)) + if (resourceFilter == null) return undefined; + if (!isComparisonCondition(resourceFilter)) return { type: FilterType.Comparison, operator: ComparisonOperator.And, not: false, - conditions: [targetFilter], + conditions: [resourceFilter], }; - return targetFilter; + return resourceFilter; }; export const EditFilterForm: React.FC<{ @@ -124,13 +124,13 @@ export const EditFilterForm: React.FC<{ const update = api.environment.update.useMutation(); const form = useForm({ schema: filterForm, - defaultValues: { targetFilter: getFilter(environment.resourceFilter) }, + defaultValues: { resourceFilter: getFilter(environment.resourceFilter) }, }); - const { targetFilter } = form.watch(); + const { resourceFilter } = form.watch(); - const filter = targetFilter ?? undefined; - const targets = api.resource.byWorkspaceId.list.useQuery( + const filter = resourceFilter ?? undefined; + const resources = api.resource.byWorkspaceId.list.useQuery( { workspaceId, filter, limit: 10 }, { enabled: workspaceId !== "" }, ); @@ -141,7 +141,7 @@ export const EditFilterForm: React.FC<{ update .mutateAsync({ id: environment.id, - data: { ...data, resourceFilter: targetFilter ?? null }, + data: { ...data, resourceFilter: resourceFilter ?? null }, }) .then(() => form.reset(data)) .then(() => utils.environment.bySystemId.invalidate(environment.systemId)) @@ -154,18 +154,18 @@ export const EditFilterForm: React.FC<{
( - Target Filter + Resource Filter <> - @@ -187,12 +187,12 @@ export const EditFilterForm: React.FC<{ > Save - {targetFilter != null && ( + {resourceFilter != null && (
- {targetFilter != null && - targets.data != null && - targets.data.total > 0 && ( + {resourceFilter != null && + resources.data != null && + resources.data.total > 0 && (
- +
- {targets.data.items.map((target) => ( -
- + {resources.data.items.map((resource) => ( +
+
- {target.name} + {resource.name} - {target.version} + {resource.version}
@@ -228,9 +231,9 @@ export const EditFilterForm: React.FC<{
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment-policy-drawer/ApprovalAndGovernance.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment-policy-drawer/ApprovalAndGovernance.tsx index aee552423..63e1d7649 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment-policy-drawer/ApprovalAndGovernance.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment-policy-drawer/ApprovalAndGovernance.tsx @@ -100,10 +100,10 @@ export const ApprovalAndGovernance: React.FC<{
Previous Deploy Status - Specify a minimum number of targets in dependent environments - to successfully be deployed to before triggering a release. - For example, specifying that all targets in QA must be - deployed to before releasing to PROD. + Specify a minimum number of resources in dependent + environments to successfully be deployed to before triggering + a release. For example, specifying that all resources in QA + must be deployed to before releasing to PROD.
@@ -113,7 +113,7 @@ export const ApprovalAndGovernance: React.FC<{ - All targets in dependent environments must complete + All resources in dependent environments must complete successfully @@ -135,7 +135,7 @@ export const ApprovalAndGovernance: React.FC<{ } className="border-b-1 h-6 w-16 text-xs" /> - targets must be successfully deployed to + resources must be successfully deployed to diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobComparisonConditionRender.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobComparisonConditionRender.tsx index 7a18b8559..00e66e6a8 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobComparisonConditionRender.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobComparisonConditionRender.tsx @@ -309,13 +309,13 @@ export const JobComparisonConditionRender: React.FC< addCondition({ - type: JobFilterType.JobTarget, + type: JobFilterType.JobResource, operator: ColumnOperator.Equals, value: "", }) } > - Target + Resource diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionBadge.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionBadge.tsx index df58d4628..ce9c55d40 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionBadge.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionBadge.tsx @@ -8,7 +8,7 @@ import type { DeploymentCondition, EnvironmentCondition, JobCondition, - JobTargetCondition, + JobResourceCondition, StatusCondition, } from "@ctrlplane/validators/jobs"; import React from "react"; @@ -34,7 +34,7 @@ import { isCreatedAtCondition, isDeploymentCondition, isEnvironmentCondition, - isJobTargetCondition, + isJobResourceCondition, isMetadataCondition, isStatusCondition, isVersionCondition, @@ -246,19 +246,19 @@ const StringifiedVersionCondition: React.FC<{ ); -const StringifiedJobTargetCondition: React.FC<{ - condition: JobTargetCondition; +const StringifiedJobResourceCondition: React.FC<{ + condition: JobResourceCondition; }> = ({ condition }) => { - const targetQ = api.resource.byId.useQuery(condition.value); - const target = targetQ.data; + const resourceQ = api.resource.byId.useQuery(condition.value); + const resource = resourceQ.data; return ( - target + resource {operatorVerbs[condition.operator]} - {noCase(target?.name ?? "")} + {noCase(resource?.name ?? "")} ); }; @@ -301,8 +301,8 @@ const StringifiedJobCondition: React.FC<{ if (isVersionCondition(condition)) return ; - if (isJobTargetCondition(condition)) - return ; + if (isJobResourceCondition(condition)) + return ; return null; }; diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionRender.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionRender.tsx index dac3c412a..238e76964 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionRender.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-condition/JobConditionRender.tsx @@ -6,7 +6,7 @@ import { isCreatedAtCondition, isDeploymentCondition, isEnvironmentCondition, - isJobTargetCondition, + isJobResourceCondition, isMetadataCondition, isStatusCondition, isVersionCondition, @@ -18,7 +18,7 @@ import { EnvironmentConditionRender } from "./EnvironmentConditionRender"; import { JobComparisonConditionRender } from "./JobComparisonConditionRender"; import { JobCreatedAtConditionRender } from "./JobCreatedAtConditionRender"; import { JobMetadataConditionRender } from "./JobMetadataConditionRender"; -import { JobTargetConditionRender } from "./JobTargetConditionRender"; +import { JobResourceConditionRender } from "./JobResourceConditionRender"; import { StatusConditionRender } from "./StatusConditionRender"; import { JobReleaseVersionConditionRender } from "./VersionConditionRender"; @@ -95,9 +95,9 @@ export const JobConditionRender: React.FC< /> ); - if (isJobTargetCondition(condition)) + if (isJobResourceCondition(condition)) return ( - +export const JobResourceConditionRender: React.FC< + JobConditionRenderProps > = ({ condition, onChange, className }) => { const [search, setSearch] = useState(""); const [searchDebounced, setSearchDebounced] = useState(""); useDebounce(() => setSearchDebounced(search), 300, [search]); const [open, setOpen] = useState(false); - const targetQ = api.resource.byId.useQuery(condition.value); - const target = targetQ.data; + const resourceQ = api.resource.byId.useQuery(condition.value); + const resource = resourceQ.data; const { workspaceSlug, systemSlug } = useParams<{ workspaceSlug: string; @@ -66,7 +66,7 @@ export const JobTargetConditionRender: React.FC< conditions: envFilters, }; - const systemTargetsFilter: ResourceCondition | undefined = + const systemResourcesFilter: ResourceCondition | undefined = system != null ? { type: FilterType.Comparison, @@ -75,9 +75,9 @@ export const JobTargetConditionRender: React.FC< } : undefined; - const filter = systemTargetsFilter ?? searchFilter; + const filter = systemResourcesFilter ?? searchFilter; - const targetsQ = api.resource.byWorkspaceId.list.useQuery( + const resourcesQ = api.resource.byWorkspaceId.list.useQuery( { workspaceId: workspace?.id ?? "", filter, limit: 8 }, { enabled: workspace != null, placeholderData: (prev) => prev }, ); @@ -86,7 +86,7 @@ export const JobTargetConditionRender: React.FC<
- Target is + Resource is
@@ -99,38 +99,39 @@ export const JobTargetConditionRender: React.FC< > - {target?.name ?? `Select target...`} + {resource?.name ?? `Select resource...`} - {targetsQ.isLoading && ( + {resourcesQ.isLoading && ( - Loading targets... + Loading resources... )} - {targetsQ.isSuccess && targetsQ.data.items.length === 0 && ( - No targets found. - )} - {targetsQ.isSuccess && - targetsQ.data.items.map((target) => ( + {resourcesQ.isSuccess && + resourcesQ.data.items.length === 0 && ( + No resources found. + )} + {resourcesQ.isSuccess && + resourcesQ.data.items.map((resource) => ( { - onChange({ ...condition, value: target.id }); + onChange({ ...condition, value: resource.id }); setOpen(false); }} > - {target.name} + {resource.name} ))} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-drawer/JobDrawer.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-drawer/JobDrawer.tsx index 1dedec20a..a1f16541f 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-drawer/JobDrawer.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/job-drawer/JobDrawer.tsx @@ -74,7 +74,7 @@ export const JobDrawer: React.FC = () => { ; -export const TargetNode: React.FC = (node) => { +export const ResourceNode: React.FC = (node) => { const { data } = node; const isKubernetes = data.version.includes("kubernetes"); const isTerraform = data.version.includes("terraform"); const isSharedCluster = data.kind.toLowerCase().includes("sharedcluster"); - const isSelected = data.id === data.targetId && !data.isOrphanNode; + const isSelected = data.id === data.resourceId && !data.isOrphanNode; const animatedBorderColor = getBorderColor(data.version, data.kind); const selectedStyle: CSSProperties | undefined = isSelected ? { @@ -45,7 +45,7 @@ export const TargetNode: React.FC = (node) => { > {isSelected &&
}
- + {data.kind}
{data.name}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceViewActionsDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceViewActionsDropdown.tsx index f47c6fd8f..89ca61ee2 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceViewActionsDropdown.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-condition/ResourceViewActionsDropdown.tsx @@ -81,7 +81,7 @@ export const ResourceViewActionsDropdown: React.FC<{ }> = ({ view, children }) => { const [open, setOpen] = useState(false); const pathname = usePathname(); - const isTargetPage = pathname.includes("/targets"); + const isResourcePage = pathname.includes("/resources"); const { setFilter } = useResourceFilter(); const setView = (v: schema.ResourceView) => setFilter(v.filter, v.id); @@ -93,7 +93,7 @@ export const ResourceViewActionsDropdown: React.FC<{ setOpen(false)} - onSubmit={isTargetPage ? setView : undefined} + onSubmit={isResourcePage ? setView : undefined} > = ({ targetId, existingKeys, children }) => { +export const CreateResourceVariableDialog: React.FC< + CreateResourceVariableDialogProps +> = ({ resourceId, existingKeys, children }) => { const [open, setOpen] = useState(false); - const createTargetVariable = api.resource.variable.create.useMutation(); + const createResourceVariable = api.resource.variable.create.useMutation(); const schema = z.object({ key: z .string() @@ -64,9 +64,9 @@ export const CreateTargetVariableDialog: React.FC< const utils = api.useUtils(); const onSubmit = form.handleSubmit((data) => - createTargetVariable - .mutateAsync({ resourceId: targetId, ...data }) - .then(() => utils.resource.byId.invalidate(targetId)) + createResourceVariable + .mutateAsync({ resourceId: resourceId, ...data }) + .then(() => utils.resource.byId.invalidate(resourceId)) .then(() => form.reset()) .then(() => setOpen(false)), ); @@ -75,7 +75,7 @@ export const CreateTargetVariableDialog: React.FC< {children} - Create Target Variable + Create Resource Variable
- diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/DeleteTargetVariableDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/DeleteResourceVariableDialog.tsx similarity index 70% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/DeleteTargetVariableDialog.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/DeleteResourceVariableDialog.tsx index 0f6a864b5..1fb9018f3 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/DeleteTargetVariableDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/DeleteResourceVariableDialog.tsx @@ -14,24 +14,24 @@ import { buttonVariants } from "@ctrlplane/ui/button"; import { api } from "~/trpc/react"; -type DeleteTargetVariableDialogProps = { +type DeleteResourceVariableDialogProps = { variableId: string; - targetId: string; + resourceId: string; onClose: () => void; children: React.ReactNode; }; -export const DeleteTargetVariableDialog: React.FC< - DeleteTargetVariableDialogProps -> = ({ variableId, targetId, onClose, children }) => { +export const DeleteResourceVariableDialog: React.FC< + DeleteResourceVariableDialogProps +> = ({ variableId, resourceId, onClose, children }) => { const [open, setOpen] = useState(false); - const deleteTargetVariable = api.resource.variable.delete.useMutation(); + const deleteResourceVariable = api.resource.variable.delete.useMutation(); const utils = api.useUtils(); const onDelete = () => - deleteTargetVariable + deleteResourceVariable .mutateAsync(variableId) - .then(() => utils.resource.byId.invalidate(targetId)) + .then(() => utils.resource.byId.invalidate(resourceId)) .then(() => setOpen(false)); return ( @@ -46,8 +46,8 @@ export const DeleteTargetVariableDialog: React.FC< Are you sure? - Deleting a target variable can change what values are passed to - pipelines running for this target. + Deleting a resource variable can change what values are passed to + pipelines running for this resource. @@ -56,7 +56,7 @@ export const DeleteTargetVariableDialog: React.FC< Delete diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/DeploymentContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/DeploymentContent.tsx similarity index 86% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/DeploymentContent.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/DeploymentContent.tsx index 3a25f81a4..51fdd47ce 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/DeploymentContent.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/DeploymentContent.tsx @@ -6,17 +6,17 @@ import { TableCell, TableHead } from "@ctrlplane/ui/table"; import { api } from "~/trpc/react"; -export const DeploymentsContent: React.FC<{ targetId: string }> = ({ - targetId, +export const DeploymentsContent: React.FC<{ resourceId: string }> = ({ + resourceId, }) => { - const resourceId = targetId; - const deployments = api.deployment.byTargetId.useQuery(resourceId); - const targetValues = api.deployment.variable.byTargetId.useQuery(resourceId); + const deployments = api.deployment.byResourceId.useQuery(resourceId); + const resourceValues = + api.deployment.variable.byResourceId.useQuery(resourceId); if (!deployments.data || deployments.data.length === 0) { return (
- This target is not part of any deployments. + This resource is not part of any deployments.
); } @@ -24,7 +24,7 @@ export const DeploymentsContent: React.FC<{ targetId: string }> = ({ return (
{deployments.data.map((deployment) => { - const deploymentVariables = targetValues.data?.filter( + const deploymentVariables = resourceValues.data?.filter( (v) => v.deploymentId === deployment.id, ); return ( diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/EditTargetVariableDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/EditResourceVariableDialog.tsx similarity index 89% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/EditTargetVariableDialog.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/EditResourceVariableDialog.tsx index 891e8a14d..8e0717f07 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/EditTargetVariableDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/EditResourceVariableDialog.tsx @@ -31,21 +31,21 @@ import { import { api } from "~/trpc/react"; -type EditTargetVariableDialogProps = { - targetVariable: SCHEMA.ResourceVariable; +type EditResourceVariableDialogProps = { + resourceVariable: SCHEMA.ResourceVariable; existingKeys: string[]; children: React.ReactNode; onClose: () => void; }; -export const EditTargetVariableDialog: React.FC< - EditTargetVariableDialogProps -> = ({ targetVariable, existingKeys, children, onClose }) => { +export const EditResourceVariableDialog: React.FC< + EditResourceVariableDialogProps +> = ({ resourceVariable, existingKeys, children, onClose }) => { const [open, setOpen] = useState(false); - const updateTargetVariable = api.resource.variable.update.useMutation(); + const updateResourceVariable = api.resource.variable.update.useMutation(); const utils = api.useUtils(); const keysWithoutCurrent = existingKeys.filter( - (k) => k !== targetVariable.key, + (k) => k !== resourceVariable.key, ); const schema = z.object({ key: z @@ -63,18 +63,18 @@ export const EditTargetVariableDialog: React.FC< sensitive: z.boolean(), }); const defaultValues = { - key: targetVariable.key, - type: typeof targetVariable.value, - value: targetVariable.value, - sensitive: targetVariable.sensitive, + key: resourceVariable.key, + type: typeof resourceVariable.value, + value: resourceVariable.value, + sensitive: resourceVariable.sensitive, }; const form = useForm({ schema, defaultValues }); const onSubmit = form.handleSubmit((data) => - updateTargetVariable - .mutateAsync({ id: targetVariable.id, data }) + updateResourceVariable + .mutateAsync({ id: resourceVariable.id, data }) .then(() => form.reset(data)) - .then(() => utils.resource.byId.invalidate(targetVariable.resourceId)) + .then(() => utils.resource.byId.invalidate(resourceVariable.resourceId)) .then(() => setOpen(false)), ); @@ -90,7 +90,7 @@ export const EditTargetVariableDialog: React.FC< > {children} - Edit Target Variable + Edit Resource Variable - diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/JobsContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/JobsContent.tsx similarity index 75% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/JobsContent.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/JobsContent.tsx index 0396525bf..78c975311 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/JobsContent.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/JobsContent.tsx @@ -4,8 +4,10 @@ import { Card } from "@ctrlplane/ui/card"; import { api } from "~/trpc/react"; -export const JobsContent: React.FC<{ targetId: string }> = ({ targetId }) => { - const jobs = api.job.byResourceId.useQuery(targetId); +export const JobsContent: React.FC<{ resourceId: string }> = ({ + resourceId, +}) => { + const jobs = api.job.byResourceId.useQuery(resourceId); return (
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/OverviewContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/OverviewContent.tsx similarity index 82% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/OverviewContent.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/OverviewContent.tsx index 88544a4ff..119aca684 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/OverviewContent.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/OverviewContent.tsx @@ -17,13 +17,11 @@ import { ReservedMetadataKey } from "@ctrlplane/validators/conditions"; import { useMatchSorterWithSearch } from "~/utils/useMatchSorter"; import { ConfigEditor } from "../ConfigEditor"; -const TargetConfigInfo: React.FC<{ config: Record }> = ({ +const ResourceConfigInfo: React.FC<{ config: Record }> = ({ config, -}) => { - return ; -}; +}) => ; -const TargetMetadataInfo: React.FC<{ metadata: Record }> = ( +const ResourceMetadataInfo: React.FC<{ metadata: Record }> = ( props, ) => { const metadata = Object.entries(props.metadata).sort(([keyA], [keyB]) => @@ -64,14 +62,14 @@ const TargetMetadataInfo: React.FC<{ metadata: Record }> = ( }; export const OverviewContent: React.FC<{ - target: Resource & { + resource: Resource & { metadata: Record; provider: ResourceProvider | null; }; -}> = ({ target }) => { +}> = ({ resource }) => { const links = - target.metadata[ReservedMetadataKey.Links] != null - ? (JSON.parse(target.metadata[ReservedMetadataKey.Links]) as Record< + resource.metadata[ReservedMetadataKey.Links] != null + ? (JSON.parse(resource.metadata[ReservedMetadataKey.Links]) as Record< string, string >) @@ -93,27 +91,27 @@ export const OverviewContent: React.FC<{
- + - + - + - + @@ -183,7 +181,7 @@ export const OverviewContent: React.FC<{
ID {target.data?.name}{resource.data?.name}
Version{target.data?.version}{resource.data?.version}
Kind{target.data?.kind}{resource.data?.kind}
- Target Provider + Resource Provider
Last Sync - {target.data?.updatedAt && - format(target.data.updatedAt, "MM/dd/yyyy mm:hh:ss")} + {resource.data?.updatedAt && + format(resource.data.updatedAt, "MM/dd/yyyy mm:hh:ss")}
Identifier {target.identifier}{resource.identifier}
Name{target.name}{resource.name}
Version{target.version}{resource.version}
Kind{target.kind}{resource.kind}
- Target Provider + Resource Provider - {target.provider != null ? ( - target.provider.name + {resource.provider != null ? ( + resource.provider.name ) : ( @@ -124,9 +122,9 @@ export const OverviewContent: React.FC<{

- The next target provider to insert a target with - the same identifier will become the owner of this - target. + The next resource provider to insert a resource + with the same identifier will become the owner of + this resource.

@@ -138,8 +136,8 @@ export const OverviewContent: React.FC<{
Last Sync - {target.updatedAt && - format(target.updatedAt, "MM/dd/yyyy mm:hh:ss")} + {resource.updatedAt && + format(resource.updatedAt, "MM/dd/yyyy mm:hh:ss")}
- {target.metadata[ReservedMetadataKey.ExternalId] ?? ( + {resource.metadata[ReservedMetadataKey.ExternalId] ?? ( Not set @@ -200,16 +198,16 @@ export const OverviewContent: React.FC<{
Config
- +
- Metadata ({Object.keys(target.metadata).length}) + Metadata ({Object.keys(resource.metadata).length})
- +
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetActionsDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceActionsDropdown.tsx similarity index 70% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetActionsDropdown.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceActionsDropdown.tsx index 42f5d3f32..76f02e7eb 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetActionsDropdown.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceActionsDropdown.tsx @@ -23,29 +23,29 @@ import { } from "@ctrlplane/ui/dropdown-menu"; import { api } from "~/trpc/react"; -import { useTargetDrawer } from "./useTargetDrawer"; +import { useResourceDrawer } from "./useResourceDrawer"; -type DeleteTargetDialogProps = { - targetId: string; +type DeleteResourceDialogProps = { + resourceId: string; onClose: () => void; children: React.ReactNode; }; -const DeleteTargetDialog: React.FC = ({ - targetId, +const DeleteResourceDialog: React.FC = ({ + resourceId, onClose, children, }) => { const [open, setOpen] = useState(false); - const deleteTarget = api.resource.delete.useMutation(); - const { removeTargetId } = useTargetDrawer(); + const deleteResource = api.resource.delete.useMutation(); + const { removeResourceId } = useResourceDrawer(); const utils = api.useUtils(); const router = useRouter(); const handleDelete = () => - deleteTarget - .mutateAsync([targetId]) - .then(() => removeTargetId()) + deleteResource + .mutateAsync([resourceId]) + .then(() => removeResourceId()) .then(() => utils.resource.byWorkspaceId.list.invalidate()) .then(() => router.refresh()) .then(() => onClose()); @@ -61,9 +61,9 @@ const DeleteTargetDialog: React.FC = ({ {children} - Delete Target + Delete Resource - Are you sure you want to delete this target? + Are you sure you want to delete this resource? @@ -71,7 +71,7 @@ const DeleteTargetDialog: React.FC = ({ Delete @@ -81,22 +81,22 @@ const DeleteTargetDialog: React.FC = ({ ); }; -type RedeployTargetDialogProps = { - targetId: string; +type RedeployResourceDialogProps = { + resourceId: string; onClose: () => void; children: React.ReactNode; }; -const RedeployTargetDialog: React.FC = ({ - targetId, +const RedeployResourceDialog: React.FC = ({ + resourceId, onClose, children, }) => { const [open, setOpen] = useState(false); - const redeployTarget = api.resource.redeploy.useMutation(); + const redeployResource = api.resource.redeploy.useMutation(); const onRedeploy = () => - redeployTarget.mutateAsync(targetId).then(() => setOpen(false)); + redeployResource.mutateAsync(resourceId).then(() => setOpen(false)); return ( = ({ {children} - Redeploy Target + Redeploy Resource - Are you sure you want to redeploy this target? This will redeploy + Are you sure you want to redeploy this resource? This will redeploy the latest release across all systems and environments for this - target. + resource. @@ -121,7 +121,7 @@ const RedeployTargetDialog: React.FC = ({ Redeploy @@ -131,22 +131,21 @@ const RedeployTargetDialog: React.FC = ({ ); }; -type TargetActionsDropdownProps = { - target: SCHEMA.Resource; +type ResourceActionsDropdownProps = { + resource: SCHEMA.Resource; children: React.ReactNode; }; -export const TargetActionsDropdown: React.FC = ({ - target, - children, -}) => { +export const ResourceActionsDropdown: React.FC< + ResourceActionsDropdownProps +> = ({ resource, children }) => { const [open, setOpen] = useState(false); return ( {children} - setOpen(false)} > = ({ Redeploy - - setOpen(false)}> + + setOpen(false)} + > e.preventDefault()} @@ -165,7 +167,7 @@ export const TargetActionsDropdown: React.FC = ({ Delete - + ); diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetDrawer.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceDrawer.tsx similarity index 82% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetDrawer.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceDrawer.tsx index a9d6b42c7..861f78066 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetDrawer.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceDrawer.tsx @@ -22,32 +22,32 @@ import { ReservedMetadataKey } from "@ctrlplane/validators/conditions"; // import { useTerminalSessions } from "~/app/terminal/TerminalSessionsProvider"; import { api } from "~/trpc/react"; -import { EditTargetDialog } from "../EditTarget"; +import { EditResourceDialog } from "../EditResource"; import { TabButton } from "../TabButton"; import { DeploymentsContent } from "./DeploymentContent"; import { JobsContent } from "./JobsContent"; import { OverviewContent } from "./OverviewContent"; -import { TargetActionsDropdown } from "./TargetActionsDropdown"; -import { useTargetDrawer } from "./useTargetDrawer"; +import { ResourceActionsDropdown } from "./ResourceActionsDropdown"; +import { useResourceDrawer } from "./useResourceDrawer"; import { VariableContent } from "./VariablesContent"; -export const TargetDrawer: React.FC = () => { - const { targetId, removeTargetId } = useTargetDrawer(); +export const ResourceDrawer: React.FC = () => { + const { resourceId, removeResourceId } = useResourceDrawer(); const { workspaceSlug } = useParams<{ workspaceSlug: string }>(); - const isOpen = targetId != null && targetId != ""; - const setIsOpen = removeTargetId; + const isOpen = resourceId != null && resourceId != ""; + const setIsOpen = removeResourceId; - const targetQ = api.resource.byId.useQuery(targetId ?? "", { + const resourceQ = api.resource.byId.useQuery(resourceId ?? "", { enabled: isOpen, refetchInterval: 10_000, }); - const resource = targetQ.data; + const resource = resourceQ.data; const [activeTab, setActiveTab] = useState("overview"); - const lockTarget = api.resource.lock.useMutation(); - const unlockTarget = api.resource.unlock.useMutation(); + const lockResource = api.resource.lock.useMutation(); + const unlockResource = api.resource.unlock.useMutation(); const router = useRouter(); const utils = api.useUtils(); @@ -59,8 +59,6 @@ export const TargetDrawer: React.FC = () => { >) : null; - // const { createSession, setIsDrawerOpen } = useTerminalSessions(); - return ( { {resource?.name} {resource != null && ( - + - + )} @@ -108,7 +106,7 @@ export const TargetDrawer: React.FC = () => { className="gap-1" size="sm" onClick={() => - (resource.lockedAt != null ? unlockTarget : lockTarget) + (resource.lockedAt != null ? unlockResource : lockResource) .mutateAsync(resource.id) .then(() => router.refresh()) } @@ -125,7 +123,7 @@ export const TargetDrawer: React.FC = () => { { )} {resource.provider == null && ( - utils.resource.byId.invalidate(resource.id)} > - + )} )} @@ -200,16 +198,16 @@ export const TargetDrawer: React.FC = () => {
{activeTab === "deployments" && ( - + )} {activeTab === "overview" && ( - + )} - {activeTab === "jobs" && } + {activeTab === "jobs" && } {activeTab === "variables" && ( )}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetVariableDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceVariableDropdown.tsx similarity index 66% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetVariableDropdown.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceVariableDropdown.tsx index 9bcd8623e..bbec95f2c 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/TargetVariableDropdown.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/ResourceVariableDropdown.tsx @@ -9,28 +9,26 @@ import { DropdownMenuTrigger, } from "@ctrlplane/ui/dropdown-menu"; -import { DeleteTargetVariableDialog } from "./DeleteTargetVariableDialog"; -import { EditTargetVariableDialog } from "./EditTargetVariableDialog"; +import { DeleteResourceVariableDialog } from "./DeleteResourceVariableDialog"; +import { EditResourceVariableDialog } from "./EditResourceVariableDialog"; -type TargetVariableDropdownProps = { - targetVariable: SCHEMA.ResourceVariable; +type ResourceVariableDropdownProps = { + resourceVariable: SCHEMA.ResourceVariable; existingKeys: string[]; children: React.ReactNode; }; -export const TargetVariableDropdown: React.FC = ({ - targetVariable, - existingKeys, - children, -}) => { +export const ResourceVariableDropdown: React.FC< + ResourceVariableDropdownProps +> = ({ resourceVariable, existingKeys, children }) => { const [open, setOpen] = useState(false); return ( {children} - setOpen(false)} > @@ -41,10 +39,10 @@ export const TargetVariableDropdown: React.FC = ({ Edit - - + setOpen(false)} > = ({ Delete - + ); diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/VariablesContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/VariablesContent.tsx similarity index 70% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/VariablesContent.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/VariablesContent.tsx index 419df7293..d320e9dfe 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/VariablesContent.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/VariablesContent.tsx @@ -15,24 +15,24 @@ import { } from "@ctrlplane/ui/table"; import { api } from "~/trpc/react"; -import { CreateTargetVariableDialog } from "./CreateTargetVariableDialog"; -import { TargetVariableDropdown } from "./TargetVariableDropdown"; +import { CreateResourceVariableDialog } from "./CreateResourceVariableDialog"; +import { ResourceVariableDropdown } from "./ResourceVariableDropdown"; -const TargetVariableSection: React.FC<{ - targetId: string; - targetVariables: SCHEMA.ResourceVariable[]; -}> = ({ targetId, targetVariables }) => ( +const ResourceVariableSection: React.FC<{ + resourceId: string; + resourceVariables: SCHEMA.ResourceVariable[]; +}> = ({ resourceId, resourceVariables }) => (
- Target Variables - v.key)} + Resource Variables + v.key)} > - +
@@ -43,7 +43,7 @@ const TargetVariableSection: React.FC<{ - {targetVariables.map((v) => ( + {resourceVariables.map((v) => ( {v.key} @@ -54,14 +54,14 @@ const TargetVariableSection: React.FC<{ {v.sensitive ? "*****" : String(v.value)}
- v.key)} + v.key)} > - +
@@ -75,9 +75,9 @@ const VariableRow: React.FC<{ varKey: string; description: string; value?: string | null; - isTargetVar: boolean; + isResourceVar: boolean; sensitive: boolean; -}> = ({ varKey, description, value, isTargetVar, sensitive }) => ( +}> = ({ varKey, description, value, isResourceVar, sensitive }) => (
@@ -90,10 +90,10 @@ const VariableRow: React.FC<{ {sensitive &&
*****
} {!sensitive && (value ??
NULL
)} - {isTargetVar && ( -
(target)
+ {isResourceVar && ( +
(resource)
)} - {!isTargetVar && ( + {!isResourceVar && (
(deployment)
)} @@ -101,17 +101,16 @@ const VariableRow: React.FC<{ ); export const VariableContent: React.FC<{ - targetId: string; - targetVariables: SCHEMA.ResourceVariable[]; -}> = ({ targetId, targetVariables }) => { - const resourceId = targetId; - const deployments = api.deployment.byTargetId.useQuery(resourceId); - const variables = api.deployment.variable.byTargetId.useQuery(resourceId); + resourceId: string; + resourceVariables: SCHEMA.ResourceVariable[]; +}> = ({ resourceId, resourceVariables }) => { + const deployments = api.deployment.byResourceId.useQuery(resourceId); + const variables = api.deployment.variable.byResourceId.useQuery(resourceId); return (
-
Deployment Variables
{deployments.data @@ -134,17 +133,17 @@ export const VariableContent: React.FC<{ {variables.data ?.filter((v) => v.deploymentId === deployment.id) .map((v) => { - const targetVar = targetVariables.find( - (tv) => tv.key === v.key, + const resourceVar = resourceVariables.find( + (rv) => rv.key === v.key, ); return ( ); })} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/useTargetDrawer.ts b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/useResourceDrawer.ts similarity index 54% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/useTargetDrawer.ts rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/useResourceDrawer.ts index df4970b8d..3ace59ff2 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/target-drawer/useTargetDrawer.ts +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resource-drawer/useResourceDrawer.ts @@ -1,12 +1,12 @@ import { useRouter, useSearchParams } from "next/navigation"; -const param = "target_id"; -export const useTargetDrawer = () => { +const param = "resource_id"; +export const useResourceDrawer = () => { const router = useRouter(); const params = useSearchParams(); - const targetId = params.get(param); + const resourceId = params.get(param); - const setTargetId = (id: string | null) => { + const setResourceId = (id: string | null) => { const url = new URL(window.location.href); if (id === null) { url.searchParams.delete(param); @@ -16,7 +16,11 @@ export const useTargetDrawer = () => { router.replace(url.toString()); }; - const removeTargetId = () => setTargetId(null); + const removeResourceId = () => setResourceId(null); - return { targetId, setTargetId, removeTargetId }; + return { + resourceId, + setResourceId, + removeResourceId, + }; }; diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/targets/getBorderColor.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/getBorderColor.tsx similarity index 100% rename from apps/webservice/src/app/[workspaceSlug]/(app)/_components/targets/getBorderColor.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/_components/resources/getBorderColor.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/TargetAnnotationPieChart.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/ResourceAnnotationPieChart.tsx similarity index 73% rename from apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/TargetAnnotationPieChart.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/ResourceAnnotationPieChart.tsx index f149377a1..f1aeb586f 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/TargetAnnotationPieChart.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/ResourceAnnotationPieChart.tsx @@ -13,39 +13,39 @@ import { import { api } from "~/trpc/react"; -export const TargetAnnotationPieChart: React.FC<{ +export const ResourceAnnotationPieChart: React.FC<{ workspaceId: string; }> = ({ workspaceId }) => { - const targets = api.resource.byWorkspaceId.list.useQuery({ workspaceId }); + const resources = api.resource.byWorkspaceId.list.useQuery({ workspaceId }); const [showUndefined] = useState(false); const [annotation] = useState( "kubernetes/autoscaling-enabled", ); - const chartData = _.chain(targets.data?.items ?? []) - .filter((t) => showUndefined || t.metadata[annotation ?? ""] != null) - .groupBy((t) => t.metadata[annotation ?? ""]?.toString() ?? "undefined") - .map((targets, metadata) => ({ + const chartData = _.chain(resources.data?.items ?? []) + .filter((r) => showUndefined || r.metadata[annotation ?? ""] != null) + .groupBy((r) => r.metadata[annotation ?? ""]?.toString() ?? "undefined") + .map((resources, metadata) => ({ metadata, - targets: targets.length, + resources: resources.length, fill: `var(--color-${metadata})`, })) .value(); const chartConfig = useMemo( () => - _.chain(targets.data?.items ?? []) - .uniqBy((t) => t.metadata[annotation ?? ""]?.toString() ?? "undefined") - .map((t) => [ - t.metadata[annotation ?? ""], + _.chain(resources.data?.items ?? []) + .uniqBy((r) => r.metadata[annotation ?? ""]?.toString() ?? "undefined") + .map((r) => [ + r.metadata[annotation ?? ""], { - metadata: t.metadata[annotation ?? ""]?.toString() ?? "undefined", + metadata: r.metadata[annotation ?? ""]?.toString() ?? "undefined", color: randomColor(), }, ]) .fromPairs() .value(), - [targets.data, annotation], + [resources.data, annotation], ); return ( @@ -60,7 +60,7 @@ export const TargetAnnotationPieChart: React.FC<{ /> { _.uniqBy( - targets.data?.items ?? [], - (t) => t.metadata[annotation ?? ""] ?? "", + resources.data?.items ?? [], + (r) => r.metadata[annotation ?? ""] ?? "", ).length } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/page.tsx index 4eb034341..cc0f187bd 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboard/page.tsx @@ -5,7 +5,7 @@ import { Card } from "@ctrlplane/ui/card"; import { api } from "../../../../trpc/server"; import { JobHistoryChart } from "../systems/JobHistoryChart"; -import { TargetAnnotationPieChart } from "./TargetAnnotationPieChart"; +import { ResourceAnnotationPieChart } from "./ResourceAnnotationPieChart"; type PageProps = { params: { workspaceSlug: string }; @@ -28,7 +28,7 @@ export default async function Dashboard({ return (
- + test
); diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/TargetWidgets.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/ResourceWidgets.tsx similarity index 97% rename from apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/TargetWidgets.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/ResourceWidgets.tsx index a8f0dac09..bd8b1e0aa 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/TargetWidgets.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/ResourceWidgets.tsx @@ -20,11 +20,11 @@ import { WidgetCardTitle, } from "./Widget"; -export const WidgetTargetMetadataCount: Widget<{ +export const WidgetResourceMetadataCount: Widget<{ key?: string; countUndefined?: boolean; }> = { - displayName: "Target Metadata Count", + displayName: "Resource Metadata Count", description: "", dimensions: { suggestedW: 2, diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/index.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/index.tsx index 6742657fb..a20e0c24b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/index.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/dashboards/widgets/index.tsx @@ -1,10 +1,10 @@ import type { Widget } from "./spec"; -import { WidgetTargetMetadataCount } from "./TargetWidgets"; +import { WidgetResourceMetadataCount } from "./ResourceWidgets"; import { WidgetHeading } from "./TextHeading"; export * from "./spec"; export const widgets: Record = { - "target-annotation-pie": WidgetTargetMetadataCount, + "resource-annotation-pie": WidgetResourceMetadataCount, heading: WidgetHeading, }; diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx index f38d49a07..35794bfb3 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx @@ -11,7 +11,7 @@ import { EnvironmentPolicyDrawer } from "./_components/environment-policy-drawer import { JobDrawer } from "./_components/job-drawer/JobDrawer"; import { ReleaseChannelDrawer } from "./_components/release-channel-drawer/ReleaseChannelDrawer"; import { ReleaseDrawer } from "./_components/release-drawer/ReleaseDrawer"; -import { TargetDrawer } from "./_components/target-drawer/TargetDrawer"; +import { ResourceDrawer } from "./_components/resource-drawer/ResourceDrawer"; import { VariableSetDrawer } from "./_components/variable-set-drawer/VariableSetDrawer"; import { AppSidebar } from "./AppSidebar"; import { AppSidebarPopoverProvider } from "./AppSidebarPopoverContext"; @@ -40,7 +40,7 @@ export default async function WorkspaceLayout({ {children} - + diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/JobHistoryChart.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/JobHistoryChart.tsx index b7453564a..ddf49a50b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/JobHistoryChart.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/JobHistoryChart.tsx @@ -87,7 +87,7 @@ export const JobHistoryChart: React.FC<{ _.maxBy(dailyCounts.data, "totalCount")?.totalCount ?? 0; const maxBarTickDomain = Math.ceil(maxDailyCount * 1.1); - const targets = api.resource.byWorkspaceId.list.useQuery({ + const resources = api.resource.byWorkspaceId.list.useQuery({ workspaceId: workspace.id, limit: 0, }); @@ -135,9 +135,9 @@ export const JobHistoryChart: React.FC<{
- Targets + Resources - {targets.data?.total ?? "-"} + {resources.data?.total ?? "-"}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemActionsDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemActionsDropdown.tsx index 40c6b574d..412a0d365 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemActionsDropdown.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemActionsDropdown.tsx @@ -43,7 +43,7 @@ export const SystemActionsDropdown: React.FC = ({ conditions: envFilters, }; const hash = LZString.compressToEncodedURIComponent(JSON.stringify(filter)); - const url = `/${workspaceSlug}/targets?filter=${hash}`; + const url = `/${workspaceSlug}/resources?filter=${hash}`; return ( @@ -56,7 +56,7 @@ export const SystemActionsDropdown: React.FC = ({ onSelect={(e) => e.preventDefault()} > - View targets + View resources diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemsList.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemsList.tsx index c9115d9e7..3ce77499a 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemsList.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/SystemsList.tsx @@ -8,7 +8,7 @@ import { useDebounce } from "react-use"; import { Skeleton } from "@ctrlplane/ui/skeleton"; import { api } from "~/trpc/react"; -import { SearchInput } from "../(targets)/targets/TargetPageContent"; +import { SearchInput } from "../(resources)/resources/ResourcePageContent"; import { SystemsTable } from "./SystemsTable"; export const SystemsList: React.FC<{ diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/DeploymentGettingStarted.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/DeploymentGettingStarted.tsx index 9cfa183e9..79e9311b2 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/DeploymentGettingStarted.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/DeploymentGettingStarted.tsx @@ -18,8 +18,9 @@ export const DeploymentGettingStarted: React.FC<{ systemId: string }> = ({

Deployments are the core component of Ctrlplane, orchestrating the delivery of your applications across various environments and - targets. They encapsulate the configuration, workflows, and triggers - required to automate and manage the entire release lifecycle. + resources. They encapsulate the configuration, workflows, and + triggers required to automate and manage the entire release + lifecycle.

diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/ReleaseDropdownMenu.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/ReleaseDropdownMenu.tsx index 48a598140..52299f706 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/ReleaseDropdownMenu.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/ReleaseDropdownMenu.tsx @@ -61,7 +61,7 @@ const RedeployReleaseDialog: React.FC<{ to {environment.name}? - This will redeploy the release to all targets in the environment. + This will redeploy the release to all resources in the environment. @@ -104,7 +104,7 @@ const ForceReleaseDialog: React.FC<{ Force release {release.name} to {environment.name}? - This will force the release to be deployed to all targets in the + This will force the release to be deployed to all resources in the environment regardless of any policies set on the environment. diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableCells.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableCells.tsx index 5c7c5d40f..2fa03b81b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableCells.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/TableCells.tsx @@ -143,7 +143,7 @@ export const Release: React.FC<{ deploymentSlug, } = props; - const latestJobsByTarget = _.chain(releaseJobTriggers) + const latestJobsByResource = _.chain(releaseJobTriggers) .groupBy((r) => r.resource.id) .mapValues((triggers) => _.maxBy(triggers, (t) => new Date(t.job.createdAt)), @@ -152,7 +152,7 @@ export const Release: React.FC<{ .compact() .value(); - const data = _.chain(latestJobsByTarget) + const data = _.chain(latestJobsByResource) .groupBy((r) => r.job.status) .entries() .map(([name, value]) => ({ name, count: value.length })) @@ -179,7 +179,7 @@ export const Release: React.FC<{ href={`/${workspaceSlug}/systems/${systemSlug}/deployments/${firstReleaseJobTrigger?.deployment?.slug ?? deploymentSlug}/releases/${props.releaseId}`} className="flex w-full items-center gap-2" > - +
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/page.tsx index 9752e6917..7f9c4a83e 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/page.tsx @@ -28,7 +28,7 @@ const Variables: React.FC<{ deployment.id, ); - const systemTargetsFilter: ComparisonCondition = { + const systemResourcesFilter: ComparisonCondition = { type: ResourceFilterType.Comparison, operator: ResourceOperator.Or, conditions: await api.environment @@ -46,8 +46,8 @@ const Variables: React.FC<{ if (v.resourceFilter == null) return { ...v, - targetCount: 0, - targets: [], + resourceCount: 0, + resources: [], filterHash: "", }; @@ -58,10 +58,10 @@ const Variables: React.FC<{ const filter: ComparisonCondition = { type: ResourceFilterType.Comparison, operator: ResourceOperator.And, - conditions: [systemTargetsFilter, v.resourceFilter], + conditions: [systemResourcesFilter, v.resourceFilter], }; - const targets = await api.resource.byWorkspaceId.list({ + const resources = await api.resource.byWorkspaceId.list({ workspaceId, filter, limit: 5, @@ -69,8 +69,8 @@ const Variables: React.FC<{ return { ...v, - targetCount: targets.total, - targets: targets.items, + resourceCount: resources.total, + resources: resources.items, filterHash, }; }); @@ -82,12 +82,12 @@ const Variables: React.FC<{ const filter: ResourceCondition = restFilters.length === 0 - ? systemTargetsFilter + ? systemResourcesFilter : { type: ResourceFilterType.Comparison, operator: ResourceOperator.And, conditions: [ - systemTargetsFilter, + systemResourcesFilter, { type: ResourceFilterType.Comparison, operator: ResourceOperator.Or, @@ -97,7 +97,7 @@ const Variables: React.FC<{ ], }; - const defaultTargets = await api.resource.byWorkspaceId.list({ + const defaultResources = await api.resource.byWorkspaceId.list({ workspaceId, filter, limit: 5, @@ -109,8 +109,8 @@ const Variables: React.FC<{ values.unshift({ ...defaultValue, - targetCount: defaultTargets.total, - targets: defaultTargets.items, + resourceCount: defaultResources.total, + resources: defaultResources.items, filterHash, }); } @@ -128,7 +128,7 @@ const Variables: React.FC<{

Variables

- Deployment variables allow you to configure target-specific settings + Deployment variables allow you to configure resource-specific settings for your application. Learn more about variable precedence here.
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/ReleaseDistributionPopover.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/ReleaseDistributionPopover.tsx index 654451a53..fe53bce67 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/ReleaseDistributionPopover.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/ReleaseDistributionPopover.tsx @@ -21,7 +21,7 @@ export const ReleaseDistributionGraphPopover: React.FC<{

Release Distribution

Distribution of the latest {showPreviousReleaseDistro} filtered - releases across targets. + releases across resources.

void; @@ -178,7 +178,7 @@ const ForceReleaseTargetDialog: React.FC<{ }> = ({ release, deploymentName, - target, + resource, environmentId, onClose, children, @@ -198,7 +198,7 @@ const ForceReleaseTargetDialog: React.FC<{ - This will force {target.name}{" "} + This will force {resource.name}{" "} onto{" "} {deploymentName} {release.version} @@ -216,7 +216,7 @@ const ForceReleaseTargetDialog: React.FC<{ forceRelease .mutateAsync({ releaseId: release.id, - resourceId: target.id, + resourceId: resource.id, environmentId: environmentId, isForcedRelease: true, }) @@ -237,9 +237,9 @@ const ForceReleaseTargetDialog: React.FC<{ const RedeployReleaseDialog: React.FC<{ release: { id: string; name: string }; environmentId: string; - target: { id: string; name: string }; + resource: { id: string; name: string }; children: React.ReactNode; -}> = ({ release, environmentId, target, children }) => { +}> = ({ release, environmentId, resource, children }) => { const router = useRouter(); const utils = api.useUtils(); const redeploy = api.release.deploy.toResource.useMutation(); @@ -254,10 +254,10 @@ const RedeployReleaseDialog: React.FC<{ {release.name} {" "} - to {target.name}? + to {resource.name}? - This will redeploy the release to {target.name}. + This will redeploy the release to {resource.name}. @@ -268,7 +268,7 @@ const RedeployReleaseDialog: React.FC<{ redeploy .mutateAsync({ environmentId, - resourceId: target.id, + resourceId: resource.id, releaseId: release.id, }) .then(() => utils.release.list.invalidate()) @@ -287,7 +287,7 @@ const RedeployReleaseDialog: React.FC<{ export const JobDropdownMenu: React.FC<{ release: { id: string; version: string; name: string }; environmentId: string; - target: { id: string; name: string; lockedAt: Date | null } | null; + resource: { id: string; name: string; lockedAt: Date | null } | null; deployment: SCHEMA.Deployment; job: { id: string; status: JobStatus }; isPassingReleaseChannel: boolean; @@ -295,7 +295,7 @@ export const JobDropdownMenu: React.FC<{ }> = ({ release, deployment, - target, + resource, environmentId, job, isPassingReleaseChannel, @@ -306,7 +306,7 @@ export const JobDropdownMenu: React.FC<{ return ( {children} - {target != null && ( + {resource != null && ( e.stopPropagation()}> {isActive && ( @@ -350,7 +350,7 @@ export const JobDropdownMenu: React.FC<{ e.preventDefault()} @@ -372,10 +372,10 @@ export const JobDropdownMenu: React.FC<{ - setOpen(false)} > @@ -386,7 +386,7 @@ export const JobDropdownMenu: React.FC<{

Force Release

-
+
)}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/TargetReleaseTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/ResourceReleaseTable.tsx similarity index 94% rename from apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/TargetReleaseTable.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/ResourceReleaseTable.tsx index 20d4b326d..39fbd8c82 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/TargetReleaseTable.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/ResourceReleaseTable.tsx @@ -50,7 +50,7 @@ type CollapsibleTableRowProps = { version: string; name: string; }; - triggersByTarget: Record; + triggersByResource: Record; }; const CollapsibleTableRow: React.FC = ({ @@ -58,7 +58,7 @@ const CollapsibleTableRow: React.FC = ({ environmentCount, deployment, release, - triggersByTarget, + triggersByResource, }) => { const { setJobId } = useJobDrawer(); @@ -71,20 +71,20 @@ const CollapsibleTableRow: React.FC = ({ (approval) => approval.policyId === environment.policyId, ); - const allTriggers = Object.values(triggersByTarget).flat(); + const allTriggers = Object.values(triggersByResource).flat(); const isOpen = allTriggers.length < 10 && environmentCount < 3; const [isExpanded, setIsExpanded] = useState(isOpen); - const [expandedTargets, setExpandedTargets] = useState< + const [expandedResources, setExpandedResources] = useState< Record >({}); - const switchTargetExpandedState = (targetId: string) => - setExpandedTargets((prev) => { + const switchResourceExpandedState = (resourceId: string) => + setExpandedResources((prev) => { const newState = { ...prev }; - const currentTargetState = newState[targetId] ?? false; - newState[targetId] = !currentTargetState; + const currentResourceState = newState[resourceId] ?? false; + newState[resourceId] = !currentResourceState; return newState; }); @@ -154,7 +154,7 @@ const CollapsibleTableRow: React.FC = ({ {isExpanded && ( <> - {Object.entries(triggersByTarget).map(([, triggers]) => { + {Object.entries(triggersByResource).map(([, triggers]) => { const resource = triggers[0]!.resource; const trigger = triggers[0]!; // triggers are already sorted by createdAt from the query const linksMetadata = trigger.job.metadata.find( @@ -182,13 +182,13 @@ const CollapsibleTableRow: React.FC = ({ size="icon" className="h-6 w-6" onClick={() => - switchTargetExpandedState(resource.id) + switchResourceExpandedState(resource.id) } > @@ -259,7 +259,7 @@ const CollapsibleTableRow: React.FC = ({ = ({ = ({ ); }; -type TargetReleaseTableProps = { +type ResourceReleaseTableProps = { release: { id: string; version: string; name: string }; deployment: SCHEMA.Deployment; environments: SCHEMA.Environment[]; }; -export const TargetReleaseTable: React.FC = ({ +export const ResourceReleaseTable: React.FC = ({ release, deployment, environments, @@ -423,7 +423,7 @@ export const TargetReleaseTable: React.FC = ({ environment: environments.find( (e) => e.id === triggers[0]!.environmentId, ), - targets: _.groupBy(triggers, (t) => t.resource.id), + resources: _.groupBy(triggers, (t) => t.resource.id), })) .filter((t) => isPresent(t.environment)) .value(); @@ -464,14 +464,14 @@ export const TargetReleaseTable: React.FC = ({ {!releaseJobTriggerQuery.isLoading && releaseJobTriggers.length > 0 && (
- {groupedTriggers.map(({ environment, targets }) => ( + {groupedTriggers.map(({ environment, resources }) => ( ))} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/page.tsx index d28f292a2..b7d3ff47b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/releases/[versionId]/page.tsx @@ -6,7 +6,7 @@ import { ScrollArea } from "@ctrlplane/ui/scroll-area"; import { ReactFlowProvider } from "~/app/[workspaceSlug]/(app)/_components/reactflow/ReactFlowProvider"; import { api } from "~/trpc/server"; import { FlowDiagram } from "./FlowDiagram"; -import { TargetReleaseTable } from "./TargetReleaseTable"; +import { ResourceReleaseTable } from "./ResourceReleaseTable"; type PageProps = { params: { @@ -65,7 +65,7 @@ export default async function ReleasePage({ params }: PageProps) { - -

{target?.name}

+

{resource?.name}

); } diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/resources/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/resources/page.tsx new file mode 100644 index 000000000..945f9569a --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/resources/page.tsx @@ -0,0 +1,3 @@ +export default function ResourcesPage() { + return
test
; +} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/targets/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/targets/page.tsx deleted file mode 100644 index abba7e797..000000000 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/targets/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function TargetsPage() { - return
test
; -} diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/AddVariableValueDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/AddVariableValueDialog.tsx index 3c84d5429..1a8d8648d 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/AddVariableValueDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/AddVariableValueDialog.tsx @@ -131,7 +131,7 @@ export const AddVariableValueDialog: React.FC<{ - A default value will match all targets in the + A default value will match all resources in the system that are not matched by other values. diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableTable.tsx index 030314cfe..38693386b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableTable.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableTable.tsx @@ -17,8 +17,8 @@ import { Input } from "@ctrlplane/ui/input"; import { Table, TableBody, TableCell, TableRow } from "@ctrlplane/ui/table"; import type { VariableData } from "./variable-data"; -import { useTargetDrawer } from "~/app/[workspaceSlug]/(app)/_components/target-drawer/useTargetDrawer"; -import { TargetIcon } from "~/app/[workspaceSlug]/(app)/_components/TargetIcon"; +import { useResourceDrawer } from "~/app/[workspaceSlug]/(app)/_components/resource-drawer/useResourceDrawer"; +import { ResourceIcon } from "~/app/[workspaceSlug]/(app)/_components/ResourceIcon"; import { useMatchSorterWithSearch } from "~/utils/useMatchSorter"; import { VariableDropdown } from "./VariableDropdown"; import { VariableValueDropdown } from "./VariableValueDropdown"; @@ -60,7 +60,7 @@ export const VariableTable: React.FC<{ return newState; }); - const { setTargetId } = useTargetDrawer(); + const { setResourceId } = useResourceDrawer(); return ( <> @@ -205,8 +205,8 @@ export const VariableTable: React.FC<{ variant="secondary" className="flex justify-center hover:bg-secondary" > - {v.targetCount} target - {v.targetCount === 1 ? "" : "s"} + {v.resourceCount} resource + {v.resourceCount === 1 ? "" : "s"} <> - {v.targets.map((t) => ( - + {v.resources.map((r) => ( + setTargetId(t.id)} + onClick={() => setResourceId(r.id)} >
-
- {t.name} + {r.name} - {t.version} + {r.version}
@@ -251,7 +251,7 @@ export const VariableTable: React.FC<{ ))} - {v.targetCount !== 0 && ( + {v.resourceCount !== 0 && ( - View {v.targetCount} targets... + View {v.resourceCount} resources...
)} - {v.targetCount === 0 && ( + {v.resourceCount === 0 && (
- No targets are using this variable + No resources are using this variable
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableValueDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableValueDropdown.tsx index 85b9db5d0..a24525569 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableValueDropdown.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/VariableValueDropdown.tsx @@ -58,10 +58,10 @@ import { api } from "~/trpc/react"; const editVariableValueFormSchema = z.object({ value: z.union([z.string(), z.number(), z.boolean()]), - targetFilter: resourceCondition + resourceFilter: resourceCondition .nullish() .refine((data) => data == null || isValidResourceCondition(data), { - message: "Invalid target condition", + message: "Invalid resource condition", }), default: z.boolean().optional(), }); @@ -78,19 +78,12 @@ const EditVariableValueDialog: React.FC<{ const form = useForm({ schema: editVariableValueFormSchema, - defaultValues: { - value: value.value, - targetFilter: value.resourceFilter, - default: variable.defaultValueId === value.id, - }, + defaultValues: { ...value, default: variable.defaultValueId === value.id }, }); const onSubmit = form.handleSubmit((data) => update - .mutateAsync({ - id: value.id, - data: { ...data, resourceFilter: data.targetFilter }, - }) + .mutateAsync({ id: value.id, data }) .then(() => router.refresh()) .then(onClose), ); @@ -155,10 +148,10 @@ const EditVariableValueDialog: React.FC<{ ( - Target filter + Resource filter form.setValue("targetFilter", null)} + onClick={() => form.setValue("resourceFilter", null)} > Clear filter diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/page.tsx index f4219fe38..958136591 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/page.tsx @@ -26,7 +26,7 @@ export default async function VariablesPage({ deployment.id, ); - const systemTargetsFilter: ComparisonCondition = { + const systemResourcesFilter: ComparisonCondition = { type: ResourceFilterType.Comparison, operator: ResourceOperator.Or, conditions: await api.environment @@ -44,8 +44,8 @@ export default async function VariablesPage({ if (v.resourceFilter == null) return { ...v, - targetCount: 0, - targets: [], + resourceCount: 0, + resources: [], filterHash: "", }; @@ -56,10 +56,10 @@ export default async function VariablesPage({ const filter: ComparisonCondition = { type: ResourceFilterType.Comparison, operator: ResourceOperator.And, - conditions: [systemTargetsFilter, v.resourceFilter], + conditions: [systemResourcesFilter, v.resourceFilter], }; - const targets = await api.resource.byWorkspaceId.list({ + const resources = await api.resource.byWorkspaceId.list({ workspaceId, filter, limit: 5, @@ -67,8 +67,8 @@ export default async function VariablesPage({ return { ...v, - targetCount: targets.total, - targets: targets.items, + resourceCount: resources.total, + resources: resources.items, filterHash, }; }); @@ -80,12 +80,12 @@ export default async function VariablesPage({ const filter: ResourceCondition = restFilters.length === 0 - ? systemTargetsFilter + ? systemResourcesFilter : { type: ResourceFilterType.Comparison, operator: ResourceOperator.And, conditions: [ - systemTargetsFilter, + systemResourcesFilter, { type: ResourceFilterType.Comparison, operator: ResourceOperator.Or, @@ -95,7 +95,7 @@ export default async function VariablesPage({ ], }; - const defaultTargets = await api.resource.byWorkspaceId.list({ + const defaultResources = await api.resource.byWorkspaceId.list({ workspaceId, filter, limit: 5, @@ -107,16 +107,13 @@ export default async function VariablesPage({ values.unshift({ ...defaultValue, - targetCount: defaultTargets.total, - targets: defaultTargets.items, + resourceCount: defaultResources.total, + resources: defaultResources.items, filterHash, }); } - return { - ...variable.deploymentVariable, - values, - }; + return { ...variable.deploymentVariable, values }; }); const variables = await Promise.all(variablesPromises); diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/variable-data.ts b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/variable-data.ts index ea2875e82..38770145a 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/variable-data.ts +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/deployments/[deploymentSlug]/variables/variable-data.ts @@ -1,8 +1,8 @@ import type * as schema from "@ctrlplane/db/schema"; export type VariableValue = schema.DeploymentVariableValue & { - targets: schema.Resource[]; - targetCount: number; + resources: schema.Resource[]; + resourceCount: number; filterHash: string; }; diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/EnvFlowPanel.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/EnvFlowPanel.tsx index 111bcc533..b342a518b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/EnvFlowPanel.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/EnvFlowPanel.tsx @@ -113,7 +113,7 @@ const AddEnvironmentButton: React.FC<{ Add Environments Group your deployments by environment. Environments can be used - to group targets. + to group resources. diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/TargetFilterUniquenessIndicator.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/TargetFilterUniquenessIndicator.tsx index 615c78a51..8ee819e76 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/TargetFilterUniquenessIndicator.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/TargetFilterUniquenessIndicator.tsx @@ -16,10 +16,10 @@ import { import { api } from "~/trpc/react"; type UniqueFilterResult = { - overlaps: { nodeId: string; overlappingTargetCount: number }[]; + overlaps: { nodeId: string; overlappingResourceCount: number }[]; } | null; -const useTargetFilterUniqueness = ( +const useResourceFilterUniqueness = ( nodes: Node[], workspaceId: string, currentNode: Node, @@ -29,10 +29,10 @@ const useTargetFilterUniqueness = ( const overlappingQueries = useQueries({ queries: otherNodes.map((node) => ({ queryKey: [ - "target", + "resource", workspaceId, - currentNode.data.targetFilter, - node.data.targetFilter, + currentNode.data.resourceFilter, + node.data.resourceFilter, ], queryFn: () => utils.resource.byWorkspaceId.list @@ -43,14 +43,15 @@ const useTargetFilterUniqueness = ( type: "comparison", operator: "and", conditions: [ - currentNode.data.targetFilter, - node.data.targetFilter, + currentNode.data.resourceFilter, + node.data.resourceFilter, ], }, }) .then((res) => res.total), enabled: - currentNode.data.targetFilter != null && node.data.targetFilter != null, + currentNode.data.resourceFilter != null && + node.data.resourceFilter != null, })), }); @@ -63,11 +64,11 @@ const useTargetFilterUniqueness = ( if (count > 0) acc.push({ nodeId: otherNodes[index]!.id, - overlappingTargetCount: count, + overlappingResourceCount: count, }); return acc; }, - [] as { nodeId: string; overlappingTargetCount: number }[], + [] as { nodeId: string; overlappingResourceCount: number }[], ); return { overlaps }; @@ -75,31 +76,31 @@ const useTargetFilterUniqueness = ( const StatusMap = { loading: { - text: "Checking target uniqueness...", + text: "Checking resource uniqueness...", icon: , }, unique: { - text: "All Environments have unique targets", + text: "All Environments have unique resources", icon: , }, overlapping: { - text: "Targets overlap Environments for this System", + text: "Resources overlap Environments for this System", icon: , }, }; -export const TargetFilterUniquenessIndicator: FC<{ +export const ResourceFilterUniquenessIndicator: FC<{ nodes: Node[]; workspaceId: string; workspaceSlug: string; currentNode: Node; }> = ({ nodes, workspaceId, workspaceSlug, currentNode }) => { - const result = useTargetFilterUniqueness(nodes, workspaceId, currentNode); + const result = useResourceFilterUniqueness(nodes, workspaceId, currentNode); - if (!currentNode.data.targetFilter) + if (!currentNode.data.resourceFilter) return ( - Please add a target filter to select targets for this environment. + Please add a resource filter to select resources for this environment. ); @@ -145,8 +146,8 @@ export const TargetFilterUniquenessIndicator: FC<{ type: "comparison", operator: "and", conditions: [ - overlappingNode.data.targetFilter, - currentNode.data.targetFilter, + overlappingNode.data.resourceFilter, + currentNode.data.resourceFilter, ], }), ); @@ -158,26 +159,26 @@ export const TargetFilterUniquenessIndicator: FC<{ {" "} has{" "} - {overlap.overlappingTargetCount} + {overlap.overlappingResourceCount} {" "} - overlapping target - {overlap.overlappingTargetCount > 1 ? "s" : ""} + overlapping resource + {overlap.overlappingResourceCount > 1 ? "s" : ""}

); })}

- This may happen if you added new targets that match multiple target - filters. + This may happen if you added new resources that match multiple + resource filters.

diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/[environmentId]/TargetCharts.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/[environmentId]/ResourceCharts.tsx similarity index 78% rename from apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/[environmentId]/TargetCharts.tsx rename to apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/[environmentId]/ResourceCharts.tsx index 68af1a343..034d85d1e 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/[environmentId]/TargetCharts.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/environments/[environmentId]/ResourceCharts.tsx @@ -12,26 +12,26 @@ import { ChartTooltipContent, } from "@ctrlplane/ui/chart"; -export const PieTargetsByKind: React.FC<{ targets: Resource[] }> = ({ - targets, +export const PieResourcesByKind: React.FC<{ resources: Resource[] }> = ({ + resources, }) => { - const chartData = _.chain(targets) - .groupBy((t) => t.kind) - .map((targets, kind) => ({ + const chartData = _.chain(resources) + .groupBy((r) => r.kind) + .map((resources, kind) => ({ kind, - targets: targets.length, + resources: resources.length, fill: `var(--color-${kind})`, })) .value(); const chartConfig = useMemo( () => - _.chain(targets) - .uniqBy((t) => t.kind) - .map((t) => [t.kind, { label: t.kind, color: randomColor() }]) + _.chain(resources) + .uniqBy((r) => r.kind) + .map((r) => [r.kind, { label: r.kind, color: randomColor() }]) .fromPairs() .value(), - [targets], + [resources], ); return ( @@ -46,7 +46,7 @@ export const PieTargetsByKind: React.FC<{ targets: Resource[] }> = ({ /> = ({ y={viewBox.cy} className="fill-foreground text-3xl font-bold" > - {_.uniqBy(targets, (t) => t.kind).length} + {_.uniqBy(resources, (r) => r.kind).length} = ({ ); }; -export const PieTargetsByProvider: React.FC<{ targets: Resource[] }> = ({ - targets, +export const PieResourcesByProvider: React.FC<{ resources: Resource[] }> = ({ + resources, }) => { - const chartData = _.chain(targets) - .groupBy((t) => t.providerId) - .map((targets, providerId) => ({ + const chartData = _.chain(resources) + .groupBy((r) => r.providerId) + .map((resources, providerId) => ({ providerId, - targets: targets.length, + resources: resources.length, fill: `var(--color-${providerId})`, })) .value(); const chartConfig = useMemo( () => - _.chain(targets) - .uniqBy((t) => t.providerId) - .map((t) => [ - t.providerId, - { label: t.providerId, color: randomColor() }, + _.chain(resources) + .uniqBy((r) => r.providerId) + .map((r) => [ + r.providerId, + { label: r.providerId, color: randomColor() }, ]) .fromPairs() .value(), - [targets], + [resources], ); return ( @@ -123,7 +123,7 @@ export const PieTargetsByProvider: React.FC<{ targets: Resource[] }> = ({ /> = ({ y={viewBox.cy} className="fill-foreground text-3xl font-bold" > - {_.uniqBy(targets, (t) => t.providerId).length} + {_.uniqBy(resources, (r) => r.providerId).length}

- Targets{" "} + Resources{" "} {0} @@ -34,7 +34,7 @@ export default async function EnvironmentPage({ - + @@ -45,31 +45,10 @@ export default async function EnvironmentPage({ - + - {/* -

- - - Name - Kind - Provider - - - - {([]).map((target) => ( - - {target.name} - - {target.provider?.name} / {target.kind} - - - ))} - -
- */}
); diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/runbooks/RunbookGettingStarted.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/runbooks/RunbookGettingStarted.tsx index 65d4efe76..010fef1f6 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/runbooks/RunbookGettingStarted.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(app)/systems/[systemSlug]/runbooks/RunbookGettingStarted.tsx @@ -18,7 +18,7 @@ export const RunbookGettingStarted: React.FC<{

Runbooks in Ctrlplane trigger pipelines that you can control and manage in one centralized place. They allow you to select specific - targets for pipeline execution and can be scheduled to run + resources for pipeline execution and can be scheduled to run automatically, streamlining your operational processes. This centralized approach to pipeline management enhances efficiency and provides greater control over your automated workflows. diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/workspace/general/WorkspaceDeleteSection.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/workspace/general/WorkspaceDeleteSection.tsx index d4b7cfdf4..02a08ef65 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/workspace/general/WorkspaceDeleteSection.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/workspace/general/WorkspaceDeleteSection.tsx @@ -7,8 +7,8 @@ export const WorkspaceDeleteSection: React.FC = () => {

If you want to permanently delete this workspace and all of its data, - including but not limited to users, deployments, targets, you can do so - below. + including but not limited to users, deployments, resources, you can do + so below.
- + @@ -161,30 +161,30 @@ export const CreateSessionDialog: React.FC<{ children: React.ReactNode }> = ({ - No target found. + No resource found. - {targets.data?.items.map((target) => ( + {resources.data?.items.map((resource) => ( { - setTargetId( - currentValue === targetId ? "" : currentValue, + setResourceId( + currentValue === resourceId ? "" : currentValue, ); - setIsTargetPopoverOpen(false); + setIsResourcePopoverOpen(false); }} > - {target.name} + {resource.name} = ({